finish migration of lights script to backend
This commit is contained in:
parent
be73eaa4cd
commit
8b6116e0cc
2 changed files with 38 additions and 17 deletions
25
cmd/reg.js
25
cmd/reg.js
|
@ -7,8 +7,7 @@ class PingCommand extends Command {
|
|||
func(msg, args, ctx) {
|
||||
msg.channel.createMessage('p').then((m) => {
|
||||
m.edit(
|
||||
`rtt: ${Math.floor(m.timestamp - msg.timestamp)}, gateway: ${
|
||||
ctx.bot.shards.get(ctx.bot.guildShardMap[ctx.bot.channelGuildMap[msg.channel.id]] || 0).latency
|
||||
`rtt: ${Math.floor(m.timestamp - msg.timestamp)}, gateway: ${ctx.bot.shards.get(ctx.bot.guildShardMap[ctx.bot.channelGuildMap[msg.channel.id]] || 0).latency
|
||||
}`
|
||||
);
|
||||
});
|
||||
|
@ -28,4 +27,26 @@ class RestartCommand extends Command {
|
|||
|
||||
initializer.addCommand(new RestartCommand());
|
||||
|
||||
class EvalCommand extends Command {
|
||||
name = 'eval';
|
||||
whitelist = true;
|
||||
func(msg, args, ctx) {
|
||||
log.debug('evaluating ' + args[0]);
|
||||
let result;
|
||||
try {
|
||||
result = eval(args[0]);
|
||||
} catch (e) {
|
||||
result = e.stack;
|
||||
}
|
||||
log.debug('result is: \n' + result);
|
||||
if (String.valueOf(result).length <= 1999) {
|
||||
msg.channel.createMessage('```\n' + result + '```\n');
|
||||
} else {
|
||||
msg.channel.createMessage('result too long, see logs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initializer.addCommand(new EvalCommand());
|
||||
|
||||
export default initializer;
|
||||
|
|
|
@ -39,7 +39,7 @@ export default function req(data, callback, errorCallback) {
|
|||
client.write(string_data);
|
||||
})
|
||||
client.on('data', (dat) => {
|
||||
callback(dat);
|
||||
callback(String(dat));
|
||||
client.destroy();
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue