Advertisement
EpicShardGamingYT

PY Announcer

Mar 7th, 2018
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.27 KB | None | 0 0
  1. #Import
  2. import random
  3. import discord
  4. from discord.ext.commands import Bot
  5. from discord.ext import commands
  6. import asyncio
  7. import time
  8. from discord.voice_client import VoiceClient
  9. import json
  10. import io
  11.  
  12.  
  13. Client = discord.Client()
  14. client = commands.Bot(command_prefix = "-")
  15. Players = ["**Players**"]
  16. IsTaken = False
  17. BlockedIds = ['221691584385646593']
  18. crossServerChannels = []
  19. DM = True
  20.  
  21.  
  22. @client.event
  23. async def on_ready():
  24.     print("RaidBot has started!")
  25.  
  26. #Kode
  27. @client.event
  28. async def on_message(message):    
  29.     global IsTaken
  30.     global DM
  31.     IsTaken = False
  32.     for player in Players:
  33.         if message.author != player and message.author != "RaidBot#4623" and message.author.id != '420111084536725507':
  34.             pass
  35.         elif message.author == player:
  36.             print("User is alredy registerd " + str(player))
  37.             IsTaken = True
  38.     if not IsTaken:
  39.         Players.append(message.author)
  40.         print("User registered!")
  41.     if message.content.upper() == ".RAID START":
  42.         pass
  43.     if message.content.upper().startswith(".RAID WHO"):
  44.         print("test")
  45.         for player in Players:
  46.             try:
  47.                 await client.send_message(message.channel, player)
  48.             except discord.errors.HTTPException:
  49.                 print("Send failed!")
  50.                 pass
  51.        
  52.  
  53.     if message.content.upper().startswith('.RAID START'):
  54.         args = message.content.split(" ")
  55.         if len(args) < 2:
  56.            await client.send_message(message.channel, "**Error:** to few arguments!")
  57.         else:
  58.             Continue = True
  59.             for BlockedId in BlockedIds:
  60.                         if message.author.id == BlockedId:
  61.                             Continue = False
  62.                             print("Someone who is blocked tryed to start, but got denied")
  63.                             await client.send_message(message.channel, "**Error:** You are blocked from the system")
  64.             if Continue:
  65.                 await client.send_message(message.channel, "Raid started!")
  66.             for player in Players:
  67.                 try:
  68.                     if Continue == True and DM:
  69.                        await client.send_message(player,str(message.author) + "> " + " ".join(args[2:]))
  70.                 except discord.errors.InvalidArgument:
  71.                     print("Could not send message")
  72.                     pass
  73.                 except discord.errors.HTTPException:
  74.                     print("Could not send message")
  75.             for server in crossServerChannels:
  76.                 if Continue == True:
  77.                     await client.send_message(server, str(message.author) + "> " + " ".join(args[2:]))
  78.     if message.content.upper()=='.RAID NIKKECRAFT':
  79.         await client.send_message(message.channel,"The ip for nikkecraft is: \nnikkecraft.mcserv.me")
  80.     if message.content.upper()=='.RAID NIKKECRAFT NORWAY':
  81.         await client.send_message(message.channel,"IPen er: \nnikkecraft.mcserv.me")
  82.     if message.content.upper().startswith(".RAID SETCHANNEL"):
  83.         sent = await client.send_message(message.channel, "New channel set! ")
  84.         crossServerChannels.append(message.channel)
  85.         time.sleep(1)
  86.         await client.delete_message(message)
  87.         await client.delete_message(sent)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement