aboutsummaryrefslogtreecommitdiff
path: root/bot.py
blob: b4cc0b47ae2454dbc2c2d36a736a9db1b9668e58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from discord.ext import commands
import discord
import logging

import datetime
import config
import json

extensions = [
    "cogs.utils",
    "cogs.admin"
]

class CelesteBot(commands.Bot):

    def __init__(self):
        super().__init__(command_prefix='/')
        self.logger = logging.getLogger('discord')

        with open('custom_commands.json', 'r') as f:
            self.custom_commands = json.load(f)

        for extension in extensions:
            self.load_extension(extension)
            
    

    async def on_ready(self):
        self.uptime = datetime.datetime.utcnow()

        game = discord.Game("Mining away")
        await self.change_presence(activity=game)

        self.logger.warning(f'Online: {self.user} (ID: {self.user.id})')

    async def on_message(self, message):

        if message.author.bot:
            return

        command = message.content.split()[0] 

        if command in self.custom_commands:
            await message.channel.send(self.custom_commands[command])
            return

        badWords = ["fair", "f a i r", "ⓕⓐⓘⓡ", "ⓕ ⓐ ⓘ ⓡ"]
        if message.channel.id == 589110766578434078:
            for word in badWords:
                if word in message.content.lower():
                    await message.channel.send('Fair')

        await self.process_commands(message)

    def run(self):
        super().run(config.token, reconnect=True)