2 # tall.bot - a simple Discord Wikipedia bot
11 def wiki_sum(search, sen, pid):
13 logging.info(str(pid) + " | " + str(int(time.time())) + " | " + search)
14 return "<Wikipedia> " + wikipedia.summary(search,
17 except Exception as e:
18 logging.debug(str(pid) + " | " + search + " | " + str(e))
21 def create_query(inp):
22 key1 = ["What", "what", "who", "Who"]
23 key2 = ["is", "are", "were", "was"]
24 key3 = ["a", "an", "the"]
27 if x[0] in key1 and x[1] in key2:
36 class TallBot(discord.Client):
37 async def on_ready(self):
38 logging.info('Logged in as ', self.user)
40 async def on_message(self, message):
41 if message.author == self.user:
44 key = create_query(message.content)
46 await message.channel.send(wiki_sum(key, 2, message.author))
49 TallBot().run(sys.argv[1])
51 if __name__ == "__main__":