Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3.  
  4. from gsheet import *
  5.  
  6. bot = commands.Bot(command_prefix='!')
  7. sheet = gsheet()
  8. FIELDS = 3 # Amount of fields needed for the arg
  9.  
  10. @bot.event
  11. async def on_ready():
  12.     print('Logged in as:')
  13.     print(bot.user.name)
  14.  
  15. @bot.command()
  16. async def friend(ctx, arg1, arg2, arg3):
  17.     await ctx.send('You have added {} to the friends list!'.format(arg1))
  18.     #format the steam and razor entries
  19.     steam = '<friend name=\"{} - {}\">{}</friend>'.format(arg1, arg3, arg2)
  20.     razor = '{} - {}#{}'.format(arg1, arg3, arg2)
  21.     #print for verification
  22.     print ('Steam: ', steam)
  23.     print ('Razor: ', razor)
  24.     #compile data to send to Google sheets
  25.     SPREADSHEET_ID = '*********************************' # Add ID here
  26.     RANGE_NAME = 'A1'
  27.     DATA = arg1 + razor + steam
  28.     sheet.add(SPREADSHEET_ID, RANGE_NAME, DATA)
  29.     print('Data added to sheets.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement