Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ async def on_ready():
|
|
52 |
@bot.event
|
53 |
async def on_member_join(mb):
|
54 |
channelv0 = discord.utils.get(mb.guild.channels, name = "👋wellcome-goodbye")
|
55 |
-
await channelv0.send(f"Welcome to server, <@{mb.id}
|
56 |
|
57 |
|
58 |
# running in thread
|
@@ -68,50 +68,10 @@ threading.Thread(target=run_bot).start()
|
|
68 |
|
69 |
event.wait()
|
70 |
|
71 |
-
if not DISCORD_TOKEN:
|
72 |
-
welcome_message = """
|
73 |
-
## You have not specified a DISCORD_TOKEN, which means you have not created a bot account. Please follow these steps:
|
74 |
-
### 1. Go to https://discord.com/developers/applications and click 'New Application'
|
75 |
-
|
76 |
-
### 2. Give your bot a name 🤖
|
77 |
-

|
78 |
-
|
79 |
-
## 3. In Settings > Bot, click the 'Reset Token' button to get a new token. Write it down and keep it safe 🔐
|
80 |
-
|
81 |
-

|
82 |
-
|
83 |
-
## 4. Optionally make the bot public if you want anyone to be able to add it to their servers
|
84 |
-
|
85 |
-
## 5. Scroll down and enable 'Message Content Intent' under 'Priviledged Gateway Intents'
|
86 |
-
|
87 |
-

|
88 |
-
## 6. Save your changes!
|
89 |
-
## 7. The token from step 3 is the DISCORD_TOKEN. Rerun the deploy_discord command, e.g client.deploy_discord(discord_bot_token=DISCORD_TOKEN, ...), or add the token as a space secret manually.
|
90 |
-
"""
|
91 |
-
else:
|
92 |
-
permissions = Permissions(326417525824)
|
93 |
-
url = oauth_url(bot.user.id, permissions=permissions)
|
94 |
-
welcome_message = f"""
|
95 |
-
## Add this bot to your server by clicking this link:
|
96 |
-
|
97 |
-
{url}
|
98 |
-
## How to use it?
|
99 |
-
The bot can be triggered via `/chat` followed by your text prompt.
|
100 |
-
|
101 |
-
This will create a thread with the bot's response to your text prompt.
|
102 |
-
You can reply in the thread (without `/chat`) to continue the conversation.
|
103 |
-
In the thread, the bot will only reply to the original author of the command.
|
104 |
-
⚠️ Note ⚠️: Please make sure this bot's command does have the same name as another command in your server.
|
105 |
-
|
106 |
-
⚠️ Note ⚠️: Bot commands do not work in DMs with the bot as of now.
|
107 |
-
"""
|
108 |
-
|
109 |
-
|
110 |
with gr.Blocks() as demo:
|
111 |
gr.Markdown(
|
112 |
f"""
|
113 |
-
# Discord bot
|
114 |
-
{welcome_message}
|
115 |
"""
|
116 |
)
|
117 |
|
|
|
52 |
@bot.event
|
53 |
async def on_member_join(mb):
|
54 |
channelv0 = discord.utils.get(mb.guild.channels, name = "👋wellcome-goodbye")
|
55 |
+
await channelv0.send(f"Welcome to server, <@{mb.id}>! ")
|
56 |
|
57 |
|
58 |
# running in thread
|
|
|
68 |
|
69 |
event.wait()
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
with gr.Blocks() as demo:
|
72 |
gr.Markdown(
|
73 |
f"""
|
74 |
+
# Discord bot is online!
|
|
|
75 |
"""
|
76 |
)
|
77 |
|