This commit is contained in:
ChomeNS 2023-03-06 08:48:52 +07:00
parent f91e2304b5
commit 7057a75ab8

View file

@ -10,7 +10,7 @@ function inject (bot, dcclient, config) {
bot.command_handler.commands = await loadFiles(path.join(__dirname, config.commandsDir)) bot.command_handler.commands = await loadFiles(path.join(__dirname, config.commandsDir))
} }
bot.command_handler.reload() bot.command_handler.reload()
bot.command_handler.main = function (prefix, username, message, sender, channeldc, hash, ownerhash, selector, proxy) { bot.command_handler.main = function (prefix, username, message, sender, channeldc, hash, ownerhash, selector) {
bot.command_handler.reload() bot.command_handler.reload()
let raw let raw
let command let command
@ -41,7 +41,7 @@ function inject (bot, dcclient, config) {
if (!command.discordExecute) throw new Error('This command is not yet supported on discord!') if (!command.discordExecute) throw new Error('This command is not yet supported on discord!')
command.discordExecute(bot, username, sender, prefix, args, channeldc, message, config) command.discordExecute(bot, username, sender, prefix, args, channeldc, message, config)
} else { } else {
command.execute(bot, username, sender, prefix, args, config, hash, ownerhash, selector, proxy) command.execute(bot, username, sender, prefix, args, config, hash, ownerhash, selector)
} }
} catch (e) { } catch (e) {
if (prefix === config.discord.prefix) { if (prefix === config.discord.prefix) {
@ -55,10 +55,10 @@ function inject (bot, dcclient, config) {
} }
} }
} }
bot.command_handler.run = function (username, message, sender, channeldc, hash, ownerhash, selector = '@a', proxy) { bot.command_handler.run = function (username, message, sender, channeldc, hash, ownerhash, selector = '@a') {
for (const prefix of config.prefixes) { for (const prefix of config.prefixes) {
if (!message.startsWith(prefix)) continue if (!message.startsWith(prefix)) continue
bot.command_handler.main(prefix, username, message, sender, channeldc, hash, ownerhash, selector, proxy) bot.command_handler.main(prefix, username, message, sender, channeldc, hash, ownerhash, selector)
} }
} }
bot.on('chat', async (_username, _message) => { bot.on('chat', async (_username, _message) => {