1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Added bot declarations

This commit is contained in:
marzavec 2020-10-14 23:43:38 -05:00
parent 308130e2b0
commit d227bcc4f6
3 changed files with 6 additions and 3 deletions

View File

@ -131,6 +131,7 @@ export async function run({
userid: newPeerList[i].userid,
channel,
isme: false,
isBot: newPeerList[i].isBot,
});
}
@ -144,7 +145,7 @@ export async function run({
// socket.channels.push(channel);
nicks.push(userInfo.nick); /* @legacy */
users.push({ ...{ isme: true }, ...userInfo });
users.push({ ...{ isme: true, isBot: socket.isBot }, ...userInfo });
// reply with channel peer list
server.reply({

View File

@ -14,7 +14,7 @@ const createSessionID = () => {
};
// module main
export async function run({ server, socket }) {
export async function run({ server, socket, payload }) {
// gather connection and channel count
let ips = {};
let channels = {};
@ -54,6 +54,7 @@ export async function run({ server, socket }) {
socket.hcProtocol = 2;
socket.userid = Math.floor(Math.random() * 9999999999999);
socket.hash = server.getSocketHash(socket);
socket.isBot = payload.isBot || false;
// dispatch info
server.reply({

View File

@ -19,8 +19,9 @@ export function upgradeLegacyJoin(server, socket, payload) {
// `join` is the legacy entry point, so apply protocol version
socket.hcProtocol = 1;
// this would have been applied in the `session` module, apply it now
// these would have been applied in the `session` module, apply it now
socket.hash = server.getSocketHash(socket);
socket.isBot = false;
// pull the password from the nick
const nickArray = payload.nick.split('#', 2);