comfyui-discord/bot.py

35 lines
789 B
Python

import discord
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():
print("READY.")
def main():
global settings
settings = get_settings(initialize=True)
client.run(settings["token"])
if __name__ == "__main__":
main()