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

[Question] How to identify previous messages? #18

Open
Kariton opened this issue Jan 31, 2023 · 2 comments
Open

[Question] How to identify previous messages? #18

Kariton opened this issue Jan 31, 2023 · 2 comments

Comments

@Kariton
Copy link
Contributor

Kariton commented Jan 31, 2023

How can I identify previous messages?
I don't mean send prior the "the bot being online".

I see that a reaction results in this:
ctx.message.raw_message.envelope.dataMessage.reaction

{
    "emoji": "\ud83d\udc4d",
    "targetAuthor": "REDACTED",
    "targetAuthorNumber": "REDACTED",
    "targetAuthorUuid": "REDACTED",
    "targetSentTimestamp": 1675109984233,
    "isRemove": false
}

but what is message "targetSentTimestamp": 1675109984233?

for contrast reply does make it more easily to identify the corresponding message:
ctx.message.raw_message.envelope.dataMessage.quote

{
    "id": 1234567890,
    "author": "REDACTED",
    "authorNumber": "REDACTED",
    "authorUuid": "REDACTED",
    "text": "message that I replied to",
    "attachments": []
}

I hope this question makes sense.

p.s.: questions wouldn't require a issue if you enable GitHub discussions in the repository settings. ;)

@Kariton
Copy link
Contributor Author

Kariton commented Feb 1, 2023

For a Discord bot you can use this:

message = await ctx.send()

and get a discord.Message object.
it looks like this:

<Message id=1070157927677182043 channel=<TextChannel id=REDACTED name='general' position=0 nsfw=False news=False category_id=REDACTED> type=20 author=<Member id=REDACTED name='REDACTED' discriminator='REDACTED' bot=True nick=None guild=<Guild id=REDACTED name='BotTest' shard_id=None chunked=False member_count=4>> flags=<MessageFlags value=0>

signalbot returns None

@filipre
Copy link
Owner

filipre commented Mar 25, 2023

At the moment you need to persist every message by yourself, either by using self.bot.storage.* or in some other way.

Maybe it makes sense to have a chat history option, so the bot can react to any message it already saw. It makes sense, because a smartphone also persist every message:
I can think of these options

  • do not persist any chat history at all
  • persist everything
  • persist the last n messages (per group or user)

btw, I enabled GitHub discussions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants