bot   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A Bot.__init__() 0 8 2
A Bot.run() 0 2 1
A Bot.on_ready() 0 8 1
1
from typing import Optional, NoReturn, Tuple
2
3
import dotenv
4
from discord import Guild, Activity, ActivityType, Intents
5
from discord.ext import commands
6
7
GUILD_ID: int = 888527538710777876
8
LOADED_EXTENSIONS: Tuple[str, ...] = (
9
    'drinks', 'members', 'utils', 'workers', 'tickets'
10
)
11
12
13
class Bot(commands.Bot):
14
15
    def __init__(self) -> None:
16
        super().__init__(command_prefix='/', intents=Intents.all())
17
        self.guild: Optional[Guild] = None
18
19
        self.remove_command('help')
20
21
        for ext in LOADED_EXTENSIONS:
22
            self.load_extension(f'app.cogs.{ext}')
23
24
    async def on_ready(self) -> None:
25
        self.guild = self.get_guild(GUILD_ID)
26
        print(self.user, 'is ready')
27
28
        await self.change_presence(
29
            activity=Activity(
30
                type=ActivityType.watching,
31
                name=f"{self.command_prefix}help"
32
            )
33
        )
34
35
    def run(self) -> NoReturn:
36
        super().run(dotenv.dotenv_values('.env').get('TOKEN'))
37