From 1753c20142ea8f6494366e05366b50df0fd54d1f Mon Sep 17 00:00:00 2001 From: franchioping Date: Mon, 22 Jul 2024 23:55:29 +0100 Subject: [PATCH] add basic discord integration --- main.py | 39 ++++++++++++++++++++++++++++++++++++++- manga.py | 2 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 6a12326..dfa4487 100644 --- a/main.py +++ b/main.py @@ -1 +1,38 @@ -sada \ No newline at end of file +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")) diff --git a/manga.py b/manga.py index 656984c..aa43baa 100644 --- a/manga.py +++ b/manga.py @@ -80,4 +80,4 @@ class MangaHandler: if __name__ == "__main__": mh = MangaHandler() - print(mh.search("Release That Witch")[0]) + print(mh.search("Release That Witch")[0].get_latest_chap().get_chapter_num())