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 22D1A804FD; Sat, 1 Oct 2022 13:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664629487; bh=yKGsboi8XJ+CNGxP7mFCATpDFbEuKPpoQNruiRFYDq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+sLbDWk+nSBCWbxzOAJ2ECmFYhr6Ip/NymL0Y/+3wRFsucr53MWCN5g7Xh6Ha+/B UsvBjA7+7gd2Cpnx2+rvMqNH3w/uAxWlfdZt30DNl0KMCIE+XVaXF4uD9TmKczm0hn LgPMnLH4xiCb16UNEOxVAucgUV/EoECsdUACIz11yUgRUdMdqTPcgLLEjp1hjaZW5e 3LFMTra9uiFD+n5xCj4tqFikFGYMcf2oCQ8kxzeNh1Ph2v/NqwBTt8CM37/esSXmI7 5i8dyfUoWZ2o3mqkh0PATHxLDSyk0RSXaXef7t8NmhbLZcjEUS6E7z7UXRQzrxcrP1 Q6M9aUvkap8fw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 13/26] discord: Add a FullMessageBtn() class in models Date: Sat, 1 Oct 2022 20:03:41 +0700 Message-Id: <20221001130355.784-14-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 a FullMessageBtn() class to be able to render a button of a lore email message on its footer. This class is a clickable URL to direct to its lore email message. Signed-off-by: Muhammad Rizki --- daemon/dscord/gnuweeb/client.py | 4 ++++ daemon/dscord/gnuweeb/models/__init__.py | 6 ++++++ daemon/dscord/gnuweeb/models/full_message_btn.py | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 daemon/dscord/gnuweeb/models/__init__.py create mode 100644 daemon/dscord/gnuweeb/models/full_message_btn.py diff --git a/daemon/dscord/gnuweeb/client.py b/daemon/dscord/gnuweeb/client.py index 7893f88..02a1ac5 100644 --- a/daemon/dscord/gnuweeb/client.py +++ b/daemon/dscord/gnuweeb/client.py @@ -7,7 +7,11 @@ import discord from discord.ext import commands from discord import Intents from dscord.config import ACTIVITY_NAME +from typing import Union +from . import filters +from . import models +from atom import utils from dscord.database import DB diff --git a/daemon/dscord/gnuweeb/models/__init__.py b/daemon/dscord/gnuweeb/models/__init__.py new file mode 100644 index 0000000..c1d2a56 --- /dev/null +++ b/daemon/dscord/gnuweeb/models/__init__.py @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + +from .full_message_btn import FullMessageBtn diff --git a/daemon/dscord/gnuweeb/models/full_message_btn.py b/daemon/dscord/gnuweeb/models/full_message_btn.py new file mode 100644 index 0000000..b8d81cf --- /dev/null +++ b/daemon/dscord/gnuweeb/models/full_message_btn.py @@ -0,0 +1,12 @@ +from discord import ui +from discord import ButtonStyle + + +class FullMessageBtn(ui.View): + def __init__(self, url: str): + super().__init__() + self.add_item(ui.Button( + label='See the full message', + style=ButtonStyle.gray, + url=url + )) -- Muhammad Rizki