add basic discord integration

This commit is contained in:
franchioping 2024-07-22 23:55:29 +01:00
parent 9985525576
commit 1753c20142
2 changed files with 39 additions and 2 deletions

39
main.py
View File

@ -1 +1,38 @@
sada import os
import discord
from discord import app_commands
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.default()
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
@tree.command(
name="ping",
description="My first application Command",
)
async def first_command(interaction: discord.Interaction):
chanel = await interaction.user.create_dm()
await chanel.send("Hi")
@client.event
async def on_message(message: discord.Message):
if isinstance(message.channel, discord.DMChannel):
user = message.author
channel = message.channel
@client.event
async def on_ready():
await tree.sync(guild=discord.Object(id=1042133536926347324))
print("Ready!")
client.run(os.environ.get("BOT_TOKEN"))

View File

@ -80,4 +80,4 @@ class MangaHandler:
if __name__ == "__main__": if __name__ == "__main__":
mh = MangaHandler() mh = MangaHandler()
print(mh.search("Release That Witch")[0]) print(mh.search("Release That Witch")[0].get_latest_chap().get_chapter_num())