summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.py22
1 files 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, "<play with me [now (default) | in (timespan) | at,from (time)] [for (timespan, default 30 minutes) | until (time)]> to find teammates.")
- await cli.send_message(message.channel, "<who can play [now (default) | in (timespan) | at,from (time)] [for (timespan, default 30 minutes) | until (time)]> to see who registered for notifications.")
+ await cli.send_message(message.channel, "<play with me when how long] to find teammates.")
await cli.send_message(message.channel, "<don't play with me> 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()