Token in .env

This commit is contained in:
Bandie 2021-06-11 19:27:17 +02:00
parent c0ccb1642d
commit 0a762ebacc
Signed by: Bandie
GPG Key ID: 843D7FA93BA46312
3 changed files with 6 additions and 7 deletions

1
.env.example Normal file
View File

@ -0,0 +1 @@
TOKEN=''

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.env
config.yml

View File

@ -1,7 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
TOKEN='' from dotenv import dotenv_values
from telegram import Update, Chat, ChatMember, ParseMode, ChatMemberUpdated, BotCommand from telegram import Update, Chat, ChatMember, ParseMode, ChatMemberUpdated, BotCommand
from telegram.ext import Updater, CommandHandler, ChatMemberHandler, CallbackContext, MessageHandler, Filters from telegram.ext import Updater, CommandHandler, ChatMemberHandler, CallbackContext, MessageHandler, Filters
import telegram import telegram
@ -9,17 +7,15 @@ import logging
import os.path import os.path
import yaml import yaml
TOKEN=dotenv_values()['TOKEN']
configFilename='config.yml' configFilename='config.yml'
config = {} config = {}
reply_markup = None reply_markup = None
bot = telegram.Bot(token=TOKEN) bot = telegram.Bot(token=TOKEN)
updater = Updater(token=TOKEN, use_context=True) updater = Updater(token=TOKEN, use_context=True)
dispatcher = updater.dispatcher dispatcher = updater.dispatcher
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)
def loadConfig(): def loadConfig():
if(os.path.isfile(configFilename)): if(os.path.isfile(configFilename)):