예제 #1
0
파일: MuteService.cs 프로젝트: Slamerz/DmC
 public async Task SetMuteRoleAsync(ulong guildId, string name)
 {
     using (var uow = _db.UnitOfWork)
     {
         var config = uow.GuildConfigs.For(guildId, set => set);
         config.MuteRoleName = name;
         GuildMuteRoles.AddOrUpdate(guildId, name, (id, old) => name);
         await uow.CompleteAsync().ConfigureAwait(false);
     }
 }
예제 #2
0
            public async Task SetMuteRole([Remainder] string name)
            {
                //var channel = (ITextChannel)Context.Channel;
                name = name.Trim();
                if (string.IsNullOrWhiteSpace(name))
                {
                    return;
                }

                using (var uow = DbHandler.UnitOfWork())
                {
                    var config = uow.GuildConfigs.For(Context.Guild.Id, set => set);
                    config.MuteRoleName = name;
                    GuildMuteRoles.AddOrUpdate(Context.Guild.Id, name, (id, old) => name);
                    await uow.CompleteAsync().ConfigureAwait(false);
                }
                await Context.Channel.SendConfirmAsync("☑️ **New mute role set.**").ConfigureAwait(false);
            }