Просмотр исходного кода

Minor twiddling before refactor

tags/1.0
Rocketsoup 4 лет назад
Родитель
Сommit
509ae5b437
1 измененных файлов: 20 добавлений и 19 удалений
  1. 20
    19
      rocketbot.py

+ 20
- 19
rocketbot.py Просмотреть файл

189
 
189
 
190
     async def command_hello(self, message: Message) -> None:
190
     async def command_hello(self, message: Message) -> None:
191
         """
191
         """
192
-        $hello command handler
192
+        Command handler
193
         """
193
         """
194
         await message.channel.send(f'Hey there, {message.author.mention}!')
194
         await message.channel.send(f'Hey there, {message.author.mention}!')
195
 
195
 
196
-    async def command_test_warn(self, context: Context) -> None:
196
+    async def command_testwarn(self, context: Context) -> None:
197
         """
197
         """
198
-        $testwarn command handler
198
+        Command handler
199
         """
199
         """
200
         if self.warning_channel is None:
200
         if self.warning_channel is None:
201
             self.__trace('No warning channel set!')
201
             self.__trace('No warning channel set!')
202
             await context.message.channel.send('No warning channel set on this guild! Type ' +
202
             await context.message.channel.send('No warning channel set on this guild! Type ' +
203
-                '`$setwarningchannel` in the channel you want warnings to be posted.')
203
+                f'`{bot.command_prefix}{setwarningchannel.__name__}` in the channel you ' +
204
+                'want warnings to be posted.')
204
             return
205
             return
205
         await self.__warn('Test warning. This is only a test.')
206
         await self.__warn('Test warning. This is only a test.')
206
 
207
 
207
-    async def command_set_warning_channel(self, context: Context):
208
+    async def command_setwarningchannel(self, context: Context):
208
         """
209
         """
209
-        $setwarningchannel command handler
210
+        Command handler
210
         """
211
         """
211
         self.__trace(f'Warning channel set to {context.channel.name}')
212
         self.__trace(f'Warning channel set to {context.channel.name}')
212
         self.warning_channel = context.channel
213
         self.warning_channel = context.channel
214
         save_guild_context(self)
215
         save_guild_context(self)
215
         await self.__warn('Warning messages will now be sent to ' + self.warning_channel.mention)
216
         await self.__warn('Warning messages will now be sent to ' + self.warning_channel.mention)
216
 
217
 
217
-    async def command_set_warning_mention(self, _context: Context, mention: str):
218
+    async def command_setwarningmention(self, _context: Context, mention: str):
218
         """
219
         """
219
-        $setwarningmention command handler
220
+        Command handler
220
         """
221
         """
221
         self.__trace('set warning mention')
222
         self.__trace('set warning mention')
222
         m = mention if mention is not None and len(mention) > 0 else None
223
         m = mention if mention is not None and len(mention) > 0 else None
227
         else:
228
         else:
228
             await self.__warn('Warning messages will now mention ' + m)
229
             await self.__warn('Warning messages will now mention ' + m)
229
 
230
 
230
-    async def command_set_raid_warning_rate(self, _context: Context, count: int, seconds: int):
231
+    async def command_setraidwarningrate(self, _context: Context, count: int, seconds: int):
231
         """
232
         """
232
-        $setraidwarningrate command handler
233
+        Command handler
233
         """
234
         """
234
         self.join_warning_count = count
235
         self.join_warning_count = count
235
         self.join_warning_seconds = seconds
236
         self.join_warning_seconds = seconds
609
 )
610
 )
610
 async def hello(ctx: Context):
611
 async def hello(ctx: Context):
611
     """
612
     """
612
-    $hello command handler
613
+    Command handler
613
     """
614
     """
614
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
615
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
615
     if gc is None:
616
     if gc is None:
626
 @commands.has_permissions(manage_messages=True)
627
 @commands.has_permissions(manage_messages=True)
627
 async def testwarn(ctx: Context):
628
 async def testwarn(ctx: Context):
628
     """
629
     """
629
-    $testwarn command handler
630
+    Command handler
630
     """
631
     """
631
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
632
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
632
     if gc is None:
633
     if gc is None:
633
         return
634
         return
634
-    await gc.command_test_warn(ctx)
635
+    await gc.command_testwarn(ctx)
635
 
636
 
636
 @bot.command(
637
 @bot.command(
637
     brief='Sets the threshold for detecting a join raid.',
638
     brief='Sets the threshold for detecting a join raid.',
643
 @commands.has_permissions(manage_messages=True)
644
 @commands.has_permissions(manage_messages=True)
644
 async def setraidwarningrate(ctx: Context, count: int, seconds: int):
645
 async def setraidwarningrate(ctx: Context, count: int, seconds: int):
645
     """
646
     """
646
-    $setraidwarningrate command handler
647
+    Command handler
647
     """
648
     """
648
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
649
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
649
     if gc is None:
650
     if gc is None:
650
         return
651
         return
651
-    await gc.command_set_raid_warning_rate(ctx, count, seconds)
652
+    await gc.command_setraidwarningrate(ctx, count, seconds)
652
 
653
 
653
 @bot.command(
654
 @bot.command(
654
     brief='Sets the current channel as the destination for bot warning messages.'
655
     brief='Sets the current channel as the destination for bot warning messages.'
656
 @commands.has_permissions(manage_messages=True)
657
 @commands.has_permissions(manage_messages=True)
657
 async def setwarningchannel(ctx: Context):
658
 async def setwarningchannel(ctx: Context):
658
     """
659
     """
659
-    $setwarningchannel command handler
660
+    Command handler
660
     """
661
     """
661
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
662
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
662
     if gc is None:
663
     if gc is None:
663
         return
664
         return
664
-    await gc.command_set_warning_channel(ctx)
665
+    await gc.command_setwarningchannel(ctx)
665
 
666
 
666
 @bot.command(
667
 @bot.command(
667
     brief='Sets an optional mention to include in every warning message.',
668
     brief='Sets an optional mention to include in every warning message.',
672
 @commands.has_permissions(manage_messages=True)
673
 @commands.has_permissions(manage_messages=True)
673
 async def setwarningmention(ctx: Context, mention: str):
674
 async def setwarningmention(ctx: Context, mention: str):
674
     """
675
     """
675
-    $setwarningmention command handler
676
+    Command handler
676
     """
677
     """
677
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
678
     gc: GuildContext = get_or_create_guild_context(ctx.guild)
678
     if gc is None:
679
     if gc is None:
679
         return
680
         return
680
-    await gc.command_set_warning_mention(ctx, mention)
681
+    await gc.command_setwarningmention(ctx, mention)
681
 
682
 
682
 # -- Bot events -------------------------------------------------------------
683
 # -- Bot events -------------------------------------------------------------
683
 
684
 

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