Skip to content

Latest commit

History

223 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

dctl

Discord REST API (v10) client for Go. Dependency-free — standard library only, enforced by a test that fails on any non-stdlib import. No gateway websocket, no event loop, no CLI: every call is an on-demand HTTP request.

go get github.com/Herrscherd/dctl
c:=dctl.New(token, defaultChannelID)
msg, _:=c.Messages().Send(ctx, "", "deploy finished") // "" => default channelmsgs, _:=c.Messages().Read(ctx, "", 20, "") // oldest-first

Resources

AccessorOperations
Messages()SendReplyReadGetEditDeleteLastMessageAt
Channels()ListGetTypeCreateCreateUnderRenameUpdateDeleteEnsureEnsureUnderArchive
Guilds()ListSole
Members()ListGetKickBan
Roles()ListCreateUpdateDeleteAssignUnassign
Threads()StartStartPrivateAddMemberCreateForumForumPost
Reactions()AddRemove
Permissions()SetRemove
Webhooks()CreateListDeleteExecute
Components()SendSelectMenuAck
Interactions()RegisterRegisterCommandsListCreateEditDeleteRegistryRespondDeferRespondAutocompleteEditResponseUpsertStatusMessageAppID

Notes

Channel-scoped ops accept "" for the configured default channel; guild-scoped ops accept "" for the bot's sole guild — or for the guild pinned by WithGuild, which a bot in several servers needs. CreateUnder / EnsureUnder need neither: they read the guild off the parent category. Nothing is read from the environment — pass the token explicitly. Without one, Enabled() is false and every call returns ErrDisabled. WithHTTPClient overrides the default 15s client.

Slash commands: NewCommand(...).With(dctl.String(...), dctl.Sub(...)) builds a typed command; c.Interactions().Registry() owns Add, Sync (diff against Discord: create/edit/delete), and Dispatch / DispatchAutocomplete. They are registered on the default guild — instant, one server — or on the application with WithGlobalCommands, which reaches every server the bot is in and takes up to an hour to propagate.

Interaction.UserID() is who invoked it, from member.user in a guild and from user in a DM — read either field alone and permission checks see an empty id in the other context.

Path segments are percent-escaped and queries built with url.Values. Webhook.Token and Interaction.Token are Secret[REDACTED] in logs and JSON, .Reveal() to read.

License

MIT

About

Pure, dependency-free Discord client library for Go (empty go.mod require block)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages