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

View File

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

View File

@ -19,8 +19,9 @@ export function upgradeLegacyJoin(server, socket, payload) {
// `join` is the legacy entry point, so apply protocol version // `join` is the legacy entry point, so apply protocol version
socket.hcProtocol = 1; 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.hash = server.getSocketHash(socket);
socket.isBot = false;
// pull the password from the nick // pull the password from the nick
const nickArray = payload.nick.split('#', 2); const nickArray = payload.nick.split('#', 2);