SHARE
TWEET

Untitled

MauiMallard12895 Feb 18th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # BSD 3-Clause License
  2. # Copyright (c) 2019, Hugonun(https://github.com/hugonun)
  3. # All rights reserved.
  4.  
  5. import discord
  6.  
  7. from gsheet import *
  8.  
  9. client = discord.Client()
  10. sheet = gsheet()
  11.  
  12. @client.event
  13. async def on_ready():
  14.     print('We have logged in as {0.user}'.format(client))
  15.  
  16. @client.event
  17. async def on_message(message):
  18.     if message.author == client.user:
  19.         return
  20.    
  21.     # Restrict the command to a role
  22.     # Change REQUIREDROLE to a role id or None
  23.     REQUIREDROLE = None
  24.     if REQUIREDROLE is not None and discord.utils.get(message.author.roles, id=str(REQUIREDROLE)) is None:
  25.         await message.channel.send('You don\'t have the required role!')
  26.         return
  27.     # Command to insert data to exc
  28.     # el
  29.     if message.content.startswith('!S Slifer Win'):
  30.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  31.         RANGE_NAME = 'A11:F'
  32.         FIELDS = 1 # Amount of fields/cells
  33.  
  34.         # Code
  35.         msg = message.content[3:]
  36.         result = [x.strip() for x in msg.split(',')]
  37.         if len(result) == FIELDS:
  38.             # Add
  39.             print(message.created_at)
  40.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0]+ result
  41.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  42.             await message.channel.send('Slifer Red Won +10 Points!')
  43.         else:
  44.             # Needs more/less fields
  45.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  46.    
  47.         # Command to insert data to excel
  48.     if message.content.startswith('!S Slifer Lose'):
  49.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  50.         RANGE_NAME = 'A11:F'
  51.         FIELDS = 1 # Amount of fields/cells
  52.  
  53.         # Code
  54.         msg = message.content[3:]
  55.         result = [x.strip() for x in msg.split(',')]
  56.         if len(result) == FIELDS:
  57.             # Add
  58.             print(message.created_at)
  59.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  60.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  61.             await message.channel.send('Slifer Red Lost -5 Points')
  62.         else:
  63.             # Needs more/less fields
  64.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  65.  
  66.     # Command to insert data to excel
  67.     if message.content.startswith('!S Slifer Bonus'):
  68.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  69.         RANGE_NAME = 'A11:F'
  70.         FIELDS = 1 # Amount of fields/cells
  71.  
  72.         # Code
  73.         msg = message.content[3:]
  74.         result = [x.strip() for x in msg.split(',')]
  75.         if len(result) == FIELDS:
  76.             # Add
  77.             print(message.created_at)
  78.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  79.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  80.             await message.channel.send('Slifer Red, Bonus +50 Points!')
  81.         else:
  82.             # Needs more/less fields
  83.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  84.    
  85.         # Command to insert data to excel
  86.     if message.content.startswith('!S Slifer Cup'):
  87.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  88.         RANGE_NAME = 'A11:F'
  89.         FIELDS = 1 # Amount of fields/cells
  90.  
  91.         # Code
  92.         msg = message.content[3:]
  93.         result = [x.strip() for x in msg.split(',')]
  94.         if len(result) == FIELDS:
  95.             # Add
  96.             print(message.created_at)
  97.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  98.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  99.             await message.channel.send('Slifer Red Wins The House Cup! Congratulations!')
  100.         else:
  101.             # Needs more/less fields
  102.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  103.  
  104.     # Command to insert data to exc
  105.     # el
  106.     if message.content.startswith('!S Ra Win'):
  107.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  108.         RANGE_NAME = 'A11:F'
  109.         FIELDS = 1 # Amount of fields/cells
  110.  
  111.         # Code
  112.         msg = message.content[3:]
  113.         result = [x.strip() for x in msg.split(',')]
  114.         if len(result) == FIELDS:
  115.             # Add
  116.             print(message.created_at)
  117.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  118.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  119.             await message.channel.send('Ra Yellow Won +10 Points!')
  120.         else:
  121.             # Needs more/less fields
  122.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  123.    
  124.         # Command to insert data to excel
  125.     if message.content.startswith('!S Ra Lose'):
  126.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  127.         RANGE_NAME = 'A11:F'
  128.         FIELDS = 1 # Amount of fields/cells
  129.  
  130.         # Code
  131.         msg = message.content[3:]
  132.         result = [x.strip() for x in msg.split(',')]
  133.         if len(result) == FIELDS:
  134.             # Add
  135.             print(message.created_at)
  136.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  137.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  138.             await message.channel.send('Ra Yellow Lost -5 Points')
  139.         else:
  140.             # Needs more/less fields
  141.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  142.  
  143.     # Command to insert data to excel
  144.     if message.content.startswith('!S Ra Bonus'):
  145.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  146.         RANGE_NAME = 'A11:F'
  147.         FIELDS = 1 # Amount of fields/cells
  148.  
  149.         # Code
  150.         msg = message.content[3:]
  151.         result = [x.strip() for x in msg.split(',')]
  152.         if len(result) == FIELDS:
  153.             # Add
  154.             print(message.created_at)
  155.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  156.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  157.             await message.channel.send('Ra Yellow, Bonus +50 Points!')
  158.         else:
  159.             # Needs more/less fields
  160.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  161.    
  162.         # Command to insert data to excel
  163.     if message.content.startswith('!S Ra Cup'):
  164.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  165.         RANGE_NAME = 'A11:F'
  166.         FIELDS = 1 # Amount of fields/cells
  167.  
  168.         # Code
  169.         msg = message.content[3:]
  170.         result = [x.strip() for x in msg.split(',')]
  171.         if len(result) == FIELDS:
  172.             # Add
  173.             print(message.created_at)
  174.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  175.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  176.             await message.channel.send('Ra Yellow Wins The House Cup! Congratulations!')
  177.         else:
  178.             # Needs more/less fields
  179.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  180.  
  181.         # Command to insert data to exc
  182.     # el
  183.     if message.content.startswith('!S Obelisk Win'):
  184.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  185.         RANGE_NAME = 'A11:F'
  186.         FIELDS = 1 # Amount of fields/cells
  187.  
  188.         # Code
  189.         msg = message.content[3:]
  190.         result = [x.strip() for x in msg.split(',')]
  191.         if len(result) == FIELDS:
  192.             # Add
  193.             print(message.created_at)
  194.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  195.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  196.             await message.channel.send('Obelisk Blue Won +10 Points!')
  197.         else:
  198.             # Needs more/less fields
  199.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  200.    
  201.         # Command to insert data to excel
  202.     if message.content.startswith('!S Obelisk Lose'):
  203.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  204.         RANGE_NAME = 'A11:F'
  205.         FIELDS = 1 # Amount of fields/cells
  206.  
  207.         # Code
  208.         msg = message.content[3:]
  209.         result = [x.strip() for x in msg.split(',')]
  210.         if len(result) == FIELDS:
  211.             # Add
  212.             print(message.created_at)
  213.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + result
  214.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  215.             await message.channel.send('Obelisk Blue Lost -5 Points')
  216.         else:
  217.             # Needs more/less fields
  218.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  219.  
  220.     # Command to insert data to excel
  221.     if message.content.startswith('!S Obelisk Bonus'):
  222.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  223.         RANGE_NAME = 'A11:F'
  224.         FIELDS = 1 # Amount of fields/cells
  225.  
  226.         # Code
  227.         msg = message.content[3:]
  228.         result = [x.strip() for x in msg.split(',')]
  229.         if len(result) == FIELDS:
  230.             # Add
  231.             print(message.created_at)
  232.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + [0] + result
  233.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  234.             await message.channel.send('Obelisk Blue Bonus +50 Points')
  235.         else:
  236.             # Needs more/less fields
  237.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  238.    
  239.         # Command to insert data to excel
  240.     if message.content.startswith('!S Obelisk Cup'):
  241.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  242.         RANGE_NAME = 'A11:F'
  243.         FIELDS = 1 # Amount of fields/cells
  244.  
  245.         # Code
  246.         msg = message.content[3:]
  247.         result = [x.strip() for x in msg.split(',')]
  248.         if len(result) == FIELDS:
  249.             # Add
  250.             print(message.created_at)
  251.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + [0] + result
  252.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  253.             await message.channel.send('Obelisk Blue Wins The House Cup! Congratulations!')
  254.         else:
  255.             # Needs more/less fields
  256.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  257.  
  258.     # Command to insert data to exc
  259.     # el
  260.     if message.content.startswith('!S Holactie Win'):
  261.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  262.         RANGE_NAME = 'A11:F'
  263.         FIELDS = 1 # Amount of fields/cells
  264.  
  265.         # Code
  266.         msg = message.content[3:]
  267.         result = [x.strip() for x in msg.split(',')]
  268.         if len(result) == FIELDS:
  269.             # Add
  270.             print(message.created_at)
  271.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + [0] + result
  272.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  273.             await message.channel.send('Holactie White Won +10 Points!')
  274.         else:
  275.             # Needs more/less fields
  276.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  277.    
  278.         # Command to insert data to excel
  279.     if message.content.startswith('!S Holactie Lose'):
  280.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  281.         RANGE_NAME = 'A11:F'
  282.         FIELDS = 1 # Amount of fields/cells
  283.  
  284.         # Code
  285.         msg = message.content[3:]
  286.         result = [x.strip() for x in msg.split(',')]
  287.         if len(result) == FIELDS:
  288.             # Add
  289.             print(message.created_at)
  290.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0]   + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + [0] + result
  291.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  292.             await message.channel.send('Holactie White Lost -5 Points')
  293.         else:
  294.             # Needs more/less fields
  295.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  296.  
  297.     # Command to insert data to excel
  298.     if message.content.startswith('!S Holactie Bonus'):
  299.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  300.         RANGE_NAME = 'A11:F'
  301.         FIELDS = 1 # Amount of fields/cells
  302.  
  303.         # Code
  304.         msg = message.content[3:]
  305.         result = [x.strip() for x in msg.split(',')]
  306.         if len(result) == FIELDS:
  307.             # Add
  308.             print(message.created_at)
  309.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0]   + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + [0] + result
  310.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  311.             await message.channel.send('Holactie White Bonus +50 Points!')
  312.         else:
  313.             # Needs more/less fields
  314.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  315.    
  316.         # Command to insert data to excel
  317.     if message.content.startswith('!S Holactie Cup'):
  318.         SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
  319.         RANGE_NAME = 'A11:F'
  320.         FIELDS = 1 # Amount of fields/cells
  321.  
  322.         # Code
  323.         msg = message.content[3:]
  324.         result = [x.strip() for x in msg.split(',')]
  325.         if len(result) == FIELDS:
  326.             # Add
  327.             print(message.created_at)
  328.             DATA = DATA = [message.author.name] + [str(message.created_at)] + [0] + [0] + [0] + [0] + [0] + [0] + [0]   + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [0] + [1] + [0] + result
  329.             sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  330.             await message.channel.send('Holactie White Wins The House Cup! Congratulations!')
  331.         else:
  332.             # Needs more/less fields
  333.             await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
  334.  
  335.     # Whois
  336.     # Please dont remove the copyright and github repo
  337.     elif len(message.mentions) > 0:
  338.         for muser in message.mentions:
  339.             if muser.id == client.user.id:
  340.                 if any(word in message.content for word in ['whois','who is','Help','help','info']):
  341.                     await message.channel.send('This bot was made by hugonun(https://github.com/hugonun/).\nSource code: https://github.com/hugonun/discord2sheet-bot')
  342.  
  343. client.run('Njc4NTIwMjU5NDQyOTAwOTky.XkkMnw.jXgbEqLDfFty3Jdvm09VBAHuNz8') # Add bot token here
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top