File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ import asyncio
1
2
import argparse
2
3
import logging
3
4
import os
@@ -69,6 +70,7 @@ def no_dm_check(ctx):
69
70
@bot .event
70
71
async def on_ready ():
71
72
await cf_common .initialize (args .nodb )
73
+ asyncio .create_task (discord_common .presence (bot ))
72
74
73
75
bot .add_listener (discord_common .bot_error_handler , name = 'on_command_error' )
74
76
Original file line number Diff line number Diff line change
1
+ import asyncio
1
2
import logging
2
3
import random
3
4
@@ -54,3 +55,19 @@ async def bot_error_handler(ctx, exception):
54
55
else :
55
56
exc_info = type (exception ), exception , exception .__traceback__
56
57
logger .exception ('Ignoring exception in command {}:' .format (ctx .command ), exc_info = exc_info )
58
+
59
+
60
+ async def presence (bot ):
61
+ await bot .change_presence (activity = discord .Activity (
62
+ type = discord .ActivityType (random .randint (0 ,3 )),
63
+ name = "and ready for input" ))
64
+ await asyncio .sleep (60 )
65
+ while True :
66
+ target = random .choice ([
67
+ member for member in bot .get_all_members ()
68
+ if 'Purgatory' not in {role .name for role in member .roles }
69
+ ])
70
+ await bot .change_presence (activity = discord .Activity (
71
+ type = discord .ActivityType (random .randint (0 ,3 )),
72
+ name = f'{ target .display_name } orz' ))
73
+ await asyncio .sleep (10 * 60 )
You can’t perform that action at this time.
0 commit comments