Skip to content

Commit

Permalink
brush up
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Gavryliuk committed Mar 20, 2024
1 parent dc5d83d commit ac96a4a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions daily_dragon_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
logging.getLogger("httpx").setLevel(logging.WARNING)
logger = logging.getLogger(__name__)

load_dotenv()
TELEGRAM_TOKEN = os.getenv('TELEGRAM_TOKEN')
if TELEGRAM_TOKEN is None or TELEGRAM_TOKEN == '':
raise ValueError('TELEGRAM_TOKEN not found in .env file')

logger = logging.getLogger(__name__)
daily_dragon = DailyDragon()


Expand All @@ -26,7 +27,7 @@

async def random_word(update: Update, context: ContextTypes.DEFAULT_TYPE):
username = update.effective_user.username
logger.info(f'User {username} requested daily word')
logger.info(f'User {username} requested random word')
if username == RAINY_BABE:
daily_dragon.set_language('Japanese')
daily_word_response = daily_dragon.get_daily_word()
Expand All @@ -35,8 +36,5 @@ async def random_word(update: Update, context: ContextTypes.DEFAULT_TYPE):

if __name__ == '__main__':
application = ApplicationBuilder().token(TELEGRAM_TOKEN).build()

start_handler = CommandHandler('random', random_word)
application.add_handler(start_handler)

application.add_handler(CommandHandler('random', random_word))
application.run_polling()

0 comments on commit ac96a4a

Please sign in to comment.