private static void OpenGuildInviteCallbackImpl(IntPtr ptr, Result result) { GCHandle h = GCHandle.FromIntPtr(ptr); OpenGuildInviteHandler callback = (OpenGuildInviteHandler)h.Target; h.Free(); callback(result); }
/// <summary> /// Opens the overlay modal for joining a Discord guild, given its invite code. /// An invite code for a server may look something like <c>fortnite</c> for a verified server—the full invite being /// <c>discord.gg/fortnite</c>—or something like /// <c>rjEeUJq</c> for a non-verified server, the full invite being <c>discord.gg/rjEeUJq</c>. /// <para> /// Note that a successful <see cref="Result" /> response does not necessarily mean that the user has joined the /// guild. /// If you want more granular control over and knowledge about users joining your guild, you may want to look into /// implementing the /// <a href="https://discord.com/developers/docs/topics/oauth2#authorization-code-grant"> /// <c>guilds.join</c> OAuth2 /// scope in an authorization code grant /// </a> /// in conjunction with the /// <a href="https://discord.com/developers/docs/resources/guild#add-guild-member">Add Guild Members endpoint</a>. /// </para> /// </summary> /// <param name="code"></param> /// <param name="callback"></param> public void OpenGuildInvite(string code, OpenGuildInviteHandler callback) { GCHandle wrapped = GCHandle.Alloc(callback); Methods.OpenGuildInvite(methodsPtr, code, GCHandle.ToIntPtr(wrapped), OpenGuildInviteCallbackImpl); }