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=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.230.80] (unknown [182.2.72.138]) by gnuweeb.org (Postfix) with ESMTPSA id 2A15F804D1; Sat, 3 Sep 2022 10:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1662201133; bh=ZfG9amQrILoa406XPXST/cEG7gBfb2/tqC88yPPcbTs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=HSBEQGq2Pf3gLo8mrzqwU9JP8ZMjda3DlkRhmIvR9I/r6bSAExfb8Ik+CEKqOVVxF bBdErabuFJzX0Vd23Ac/pED5AOJtZbBm4WQgMfmt7GkpCnxxkLmHfxLKfqb2DlVkVG tZTXZsMiYz0WrSFDa9wxj9y0XizW8jYaKXdqjuvxGlIEcQIhEdNNFNMne8lbiHsTkE FNSAvUTl4JE8/YsJHvwZ4rjMXSvS5fhc5+q1Kfh+fvxHh501B9FoS8WST4cF1IoE1/ i1HG8wWUhsWg9C2mha2Mg+QKvmAWm+0BZeIY2vEBYva8zl991WOybhF3myk0IGovAR 9jYlm8s2BxAJA== Message-ID: Date: Sat, 3 Sep 2022 17:32:08 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 0/3] New Discord bot and full refactor scripts Content-Language: en-US To: Muhammad Rizki Cc: GNU/Weeb Mailing List , Alviro Iskandar Setiawan References: <20220827030236.1094-1-kiizuha@gnuweeb.org> <7a414bd1-68f1-86a4-e647-7ee071a4300d@gnuweeb.org> <4de7a42e-bdae-f3b3-2674-20d673d71a58@gnuweeb.org> <643c97fb-d517-4662-4ce0-6e31a97c9e07@gnuweeb.org> <604e99d6-23fb-8a47-5445-ca10c8655729@gnuweeb.org> <37043daf-bbf9-1ed5-185c-2c223313a0a7@gnuweeb.org> From: Ammar Faizi In-Reply-To: <37043daf-bbf9-1ed5-185c-2c223313a0a7@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: On 9/3/22 5:05 PM, Muhammad Rizki wrote: > On 03/09/2022 16.44, Ammar Faizi wrote: >> On 9/3/22 8:01 AM, Muhammad Rizki wrote: >>> The `ADMIN_ROLE_ID` is the Discord role ID for `Lore Admin` to manage >>> add/delete atom/broadcast. You can copy it from the role management in >>> Discord, paste the role ID to the ADMIN_ROLE_ID in >>> daemon/dscord/config.py (the config name must config.py because it will >>> importable with Python) >> >> I did that, it's running and the bot is online as well. But how to use >> the bot exactly? Any example? >> > > Oh yes, my bad. I develop the script to avoid ratelimit for syncing > slash commands, so I decide to init it using the [`$sync`, `.sync`, > `.s`, `$s`] or whatever is, you can find it the basic command in the > `daemon/dscord/gnuweeb/plugins/basic_commands/sync_it.py` file. > > The old one I sync it in the `setup_hook()` in client.py, so when the > bot is starting, it will initialize/sync the slash commands to global, > this is not recommended by the community, because while you debugging > you will restarting the script many times, it will hit the ratelimit, so > I decide to comment it and initialize using the `.sync` basic commmand. > > > The bot uses slash commands, if you type "/" in the channel text field > chat, it will display the list of slash commands, for example: > > Typing `/atom` it will display the list of group commands for atom > like add, list or delete. > Typing `/broadcast` it will display the list of group commands for > broadcast like add, list or delete. > > Still didn't work? tell me. OK, just did the sync command and now I can see the command suggestions on the Discord input box. Then I tried to add several atom URLS. At a glance it works. So I am happy with the current functional. But it's still not perfect, when invoking `/lore url:` command, I got the following error and the bot didn't respond: [__run]: Running... 2022-09-03 17:18:08 ERROR discord.app_commands.tree Ignoring exception in command 'lore' Traceback (most recent call last): File "/home/ammarfaizi2/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 850, in _do_call return await self._callback(self.binding, interaction, **params) # type: ignore File "/home/ammarfaizi2/app/lore-daemon.dev/daemon/dscord/gnuweeb/plugins/slash_commands/get_lore_mail.py", line 30, in get_lore text, files, is_patch = utils.create_template(mail) TypeError: create_template() missing 1 required positional argument: 'platform' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ammarfaizi2/.local/lib/python3.10/site-packages/discord/app_commands/tree.py", line 1240, in _call await command._invoke_with_namespace(interaction, namespace) File "/home/ammarfaizi2/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 876, in _invoke_with_namespace return await self._do_call(interaction, transformed_values) File "/home/ammarfaizi2/.local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 865, in _do_call raise CommandInvokeError(self, e) from e discord.app_commands.errors.CommandInvokeError: Command 'lore' raised an exception: TypeError: create_template() missing 1 required positional argument: 'platform' [__run]: Running... Please fix it in the next revision. I got other errors when the bot is broadcasting the email to a Discord channel. Will send that in a separate email. -- Ammar Faizi