Switch to interactions-py
parent
ad7e3c578e
commit
eebc109020
@ -1,21 +1,51 @@
|
|||||||
from discord import Intents, Streaming
|
import os
|
||||||
from discord.ext.commands import Context, Bot
|
from pathlib import Path
|
||||||
|
|
||||||
from exclamation_mark_charity import BOT_PREFIX, BOT_TOKEN, HAMMY, NUGGS, LUCA, TWITCH_CHANNEL
|
from dotenv import load_dotenv
|
||||||
|
from interactions import Client, Intents, ClientPresence, PresenceActivity, PresenceActivityType
|
||||||
|
|
||||||
bot = Bot(
|
from exclamation_mark_charity.constants import TWITCH_CHANNEL
|
||||||
command_prefix=BOT_PREFIX,
|
from exclamation_mark_charity.logger_factory import LoggerFactory
|
||||||
intents=Intents.all(),
|
|
||||||
help_command=None,
|
|
||||||
owner_ids=(HAMMY, NUGGS, LUCA)
|
|
||||||
)
|
|
||||||
bot.activity = Streaming(name="!charity", url=TWITCH_CHANNEL)
|
|
||||||
|
|
||||||
|
|
||||||
@bot.command()
|
def main():
|
||||||
async def charity(ctx: Context):
|
logger = LoggerFactory.get_logger(__name__)
|
||||||
await ctx.send("!charity")
|
|
||||||
|
# Setup dotenv()
|
||||||
|
logger.info("---------------------------------------------------------------")
|
||||||
|
logger.debug("Loading Environment Variables...")
|
||||||
|
load_dotenv()
|
||||||
|
logger.debug("Finished Loading Environment Variables!")
|
||||||
|
|
||||||
|
# Setup Bot
|
||||||
|
logger.debug("Registering Client...")
|
||||||
|
bot = Client(
|
||||||
|
token=os.environ.get("CHARITY_BOT_TOKEN"),
|
||||||
|
intents=Intents.ALL,
|
||||||
|
presence=ClientPresence(
|
||||||
|
activities=[
|
||||||
|
PresenceActivity(
|
||||||
|
name="!charity",
|
||||||
|
type=PresenceActivityType.STREAMING,
|
||||||
|
url=TWITCH_CHANNEL
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
logger.debug("Finished Registering Client!")
|
||||||
|
|
||||||
|
# Load cogs
|
||||||
|
logger.debug("Loading Cogs...")
|
||||||
|
for folder in os.listdir("modules"):
|
||||||
|
if os.path.exists(Path("modules", folder, "cog.py")):
|
||||||
|
bot.load(f"modules.{folder}.cog")
|
||||||
|
logger.debug(f"Cog '{folder}' Successfully Loaded!")
|
||||||
|
logger.debug("All Cogs Loaded!")
|
||||||
|
|
||||||
|
# Run
|
||||||
|
logger.info("Bot Online!")
|
||||||
|
bot.start()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
bot.run(BOT_TOKEN)
|
main()
|
||||||
|
Loading…
Reference in New Issue