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 6846180E9E; Tue, 20 Sep 2022 13:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1663681730; bh=6agiYq5/PyodQsAUlKGO6o+gseD3Cuxk5sTIOJiP8OA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b8e+wXHpz9Wzzlq16vB0LkgVYgx9UqLdBw49Na7jp9tM+sEd3hj4fjCUBOoTFRBQ6 GjqRHB4QphWW4u2herSX8O2sIpjK7tYx634qVLy7IjEA8TifrSBNY6vvYCsEdMC63R LaR/sgJaINOu3daNPv2qP3Xsch7jXiK2u8uui9MiAKECscVknMddjdabS9ziV1TJy+ eMoswCl9vI9qLuqeuoVQcQFmN9ElSksShBbpp7x67Gyq4VpN2KHzQ8OwExyra4MY/5 dMYg8p2mBcYPJIyJm7dK3ZjbWlTHZ81OnGw2DnAB6pNmW6Q6F/dYXAWWE98+CzbNyI +I1DrfXBOrNnA== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [RFC PATCH v4 09/17] discord: Add success run notice on_ready event Date: Tue, 20 Sep 2022 20:48:04 +0700 Message-Id: <20220920134812.331-10-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220920134812.331-1-kiizuha@gnuweeb.org> References: <20220920134812.331-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add 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