diff --git a/StarsiegeBot/ChannelManagement.cs b/StarsiegeBot/ChannelManagement.cs index ebe022b..68c771d 100644 --- a/StarsiegeBot/ChannelManagement.cs +++ b/StarsiegeBot/ChannelManagement.cs @@ -26,17 +26,18 @@ namespace StarsiegeBot [Command("Allow")] public async Task AllowChannels(CommandContext ctx, [Description("List of discord channels to allow the bot to respond on.")]params DiscordChannel[] discordChannels) { - + await ctx.TriggerTypingAsync(); } [Command("Allow")] public async Task AllowChannels(CommandContext ctx, string discordChannels = "") { - + await ctx.TriggerTypingAsync(); } [Command("deny")] public async Task DenyChannels(CommandContext ctx, params DiscordChannel[] discordChannels) { + await ctx.TriggerTypingAsync(); foreach (DiscordChannel chan in discordChannels) { Console.WriteLine(chan.Id.ToString()); @@ -45,6 +46,7 @@ namespace StarsiegeBot [Command("deny")] public async Task DenyChannels(CommandContext ctx, [Description("List of discord channels to deny the bot to respond on.")] string discordChannels = "") { + await ctx.TriggerTypingAsync(); } } diff --git a/StarsiegeBot/EventTriggers.cs b/StarsiegeBot/EventTriggers.cs index aa4037e..f086296 100644 --- a/StarsiegeBot/EventTriggers.cs +++ b/StarsiegeBot/EventTriggers.cs @@ -17,7 +17,6 @@ namespace StarsiegeBot public readonly EventId BotEventId; public static DiscordMember notify; // protected string BotName { get; set; } - private readonly BotSettings _guilds = new BotSettings(); public Triggers(EventId botEventId) => BotEventId = botEventId; public Task CommandExecuted(CommandsNextExtension ext, CommandExecutionEventArgs e) { @@ -46,6 +45,33 @@ namespace StarsiegeBot if (!(e.Guild is null)) { string gId = e.Guild.Id.ToString(); + bool allowedToPost = false; + if (BotSettings.GuildSettings[gId].DenyChannels.Contains("all")) + { + if (BotSettings.GuildSettings[gId].AllowChannels.Contains(e.Channel.Id.ToString())) + { + allowedToPost = true; + } + } + else + { + if (!BotSettings.GuildSettings[gId].DenyChannels.Contains(e.Channel.Id.ToString())) + { + allowedToPost = true; + } + } + if (allowedToPost) + { + Console.WriteLine("We're allowed to post."); + } + if (!allowedToPost) + { + Console.WriteLine("We're *NOT* allowed to post."); + return Task.CompletedTask; + } + + + // Check to see if the guild has settings. if (BotSettings.GuildSettings.ContainsKey(gId)) { @@ -62,6 +88,8 @@ namespace StarsiegeBot } } } + + // hard code the bot's mention as a possible prefix. prefixes.Add(d.CurrentUser.Mention.Insert(2, "!")); foreach (string item in prefixes) diff --git a/StarsiegeBot/Phoenix/GroupRoleManagement.cs b/StarsiegeBot/Phoenix/GroupRoleManagement.cs index 74a516c..4d7ec1d 100644 --- a/StarsiegeBot/Phoenix/GroupRoleManagement.cs +++ b/StarsiegeBot/Phoenix/GroupRoleManagement.cs @@ -20,6 +20,7 @@ namespace StarsiegeBot [GroupCommand] public async Task ListGroups(CommandContext ctx) { + await ctx.TriggerTypingAsync(); } [Command("add")] [Description("Work in progress. Does nothing yet.")] @@ -50,6 +51,7 @@ namespace StarsiegeBot [Description("The role to delete.")] DiscordRole role, [Description("The group to remove the role from. If left blank, will remove from all groups."), RemainingText] string group = null) { + await ctx.TriggerTypingAsync(); // Verify role is in a group. // Verify group selected exists. // If group null, remove from all groups? @@ -58,6 +60,7 @@ namespace StarsiegeBot [Description("Work in progress. Does nothing yet.")] public async Task EditRole(CommandContext ctx, DiscordRole role, int newPrice = 0, [RemainingText] string newGroup = null) { + await ctx.TriggerTypingAsync(); } private DiscordEmbedBuilder StartEmbed(string desc) { diff --git a/StarsiegeBot/Phoenix/LevelManagement.cs b/StarsiegeBot/Phoenix/LevelManagement.cs index 13bed5d..99386a5 100644 --- a/StarsiegeBot/Phoenix/LevelManagement.cs +++ b/StarsiegeBot/Phoenix/LevelManagement.cs @@ -20,21 +20,25 @@ namespace StarsiegeBot [Description("Work in progress. Does nothing yet.")] public async Task ListLevels(CommandContext ctx) { + await ctx.TriggerTypingAsync(); } [Command("AddLevel"), Aliases("al")] [Description("Work in progress. Does nothing yet.")] public async Task AddLevel(CommandContext ctx, int newLevelGroup) { + await ctx.TriggerTypingAsync(); } [Command("DeleteLevel"), Aliases("dl")] [Description("Work in progress. Does nothing yet.")] public async Task DeleteLevel(CommandContext ctx, int oldLevelGroup) { + await ctx.TriggerTypingAsync(); } [Command("edit")] [Description("Work in progress. Does nothing yet.")] public async Task EditLevel(CommandContext ctx, int oldLeve, int newLevel) { + await ctx.TriggerTypingAsync(); } } } diff --git a/StarsiegeBot/Phoenix/LevelRoleManagement.cs b/StarsiegeBot/Phoenix/LevelRoleManagement.cs index 4f85ed5..e63fe69 100644 --- a/StarsiegeBot/Phoenix/LevelRoleManagement.cs +++ b/StarsiegeBot/Phoenix/LevelRoleManagement.cs @@ -20,21 +20,25 @@ namespace StarsiegeBot [Description("Work in progress. Does nothing yet.")] public async Task EditRole(CommandContext ctx, int oldLevel, int newLevel, DiscordRole role) { + await ctx.TriggerTypingAsync(); } [Command("edit")] [Description("Work in progress. Does nothing yet.")] public async Task EditRole(CommandContext ctx, int newLevel, [RemainingText] string role) { + await ctx.TriggerTypingAsync(); } [Command("remove")] [Description("Work in progress. Does nothing yet.")] public async Task RemoveRole(CommandContext ctx, DiscordRole role) { + await ctx.TriggerTypingAsync(); } [Command("remove")] [Description("Work in progress. Does nothing yet.")] public async Task RemoveRole(CommandContext ctx, [RemainingText] string roleName) { + await ctx.TriggerTypingAsync(); } } } diff --git a/StarsiegeBot/Phoenix/RoleManagement.cs b/StarsiegeBot/Phoenix/RoleManagement.cs index 1117b14..868e203 100644 --- a/StarsiegeBot/Phoenix/RoleManagement.cs +++ b/StarsiegeBot/Phoenix/RoleManagement.cs @@ -20,21 +20,25 @@ namespace StarsiegeBot [Description("Work in progress. Does nothing yet.")] public async Task JoinSelfRole(CommandContext ctx, DiscordRole role) { + await ctx.TriggerTypingAsync(); } [Command("join")] [Description("Work in progress. Does nothing yet.")] public async Task JoinSelfRole(CommandContext ctx, [RemainingText] string role) { + await ctx.TriggerTypingAsync(); } [Command("leave")] [Description("Work in progress. Does nothing yet.")] public async Task LeaveSelfRole(CommandContext ctx, DiscordRole role) { + await ctx.TriggerTypingAsync(); } [Command("leave")] [Description("Work in progress. Does nothing yet.")] public async Task LeaveSelfRole(CommandContext ctx, [RemainingText] string role) { + await ctx.TriggerTypingAsync(); } private bool VerifiedRole(DiscordGuild guild, DiscordRole role) {