-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
111 lines (101 loc) · 3.23 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import interactions
import os
from fetch import fetch_hours, restaurants, fetch_menus
from order import OrderManager
bot = interactions.Client(token=os.getenv('TOKEN'))
# active_orders = {}
# @bot.command(
# name="startorder",
# description="Start a new order"
# )
# async def start_order(ctx: interactions.CommandContext):
# user_id = ctx.author.id
# if user_id not in active_orders:
# order_manager = OrderManager()
# if order_manager.initialization_successful:
# active_orders[user_id] = order_manager
# await ctx.send("Order started! Add items and finalize your order with /endorder.")
# else:
# await ctx.send("Failed to start order due to WebDriver issues.")
# else:
# await ctx.send("You already have an active order. Use /endorder to finalize it.")
# @bot.command(
# name="endorder",
# description="Complete your order",
# options=[
# interactions.Option(
# name="payment_info",
# description="Your payment information",
# type=interactions.OptionType.STRING,
# required=True
# )
# ]
# )
# async def end_order(ctx: interactions.CommandContext, payment_info: str):
# user_id = ctx.author.id
# if user_id in active_orders:
# order = active_orders.pop(user_id)
# # Here, you would process the order and payment info
# await ctx.send(f"Order completed! Payment info received: {payment_info}. Items ordered: {order['items']}")
# else:
# await ctx.send("You don't have an active order. Start a new order with /startorder.")
# @bot.event
# async def on_message(message):
# if message.author.bot:
# return
# user_id = message.author.id
# if user_id in active_orders:
# response = new_order(user_id, message.content)
# await message.channel.send(response)
@bot.command(
name="hours",
description="Get the hours of a specific restaurant",
options=[
interactions.Option(
name="restaurant",
description="Name of the restaurant",
type=interactions.OptionType.STRING,
required=True
)
]
)
async def hours(ctx, restaurant: str):
hours = fetch_hours(restaurant)
if not hours:
await ctx.send("Restaurant hours not found")
else:
await ctx.send(hours)
@bot.command(
name="menu",
description="Get the menu of a specific restaurant",
options=[
interactions.Option(
name="restaurant",
description="Name of the restaurant",
type=interactions.OptionType.STRING,
required=True
)
]
)
async def menus(ctx, restaurant: str):
menu = fetch_menus(restaurant)
if not menu:
await ctx.send("Menu was not found")
else:
await ctx.send(menu)
@bot.command(
name="help",
description="Get help information"
)
async def help(ctx):
with open("README.md", "r") as file:
help_content = file.read()
await ctx.send(help_content)
@bot.command(
name="restaurants",
description="Get a list of available restaurants"
)
async def restaurant(ctx):
restaurant_list = '\n'.join(restaurants.keys())
await ctx.send(restaurant_list)
bot.start()