Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- client = discord.Client()
- email = "clearskypony@gmail.com"
- password = "mlpdashie1"
- numofplayers = 10
- @client.event
- async def on_message(message):
- entered = []
- if message.author == client.user:
- return
- if message.content.startswith("!hello"):
- msg = "Hello {0.author.mention}".format(message)
- await client.send_message(message.channel, msg)
- if message.content.startswith("!10man"):
- await client.send_message(message.channel, "Starting 10 man:\nTo enter, type '!enter'\nTo leave type '!leave'\nTo list the current users in the 10 man, type '!listusers'")
- while len(entered) <= numofplayers:
- if len(entered) == numofplayers:
- msg = "Starting 10 man with the following users: ".format(message)
- await client.send_message(message.channel, msg)
- x = 0
- while x < numofplayers:
- username = (entered[x])
- await client.send_message(message.channel, username)
- x += 1
- entered = []
- return
- else:
- messageobj = await client.wait_for_message()
- content = messageobj.content
- author = messageobj.author
- author = str(author)
- if content.startswith("!enter"):
- if any(author in s for s in entered):
- msg = "Cannot add {0.author.mention} to 10 man, because {0.author.mention} is already a part of the 10 man".format(message)
- await client.send_message(message.channel, msg)
- else:
- entered.append(author)
- msg = "Entered {0.author.mention} to the 10 man, to leave type '!leave'".format(message)
- await client.send_message(message.channel, msg)
- if content.startswith("!leave"):
- if any(author in s for s in entered):
- entered.remove(author)
- msg = "Removed {0.author.mention} from the 10 man".format(message)
- await client.send_message(message.channel, msg)
- else:
- msg = "Cannot remove {0.author.mention} from the 10 man, because {0.author.mention} is not in the 10 man".format(message)
- await client.send_message(message.channel, msg)
- if content.startswith("!listusers"):
- x = 0
- await client.send_message(message.channel, "Current users in 10 man: ")
- while x < len(entered):
- username = entered[x]
- await client.send_message(message.channel, username)
- x += 1
- @client.event
- async def on_ready():
- print('Logged in as')
- print(client.user.name)
- print(client.user.id)
- client.run(email, password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement