1010
1111import aiohttp
1212from discord import File , Member , Message
13+ from discord .ext import tasks
1314from discord .ext .commands import Cog , Context , Converter , command
1415from loguru import logger
1516from wand .image import Image
2930 ":grin:" ,
3031 ":blush:" ,
3132)
33+ MANAGEMENT_ONE_TO_ONE_COMMENTS = (
34+ "Well Clarice, have the lambs stopped screaming?" ,
35+ "I do wish we could chat longer, but... I'm having an old friend for dinner. Bye." ,
36+ "What is your father, dear? Is he a coal miner?" ,
37+ "Senator, just one more thing: love your suit!" ,
38+ "Memory, Agent Starling, is what I have instead of a view." ,
39+ "You still wake up sometimes, don't you? You wake up in the dark and hear the screaming of the lambs." ,
40+ "People will say we're in love." ,
41+ "All good things to those who wait." ,
42+ '"Plum Island Animal Disease Research Center." Sounds charming.' ,
43+ "Ready when you are, Sergeant Pembry." ,
44+ "A census taker once tried to test me." ,
45+ )
3246
3347
3448class URLConverter (Converter ):
@@ -72,6 +86,7 @@ def __init__(self, bot: KingArthur) -> None:
7286 self .cached_blogcom = None
7387 self .cached_bullshit = None
7488 self .last_sent = None
89+ self .conduct_one_to_ones .start ()
7590
7691 async def fetch_resource (self , name : str ) -> str :
7792 """Fetch the file contents of the given filename, starting from ``/``."""
@@ -81,6 +96,33 @@ async def fetch_resource(self, name: str) -> str:
8196 self .cached_resources [name ] = await resp .text ()
8297 return self .cached_resources [name ]
8398
99+ async def cog_unload (self ) -> None :
100+ """Tasks to run when cog is unloaded."""
101+ self .conduct_one_to_ones .cancel ()
102+
103+ @tasks .loop (hours = 12 )
104+ async def conduct_one_to_ones (self ) -> None :
105+ """Conduct management one-to-ones with eligible team members."""
106+ if random .random () > 0.01 :
107+ # Management budget exceeded for this one-to-one slot.
108+ return
109+
110+ guild = self .bot .get_guild (CONFIG .guild_id )
111+
112+ if guild is None :
113+ return
114+
115+ role = guild .get_role (CONFIG .devops_role )
116+
117+ if role is None :
118+ return
119+
120+ selected_member = random .choice (role .members )
121+ selected_management_comment = random .choice (MANAGEMENT_ONE_TO_ONE_COMMENTS )
122+
123+ await selected_member .send (selected_management_comment )
124+ logger .info ("Inspirational management tactic applied to %s" , selected_member )
125+
84126 @Cog .listener ()
85127 async def on_message (self , msg : Message ) -> None :
86128 """Handler for incoming messages, potentially returning system information."""
0 commit comments