Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import discord
|
2 |
from discord.ui import Button
|
3 |
from discord.ext import commands #for buttons
|
4 |
-
|
5 |
import gradio_client
|
6 |
from gradio_client import Client
|
7 |
import gradio as gr
|
@@ -83,20 +83,6 @@ class ButtonView(discord.ui.View):
|
|
83 |
#---------------------------------------------------------------------------------------------------------------------------------------------------
|
84 |
# Set up discord bot
|
85 |
class MyClient(discord.Client):
|
86 |
-
|
87 |
-
guild = 879548962464493619
|
88 |
-
OFFLINE_ROLE_ID = 1103676632667017266
|
89 |
-
REQUIRED_ROLE_ID = 897376942817419265 # 900063512829755413 = @verified, 897376942817419265 = @huggingfolks
|
90 |
-
ALLOWED_CHANNEL_IDS = [1100458786826747945] # 1100458786826747945 = #bot-test
|
91 |
-
bot_member = guild.get_member(self.user.id)
|
92 |
-
|
93 |
-
if any(role.id == OFFLINE_ROLE_ID for role in bot_member.roles):
|
94 |
-
return
|
95 |
-
if not any(role.id == REQUIRED_ROLE_ID for role in message.author.roles):
|
96 |
-
return
|
97 |
-
if message.channel.id not in ALLOWED_CHANNEL_IDS:
|
98 |
-
return
|
99 |
-
|
100 |
async def on_ready(self):
|
101 |
print('Logged on as', self.user)
|
102 |
self.log_channel = self.get_channel(1036960509586587689) # 1100458786826747945 = bot test
|
@@ -126,12 +112,23 @@ class MyClient(discord.Client):
|
|
126 |
try:
|
127 |
await message.delete()
|
128 |
await asyncio.sleep(5) # safety mechanism, can only delete slowly
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
# the message author needs this role in order to use the bot
|
131 |
-
|
|
|
|
|
132 |
|
133 |
# channels where bot will accept commands
|
134 |
-
|
|
|
|
|
135 |
|
136 |
#deepfloydif----------------------------------------------------------------------------------------------------
|
137 |
|
|
|
1 |
import discord
|
2 |
from discord.ui import Button
|
3 |
from discord.ext import commands #for buttons
|
4 |
+
|
5 |
import gradio_client
|
6 |
from gradio_client import Client
|
7 |
import gradio as gr
|
|
|
83 |
#---------------------------------------------------------------------------------------------------------------------------------------------------
|
84 |
# Set up discord bot
|
85 |
class MyClient(discord.Client):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
async def on_ready(self):
|
87 |
print('Logged on as', self.user)
|
88 |
self.log_channel = self.get_channel(1036960509586587689) # 1100458786826747945 = bot test
|
|
|
112 |
try:
|
113 |
await message.delete()
|
114 |
await asyncio.sleep(5) # safety mechanism, can only delete slowly
|
115 |
+
|
116 |
+
# if the bot has this role, it won't run
|
117 |
+
OFFLINE_ROLE_ID = 1103676632667017266 # 1103676632667017266 = @offline / under maintenance
|
118 |
+
guild = message.guild
|
119 |
+
bot_member = guild.get_member(self.user.id)
|
120 |
+
if any(role.id == OFFLINE_ROLE_ID for role in bot_member.roles):
|
121 |
+
return
|
122 |
+
|
123 |
# the message author needs this role in order to use the bot
|
124 |
+
REQUIRED_ROLE_ID = 897376942817419265 # 900063512829755413 = @verified, 897376942817419265 = @huggingfolks
|
125 |
+
if not any(role.id == REQUIRED_ROLE_ID for role in message.author.roles):
|
126 |
+
return
|
127 |
|
128 |
# channels where bot will accept commands
|
129 |
+
ALLOWED_CHANNEL_IDS = [1100458786826747945] # 1100458786826747945 = #bot-test
|
130 |
+
if message.channel.id not in ALLOWED_CHANNEL_IDS:
|
131 |
+
return
|
132 |
|
133 |
#deepfloydif----------------------------------------------------------------------------------------------------
|
134 |
|