From 9b71a405b0c2120b631a52d9c19797f8a4880ee9 Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 1 Feb 2017 14:54:40 +0100 Subject: rm play role, alias ?play --- main.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 648e304..68d0f1a 100644 --- a/main.py +++ b/main.py @@ -67,11 +67,9 @@ async def search_teammates(server, channel, who, query, notify=True): "end": end }).inserted_id - playrole = [r for r in server.roles if r.name == "play"][0] await cli.send_message(channel, who.mention + " You have been put into the queue.") await asyncio.sleep((start-now).total_seconds()) - await cli.add_roles(who, playrole) - await cli.send_message(channel, "%s You were given the 'play' role and will be in queue for %s minutes." % (who.mention, int((end-start).total_seconds() // 60))) + await cli.send_message(channel, "%s You will be in queue for %s minutes." % (who.mention, int((end-start).total_seconds() // 60))) players = [] query = { "$or": [ @@ -100,9 +98,8 @@ async def search_teammates(server, channel, who, query, notify=True): if notify: await asyncio.sleep((end-start).total_seconds()) - await cli.remove_roles(who, playrole) db.playwithme.remove({"_id": queueid}) - await cli.send_message(channel, "%s You have been removed from the queue and were taken the play role." % (who.mention)) + await cli.send_message(channel, "%s You have been removed from the queue." % (who.mention)) @cli.event async def on_message_delete(message): @@ -155,13 +152,15 @@ async def on_message(message): if msg.startswith("?help"): await cli.send_message(message.channel, "Commands: ?help, ?ping, ?about") - await cli.send_message(message.channel, " to find teammates.") - await cli.send_message(message.channel, " to see who registered for notifications.") + await cli.send_message(message.channel, " to cancel.") - if msg.startswith("play with me") or msg.startswith("who can play"): - if msg.startswith("play with me"): - when = message.content[len("play with me"):] + if msg.startswith("play with me") or msg.startswith("who can play") or msg.startswith("?play"): + if msg.startswith("play with me") or msg.startswith("?play"): + if msg.startswith("play with me"): + when = message.content[len("play with me"):] + else: + when = message.content[len("?play"):] notify = True else: when = message.content[len("who can play"):] @@ -170,8 +169,7 @@ async def on_message(message): if msg.startswith("don't play with me") or msg.startswith("dont play with me"): db.playwithme.remove({"player": message.author.id}) - await cli.remove_roles(message.author, [r for r in message.server.roles if r.name == "play"][0]) - await cli.send_message(message.channel, "%s: Canceled all notifications and removed the 'play' role." % (message.author.mention)) + await cli.send_message(message.channel, "%s: Canceled all notifications." % (message.author.mention)) if __name__ == '__main__': logging.basicConfig() -- cgit v1.3.1