-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathbase.py
58 lines (42 loc) · 1.58 KB
/
base.py
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
57
58
"""
Base cog class. All cogs should inherit from this class.
"""
from functools import cached_property
import disnake
from config.app_config import config
from rubbergod import Rubbergod
class Base:
config = config
bot: Rubbergod
def __init__(self):
self.tasks = []
@cached_property
def base_guild(self) -> disnake.Guild:
return self.bot.get_guild(Base.config.guild_id)
@cached_property
def mod_room(self) -> disnake.TextChannel:
return self.bot.get_channel(self.config.mod_room)
@cached_property
def submod_helper_room(self) -> disnake.TextChannel:
return self.bot.get_channel(self.config.submod_helper_room)
@cached_property
def log_channel(self) -> disnake.TextChannel:
return self.bot.get_channel(self.config.log_channel)
@cached_property
def bot_room(self) -> disnake.TextChannel:
return self.bot.get_channel(self.config.bot_room)
@cached_property
def bot_dev_channel(self) -> disnake.TextChannel:
return self.bot.get_channel(self.config.bot_dev_channel)
@cached_property
def teacher_info_channel(self) -> disnake.TextChannel:
return self.bot.get_channel(self.config.teacher_info_channel)
@cached_property
def space_channel(self) -> disnake.TextChannel:
return self.bot.get_channel(Base.config.space_channel)
@cached_property
def moderation_channel(self) -> disnake.TextChannel:
return self.bot.get_channel(Base.config.moderation_channel)
def cog_unload(self) -> None:
for task in self.tasks:
task.cancel()