added [continue_falcon]
Browse files
app.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import info
|
2 |
from falcon import falcon_command
|
|
|
|
|
3 |
MY_GUILD = info.MY_GUILD
|
4 |
discord = info.discord
|
5 |
app_commands = info.discord.app_commands
|
@@ -28,12 +30,23 @@ async def on_ready():
|
|
28 |
print('------')
|
29 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
30 |
@client.tree.command()
|
31 |
-
@app_commands.describe(
|
32 |
-
prompt='Enter some text to chat with the bot! Like this: /falcon Hello, how are you?')
|
33 |
async def falcon(interaction: discord.Interaction, prompt: str):
|
34 |
"""Generates text based on a given prompt"""
|
35 |
try:
|
36 |
await falcon_command(interaction, prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
except Exception as e:
|
39 |
print(f"Error: {e}")
|
|
|
1 |
import info
|
2 |
from falcon import falcon_command
|
3 |
+
from falcon import continue_falcon
|
4 |
+
|
5 |
MY_GUILD = info.MY_GUILD
|
6 |
discord = info.discord
|
7 |
app_commands = info.discord.app_commands
|
|
|
30 |
print('------')
|
31 |
#-------------------------------------------------------------------------------------------------------------------------------------
|
32 |
@client.tree.command()
|
33 |
+
@app_commands.describe(prompt='Enter some text to chat with the bot! Like this: /falcon Hello, how are you?')
|
|
|
34 |
async def falcon(interaction: discord.Interaction, prompt: str):
|
35 |
"""Generates text based on a given prompt"""
|
36 |
try:
|
37 |
await falcon_command(interaction, prompt)
|
38 |
+
except Exception as e:
|
39 |
+
print(f"Error: {e}")
|
40 |
+
#-------------------------------------------------------------------------------------------------------------------------------------
|
41 |
+
@client.event
|
42 |
+
async def on_message(message):
|
43 |
+
"""detects messages and calls continue_falcon if we're in the right channel"""
|
44 |
+
try:
|
45 |
+
if not message.author.bot:
|
46 |
+
global falcon_userid_threadid_dictionary # tracks userid-thread existence
|
47 |
+
if message.channel.id in falcon_userid_threadid_dictionary: # is this a valid thread?
|
48 |
+
if falcon_userid_threadid_dictionary[message.channel.id] == message.author.id: # more than that - is this specifically the right user for this thread?
|
49 |
+
await continue_falcon(message)
|
50 |
|
51 |
except Exception as e:
|
52 |
print(f"Error: {e}")
|