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.177]) by gnuweeb.org (Postfix) with ESMTPSA id 39EFA804FD; Sat, 1 Oct 2022 13:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664629516; bh=2AHajgELjZV1frFdXr43OrHjG9QV5Rnh6KhebmiAAHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtwP6ZGCWibpukMNFlBJISnbso6gf3n38/iDLJuU/EFu2hGfQEyKWxCI4hEReODFp yJW57s1hBFJJ4sRJNnEdI4TbdeS5nimGy+iWbXpQuUl1oi2rR3V+KCOiyf5RBpDI37 k4x12ineFDTXTsJ2xsrAUqe+TiB03OK4XDyBBT7LoHpb0MeryjwGM/RUi1cNSrmbUC W6OtOkUvn1MnJCaRHzkZbnq984u+vtpvp0NH9lK23LHlTzpYdIgi+WJheoKbMIlBT7 e6TPp4vtG+o2o8y1IKzPrAvqxiyEKdRDrwkmVOkyy5IC/9vfu3Pyq8Tlz/KRVPtIBS /b8tQ8hLKZ2DQ== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 24/26] discord: Add an add broadcast slash command Date: Sat, 1 Oct 2022 20:03:52 +0700 Message-Id: <20221001130355.784-25-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221001130355.784-1-kiizuha@gnuweeb.org> References: <20221001130355.784-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add `/broadcast add` to add the current Discord channel for listening to new lore email messages. Signed-off-by: Muhammad Rizki --- .../slash_commands/manage_broadcast.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/daemon/dscord/gnuweeb/plugins/slash_commands/manage_broadcast.py b/daemon/dscord/gnuweeb/plugins/slash_commands/manage_broadcast.py index db3d9e6..b9dd5e1 100644 --- a/daemon/dscord/gnuweeb/plugins/slash_commands/manage_broadcast.py +++ b/daemon/dscord/gnuweeb/plugins/slash_commands/manage_broadcast.py @@ -7,6 +7,7 @@ from discord.ext import commands from discord import Interaction from discord import app_commands +from atom import utils from dscord.gnuweeb import filters @@ -39,3 +40,28 @@ class ManageBroadcastSC(commands.Cog): text += f"Link: {u[4]}\n\n" await i.response.send_message(text, ephemeral=True) + + + @broadcast.command( + name="add", + description="Add broadcast channel for sending lore emails." + ) + @filters.lore_admin + async def add_channel(self, i: "Interaction"): + inserted = self.bot.db.save_broadcast( + guild_id=i.guild_id, + channel_id=i.channel_id, + channel_name=i.channel.name, + channel_link=utils.channel_link( + guild_id=i.guild_id, + channel_id=i.channel_id + ) + ) + + if inserted is None: + t = f"This channel already added for send email messages." + await i.response.send_message(t, ephemeral=True) + return + + t = f"Success add this channel for send email messages." + await i.response.send_message(t, ephemeral=True) -- Muhammad Rizki