comfyui-discord/bot.py

37 lines
855 B
Python

import discord
import lib.log as log
from lib.settings import *
from lib.events import *
intents = discord.Intents(messages=True, guilds=True, message_content=True, reactions=True)
client = discord.Client(intents=intents)
settings = {}
@client.event
async def on_message(msg):
await on_message_or_reaction(client, msg)
@client.event
async def on_raw_reaction_add(rxn):
ALLOW_REPEAT = settings["allow_repeat"]
REPEAT_EMOJI = settings["repeat_emoji"]
if ALLOW_REPEAT:
if rxn.emoji.name == REPEAT_EMOJI:
await on_message_or_reaction(client, rxn)
@client.event
async def on_ready():
log.write("READY.")
def main():
global settings
settings = get_settings(initialize=True)
client.run(settings["token"], log_handler=None)
if __name__ == "__main__":
log.write("test")
main()