OAuth2 helpers for Discord bot applications.
Summary
Functions
Generates a bot invite URL with the specified permissions and scopes.
Functions
Generates a bot invite URL with the specified permissions and scopes.
The client_id is fetched from the cached bot user (EDA.Cache.me()["id"])
if not provided.
Options
:client_id— application/bot client ID (auto-detected if omitted):permissions— list of permission atoms (e.g.,[:send_messages, :manage_messages]) or an integer bitfield (default:0):scopes— list of OAuth2 scope strings (default:["bot", "applications.commands"]):guild_id— pre-select a guild in the authorization prompt:disable_guild_select— iftrue, prevent the user from changing the guild
Examples
EDA.OAuth2.invite_url()
#=> "https://discord.com/oauth2/authorize?client_id=123&scope=bot+applications.commands&permissions=0"
EDA.OAuth2.invite_url(permissions: [:send_messages, :read_message_history])
#=> "https://discord.com/oauth2/authorize?client_id=123&scope=bot+applications.commands&permissions=65600"
EDA.OAuth2.invite_url(client_id: "999", guild_id: "555", scopes: ["bot"])
#=> "https://discord.com/oauth2/authorize?client_id=999&scope=bot&permissions=0&guild_id=555"