CryptoScoutv1
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ from threading import Event
|
|
5 |
from typing import Optional
|
6 |
|
7 |
import discord
|
8 |
-
import discord_slash
|
9 |
|
10 |
import gradio as gr
|
11 |
from discord import Permissions
|
@@ -13,7 +12,7 @@ from discord.ext import commands
|
|
13 |
from discord.utils import oauth_url
|
14 |
import gradio_client as grc
|
15 |
from gradio_client.utils import QueueError
|
16 |
-
from discord_slash.model import
|
17 |
|
18 |
event = Event()
|
19 |
|
@@ -58,14 +57,7 @@ async def on_ready():
|
|
58 |
|
59 |
|
60 |
|
61 |
-
async def crypto_portfolio(ctx,
|
62 |
-
selection: Option(str,
|
63 |
-
"Select an option",
|
64 |
-
choices=[
|
65 |
-
"Find the top performing cryptocurrencies of the day.",
|
66 |
-
"Find the top performing cryptocurrencies of the week.",
|
67 |
-
"Find the top performing cryptocurrencies of the month."
|
68 |
-
])):
|
69 |
try:
|
70 |
# Acknowledge the command
|
71 |
await ctx.send(f"Processing request: {selection}")
|
@@ -85,6 +77,27 @@ async def crypto_portfolio(ctx,
|
|
85 |
except Exception as e:
|
86 |
print(f"{e}")
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
@bot.hybrid_command(name="cshelp", description="Get information on how to use this bot.")
|
90 |
async def help_command(ctx):
|
|
|
5 |
from typing import Optional
|
6 |
|
7 |
import discord
|
|
|
8 |
|
9 |
import gradio as gr
|
10 |
from discord import Permissions
|
|
|
12 |
from discord.utils import oauth_url
|
13 |
import gradio_client as grc
|
14 |
from gradio_client.utils import QueueError
|
15 |
+
from discord_slash.model import OptionData, ChoiceData
|
16 |
|
17 |
event = Event()
|
18 |
|
|
|
57 |
|
58 |
|
59 |
|
60 |
+
async def crypto_portfolio(ctx, selection):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
try:
|
62 |
# Acknowledge the command
|
63 |
await ctx.send(f"Processing request: {selection}")
|
|
|
77 |
except Exception as e:
|
78 |
print(f"{e}")
|
79 |
|
80 |
+
# Define the options for the command
|
81 |
+
crypto_portfolio_options = [
|
82 |
+
OptionData(
|
83 |
+
name="selection",
|
84 |
+
description="Select an option",
|
85 |
+
required=True,
|
86 |
+
choices=[
|
87 |
+
ChoiceData(name="Find the top performing cryptocurrencies of the day.", value="daily"),
|
88 |
+
ChoiceData(name="Find the top performing cryptocurrencies of the week.", value="weekly"),
|
89 |
+
ChoiceData(name="Find the top performing cryptocurrencies of the month.", value="monthly")
|
90 |
+
]
|
91 |
+
)
|
92 |
+
]
|
93 |
+
|
94 |
+
# Register your command with these options using your bot's command registration system
|
95 |
+
# Example (this will vary based on how your bot is set up):
|
96 |
+
@slash.slash(name="cryptoportfolio", description="View top performing cryptocurrencies", options=crypto_portfolio_options)
|
97 |
+
async def crypto_portfolio_command(ctx, *args, **kwargs):
|
98 |
+
await crypto_portfolio(ctx, **kwargs)
|
99 |
+
|
100 |
+
|
101 |
|
102 |
@bot.hybrid_command(name="cshelp", description="Get information on how to use this bot.")
|
103 |
async def help_command(ctx):
|