talking in other channels is now a thing

This commit is contained in:
rhearmas 2019-12-22 22:58:15 -05:00
parent 1aeee86b5d
commit 0ee9694df1
1 changed files with 16 additions and 7 deletions

View File

@ -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 <text>"
};