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 77C0380908; Sun, 11 Sep 2022 10:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1662892443; bh=B9xSmx05wAf7VwMwQi12ayoIIMOnRzRys/ZdH+ha5Xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GM3ROs69r3Ftv28QQdPtuyDE7FY/5IvHzuWdyW/TqaNhvTCfSv6G2S/R/kqAnRRGP m4nPPLDAvjegIxa03m40yAzg582FpF7TXNDdd2BttkA9D38QB5/uoMtKUkdD0ACs8x ooW33MpAw7QEvRYsRtukMW5Pju0heHsR6EqH9nZ4pyfPdf0+XZjCPPBKerUvo2X1xq aryBm+ig04pKIhgTwH5+LJm0e6jAr7q3csvtbufGfuKxwDzQybzv10664pLrALrnfO KEwjg/Jxtug62UEwSO0budgGPNINusx4UrMHGX+FgKMq6ZN7Gc51Dkb4Wl1Jf/Dlmf r6KLplV1qS9eg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [RFC PATCH v1 09/17] [discord] Add success run notice on_ready event Date: Sun, 11 Sep 2022 17:33:15 +0700 Message-Id: <20220911103323.1949-10-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220911103323.1949-1-kiizuha@gnuweeb.org> References: <20220911103323.1949-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Just adding a successful running the Discord bot on_ready event like display a Bot ID, Bot Name, Bot Tag. 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