Remove debugging

This commit is contained in:
Daniel Mason 2020-03-28 08:41:01 +13:00
parent 001e3faa19
commit fbbeafefe3

5
bot.py
View File

@ -25,21 +25,16 @@ class DiscordKeywordBot(discord.Client):
await channel.send('test: ' + message.content) await channel.send('test: ' + message.content)
def cache_check(msg): def cache_check(msg):
print('Checking cache for: ' + msg)
if msg in DiscordKeywordBot.CACHE_DICT: if msg in DiscordKeywordBot.CACHE_DICT:
""" Has been sent before.. Check TTL """ """ Has been sent before.. Check TTL """
print('Exists in cache: ' + msg)
if DiscordKeywordBot.CACHE_DICT.get(msg) <= int(time.time()): if DiscordKeywordBot.CACHE_DICT.get(msg) <= int(time.time()):
""" TTL Expired. """ """ TTL Expired. """
print('TTL Expired for:' + msg)
DiscordKeywordBot.CACHE_DICT[msg] = (int(time.time()) + DiscordKeywordBot.CACHE_TTL) DiscordKeywordBot.CACHE_DICT[msg] = (int(time.time()) + DiscordKeywordBot.CACHE_TTL)
return True return True
else: else:
""" TTL Not Expired """ """ TTL Not Expired """
print('TTL Not expired: ' + msg)
return False return False
else: else:
print('Not in cache: ' + msg)
DiscordKeywordBot.CACHE_DICT[msg] = (int(time.time()) + DiscordKeywordBot.CACHE_TTL) DiscordKeywordBot.CACHE_DICT[msg] = (int(time.time()) + DiscordKeywordBot.CACHE_TTL)
return True return True