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:
parent
308130e2b0
commit
d227bcc4f6
|
@ -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({
|
||||||
|
|
|
@ -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({
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user