[main] found the bug! intents.default causes issues, using intents.all instead
Browse files
app.py
CHANGED
|
@@ -29,6 +29,9 @@ DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
|
| 29 |
|
| 30 |
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 33 |
class MyClient(discord.Client):
|
| 34 |
"""This structure allows commands to work instantly (instead of needing to sync global commands for up to an hour)"""
|
|
@@ -52,35 +55,48 @@ async def on_ready():
|
|
| 52 |
@app_commands.describe(
|
| 53 |
prompt='Enter some text to chat with the bot! Like this: /falcon Hello, how are you?')
|
| 54 |
async def falcon(interaction: discord.Interaction, prompt: str):
|
| 55 |
-
"""Command that begins a new conversation with Falcon"""
|
| 56 |
try:
|
| 57 |
await try_falcon(interaction, prompt)
|
| 58 |
-
|
| 59 |
except Exception as e:
|
| 60 |
print(f"Error: {e}")
|
| 61 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 62 |
@client.event
|
| 63 |
async def on_message(message):
|
| 64 |
-
"""Checks channel and continues Falcon conversation if it's the right Discord Thread"""
|
| 65 |
try:
|
| 66 |
await continue_falcon(message)
|
| 67 |
-
await message.remove_reaction('π', client.user) # test=π hf=π
|
| 68 |
-
|
| 69 |
except Exception as e:
|
| 70 |
print(f"Error: {e}")
|
| 71 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
| 74 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
| 75 |
-
|
| 76 |
def run_bot():
|
| 77 |
client.run(DISCORD_TOKEN)
|
| 78 |
-
|
| 79 |
threading.Thread(target=run_bot).start()
|
| 80 |
-
|
| 81 |
def greet(name):
|
| 82 |
return "Hello " + name + "!"
|
| 83 |
-
|
| 84 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 85 |
demo.queue(concurrency_count=20)
|
| 86 |
demo.launch()
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
+
|
| 33 |
+
DEEPFLOYD_CHANNEL_ID = 1121834257959092234 # 1121834257959092234 = test
|
| 34 |
+
#df = Client("huggingface-projects/IF", HF_TOKEN)
|
| 35 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 36 |
class MyClient(discord.Client):
|
| 37 |
"""This structure allows commands to work instantly (instead of needing to sync global commands for up to an hour)"""
|
|
|
|
| 55 |
@app_commands.describe(
|
| 56 |
prompt='Enter some text to chat with the bot! Like this: /falcon Hello, how are you?')
|
| 57 |
async def falcon(interaction: discord.Interaction, prompt: str):
|
|
|
|
| 58 |
try:
|
| 59 |
await try_falcon(interaction, prompt)
|
|
|
|
| 60 |
except Exception as e:
|
| 61 |
print(f"Error: {e}")
|
| 62 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 63 |
@client.event
|
| 64 |
async def on_message(message):
|
|
|
|
| 65 |
try:
|
| 66 |
await continue_falcon(message)
|
| 67 |
+
#await message.remove_reaction('π', client.user) # test=π hf=π
|
|
|
|
| 68 |
except Exception as e:
|
| 69 |
print(f"Error: {e}")
|
| 70 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 71 |
+
@client.tree.command()
|
| 72 |
+
@app_commands.describe(
|
| 73 |
+
prompt='Enter a prompt to generate an image! Can generate realistic text, too!')
|
| 74 |
+
async def deepfloydif(interaction: discord.Interaction, prompt: str):
|
| 75 |
+
try:
|
| 76 |
+
await deepfloydif_stage_1(interaction, prompt, client)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
except Exception as e:
|
| 80 |
+
print(f"Error: {e}")
|
| 81 |
+
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 82 |
+
@client.event
|
| 83 |
+
async def on_reaction_add(reaction, user):
|
| 84 |
+
"""Checks for a reaction in order to call dfif2"""
|
| 85 |
+
try:
|
| 86 |
+
await deepfloydif_stage_2_react_check(reaction, user)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
except Exception as e:
|
| 91 |
+
print(f"Error: {e} (known error, does not cause issues, low priority)")
|
| 92 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
| 93 |
+
# running in thread
|
| 94 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
|
|
|
| 95 |
def run_bot():
|
| 96 |
client.run(DISCORD_TOKEN)
|
|
|
|
| 97 |
threading.Thread(target=run_bot).start()
|
|
|
|
| 98 |
def greet(name):
|
| 99 |
return "Hello " + name + "!"
|
|
|
|
| 100 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 101 |
demo.queue(concurrency_count=20)
|
| 102 |
demo.launch()
|