use arrow function because its cool!!11

This commit is contained in:
ChomeNS 2023-01-10 17:09:31 +07:00
parent d449ec6f20
commit cd1c04e50f
2 changed files with 7 additions and 7 deletions

8
bot.js
View file

@ -64,7 +64,7 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) {
await loadPlugins(bot, dcclient, config, rl) await loadPlugins(bot, dcclient, config, rl)
bot._client.on('end', function (reason) { bot._client.on('end', (reason) => {
bot.end(reason, 'end') bot.end(reason, 'end')
}) })
@ -98,17 +98,17 @@ async function createBot (server, config, getBots, setNewBot, dcclient, rl) {
bot.write('keep_alive', { keepAliveId }) bot.write('keep_alive', { keepAliveId })
}) })
bot._client.on('kick_disconnect', function (data) { bot._client.on('kick_disconnect', (data) => {
const parsed = JSON.parse(data.reason) const parsed = JSON.parse(data.reason)
bot.end(parsed, 'kick_disconnect') bot.end(parsed, 'kick_disconnect')
}) })
bot._client.on('disconnect', function (data) { bot._client.on('disconnect', (data) => {
const parsed = JSON.parse(data.reason) const parsed = JSON.parse(data.reason)
bot.end(parsed, 'disconnect') bot.end(parsed, 'disconnect')
}) })
bot._client.on('error', function () {}) bot._client.on('error', () => {})
return bot return bot
}; };

View file

@ -23,7 +23,7 @@ function inject (bot, dcclient, config) {
version version
}) })
srv.on('login', function (client) { srv.on('login', (client) => {
bot.console.info(`[Proxy] ${client.username} connected to proxy`) bot.console.info(`[Proxy] ${client.username} connected to proxy`)
let clientEnded = false let clientEnded = false
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -83,7 +83,7 @@ function inject (bot, dcclient, config) {
targetEnded = true targetEnded = true
}) })
client.on('end', function () { client.on('end', () => {
clientEnded = true clientEnded = true
target.end() target.end()
target.removeAllListeners() target.removeAllListeners()
@ -91,7 +91,7 @@ function inject (bot, dcclient, config) {
bot.console.info(`[Proxy] ${client.username} ended`) bot.console.info(`[Proxy] ${client.username} ended`)
}) })
client.on('error', function () { client.on('error', () => {
clientEnded = true clientEnded = true
target.removeAllListeners() target.removeAllListeners()
client.removeAllListeners() client.removeAllListeners()