From 773ebdeccaef172ccfb46cf5d5bb070cee93eabe Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 24 Feb 2018 21:22:16 -0500 Subject: try --- commands/Pokemon/claim.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 commands/Pokemon/claim.js (limited to 'commands/Pokemon/claim.js') diff --git a/commands/Pokemon/claim.js b/commands/Pokemon/claim.js new file mode 100644 index 0000000..dccbd29 --- /dev/null +++ b/commands/Pokemon/claim.js @@ -0,0 +1,21 @@ +exports.run = async (bot, msg) => { + if (!msg.channel.topic.startsWith('Current Owner:')) return msg.reply('Go into one of the gym channels and try again.'); + if (msg.channel.topic == 'Current Owner: *none*') { + msg.reply('Alright, you have claimed this gym as yours! Be ready to battle anyone who approaches you'); + msg.channel.setTopic('Current Owner: ' + msg.author.id + '/' + msg.author.tag); + } + else { + const owner = msg.channel.topic.slice(15).substring(msg.author.id.length); + msg.channel.send('<@' + owner + '>, come here as ' + msg.author + 'wants to battle you.'); + } +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; + +exports.help = { + name: 'claim', + description: 'Claim a gym.', +}; -- cgit v1.2.3