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

Minor bug fixes

This commit is contained in:
marzavec 2019-11-07 11:46:55 -06:00
parent a4588dc4f6
commit f34ee18c30
9 changed files with 12 additions and 12 deletions

View File

@ -87,7 +87,7 @@ export async function run(core, server, socket, data) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.nickCheck, 29);
server.registerHook('in', 'chat', this.nickCheck.bind(this), 29);
}
// hooks chat commands checking for /nick

View File

@ -66,8 +66,8 @@ export async function run(core, server, socket, data) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.commandCheckIn, 20);
server.registerHook('in', 'chat', this.finalCmdCheck, 254);
server.registerHook('in', 'chat', this.commandCheckIn.bind(this), 20);
server.registerHook('in', 'chat', this.finalCmdCheck.bind(this), 254);
}
// checks for miscellaneous '/' based commands

View File

@ -56,7 +56,7 @@ export async function run(core, server, socket, payload) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.emoteCheck, 30);
server.registerHook('in', 'chat', this.emoteCheck.bind(this), 30);
}
// hooks chat commands checking for /me

View File

@ -59,7 +59,7 @@ export async function run(core, server, socket, payload) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.helpCheck, 28);
server.registerHook('in', 'chat', this.helpCheck.bind(this), 28);
}
// hooks chat commands checking for /whisper

View File

@ -26,7 +26,7 @@ export async function run(core, server, socket) {
let ips = {};
let channels = {};
// for (const client of server.clients) {
this.clients.forEach((client) => {
server.clients.forEach((client) => {
if (client.channel) {
channels[client.channel] = true;
ips[client.address] = true;
@ -59,7 +59,7 @@ export async function run(core, server, socket) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.statsCheck, 26);
server.registerHook('in', 'chat', this.statsCheck.bind(this), 26);
}
// hooks chat commands checking for /stats

View File

@ -8,7 +8,7 @@ export async function run(core, server, socket) {
let ips = {};
let channels = {};
// for (const client of server.clients) {
this.clients.forEach((client) => {
server.clients.forEach((client) => {
if (client.channel) {
channels[client.channel] = true;
ips[client.address] = true;

View File

@ -78,7 +78,7 @@ export async function run(core, server, socket, payload) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.whisperCheck, 20);
server.registerHook('in', 'chat', this.whisperCheck.bind(this), 20);
}
// hooks chat commands checking for /whisper

View File

@ -63,8 +63,8 @@ export async function run(core, server, socket, data) {
// module hook functions
export function initHooks(server) {
server.registerHook('in', 'chat', this.chatCheck, 25);
server.registerHook('in', 'invite', this.inviteCheck, 25);
server.registerHook('in', 'chat', this.chatCheck.bind(this), 25);
server.registerHook('in', 'invite', this.inviteCheck.bind(this), 25);
// TODO: add whisper hook, need hook priorities todo finished first
}

View File

@ -77,7 +77,7 @@ class RateLimiter {
return true;
}
record.score *= 2 ** -(Date.now() - record.time) / this.halflife;
record.score *= Math.pow(2, -(Date.now() - record.time ) / this.halflife);
record.score += deltaScore;
record.time = Date.now();