discord-ext-track-edits
A discord.py extension that implements edit tracking for prefix commands, inspired by poise:
- When user edits their message, automatically update bot response
- When user deletes their message, automatically delete corresponding bot response, if it exists.
Usage
The extension contains an EditTrackerCog and an EditTrackableContext. They must
be used together for edit tracking to work.
Responses will be tracked only when you explicitly .reply() to the invocation message.
from datetime import timedelta
from typing import Type, Union
from typing_extensions import override
import discord
from discord.ext import commands
from discord.ext.track_edits import EditTrackerCog, EditTrackableContext
class Bot(commands.Bot):
async def setup_hook(self) -> None:
await self.add_cog(
EditTrackerCog(
self,
max_duration=timedelta(minutes=5),
execute_untracked_edits=True,
ignore_edits_if_not_yet_responded=False,
),
)
@override
async def get_context(
self,
origin: Union[discord.Message, discord.Interaction],
*,
cls: Type[EditTrackableContext] = EditTrackableContext,
) -> EditTrackableContext:
return await super().get_context(origin, cls=cls)
# your usual bot setup code here
Cog options
max_duration: How long to track bot responses for. If set toNone, bot responses will be tracked indefinitely until the process is shut down. (default: 5 minutes)execute_untracked_edits: Whether to execute a command that was previously untracked, for example, when the user makes a typo and edits it into a valid invocation. (default:True)ignore_edits_if_not_yet_responded: Whether to ignore edits on messages that have not been responded to. This happens if the edits happens before the command has sent a response, or if the command does not respond at all. (default:False)
Command options
Command options are supplied through the extras dictionary:
@commands.command(extras={"invoke_on_edit": False})
async def cmd(ctx):
...
invoke_on_edit: Whether to rerun the command if an existing invocation message is edited (default:True)track_deletion: Whether to delete the bot response if an existing invocation message is deleted (default:True)reuse_response: Whether to post subsequent responses as edits to the original response (default:True)
Release files for discord-ext-track-edits 0.1.3.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| discord_ext_track_edits-0.1.3.post1.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| discord_ext_track_edits-0.1.3.post1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / discord_ext_track_edits-0.1.3.post1.tar.gz
| Download URL | discord_ext_track_edits-0.1.3.post1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78d4912c397cf3f9c7f1cd4de46082fac53d0365b0d7367b9989a1615a8dc192
|
|
BLAKE2b-256 checksum How to use checksums |
445f5060e04f501192801b13ccad454c3c9b1f55c5d97b7f4e6353fd5a025fbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / discord_ext_track_edits-0.1.3.post1-py3-none-any.whl
| Download URL | discord_ext_track_edits-0.1.3.post1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
908179d7402b9a95cd90dedc7857d4651ff1258f00c192a5045e7504cac88eae
|
|
BLAKE2b-256 checksum How to use checksums |
675a58dd854a9795e62c292385b7e007d3baba5db1c0730d3f718f60b58265a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|