Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- import asyncio
- import discord.utils
- import datetime
- import gspread
- import traceback
- import sys
- import time
- from gspread.exceptions import CellNotFound
- from oauth2client.service_account import ServiceAccountCredentials
- scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
- credentials = ServiceAccountCredentials.from_json_keyfile_name('Credites-d90e60bb9daf.json', scope)
- gc = gspread.authorize(credentials)
- wks = gc.open_by_key('1hv3Xv5xssd0jmK1lsrdxTFVvARTMMiyUcX6TW2vHcdg') .sheet1
- client = commands.Bot(command_prefix = '.')
- #Credits code.
- @client.command()
- @commands.cooldown(1, 15)
- @commands.has_any_role('test', 'Owner', 492212595072434186)
- async def credits(ctx):
- gc.login()
- time2 = datetime.datetime.now().strftime("%b %d, %Y at %I:%M %p (EST)")
- channel = client.get_channel(632969296535879705)
- await ctx.message.delete()
- cell = wks.find(str(ctx.message.author.id))
- ftocredits = wks.cell(cell.row,3).value
- await ctx.message.author.send("**__" + time2 + "__**")
- if str(ftocredits).lower() == '1':
- await ctx.message.author.send(f'**•** You have **{ftocredits}** credit')
- await channel.send("**__" + time2 + "__**\n**" + ctx.message.author.mention + "** Has successfully run the `credits` command!\n---------")
- elif str(ftocredits).lower() == '':
- await ctx.message.author.send("**•** **System Error; No Credits Available**")
- else:
- await ctx.message.author.send(f'**•** You have **{ftocredits}** credits')
- await channel.send("**__" + time2 + "__**\n**" + ctx.message.author.mention + "** Has successfully run the `credits` command!\n---------")
- requirements = wks.cell(cell.row,2).value
- if str(requirements).lower() == 'yes':
- await ctx.message.author.send('**•** You **have** met the requirements for this month!')
- elif str(requirements).lower() == 'fta':
- await ctx.message.author.send("**•** You are an FTA, don't worry about meeting requiremnts, rather focus on getting sit-ins done within your 60 days.")
- elif str(requirements).lower() == '\\':
- await ctx.message.author.send("**•** You are not required to meet requirements for this month!")
- elif str(requirements).lower() == '':
- await ctx.message.author.send("**•** Please contact an FTO-Lead for credits. The bot developer has been notified of this error.")
- await channel.send("**__" + time2 + "__**\n" + "<@359788891412103169> - **User: "+ ctx.message.author.mention + "** Has encountered an error while trying to use the `credits` command.\n---------")
- else:
- await ctx.message.author.send('**•** You **do not** meet the monthly requirements.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement