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

Bot message author #6

Merged
merged 2 commits into from
Dec 11, 2024
Merged

Conversation

raphaelantoniocampos
Copy link
Contributor

Hello, it's me again. I hope I don't bother you with my pull requests. I really liked your project and I really believe that it will become the standard for discord in gleam.

So, this pull request adds the client_id inside the bot.Bot as snowflake.

discord_gleam/src/discord_gleam/types/bot.gleam

  Bot(
    token: String,
    client_id: Snowflake,
    intents: intents.Intents,
    cache: Cache,
  )

The idea is that this makes it easier to check if the person who sent the message was not the bot itself. See example:

discord_gleam/test/example_bot.gleam

case message.d.author.id != bot.client_id {
    True -> {
        case message.d.content {
            "hello" -> {
                discord_gleam.reply(
                    bot,
                    message.d.channel_id,
                    message.d.id,
                    "hello",
                    [],
                )
            }
        }
    }
}

Take a look and see if it makes sense. Thanks for your attention.

@Cyteon
Copy link
Owner

Cyteon commented Dec 9, 2024

Nah dw you ain't bothering me, I always love some prs. I'll review this asap tmrw

@Cyteon Cyteon merged commit b9f3eb3 into Cyteon:main Dec 11, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants