Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.70 KB | None | 0 0
  1. import discord as bot
  2. import urllib.request
  3. import demjson
  4.  
  5. flightname = None
  6. flightime = None
  7. flightaircraft = None
  8. flightshouttime = 0
  9.  
  10.  
  11.  
  12. adminlist = ['323014681511985154', '406329247435849730']
  13.  
  14. client = bot.Client()
  15. prefix = '[]'
  16.  
  17.  
  18.  
  19. @client.event
  20. async def on_message(message):
  21.    
  22.     global flightshouttime
  23.     global flightname
  24.     global flightaircraft
  25.     global flightime
  26.    
  27.     admin = False
  28.    
  29.     msg = str(message.content)
  30.  
  31.     if message.author == client.user:
  32.         return
  33.     elif msg.startswith(prefix):
  34.         msg = msg[len(prefix):len(msg)]
  35.        
  36.         response = urllib.request.urlopen('https://trello.com/1/boards/0BJgbL8N/lists?key=37d50eb4be08bb1fe103829e212ddb22&token=6b4e3a5f6b25fc1d92ff5475ecbffdd19394de05ef7bd4250b3d33f77393f1a0')
  37.         st = response.read().decode("utf8")
  38.         d = demjson.decode(st)
  39.         for a in range(len(d)):
  40.             print(d[a]['name'])
  41.             if message.author.id == d[a]['name']:
  42.                 await client.send_message(message.channel, 'Sorry, but you current was in the GLOBAL BANLIST')
  43.                 return
  44.        
  45.         for a in adminlist:
  46.             if message.author.id == a:
  47.                 admin = True
  48.        
  49.         if admin == True:
  50.             if msg[:10] == "flightname":
  51.                 print("test")
  52.                 msgsec = msg[10:len(msg)]
  53.                 print(msgsec)
  54.                 returnmsg = 'Finish, the system [Flight Name] Value has changed to: '+ msgsec
  55.                 flightname = msgsec
  56.                 await client.send_message(message.channel, returnmsg)
  57.            
  58.             elif msg[:10] == "flighttime":
  59.                 print("test")
  60.                 msgsec = msg[10:len(msg)]
  61.                 print(msgsec)
  62.                 returnmsg = 'Finish, the system [Flight Time] Value has changed to: '+ msgsec
  63.                 flightime = msgsec
  64.                 await client.send_message(message.channel, returnmsg//***)
  65.            
  66.             elif msg[:14] == "flightaircraft":
  67.                 print("test")
  68.                 msgsec = msg[14:len(msg)]
  69.                 print(msgsec)
  70.                 returnmsg = 'Finish, the system [Flight Aircraft] Value has changed to: '+ msgsec
  71.                 flightaircraft = msgsec
  72.                 await client.send_message(message.channel, returnmsg)
  73.            
  74.             elif msg[:11] == "flightshout":
  75.                
  76.                 if flightshouttime == 0:
  77.                     flightshouttime = 1
  78.                     await client.send_message(message.channel, 'Are you sure about that? Use the commands one more time to comform. Current mode: No tagging')
  79.                
  80.                 else:
  81.                     print(flightime)
  82.                     print(flightaircraft)
  83.                     print(flightname)
  84.                     flightshouttime = 0
  85.                     returnmsg = 'Hey there, we got a ' + flightname +' and it will be hosted in '+ flightime + ' and we will use the ' + flightaircraft
  86.                     await client.send_message(client.get_channel('444873253098356756'), returnmsg)
  87.        
  88.         if msg[:7] == "aboutus":
  89.                 await client.send_message(message.channel, 'Mars Airways Is An Airline Founded In April And Officially Started Operations On October 23rd, 2018, Since Then Mars Airways Has Been Operating Threw Bexon Airport To Mars. There Fleet Is 737-10MAX. This Airline Was Founded By 10xTheFoxy. \n Mars Airways, The Airline Of The Gateway to Mars.')
  90.            
  91.  
  92. @client.event
  93. async def on_ready():
  94.     print('Logged in as')
  95.     print(client.user.name)
  96.     print(client.user.id)
  97.     print('------')
  98.  
  99. client.run('NTIyNzczMzMyNDkyNDE5MDgz.DvP2Mg.oM2jvDozYpDzZb_A0DENahYHIMA')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement