@@ -127,8 +127,8 @@ def is_susceptible(self):
127127 def is_infectious (self ):
128128 return self .infected and self .sickness not in (0 , 100 )
129129
130- def infect (self ):
131- if self .infected :
130+ def infect (self , * , force = False ):
131+ if self .infected and not force :
132132 return False
133133
134134 self .infected = True
@@ -515,6 +515,17 @@ async def infect(self, user):
515515
516516 await self .send_infect_message (user )
517517
518+ async def reinfect (self , user ):
519+ # Causes a previously cured user to be reinfected
520+ if user .is_cured ():
521+ self .storage ['stats' ].cured -= 1
522+ elif user .is_susceptible ():
523+ return await self .infect (user )
524+
525+ user .infect (force = True )
526+ await self .storage .save ()
527+ await self .send_reinfect_message (user )
528+
518529 async def kill (self , user ):
519530 self .storage ['stats' ].dead += user .kill ()
520531 await self .storage .save ()
@@ -581,7 +592,6 @@ async def apply_sickness_to_all(self, channel, sickness, *, cause=None):
581592 await self .storage .save ()
582593
583594 async def send_dead_message (self , participant ):
584- guild = self .bot .get_guild (DISCORD_PY )
585595 total = self .storage ['stats' ].dead
586596
587597 try :
@@ -605,7 +615,6 @@ async def send_dead_message(self, participant):
605615
606616 async def send_infect_message (self , participant ):
607617 total = self .storage ['stats' ].infected
608- guild = self .bot .get_guild (DISCORD_PY )
609618
610619 try :
611620 ping = self .bot .get_user (participant .member_id ) or await self .bot .fetch_user (participant .member_id )
@@ -627,7 +636,6 @@ async def send_infect_message(self, participant):
627636
628637 async def send_cured_message (self , participant ):
629638 total = self .storage ['stats' ].cured
630- guild = self .bot .get_guild (DISCORD_PY )
631639
632640 try :
633641 ping = self .bot .get_user (participant .member_id ) or await self .bot .fetch_user (participant .member_id )
@@ -642,7 +650,6 @@ async def send_cured_message(self, participant):
642650
643651 async def send_healer_message (self , participant ):
644652 total = self .storage ['stats' ].healers
645- guild = self .bot .get_guild (DISCORD_PY )
646653
647654 try :
648655 ping = self .bot .get_user (participant .member_id ) or await self .bot .fetch_user (participant .member_id )
@@ -654,6 +661,19 @@ async def send_healer_message(self, participant):
654661 except discord .HTTPException :
655662 pass
656663
664+ async def send_reinfect_message (self , participant ):
665+ try :
666+ ping = self .bot .get_user (participant .member_id ) or await self .bot .fetch_user (participant .member_id )
667+ except discord .HTTPException :
668+ return
669+
670+ stats = self .storage ['stats' ]
671+
672+ try :
673+ await self .log_channel .send (f'{ ping } has gotten reinfected... Cured count is down to { stats .cured } .' )
674+ except discord .HTTPException :
675+ return
676+
657677 @commands .Cog .listener ()
658678 async def on_regular_message (self , message ):
659679 if message .guild is None or message .guild .id != DISCORD_PY :
0 commit comments