diff --git a/index.js b/index.js index e6a5b41..a1f2bfa 100644 --- a/index.js +++ b/index.js @@ -473,168 +473,11 @@ dcclient.on('ready', async () => { dcclient.on('messageCreate', async (message) => { // Ignore messages from the bot itself if (message.author.id === dcclient.user.id) return; - // if (message.content.toLowerCase().startsWith('!chomensmsg ')) { - // bot.core.run(`minecraft:tellraw @a ["",{"text":"[","color":"dark_gray"},{"text":"ChomeNS ","color":"yellow","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":"Discord","color":"blue","clickEvent":{"action":"open_url","value":"https://discord.gg/xdgCkUyaA4"},"hoverEvent":{"action":"show_text","contents":[{"text":"https://discord.gg/xdgCkUyaA4 ","color":"blue"},{"text":"<-- join now","color":"red"}]}},{"text":" (ChomeNS Channel)","color":"gray"},{"text":"] ","color":"dark_gray"},{"text":"${message.member.displayName}","color":"red","clickEvent":{"action":"copy_to_clipboard","value":"${message.author.username}#${message.author.discriminator}"},"hoverEvent":{"action":"show_text","value":{"text":"${message.author.username}ยง7#${message.author.discriminator}"} }},{"text":" ","color":"white"},` + MessageBuilder.fromString('&7' + message.content.substring(12)) + ']'); - // return; - // } + // Only handle messages in specified channel if (message.channel.id != channel.id) return; if (message.content.startsWith(config.discord.prefix)) return; - // try { - // if (message.content.toLowerCase()==='!test') { - // const Embed = new MessageEmbed() - // .setColor('#FFFF00') - // .setTitle('Hello!') - // .setDescription('This is the first command to be discordified!'); - // channeldc.send({embeds: [Embed]}); - // return; - // } - // if (message.content.toLowerCase()==='!help') { - // const Embed = new MessageEmbed() - // .setColor('#FFFF00') - // .setTitle('Commands') - // .setDescription('help echo cb eval stopserver end ayunsudo playerlist'); - // channeldc.send({embeds: [Embed]}); - // return; - // } - // if (message.content.toLowerCase().startsWith('!echo ')) { - // channeldc.send(`${message.author.username}, sending "${message.content.toLowerCase().substring(6)}"`); - // bot.chat(message.content.substring(6)); - // return; - // } - // if (message.content.toLowerCase().startsWith('!cb ')) { - // channeldc.send(`${message.author.username}, executing "${message.content.toLowerCase().substring(4)}"`); - // bot.core.run(message.content.substring(4)); - // return; - // } - // if (message.content.toLowerCase().startsWith('!eval run ')) { - // try { - // const Embed = new MessageEmbed() - // .setColor('#FFFF00') - // .setTitle('Output') - // .setDescription(`\`\`\`js\n${escapeMarkdown(util.inspect(vm.run(message.content.substring(10))))}\`\`\``.substring(0, 1900)); - // channeldc.send({embeds: [Embed]}); - // } catch (err) { - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription(`\`\`\`text\n${escapeMarkdown(util.inspect(err).replaceAll('runner', 'chayapak1'))}\`\`\``.substring(0, 1900)); - // channeldc.send({embeds: [Embed]}); - // } - // return; - // } - // if (message.content.toLowerCase()==='!eval reset') { - // vm = new VM(vmoptions); - // return; - // } - // if (message.content.toLowerCase().startsWith('!eval server ')) { - // axios - // .post('http://192.168.1.105:4445/', querystring.stringify({ - // html: false, - // showErrorMsg: true, - // code: message.content.substring(13), - // })).then((res) => { - // const Embed = new MessageEmbed() - // .setColor('#FFFF00') - // .setTitle('Output') - // .setDescription(`\`\`\`js\n${res.data}\`\`\``.substring(0, 1900)); - // channeldc.send({embeds: [Embed]}); - // }).catch((e) => { - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription(`\`\`\`text\n${e}\`\`\``.substring(0, 1900)); - // channeldc.send({embeds: [Embed]}); - // }); - // return; - // } - // if (message.content.toLowerCase().startsWith('!eval dineval ')) { - // axios - // .get('https://eval.dinhero21.repl.co', { - // headers: { - // data: message.content.substring(14), - // }, - // }).then((res) => { - // const Embed = new MessageEmbed() - // .setColor('#FFFF00') - // .setTitle('Output') - // .setDescription(`\`\`\`js\n${res.data}\`\`\``.substring(0, 1900)); - // channeldc.send({embeds: [Embed]}); - // }).catch((e) => { - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription(`\`\`\`text\n${e}\`\`\``.substring(0, 1900)); - // channeldc.send({embeds: [Embed]}); - // }); - // return; - // } - // if (message.content.toLowerCase()==='!stopserver') { - // if (message.member._roles.at(0)==='981159334299983953' || message.member._roles.at(0)==='974590495563075594') { - // bot.core.run('minecraft:execute unless entity @s[name= run ] run stop'); - // } else { - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription('You\'re not in the trusted role!'); - // channeldc.send({embeds: [Embed]}); - // } - // return; - // } - // if (message.content.toLowerCase()==='!end') { - // if (message.member._roles.at(0)==='981159334299983953' || message.member._roles.at(0)==='974590495563075594') { - // bot.emit('end', 'end command'); - // // onerror(`${message.member.displayName} issued "end" command, rebooting bot...`); - // } else { - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription('You\'re not in the trusted role!'); - // channeldc.send({embeds: [Embed]}); - // } - // return; - // } - // if (message.content.toLowerCase().startsWith('!ayunsudo ')) { - // if (message.member._roles.at(0)==='981159334299983953' || message.member._roles.at(0)==='974590495563075594') { - // for (const property of bot.players.list) { - // bot.core.run('sudo ' + property.UUID + ' ' + message.content.toLowerCase().substring(10)); - // } - // } else { - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription('You\'re not in the trusted role!'); - // channeldc.send({embeds: [Embed]}); - // } - // return; - // } - // if (message.content.toLowerCase()==='!playerlist' || message.content.toLowerCase()==='!list') { - // var allplayers = ''; - // for (const property of bot.tabcompleteplayers) { - // if (property.match.startsWith('@')) continue; - // // eslint-disable-next-line no-redeclare - // var allplayers = allplayers + '\n`' + property.match + '` > `' + bot.players.getPlayer(property.match).UUID + '`'; - // } - // const Embed = new MessageEmbed() - // .setColor('#FFFF00') - // .setTitle('Players') - // .setDescription(allplayers); - // channeldc.send({embeds: [Embed]}); - // return; - // } - // - // if (message.content.toLowerCase().startsWith('!')) { - // const args = message.content.toLowerCase().substring(1).trim().split(' '); - // const Embed = new MessageEmbed() - // .setColor('#FF0000') - // .setTitle('Error') - // .setDescription(`Unknown command or incomplete command: "${args.at(0)}"`); - // channeldc.send({embeds: [Embed]}); - // return; - // } - // } catch (e) { - // console.log(e); - // } + try { const attachmentsComponent = []; if (message.attachments) {