Esempio n. 1
0
 public async Task SetHeaderCommand(CommandContext ctx, string headerName, [RemainingText] string headerValue)
 {
     Logger.LogInformation($"Added header {headerName} = {headerValue}");
     using (var db = new DatabaseDbContext())
     {
         var customHeader = new CustomHeader {
             Name = headerName, Value = headerValue
         };
         db.AddOrUpdate(customHeader);
         await db.SaveChangesAsync();
     }
 }
Esempio n. 2
0
 public async Task SetUpdateChannelCommand(CommandContext ctx, DiscordChannel channel)
 {
     Logger.LogInformation($"Update channel for guild {ctx.Guild.Name} set to {channel.Name}");
     // We can also access the channel from the Command Context.
     using (var db = new DatabaseDbContext())
     {
         var guildConfig = new GuildConfig {
             Guild = ctx.Guild.Id, UpdatesChannel = channel.Id
         };
         db.AddOrUpdate(guildConfig);
         await db.SaveChangesAsync();
     }
 }