Ejemplo n.º 1
0
 public static Task AcceptInvite(this DiscordClient client, Invite invite)
 {
     if (invite == null)
     {
         throw new ArgumentNullException(nameof(invite));
     }
     return(invite.Accept());
 }
Ejemplo n.º 2
0
        public async Task <bool> JoinServer(Invite invite)
        {
            try
            {
                if (Servers.Any(s => s.Id == invite.Server.Id))
                {
                    // Already joined the server
                    return(true);
                }

                await invite.Accept();

                return(true);
            }
            catch (Exception ex)
            {
                TShock.Log.ConsoleError(ex.Message);
                TShock.Log.Error(ex.ToString());
                return(false);
            }
        }
Ejemplo n.º 3
0
        public static async Task JoinInvite(string inviteId, Channel callback)
        {
            Invite invite = await callback.Client.GetInvite(inviteId);

            if (invite == null)
            {
                await callback.SafeSendMessage("Invite not found.");

                return;
            }
            if (invite.IsRevoked)
            {
                await
                callback.SafeSendMessage("This invite has expired or the bot is banned from that server.");

                return;
            }

            await invite.Accept();

            await callback.SafeSendMessage("Joined server.");

            await Config.Owner.SendPrivate($"Joined server: `{invite.Server.Name}`.");
        }
Ejemplo n.º 4
0
 public static Task AcceptInvite(this DiscordClient client, Invite invite)
 {
     if (invite == null) throw new ArgumentNullException(nameof(invite));
     return invite.Accept();
 }