From: Muhammad Rizki <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Muhammad Rizki <[email protected]>,
Alviro Iskandar Setiawan <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH v2 17/28] discord: Add send lore email message functions
Date: Tue, 4 Oct 2022 06:52:18 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Add send_text_email() and send_patch_email() in the
dscord/gnuweeb/client.py to send the lore email message to the Discord
channel.
Signed-off-by: Muhammad Rizki <[email protected]>
---
daemon/dscord/gnuweeb/client.py | 42 +++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/daemon/dscord/gnuweeb/client.py b/daemon/dscord/gnuweeb/client.py
index 02a1ac5..2506ec3 100644
--- a/daemon/dscord/gnuweeb/client.py
+++ b/daemon/dscord/gnuweeb/client.py
@@ -33,3 +33,45 @@ class GWClient(commands.Bot):
name=".gnuweeb.plugins",
package="dscord"
)
+
+
+ @filters.wait_on_limit
+ async def send_text_email(self, guild_id: int, chat_id: int, text: str,
+ reply_to: Union[int, None] = None, url: str = None):
+ print("[send_text_email]")
+ channel = self.get_channel(chat_id)
+
+ return await channel.send(
+ content=text,
+ reference=discord.MessageReference(
+ guild_id=guild_id,
+ channel_id=chat_id,
+ message_id=reply_to
+ ) if reply_to else None,
+ view=models.FullMessageBtn(url)
+ )
+
+
+ @filters.wait_on_limit
+ async def send_patch_email(self, mail, guild_id: int, chat_id: int, text: str,
+ reply_to: Union[int, None] = None, url: str = None):
+ print("[send_patch_email]")
+ tmp, doc, caption, url = utils.prepare_patch(
+ mail, text, url, "discord"
+ )
+ channel = self.get_channel(chat_id)
+
+ m = await channel.send(
+ content=caption,
+ file=discord.File(doc),
+ reference=discord.MessageReference(
+ guild_id=guild_id,
+ channel_id=chat_id,
+ message_id=reply_to
+ ) if reply_to else None,
+
+ view=models.FullMessageBtn(url)
+ )
+
+ utils.remove_patch(tmp)
+ return m
--
Muhammad Rizki
next prev parent reply other threads:[~2022-10-03 23:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 23:52 [PATCH v2 00/28] The complete version of the Discord bot Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 01/28] discord: Add .gitignore in the Discord's storage directory Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 02/28] Fix the storage management after the refactor was happened Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 03/28] Fix the empty temporary patch directory on atom/utils.py Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 04/28] discord: Add get_atom_urls() to get the list of atom URLs Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 05/28] discord: Add get_broadcast_chats() to get the list of broadcast chats Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 06/28] discord: Add get_email_id() in getter directory Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 07/28] discord: Add get_reply_id() " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 08/28] discord: Inherit Getter() class to the DBMethods() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 09/28] discord: Add delete_atom() in deletion directory Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 10/28] discord: Add delete_broadcast() " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 11/28] discord: Inherit the Deletion() class to the DBMethods() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 12/28] discord: Inherit the DBMethods() class to the DB() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 13/28] discord: Use the created " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 14/28] telegram: Rename some utility functions Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 15/28] discord: Add a FullMessageBtn() class in models Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 16/28] discord: Add filters.wait_on_limit() decorator Muhammad Rizki
2022-10-03 23:52 ` Muhammad Rizki [this message]
2022-10-03 23:52 ` [PATCH v2 18/28] discord: Add mail listener Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 19/28] discord: Implement the mail Listener() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 20/28] discord: Add @filters.lore_admin() decorator Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 21/28] discord: Add a list of atom URL slash command Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 22/28] discord: Add an add atom " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 23/28] discord: Add a delete " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 24/28] discord: Add channel_link() in the atom/utils.py Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 25/28] discord: Add a list broadcast slash command Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 26/28] discord: Add an add " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 27/28] discord: Add a delete " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 28/28] discord: Change the on_ready message Muhammad Rizki
2022-10-07 22:57 ` [PATCH v2 00/28] The complete version of the Discord bot Ammar Faizi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox