-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added website command to refactored code
- Loading branch information
1 parent
094c95b
commit a841c14
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import logging | ||
import re | ||
import os | ||
import pymongo | ||
import telebot | ||
import time | ||
from telebot import types | ||
from datetime import datetime, date, timedelta | ||
from telegram import ParseMode | ||
from telethon import TelegramClient | ||
import asyncio | ||
from pymongo import MongoClient, ReturnDocument | ||
import os | ||
from dotenv import load_dotenv | ||
import argparse | ||
import Scraped_data | ||
import formatter | ||
from tabulate import tabulate | ||
load_dotenv() | ||
|
||
api_token = os.getenv('TELEGRAM_BOT_TOKEN') | ||
api_id = os.getenv('TELEGRAM_API_ID') | ||
api_hash = os.getenv('TELEGRAM_API_HASH') | ||
api_username = os.getenv('TELEGRAM_USERNAME') | ||
cluster = os.getenv('MONGO_DB_URL') | ||
|
||
mongo_client = MongoClient(cluster) | ||
db = mongo_client.smartSpendDB | ||
|
||
#global variables to store user choice, user list, spend categories, etc | ||
user_bills = {} | ||
user_limits = {} | ||
count_ = 0 | ||
spend_categories = ['Food', 'Groceries', 'Utilities', 'Transport', 'Shopping', 'Miscellaneous', 'Others (Please Specify)'] | ||
spend_display_option = ['Day', 'Month', 'All'] | ||
timestamp_format = '%b %d %Y %I:%M%p' | ||
limit_categories = ['daily', 'monthly', 'yearly', 'View Limits'] | ||
|
||
#set of implemented commands and their description | ||
commands = { | ||
'menu': 'Display this menu', | ||
'add': 'Record/Add a new spending', | ||
'display': 'Show sum of expenditure for the current day/month', | ||
'history': 'Display spending history', | ||
'delete': 'Clear/Erase all your records', | ||
'edit': 'Edit/Change spending details', | ||
'limit': 'Add daily/monthly/yearly limits for spending', | ||
'search':'Search a product and compare prices', | ||
'settle': 'Settle an expense shared with you' | ||
} | ||
|
||
def command_website(message, bot): | ||
chat_id = message.chat.id | ||
# print(cluster) | ||
# print('https://localhost:4200/{}'.format(chat_id)) | ||
url = 'https://localhost:4200/{}'.format(chat_id) | ||
bot.send_message(chat_id, text="Check out the website:\n http://localhost:4200/{}".format(chat_id),parse_mode=ParseMode.MARKDOWN) | ||
return True | ||
|
||
|