CryptoScoutv1 commited on
Commit
79eddcb
·
verified ·
1 Parent(s): 0a873df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -13,7 +13,9 @@ from discord.utils import oauth_url
13
  import gradio_client as grc
14
  from gradio_client.utils import QueueError
15
  from discord.ext import commands
16
-
 
 
17
 
18
 
19
  event = Event()
@@ -71,8 +73,24 @@ bot = commands.Bot(command_prefix="!", intents=discord.Intents.default())
71
  async def on_ready():
72
  print(f"We have logged in as {bot.user}")
73
 
74
- @bot.slash_command(name="cryptosearch", description="Find top trending cryptocurrencies for a specific period.")
75
- async def cryptosearch(ctx, period: str = commands.Param(choices=["day", "week", "month"])):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  if ctx.author.id == bot.user.id:
77
  return
78
 
 
13
  import gradio_client as grc
14
  from gradio_client.utils import QueueError
15
  from discord.ext import commands
16
+ from discord.ext import commands
17
+ from discord.ext import SlashCommand, SlashContext
18
+ from discord.ext import create_option, create_choice
19
 
20
 
21
  event = Event()
 
73
  async def on_ready():
74
  print(f"We have logged in as {bot.user}")
75
 
76
+ @slash.slash(
77
+ name="cryptotrend",
78
+ description="Find top trending cryptocurrencies for a specific period.",
79
+ options=[
80
+ create_option(
81
+ name="period",
82
+ description="Choose the period",
83
+ option_type=3, # Type 3 corresponds to STRING
84
+ required=True,
85
+ choices=[
86
+ create_choice(name="Day", value="day"),
87
+ create_choice(name="Week", value="week"),
88
+ create_choice(name="Month", value="month")
89
+ ]
90
+ )
91
+ ]
92
+ )
93
+ async def cryptotrend(ctx: SlashContext, period: str):
94
  if ctx.author.id == bot.user.id:
95
  return
96