Skip to content

Commit 6ebaec1

Browse files
authored
Update bot.py
1 parent e8b2bb9 commit 6ebaec1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import os
12
from telegram import Update
23
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
34
from openpyxl import load_workbook
45

6+
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
7+
XLSX_FILE_PATH = os.getenv("XLSX_FILE_PATH")
8+
59
async def find(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
610
if update.message and update.message.text:
7-
workbook = load_workbook('test.xlsx')
11+
workbook = load_workbook(XLSX_FILE_PATH)
812
sheet = workbook.active
913
response_message = ''
1014

@@ -19,7 +23,7 @@ async def find(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
1923

2024
def main():
2125
try:
22-
app = ApplicationBuilder().token("BOT_TOKEN").build()
26+
app = ApplicationBuilder().token(TELEGRAM_BOT_TOKEN).build()
2327
app.add_handler(CommandHandler("find", find))
2428
app.run_polling()
2529
except Exception as err:

0 commit comments

Comments
 (0)