diff --git a/commands/Fun/talk.js b/commands/Fun/talk.js index 21145fc..6dce9d1 100644 --- a/commands/Fun/talk.js +++ b/commands/Fun/talk.js @@ -4,13 +4,22 @@ exports.run = async (client, message, args) => { msg = args.join(" "); await message.delete(); - if(args.length == 0) - return message.reply("please insert a valid message.") - .then(msg => { - msg.delete(5000).catch(e => {e}) - }) + if(args.length === 0) { + return (await message.reply("please insert a valid message.")).delete(5000); + } + + let location = message.channel; + guild = message.guild; + + if(args[0].startsWith('<#') && args[0].endsWith('>')) { + location = args[0].slice(2, -1); + location = guild.channels.find(c => c.id === location); + msg = msg.replace(/[0-9]+/g, ""); + msg = msg.replace(/[$<#> ]+/g, ""); + console.log(`msg is ${msg}`) + } - message.channel.send(msg); + location.send(msg); } exports.conf = { @@ -24,5 +33,5 @@ exports.help = { name: "talk", category: "Fun", description: "Talk as the bot in the current channel you're in.", - usage: "talk text" + usage: "talk " }; \ No newline at end of file