From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.100]) by gnuweeb.org (Postfix) with ESMTPSA id 3638980BE8; Tue, 13 Sep 2022 10:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1663064776; bh=7EjQ7eY3d8wchckHpCP4Yp4zzfivDuWN4/nLhbwLPKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVVsGrHHui0OS/nvYYHCPPCzDUepOJ4c7YL64xosS2368YwLmHG3WiC7y78/U3fXc mJGCyvYX+/yaKNGm2+ibdBIvVOaaAvnbmypqZqK4QQs7/Znevfr1GiTUYz+LuexcFe p7Ef9tx9ZA9WTT2CQNm0P11VeWgWrDf9+IBDN/5VSIMUHOUhEYr9Y5sZE/S3qNnNKu IFVj9GylIhQMPtB4UV1d0FcD0wkmjK3/nvC0ppwa28f5LiMFvROlGEr5aakMCfQcMY mcRw3/QvvPBRJ6hGuR2PF4btXa6mqnWVKy3JSYV9GJImZ7DYxNbbPkNNUtYHYOOzJV DldpAVt3Cg7rQ== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [RFC PATCH v2 09/17] discord: Add success run notice on_ready event Date: Tue, 13 Sep 2022 17:24:50 +0700 Message-Id: <20220913102458.615-10-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220913102458.615-1-kiizuha@gnuweeb.org> References: <20220913102458.615-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Adding a bot info and success message on the on_ready event. Signed-off-by: Muhammad Rizki --- daemon/dscord/gnuweeb/plugins/__init__.py | 8 ++++++- .../dscord/gnuweeb/plugins/events/__init__.py | 11 ++++++++++ .../dscord/gnuweeb/plugins/events/on_ready.py | 21 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 daemon/dscord/gnuweeb/plugins/events/__init__.py create mode 100644 daemon/dscord/gnuweeb/plugins/events/on_ready.py diff --git a/daemon/dscord/gnuweeb/plugins/__init__.py b/daemon/dscord/gnuweeb/plugins/__init__.py index b9a7e37..ab4cb7f 100644 --- a/daemon/dscord/gnuweeb/plugins/__init__.py +++ b/daemon/dscord/gnuweeb/plugins/__init__.py @@ -5,7 +5,13 @@ from discord.ext import commands +from .events import Events + + +class Plugins( + Events +): pass async def setup(bot: "commands.Bot"): - pass + await bot.add_cog(Plugins(bot)) diff --git a/daemon/dscord/gnuweeb/plugins/events/__init__.py b/daemon/dscord/gnuweeb/plugins/events/__init__.py new file mode 100644 index 0000000..d9a891f --- /dev/null +++ b/daemon/dscord/gnuweeb/plugins/events/__init__.py @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + +from .on_ready import OnReady + + +class Events( + OnReady, +): pass diff --git a/daemon/dscord/gnuweeb/plugins/events/on_ready.py b/daemon/dscord/gnuweeb/plugins/events/on_ready.py new file mode 100644 index 0000000..cb7de29 --- /dev/null +++ b/daemon/dscord/gnuweeb/plugins/events/on_ready.py @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + +from discord.ext import commands + + +class OnReady(commands.Cog): + def __init__(self, bot: "commands.Bot") -> None: + self.bot = bot + + + @commands.Cog.listener() + async def on_ready(self): + t = "[ GNU/Weeb Bot is connected ]\n\n" + t += f"ID : {self.bot.user.id}\n" + t += f"Name : {self.bot.user.display_name}\n" + t += f"Tags : {self.bot.user}\n\n" + t += "Ready to get the latest of lore kernel emails." + print(t) -- Muhammad Rizki