Update README.md

This commit is contained in:
Conner Harkness 2025-03-04 11:41:34 -07:00
parent 9845de265e
commit e7915ad2b6
3 changed files with 13 additions and 4 deletions

View File

@ -6,7 +6,17 @@ A simplified interface to ComfyUI through Discord
1. Run `comfyui-discord.sh` to create `settings.json` 1. Run `comfyui-discord.sh` to create `settings.json`
2. Put your Discord bot's token in `settings.json` 2. Modify `settings.json`, e.g.
```
{
"token": "Your Discord bot's token here"
"api_url": "http://127.0.0.1:8188",
...
}
```
...where `token` is set to your Discord bot's token and `api_url` is the address to your running & accessible ComfyUI web interface.
3. Set a channel's topic to `example-workflow` 3. Set a channel's topic to `example-workflow`

View File

@ -20,6 +20,7 @@ async def on_message_or_reaction(client, obj):
msg_types = [discord.MessageType.default] msg_types = [discord.MessageType.default]
# Handle reactions:
if isinstance(obj, discord.RawReactionActionEvent): if isinstance(obj, discord.RawReactionActionEvent):
chl = await client.fetch_channel(obj.channel_id) chl = await client.fetch_channel(obj.channel_id)
msg = await chl.fetch_message(obj.message_id) msg = await chl.fetch_message(obj.message_id)
@ -30,6 +31,7 @@ async def on_message_or_reaction(client, obj):
msg_types.append(discord.MessageType.reply) msg_types.append(discord.MessageType.reply)
# Handle direct messages from users:
if isinstance(obj, discord.Message): if isinstance(obj, discord.Message):
msg = obj msg = obj
chl = obj.channel chl = obj.channel

View File

@ -1,7 +1,6 @@
import json import json
import os import os
# Make it easy to read a json file # Make it easy to read a json file
def read_json(path, default_value={}): def read_json(path, default_value={}):
if os.path.isfile(path): if os.path.isfile(path):
@ -14,7 +13,6 @@ def read_json(path, default_value={}):
pass pass
return default_value return default_value
# Merge dictionary b into a # Merge dictionary b into a
def merge_dicts(a, b): def merge_dicts(a, b):
if b is None: if b is None:
@ -42,7 +40,6 @@ def merge_dicts(a, b):
return output return output
def write_json(path, o): def write_json(path, o):
try: try:
with open(path, "w") as file: with open(path, "w") as file: