+#!/usr/bin/env python3
+# tall.bot - a simple Discord Wikipedia bot
+# Armaan Bhojwani 2020
+
+import sys
+import wikipedia
+import discord
+
+keywords = ["what is", "What is", "what was", "What was", "what were",
+ "What were", "who is", "Who is", "who was", "Who was",
+ "who were", "Who were", "who are", "Who are"]
+
+def wiki_sum(search, sen):
+ try:
+ output = "From Wikipedia: " + wikipedia.summary(search, sentences=sen)
+ except:
+ output = "There was an error"
+
+ return output
+
+def keyword_check(inp):
+ x = inp.split()
+ x = " ".join(x[:2])
+ if x in keywords:
+ return True
+ else:
+ return False
+
+class MyClient(discord.Client):
+ async def on_ready(self):
+ print('Logged in as', self.user)
+
+ async def on_message(self, message):
+ if message.author == self.user:
+ return
+
+ if keyword_check(message.content):
+ await message.channel.send(wiki_sum(message.content.split()[2:], 2))
+
+client = MyClient()
+client.run(sys.argv[1])