Rocketsoup 4 лет назад
Родитель
Сommit
588b79fa09
1 измененных файлов: 8 добавлений и 8 удалений
  1. 8
    8
      cogs/base.py

+ 8
- 8
cogs/base.py Просмотреть файл

7
 	def __init__(self, bot):
7
 	def __init__(self, bot):
8
 		self.bot = bot
8
 		self.bot = bot
9
 
9
 
10
-	@staticmethod
11
-	def save_setting(guild: Guild, name: str, value):
10
+	@classmethod
11
+	def save_setting(cls, guild: Guild, name: str, value):
12
 		"""
12
 		"""
13
 		Saves one value to a guild's persisted state. The given value must
13
 		Saves one value to a guild's persisted state. The given value must
14
 		be a JSON-encodable type.
14
 		be a JSON-encodable type.
22
 			state[name] = value
22
 			state[name] = value
23
 		Storage.save_guild_state(guild)
23
 		Storage.save_guild_state(guild)
24
 
24
 
25
-	@staticmethod
26
-	async def warn(guild: Guild, message: str) -> bool:
25
+	@classmethod
26
+	async def warn(cls, guild: Guild, message: str) -> bool:
27
 		"""
27
 		"""
28
 		Sends a warning message to the configured warning channel for the
28
 		Sends a warning message to the configured warning channel for the
29
 		given guild. If no warning channel is configured no action is taken.
29
 		given guild. If no warning channel is configured no action is taken.
33
 		state: dict = Storage.state_for_guild(guild)
33
 		state: dict = Storage.state_for_guild(guild)
34
 		channel_id = state.get(StateKey.WARNING_CHANNEL_ID)
34
 		channel_id = state.get(StateKey.WARNING_CHANNEL_ID)
35
 		if channel_id is None:
35
 		if channel_id is None:
36
-			guild_trace(guild, 'No warning channel set! No warning issued.')
36
+			cls.guild_trace(guild, 'No warning channel set! No warning issued.')
37
 			return False
37
 			return False
38
 		channel: TextChannel = guild.get_channel(channel_id)
38
 		channel: TextChannel = guild.get_channel(channel_id)
39
 		if channel is None:
39
 		if channel is None:
40
-			guild_trace(guild, 'Configured warning channel no longer exists!')
40
+			cls.guild_trace(guild, 'Configured warning channel no longer exists!')
41
 			return False
41
 			return False
42
 		message: Message = await channel.send(message)
42
 		message: Message = await channel.send(message)
43
 		return message is not None
43
 		return message is not None
44
 
44
 
45
-	@staticmethod
46
-	def guild_trace(guild: Guild, message: str) -> None:
45
+	@classmethod
46
+	def guild_trace(cls, guild: Guild, message: str) -> None:
47
 		print(f'[guild {guild.id}|{guild.name}] {message}')
47
 		print(f'[guild {guild.id}|{guild.name}] {message}')

Загрузка…
Отмена
Сохранить