diff options
author | AnInternetTroll <lucafulger@gmail.com> | 2020-06-05 17:47:19 +0000 |
---|---|---|
committer | AnInternetTroll <lucafulger@gmail.com> | 2020-06-05 17:47:19 +0000 |
commit | bfa568af62117bc7b55f13926d4c2802081002a6 (patch) | |
tree | f5a7cd98732b459bb74f65ac24fb031a2f12d308 /bot.py | |
parent | 6580e4104f003bd6f22a0e833677c43ce8d942a0 (diff) | |
download | steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.tar steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.tar.gz steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.tar.bz2 steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.tar.lz steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.tar.xz steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.tar.zst steve-bot-bfa568af62117bc7b55f13926d4c2802081002a6.zip |
Added blacklist
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x] | bot.py | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -49,21 +49,31 @@ class BedrockBot(commands.Bot): game = discord.Game("Mining away") await self.change_presence(activity=game) + with open('blacklist.json', 'r') as f: + try: + self.blacklist = json.load(f) + except json.decoder.JSONDecodeError: + self.blacklist = [] + self.logger.warning(f'Online: {self.user} (ID: {self.user.id})') async def on_message(self, message): if message.author.bot: return + if message.author.id in self.blacklist: + return await self.process_commands(message) try: command = message.content.split()[0] except IndexError: pass - - if command in self.custom_commands: - await message.channel.send(self.custom_commands[command]) + try: + if command in self.custom_commands: + await message.channel.send(self.custom_commands[command]) + return + except: return def run(self): |