Partial stuff

This commit is contained in:
Christopher Darnell committed 2021-05-09 20:05:34 -07:00
1 parent c8095f3ba6
commit cbf88055d3
6 files changed
+48 -3

No files matched your search

+4 -2
View File
@@ -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();
}
}
+29 -1
View File
@@ -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)
@@ -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)
{
+4
View File
@@ -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();
}
}
}
@@ -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();
}
}
}
+4
View File
@@ -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)
{