Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from gsheet import *
- bot = commands.Bot(command_prefix='!')
- sheet = gsheet()
- FIELDS = 3 # Amount of fields needed for the arg
- @bot.event
- async def on_ready():
- print('Logged in as:')
- print(bot.user.name)
- @bot.command()
- async def friend(ctx, arg1, arg2, arg3):
- await ctx.send('You have added {} to the friends list!'.format(arg1))
- #format the steam and razor entries
- steam = '<friend name=\"{} - {}\">{}</friend>'.format(arg1, arg3, arg2)
- razor = '{} - {}#{}'.format(arg1, arg3, arg2)
- #print for verification
- print ('Steam: ', steam)
- print ('Razor: ', razor)
- #compile data to send to Google sheets
- SPREADSHEET_ID = '*********************************' # Add ID here
- RANGE_NAME = 'A1'
- DATA = arg1 + razor + steam
- sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
- print('Data added to sheets.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement