Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # BSD 3-Clause License
- # Copyright (c) 2019, Hugonun(https://github.com/hugonun)
- # All rights reserved.
- import discord
- from gsheet import *
- client = discord.Client()
- sheet = gsheet()
- @client.event
- async def on_ready():
- print('We have logged in as {0.user}'.format(client))
- @client.event
- async def on_message(message):
- if message.author == client.user:
- return
- # Restrict the command to a role
- # Change REQUIREDROLE to a role id or None
- REQUIREDROLE = None
- if REQUIREDROLE is not None and discord.utils.get(message.author.roles, id=str(REQUIREDROLE)) is None:
- await message.channel.send('You don\'t have the required role!')
- return
- # Command to insert data to exc
- # el
- if message.content.startswith('!S Slifer Win'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Slifer Red Won +10 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Slifer Lose'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Slifer Red Lost -5 Points')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Slifer Bonus'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Slifer Red, Bonus +50 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Slifer Cup'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Slifer Red Wins The House Cup! Congratulations!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to exc
- # el
- if message.content.startswith('!S Ra Win'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Ra Yellow Won +10 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Ra Lose'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Ra Yellow Lost -5 Points')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Ra Bonus'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Ra Yellow, Bonus +50 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Ra Cup'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Ra Yellow Wins The House Cup! Congratulations!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to exc
- # el
- if message.content.startswith('!S Obelisk Win'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Obelisk Blue Won +10 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Obelisk Lose'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Obelisk Blue Lost -5 Points')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Obelisk Bonus'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Obelisk Blue Bonus +50 Points')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Obelisk Cup'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Obelisk Blue Wins The House Cup! Congratulations!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to exc
- # el
- if message.content.startswith('!S Holactie Win'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Holactie White Won +10 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Holactie Lose'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Holactie White Lost -5 Points')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Holactie Bonus'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Holactie White Bonus +50 Points!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Command to insert data to excel
- if message.content.startswith('!S Holactie Cup'):
- SPREADSHEET_ID = '1oaN40EjGcCfqMVZlHuXZMI8avsDdO5Oelca0k-OjEJA' # Add ID here
- RANGE_NAME = 'A11:F'
- FIELDS = 1 # Amount of fields/cells
- # Code
- msg = message.content[3:]
- result = [x.strip() for x in msg.split(',')]
- if len(result) == FIELDS:
- # Add
- print(message.created_at)
- 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
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- await message.channel.send('Holactie White Wins The House Cup! Congratulations!')
- else:
- # Needs more/less fields
- await message.channel.send('Error: You need to add {0} fields, meaning it can only have {1} comma.'.format(FIELDS,FIELDS-1))
- # Whois
- # Please dont remove the copyright and github repo
- elif len(message.mentions) > 0:
- for muser in message.mentions:
- if muser.id == client.user.id:
- if any(word in message.content for word in ['whois','who is','Help','help','info']):
- await message.channel.send('This bot was made by hugonun(https://github.com/hugonun/).\nSource code: https://github.com/hugonun/discord2sheet-bot')
- client.run('Njc4NTIwMjU5NDQyOTAwOTky.XkkMnw.jXgbEqLDfFty3Jdvm09VBAHuNz8') # Add bot token here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement