From 6e5e726e059a57746a2d540a6622857101de6064 Mon Sep 17 00:00:00 2001 From: xfnw Date: Fri, 11 Dec 2020 10:19:38 -0500 Subject: [PATCH] case-insensitive drinks this is achived by String.lower()'ing both the message and the channel name. you can now drink COFFEE! if you are EXITED! --- modules/drinks.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/drinks.py b/modules/drinks.py index 2644802..ebcafed 100644 --- a/modules/drinks.py +++ b/modules/drinks.py @@ -4,8 +4,14 @@ from bot import * async def coffeeup(self,c,n,m): - if c in ['#coffee','#tea','#water','#CAPS','#sodawater']: - if (c[1:]+"!" in m and c+'!' not in m) or c=='#coffee' and ('latte!' in m or 'espresso!' in m or 'cappucino!' in m) or c=='#tea' and ('chai!' in m): + m = m.lower() + c = c.lower() + if c in ['#coffee','#tea','#water','#caps','#sodawater']: + if ( + (c[1:]+"!" in m and c+'!' not in m) + or c=='#coffee' and ('latte!' in m or 'espresso!' in m or 'cappucino!' in m) + or c=='#tea' and ('chai!' in m or 'kombucha!' in m) + ): cc = self.coffee.find_one(name=c) if cc: self.coffee.update(dict(name=c,value=cc['value']+1),['name'])