Exemple #1
0
 public async Task <IEnumerable <DiscordEmoji> > GetEmojis(DiscordServer server)
 {
     try
     {
         return(await this.GetAsync <IEnumerable <DiscordEmoji> >(string.Format("guilds/{0}/emojis", server.ID)));
     }
     catch (Exception ex) { Logger.Log(ex); }
     return(null);
 }
Exemple #2
0
 private async Task <HttpResponseMessage> ModifyServerMember(DiscordServer server, DiscordUser user, JObject content)
 {
     try
     {
         return(await this.PatchAsync("guilds/" + server.ID + "/members/" + user.ID, AdvancedHttpClient.CreateContentFromObject(content)));
     }
     catch (Exception ex) { Logger.Log(ex); }
     return(null);
 }
Exemple #3
0
 public async Task <DiscordServerUser> GetServerMember(DiscordServer server, DiscordUser user)
 {
     try
     {
         return(await this.GetAsync <DiscordServerUser>("guilds/" + server.ID + "/members/" + user.ID));
     }
     catch (Exception ex) { Logger.Log(ex); }
     return(null);
 }
Exemple #4
0
 public async Task <IEnumerable <DiscordServerUser> > GetServerMembers(DiscordServer server, int maxNumbers = 1)
 {
     try
     {
         return(await this.GetAsync <IEnumerable <DiscordServerUser> >("guilds/" + server.ID + "/members?limit=" + maxNumbers));
     }
     catch (Exception ex) { Logger.Log(ex); }
     return(new List <DiscordServerUser>());
 }
Exemple #5
0
 public async Task <IEnumerable <DiscordChannel> > GetServerChannels(DiscordServer server)
 {
     try
     {
         return(await this.GetAsync <IEnumerable <DiscordChannel> >("guilds/" + server.ID + "/channels"));
     }
     catch (Exception ex) { Logger.Log(ex); }
     return(new List <DiscordChannel>());
 }
Exemple #6
0
 public async Task DeafenServerMember(DiscordServer server, DiscordUser user, bool deaf = true)
 {
     try
     {
         JObject jobj = new JObject();
         jobj["deaf"] = deaf;
         await this.ModifyServerMember(server, user, jobj);
     }
     catch (Exception ex) { Logger.Log(ex); }
 }
Exemple #7
0
 public async Task MuteServerMember(DiscordServer server, DiscordUser user, bool mute = true)
 {
     try
     {
         JObject jobj = new JObject();
         jobj["mute"] = mute;
         await this.ModifyServerMember(server, user, jobj);
     }
     catch (Exception ex) { Logger.Log(ex); }
 }
Exemple #8
0
        public async Task ChangeServerMemberRole(DiscordServer server, DiscordUser user, IEnumerable <string> roles)
        {
            try
            {
                JArray rolesArray = new JArray();
                foreach (string role in roles)
                {
                    rolesArray.Add(role);
                }

                JObject jobj = new JObject();
                jobj["roles"] = rolesArray;

                await this.ModifyServerMember(server, user, jobj);
            }
            catch (Exception ex) { Logger.Log(ex); }
        }
Exemple #9
0
 public async Task <IEnumerable <DiscordEmoji> > GetEmojis(DiscordServer server)
 {
     return(await this.botService.GetEmojis(server));
 }
Exemple #10
0
 public async Task <IEnumerable <DiscordChannel> > GetServerChannels(DiscordServer server)
 {
     return(await this.botService.GetServerChannels(server));
 }
Exemple #11
0
 public async Task <DiscordServerUser> GetServerMember(DiscordServer server, DiscordUser user)
 {
     return(await this.botService.GetServerMember(server, user));
 }
Exemple #12
0
 public async Task <IEnumerable <DiscordServerUser> > GetServerMembers(DiscordServer server, int maxNumbers = 1)
 {
     return(await this.botService.GetServerMembers(server, maxNumbers));
 }
Exemple #13
0
 public async Task DeafenServerMember(DiscordServer server, DiscordUser user, bool deaf = true)
 {
     await this.botService.DeafenServerMember(server, user, deaf);
 }
Exemple #14
0
 public async Task MuteServerMember(DiscordServer server, DiscordUser user, bool mute = true)
 {
     await this.botService.MuteServerMember(server, user, mute);
 }
Exemple #15
0
 public async Task ChangeServerMemberRole(DiscordServer server, DiscordUser user, IEnumerable <string> roles)
 {
     await this.botService.ChangeServerMemberRole(server, user, roles);
 }