Added !lmgtfy

!lmgtfy [search terms]
This commit is contained in:
Twentysix 2016-01-26 23:44:08 +01:00
parent 0827fb0c33
commit 5e431b52bf

11
red.py
View File

@ -281,6 +281,8 @@ async def on_message(message):
await client.send_message(message.channel, "{} `Check your DMs for " + p +"meme help.`".format(message.author.mention)) await client.send_message(message.channel, "{} `Check your DMs for " + p +"meme help.`".format(message.author.mention))
elif message.content.startswith (p + 'meme'): elif message.content.startswith (p + 'meme'):
await memes(message) await memes(message)
elif message.content.startswith (p + 'lmgtfy'):
await lmgtfy(message)
################## music ####################### ################## music #######################
elif message.content == p + "sing": elif message.content == p + "sing":
await playPlaylist(message, sing=True) await playPlaylist(message, sing=True)
@ -549,6 +551,7 @@ class Trivia():
self.addPoint(client.user.name) self.addPoint(client.user.name)
self.currentQ["ANSWERS"] = [] self.currentQ["ANSWERS"] = []
await client.send_message(self.channel, msg) await client.send_message(self.channel, msg)
await client.send_typing(self.channel)
await asyncio.sleep(3) await asyncio.sleep(3)
if not self.status == "stop": if not self.status == "stop":
await self.newQuestion() await self.newQuestion()
@ -572,6 +575,7 @@ class Trivia():
self.status = "correct answer" self.status = "correct answer"
self.addPoint(message.author.name) self.addPoint(message.author.name)
await client.send_message(self.channel, "You got it {}! **+1** to you!".format(message.author.name)) await client.send_message(self.channel, "You got it {}! **+1** to you!".format(message.author.name))
await client.send_typing(self.channel)
return True return True
def addPoint(self, user): def addPoint(self, user):
@ -1095,6 +1099,13 @@ async def avatar(message):
else: else:
await client.send_message(message.channel, "`" + settings["PREFIX"] + "avatar [name or mention]`") await client.send_message(message.channel, "`" + settings["PREFIX"] + "avatar [name or mention]`")
async def lmgtfy(message):
msg = message.content.split()
if len(msg) >= 2:
msg = "+".join(msg[1:])
await client.send_message(message.channel, "http://lmgtfy.com/?q=" + msg)
else:
await client.send_message(message.channel, "`" + settings["PREFIX"] + "lmgtfy [search terms]`")
def getTriviabyChannel(channel): def getTriviabyChannel(channel):
for t in trivia_sessions: for t in trivia_sessions: