Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Todo: logging #12

Open
FloatingMilkshake opened this issue Nov 21, 2022 · 3 comments
Open

Todo: logging #12

FloatingMilkshake opened this issue Nov 21, 2022 · 3 comments
Labels
enhancement New feature or request, or improvement to existing feature

Comments

@FloatingMilkshake
Copy link
Owner

FloatingMilkshake commented Nov 21, 2022

Includes message logging (edits & deletes) and user logging.

Message logging will require storing a cache of sent messages. Both will require storing some settings for each guild (think log channel).

@FloatingMilkshake FloatingMilkshake added the enhancement New feature or request, or improvement to existing feature label Nov 21, 2022
@auravoid
Copy link
Contributor

auravoid commented Mar 6, 2023

Discord provides the message that was deleted along with the message edits.

Message update provides two responses:
Old content

{
    "channelId": "1012849719241883788",
    "guildId": "1007457740655968327",
    "id": "1082407022361850067",
    "createdTimestamp": 1678136344281,
    "type": 0,
    "system": false,
    "content": "hello world!",
    "authorId": "455428041586376729",
    "pinned": false,
    "tts": false,
    "nonce": "1082407016984477696",
    "embeds": [],
    "components": [],
    "attachments": [],
    "stickers": [],
    "position": null,
    "editedTimestamp": null,
    "mentions": {
        "everyone": false,
        "users": [],
        "roles": [],
        "crosspostedChannels": [],
        "repliedUser": null,
        "members": [],
        "channels": []
    },
    "webhookId": null,
    "groupActivityApplicationId": null,
    "applicationId": null,
    "activity": null,
    "flags": 0,
    "reference": null,
    "interaction": null,
    "cleanContent": "hello world!"
} 

New content:

{
    "channelId": "1012849719241883788",
    "guildId": "1007457740655968327",
    "id": "1082407022361850067",
    "createdTimestamp": 1678136344281,
    "type": 0,
    "system": false,
    "content": "Hello World!",
    "authorId": "455428041586376729",
    "pinned": false,
    "tts": false,
    "nonce": "1082407016984477696",
    "embeds": [],
    "components": [],
    "attachments": [],
    "stickers": [],
    "position": null,
    "editedTimestamp": 1678136352029,
    "mentions": {
        "everyone": false,
        "users": [],
        "roles": [],
        "crosspostedChannels": [],
        "repliedUser": null,
        "members": [],
        "channels": []
    },
    "webhookId": null,
    "groupActivityApplicationId": null,
    "applicationId": null,
    "activity": null,
    "flags": 0,
    "reference": null,
    "interaction": null,
    "cleanContent": "Hello World!"
}

And message deletions also send the content in:

{
    "channelId": "1012849719241883788",
    "guildId": "1007457740655968327",
    "id": "1082407022361850067",
    "createdTimestamp": 1678136344281,
    "type": 0,
    "system": false,
    "content": "Hello World!",
    "authorId": "455428041586376729",
    "pinned": false,
    "tts": false,
    "nonce": "1082407016984477696",
    "embeds": [],
    "components": [],
    "attachments": [],
    "stickers": [],
    "position": null,
    "editedTimestamp": 1678136352029,
    "mentions": {
        "everyone": false,
        "users": [],
        "roles": [],
        "crosspostedChannels": [],
        "repliedUser": null,
        "members": [],
        "channels": []
    },
    "webhookId": null,
    "groupActivityApplicationId": null,
    "applicationId": null,
    "activity": null,
    "flags": 0,
    "reference": null,
    "interaction": null,
    "cleanContent": "Hello World!"
}

@auravoid
Copy link
Contributor

auravoid commented Mar 6, 2023

See 9b9c310 as a proof of concept

@FloatingMilkshake
Copy link
Owner Author

That's actually a cache thing! On Message Update, Discord provides the same data as the Message Create event. On Message Delete it provides even less. It's nice that this data could be cached, but I wouldn't depend on it.

A separate message cache should be implemented somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request, or improvement to existing feature
Projects
None yet
Development

No branches or pull requests

2 participants