prepare code for gspread usage

This commit is contained in:
2021-06-08 21:06:15 +02:00
parent dc1ba0d7ef
commit bf74ec49bc
4 changed files with 10 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ init:
install: install:
cp jeevesbot/env.py.dist jeevesbot/env.py cp jeevesbot/env.py.dist jeevesbot/env.py
cp jeevesbot/secret.json.dist jeevesbot/secret.json
clearlog: clearlog:
rm jeeves.log rm jeeves.log
@@ -10,6 +11,7 @@ clearlog:
clean: clean:
rm jeeves.log rm jeeves.log
rm jeevesbot/env.py rm jeevesbot/env.py
rm jeevesbot/secret.json
rm -rf jeevesbot/__pycache/ rm -rf jeevesbot/__pycache/
rm -rf __pycache/ rm -rf __pycache/

View File

@@ -4,6 +4,8 @@ import discord
from discord.ext import commands from discord.ext import commands
import logging import logging
from jeevesbot import bothelp, functions, env from jeevesbot import bothelp, functions, env
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# setup logging # setup logging
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
@@ -12,10 +14,13 @@ logger.setLevel(logging.INFO)
handler = logging.FileHandler(filename='jeeves.log', encoding='utf-8', mode='a') handler = logging.FileHandler(filename='jeeves.log', encoding='utf-8', mode='a')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')) handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler) logger.addHandler(handler)
# setup discord.py # setup discord.py
client = discord.Client() client = discord.Client()
e = discord.Embed() e = discord.Embed()
# setup gspread
scope = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('secret.json', scope)
gclient = gspread.authorize(creds)
@client.event @client.event
async def on_message(message): async def on_message(message):
@@ -70,8 +75,3 @@ async def on_ready():
if __name__ == '__main__': if __name__ == '__main__':
client.run(env.TOKEN) client.run(env.TOKEN)
## TODO
# /tenor andere syntax
# tenor android keyboard andere syntax (https://c.tenor.com/)
# giphy verdubbelt url

View File

View File

@@ -8,6 +8,8 @@ multidict
pyparsing pyparsing
typing-extensions typing-extensions
pylint pylint
gspread
oauth2client
# needs this version, otherwise TypeErrors will break stuff # needs this version, otherwise TypeErrors will break stuff
yarl==1.4.2 yarl==1.4.2