Told VS to do a Code Cleanup.

This commit is contained in:
Chris Darnell committed 2021-04-30 18:31:30 -07:00
1 parent 50c5bd0caa
commit bf94bffb77
18 files changed
+138 -282

No files matched your search

+8 -9
View File
@@ -1,14 +1,13 @@
using System; using DSharpPlus.CommandsNext;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text; using System.Text;
using DSharpPlus; using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -86,8 +85,8 @@ namespace StarsiegeBot
public bool AllowRolesPurchase { get; set; } public bool AllowRolesPurchase { get; set; }
public bool UseAutoRoles { get; set; } public bool UseAutoRoles { get; set; }
public List<String> Prefixes { get; set; } public List<String> Prefixes { get; set; }
public Dictionary<string,Dictionary<string,int>> SelfRoles { get; set; } public Dictionary<string, Dictionary<string, int>> SelfRoles { get; set; }
public Dictionary<int,List<DiscordRole>> LevelRoles { get; set; } public Dictionary<int, List<DiscordRole>> LevelRoles { get; set; }
public List<DiscordRole> HiddenRolesList { get; set; } public List<DiscordRole> HiddenRolesList { get; set; }
public DiscordChannel WelcomeChannel { get; set; } public DiscordChannel WelcomeChannel { get; set; }
public bool UseWelcome { get; set; } public bool UseWelcome { get; set; }
+6 -13
View File
@@ -1,20 +1,13 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus; using DSharpPlus;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.EventArgs; using DSharpPlus.EventArgs;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Enums;
using DSharpPlus.Interactivity.Extensions;
using DSharpPlus.VoiceNext;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -225,7 +218,7 @@ namespace StarsiegeBot
{ {
d.Logger.LogDebug(BotEventId, "GuildDownloadCompleted."); d.Logger.LogDebug(BotEventId, "GuildDownloadCompleted.");
//if(e.Guilds[376937422010974209].Members.ContainsKey(139548200099905536)) //if(e.Guilds[376937422010974209].Members.ContainsKey(139548200099905536))
//notify = e.Guilds[376937422010974209].Members[139548200099905536]; //notify = e.Guilds[376937422010974209].Members[139548200099905536];
return Task.CompletedTask; return Task.CompletedTask;
} }
@@ -255,7 +248,7 @@ namespace StarsiegeBot
string msg = WelcomeMessage.WelcomeMessageProcessing(BotSettings.GuildSettings[gId].WelcomeMessage, e.Member, e.Guild); string msg = WelcomeMessage.WelcomeMessageProcessing(BotSettings.GuildSettings[gId].WelcomeMessage, e.Member, e.Guild);
BotSettings.GuildSettings[gId].WelcomeChannel.SendMessageAsync(msg); BotSettings.GuildSettings[gId].WelcomeChannel.SendMessageAsync(msg);
} }
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task GuildMemberRemoved(DiscordClient d, GuildMemberRemoveEventArgs e) public Task GuildMemberRemoved(DiscordClient d, GuildMemberRemoveEventArgs e)
@@ -1,35 +1,27 @@
using System; using DSharpPlus.CommandsNext;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions; using DSharpPlus.Interactivity.Extensions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot namespace StarsiegeBot
{ {
[Group("ex")] [Group("ex")]
[Hidden] [Hidden]
[Description("Experimental commands. May break the bot.")] [Description("Experimental commands. May break the bot.")]
class StarsiegeCommands : BaseCommandModule class ExperiemntalCommands : BaseCommandModule
{ {
private readonly List<Questions> QuizQuestions; private readonly List<Questions> QuizQuestions;
private readonly Random rnd = new Random(); private readonly Random rnd = new Random();
public StarsiegeCommands() public ExperiemntalCommands()
{ {
// Load all the Quick Chat texts and sound wav file info. // Load all the Quick Chat texts and sound wav file info.
var json = ""; var json = "";
@@ -48,7 +40,7 @@ namespace StarsiegeBot
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
DiscordEmbedBuilder embed = new DiscordEmbedBuilder(); DiscordEmbedBuilder embed = new DiscordEmbedBuilder();
int[] ids = { rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count)}; int[] ids = { rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count), rnd.Next(QuizQuestions.Count) };
int selection = rnd.Next(ids.Length); int selection = rnd.Next(ids.Length);
int mainId = ids[selection]; int mainId = ids[selection];
string[] options = { "a", "b", "c", "d" }; string[] options = { "a", "b", "c", "d" };
@@ -71,7 +63,7 @@ namespace StarsiegeBot
var itemEmote = DiscordEmoji.FromName(ctx.Client, $":regional_indicator_{item}:"); var itemEmote = DiscordEmoji.FromName(ctx.Client, $":regional_indicator_{item}:");
await message.CreateReactionAsync(itemEmote); await message.CreateReactionAsync(itemEmote);
} }
var result = message.WaitForReactionAsync(ctx.Message.Author,TimeSpan.FromSeconds(5d)); var result = message.WaitForReactionAsync(ctx.Message.Author, TimeSpan.FromSeconds(5d));
if (!result.Result.TimedOut) if (!result.Result.TimedOut)
{ {
if (result.Result.Result.Emoji == correctAnswer) await ctx.RespondAsync("**CORRECT!!**"); if (result.Result.Result.Emoji == correctAnswer) await ctx.RespondAsync("**CORRECT!!**");
@@ -95,7 +87,7 @@ namespace StarsiegeBot
{ {
foreach (var person in reaction.Users) foreach (var person in reaction.Users)
{ {
if ( ! correctEmote.Equals(reaction.Emoji)) if (!correctEmote.Equals(reaction.Emoji))
{ {
losers.Add(person, true); losers.Add(person, true);
} }
@@ -1,16 +1,16 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using System.Text.RegularExpressions; using System;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot namespace StarsiegeBot
{ {
class Commands : BaseCommandModule class GameCommands : BaseCommandModule
{ {
// Master insult list. // Master insult list.
private readonly string[] InsultMaster = { private readonly string[] InsultMaster = {
@@ -22,7 +22,7 @@ namespace StarsiegeBot
}; };
private List<string> InsultCopy; private List<string> InsultCopy;
public Commands() public GameCommands()
{ {
// Let the console know we've loaded basic commands. // Let the console know we've loaded basic commands.
Console.WriteLine("Basic Commands Loaded"); Console.WriteLine("Basic Commands Loaded");
@@ -174,11 +174,11 @@ namespace StarsiegeBot
else else
await ctx.RespondAsync(overallResults); await ctx.RespondAsync(overallResults);
} }
[Command("guilds"),Hidden,RequireOwner] [Command("guilds"), Hidden, RequireOwner]
public async Task GimmeServerNames (CommandContext ctx) public async Task GimmeServerNames(CommandContext ctx)
{ {
string output = ""; string output = "";
foreach (KeyValuePair<ulong,DiscordGuild> item in ctx.Client.Guilds) foreach (KeyValuePair<ulong, DiscordGuild> item in ctx.Client.Guilds)
{ {
output += item.Value.Name + "\r\n"; output += item.Value.Name + "\r\n";
} }
@@ -382,7 +382,7 @@ namespace StarsiegeBot
if (msg != "") if (msg != "")
result = msg; result = msg;
else else
result ="I need something to say..."; result = "I need something to say...";
DiscordEmbedBuilder embed = new DiscordEmbedBuilder DiscordEmbedBuilder embed = new DiscordEmbedBuilder
{ {
Description = result, Description = result,
+4 -17
View File
@@ -1,25 +1,12 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext; using System;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using System.Text.RegularExpressions;
using System.Text; using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
+5 -19
View File
@@ -1,25 +1,11 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq; using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -41,7 +27,7 @@ namespace StarsiegeBot
[Command("add")] [Command("add")]
[Description("Work in progress. Does nothing yet.")] [Description("Work in progress. Does nothing yet.")]
public async Task AddSelfRole(CommandContext ctx, [Description("The role to add.")]DiscordRole role, [Description("The price of the role for buyable roles. 0 for no cost. Free free to leave blank if not using Buyable roles.")]int price = 0, [Description("What group to put the role in. If not using groups, you can leave blank.")]string group = null) public async Task AddSelfRole(CommandContext ctx, [Description("The role to add.")] DiscordRole role, [Description("The price of the role for buyable roles. 0 for no cost. Free free to leave blank if not using Buyable roles.")] int price = 0, [Description("What group to put the role in. If not using groups, you can leave blank.")] string group = null)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
if (price == -1) if (price == -1)
@@ -52,7 +38,7 @@ namespace StarsiegeBot
[Command("delete")] [Command("delete")]
[Description("Work in progress. Does nothing yet.")] [Description("Work in progress. Does nothing yet.")]
public async Task DeleteSelfRole(CommandContext ctx, [Description("The role to delete.")] DiscordRole role, [Description("The group to remove the role from. If left blank, will remove from all groups.")]string group = null) public async Task DeleteSelfRole(CommandContext ctx, [Description("The role to delete.")] DiscordRole role, [Description("The group to remove the role from. If left blank, will remove from all groups.")] string group = null)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
} }
+4 -19
View File
@@ -1,25 +1,10 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using System;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq; using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -57,7 +42,7 @@ namespace StarsiegeBot
[Command("edit")] [Command("edit")]
[Description("Work in progress. Does nothing yet.")] [Description("Work in progress. Does nothing yet.")]
public async Task EditLevel (CommandContext ctx, int oldLeve, int newLevel) public async Task EditLevel(CommandContext ctx, int oldLeve, int newLevel)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
} }
+3 -17
View File
@@ -1,25 +1,11 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq; using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
+5 -19
View File
@@ -1,30 +1,16 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq; using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
[Group("role")] [Group("role")]
[RequireGuild,RequirePermissions(Permissions.ManageRoles)] [RequireGuild, RequirePermissions(Permissions.ManageRoles)]
class RoleManagement : BotSettings class RoleManagement : BotSettings
{ {
public RoleManagement() public RoleManagement()
+6 -19
View File
@@ -1,24 +1,11 @@
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext; using System;
using System.Text.RegularExpressions;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Text.RegularExpressions;
using Newtonsoft.Json; using System.Threading.Tasks;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -120,7 +107,7 @@ namespace StarsiegeBot
await ctx.RespondAsync($"Global Prefix usage has been turned **{(isEnabled ? "on" : "off")}**"); await ctx.RespondAsync($"Global Prefix usage has been turned **{(isEnabled ? "on" : "off")}**");
} }
[Command("global")] [Command("global")]
public async Task UseGlobalPrefixes(CommandContext ctx, [Description("ON or OFF"),RemainingText] string isEnabled = null) public async Task UseGlobalPrefixes(CommandContext ctx, [Description("ON or OFF"), RemainingText] string isEnabled = null)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
isEnabled = isEnabled.ToLower(); isEnabled = isEnabled.ToLower();
@@ -151,7 +138,7 @@ namespace StarsiegeBot
} }
else else
{ {
} }
await ctx.RespondAsync(embed); await ctx.RespondAsync(embed);
} }
+9 -12
View File
@@ -1,19 +1,16 @@
using System; using DSharpPlus;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.EventArgs;
using DSharpPlus.Interactivity; using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Enums; using DSharpPlus.Interactivity.Enums;
using DSharpPlus.Interactivity.Extensions; using DSharpPlus.Interactivity.Extensions;
using DSharpPlus.VoiceNext; using DSharpPlus.VoiceNext;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -122,16 +119,16 @@ namespace StarsiegeBot
// up next, let's register our commands // up next, let's register our commands
this.Commands.RegisterCommands<BotSettings>(); // Main Folder. Test Items. this.Commands.RegisterCommands<BotSettings>(); // Main Folder. Test Items.
this.Commands.RegisterCommands<Commands>(); this.Commands.RegisterCommands<ExperiemntalCommands>(); // Experimental commands file.
this.Commands.RegisterCommands<GameCommands>();
this.Commands.RegisterCommands<GroupManagement>(); // Main Folder. Test Items. this.Commands.RegisterCommands<GroupManagement>(); // Main Folder. Test Items.
this.Commands.RegisterCommands<GroupRoleManagement>(); // Main Folder. Test Items. this.Commands.RegisterCommands<GroupRoleManagement>(); // Main Folder. Test Items.
this.Commands.RegisterCommands<LevelManagement>(); // Main Folder. Test Items. this.Commands.RegisterCommands<LevelManagement>(); // Main Folder. Test Items.
this.Commands.RegisterCommands<LevelRoleManagement>(); // Main Folder. Test Items. this.Commands.RegisterCommands<LevelRoleManagement>(); // Main Folder. Test Items.
this.Commands.RegisterCommands<NotFacts>(); // Raven Folder.
this.Commands.RegisterCommands<PrefixManagement>(); this.Commands.RegisterCommands<PrefixManagement>();
this.Commands.RegisterCommands<RoleManagement>(); // Main Folder. Test Items. this.Commands.RegisterCommands<RoleManagement>(); // Main Folder. Test Items.
this.Commands.RegisterCommands<SnappleFacts>(); this.Commands.RegisterCommands<SnappleFacts>(); // Raven folder.
this.Commands.RegisterCommands<NotFacts>();
this.Commands.RegisterCommands<StarsiegeCommands>();
this.Commands.RegisterCommands<WelcomeMessage>(); // Main Folder. Test Items. this.Commands.RegisterCommands<WelcomeMessage>(); // Main Folder. Test Items.
// All these commands are in the STARSIEGE folder. // All these commands are in the STARSIEGE folder.
+6 -6
View File
@@ -1,17 +1,17 @@
using System; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using Newtonsoft.Json;
namespace StarsiegeBot namespace StarsiegeBot
{ {
class NotFacts : BaseCommandModule class NotFacts : BaseCommandModule
{ {
private List<string> notfacts; private readonly List<string> notfacts;
public NotFacts() public NotFacts()
{ {
@@ -31,7 +31,7 @@ namespace StarsiegeBot
await ctx.RespondAsync(notfacts[notFactID]); await ctx.RespondAsync(notfacts[notFactID]);
return; return;
} }
catch(Exception) catch (Exception)
{ {
await ctx.RespondAsync(notfacts[Program.rnd.Next(0, notfacts.Count)]); await ctx.RespondAsync(notfacts[Program.rnd.Next(0, notfacts.Count)]);
} }
+7 -7
View File
@@ -1,17 +1,17 @@
using System; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using Newtonsoft.Json;
namespace StarsiegeBot namespace StarsiegeBot
{ {
class SnappleFacts : BaseCommandModule class SnappleFacts : BaseCommandModule
{ {
private List<string> facts; private readonly List<string> facts;
public SnappleFacts() public SnappleFacts()
{ {
@@ -21,7 +21,7 @@ namespace StarsiegeBot
} }
[Command("snapple"), Description("Get a Snapple \"Real Fact\".")] [Command("snapple"), Description("Get a Snapple \"Real Fact\".")]
public async Task Snapplefact(CommandContext ctx, [Description("[Optional] A Snapple Fact ID")]int snapId = -1) public async Task Snapplefact(CommandContext ctx, [Description("[Optional] A Snapple Fact ID")] int snapId = -1)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
@@ -31,7 +31,7 @@ namespace StarsiegeBot
await ctx.RespondAsync(facts[snapId]); await ctx.RespondAsync(facts[snapId]);
return; return;
} }
catch(Exception) catch (Exception)
{ {
await ctx.RespondAsync(facts[Program.rnd.Next(0, facts.Count)]); await ctx.RespondAsync(facts[Program.rnd.Next(0, facts.Count)]);
} }
+11 -17
View File
@@ -1,21 +1,15 @@
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text; using System.Text;
using DSharpPlus; using System.Text.RegularExpressions;
using DSharpPlus.CommandsNext.Exceptions; using System.Threading.Tasks;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -117,7 +111,7 @@ namespace StarsiegeBot
} }
[GroupCommand] [GroupCommand]
public async Task DeathMessage(CommandContext ctx, [Description("Optional. Person you want to see kill you. If blank, will show generic death message.")]DiscordMember target = null) public async Task DeathMessage(CommandContext ctx, [Description("Optional. Person you want to see kill you. If blank, will show generic death message.")] DiscordMember target = null)
{ {
// We're typing! (In all honesty, this is just used to avoid the 'async task not using await' messages I get. // We're typing! (In all honesty, this is just used to avoid the 'async task not using await' messages I get.
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
@@ -129,7 +123,7 @@ namespace StarsiegeBot
await ctx.RespondAsync("Death Messages Commands have been disabled. Please contact the bot owners."); await ctx.RespondAsync("Death Messages Commands have been disabled. Please contact the bot owners.");
return; return;
} }
// set some basic output incase something goes south. // set some basic output incase something goes south.
string line = "Something went wrong."; string line = "Something went wrong.";
// if there is no target, we're going to "kill" the author. // if there is no target, we're going to "kill" the author.
@@ -182,7 +176,7 @@ namespace StarsiegeBot
[Command("Add")] [Command("Add")]
[Description("Adds a message to the Pending Death Message Queue. Generic Death Messages require just a [Killed] while any other death message requires both a [Killed] and a [Killer] tags. These will be replaced with the correct information in game, and in the usage of random DM generation.")] [Description("Adds a message to the Pending Death Message Queue. Generic Death Messages require just a [Killed] while any other death message requires both a [Killed] and a [Killer] tags. These will be replaced with the correct information in game, and in the usage of random DM generation.")]
[Cooldown(1, 2, CooldownBucketType.Guild)] [Cooldown(1, 2, CooldownBucketType.Guild)]
public async Task DeathMessageNew(CommandContext ctx, [RemainingText,Description("The Death Message you want added. See help section.")] string msg) public async Task DeathMessageNew(CommandContext ctx, [RemainingText, Description("The Death Message you want added. See help section.")] string msg)
{ {
// IF we're missing the Death Messages dot JSON file, we're going to get disabled... Check for that. // IF we're missing the Death Messages dot JSON file, we're going to get disabled... Check for that.
// If disabled, let the person know the command set is disabled, and return. // If disabled, let the person know the command set is disabled, and return.
@@ -265,7 +259,7 @@ namespace StarsiegeBot
// Tell DSharp that we want to upload this file. // Tell DSharp that we want to upload this file.
msg.WithFile("deathmessages.cs", sound); msg.WithFile("deathmessages.cs", sound);
// Add some content so its not a blank file. // Add some content so its not a blank file.
msg.Content ="Here is your request for a death message script."; msg.Content = "Here is your request for a death message script.";
// send that message. // send that message.
await ctx.RespondAsync(msg); await ctx.RespondAsync(msg);
// We're done with the file, so close access to it. // We're done with the file, so close access to it.
+7 -13
View File
@@ -1,21 +1,15 @@
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text; using System.Text;
using DSharpPlus; using System.Text.RegularExpressions;
using DSharpPlus.CommandsNext.Exceptions; using System.Threading.Tasks;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
namespace StarsiegeBot namespace StarsiegeBot
{ {
+12 -22
View File
@@ -1,22 +1,12 @@
using System; using DSharpPlus.CommandsNext;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Text; using System;
using DSharpPlus; using System.Collections.Generic;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using System.Net; using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -50,7 +40,7 @@ namespace StarsiegeBot
} }
} }
[GroupCommand] [GroupCommand]
public async Task Overview (CommandContext ctx) public async Task Overview(CommandContext ctx)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
Update(); Update();
@@ -70,9 +60,9 @@ namespace StarsiegeBot
Title = "Master|Game Server Overview", Title = "Master|Game Server Overview",
Description = "Number of Master, and Game servers. Along with number of errors." Description = "Number of Master, and Game servers. Along with number of errors."
}; };
embed.AddField("Masters", gameData.Masters.Length.ToString(),true); embed.AddField("Masters", gameData.Masters.Length.ToString(), true);
embed.AddField("Games", gameData.Games.Length.ToString(),true); embed.AddField("Games", gameData.Games.Length.ToString(), true);
embed.AddField("Errors", gameData.Errors.Length.ToString(),true); embed.AddField("Errors", gameData.Errors.Length.ToString(), true);
await ctx.RespondAsync(embed); await ctx.RespondAsync(embed);
} }
@@ -106,7 +96,7 @@ namespace StarsiegeBot
[Command("Masters"), Aliases("m")] [Command("Masters"), Aliases("m")]
[Description("Gives all the master servers as a script to be improted into `master.cs`.")] [Description("Gives all the master servers as a script to be improted into `master.cs`.")]
public async Task MasterServers (CommandContext ctx) public async Task MasterServers(CommandContext ctx)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
Update(); Update();
@@ -137,7 +127,7 @@ namespace StarsiegeBot
[Command("games"), Aliases("g")] [Command("games"), Aliases("g")]
[Description("Currently: Lists games that have been started (Player dropped in). End Result: Lists all games that have a player in the server (either dropped in or not)")] [Description("Currently: Lists games that have been started (Player dropped in). End Result: Lists all games that have a player in the server (either dropped in or not)")]
public async Task GameServers(CommandContext ctx, [Description("Number of players you want to check for. Game servers will need at least this meaning or more to be listed.")]int playerCount = 1) public async Task GameServers(CommandContext ctx, [Description("Number of players you want to check for. Game servers will need at least this meaning or more to be listed.")] int playerCount = 1)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
Update(); Update();
@@ -145,7 +135,7 @@ namespace StarsiegeBot
// setup an exit point check. // setup an exit point check.
bool exit = false; bool exit = false;
// if its null, we're going to exit. // if its null, we're going to exit.
if(gameData is null || gameData.Games is null) if (gameData is null || gameData.Games is null)
{ {
exit = true; exit = true;
} }
+14 -20
View File
@@ -1,21 +1,15 @@
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text; using System.Text;
using DSharpPlus; using System.Text.RegularExpressions;
using DSharpPlus.CommandsNext.Exceptions; using System.Threading.Tasks;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -44,7 +38,7 @@ namespace StarsiegeBot
var json = ""; var json = "";
using (var fs = File.OpenRead("quickchats.json")) using (var fs = File.OpenRead("quickchats.json"))
using (var sr = new StreamReader(fs, new UTF8Encoding(false))) using (var sr = new StreamReader(fs, new UTF8Encoding(false)))
json = sr.ReadToEnd(); json = sr.ReadToEnd();
quickchats = JsonConvert.DeserializeObject<Dictionary<string, Quickchat>>(json); quickchats = JsonConvert.DeserializeObject<Dictionary<string, Quickchat>>(json);
// enable the commands. // enable the commands.
return true; return true;
@@ -194,7 +188,7 @@ namespace StarsiegeBot
{ {
// Open the file. // Open the file.
FileStream sound = new FileStream($"./qc/{chat.soundFile}", FileMode.Open, FileAccess.Read); FileStream sound = new FileStream($"./qc/{chat.soundFile}", FileMode.Open, FileAccess.Read);
// feed it to the Message Builder. // feed it to the Message Builder.
msg.WithFile(chat.soundFile, sound); msg.WithFile(chat.soundFile, sound);
} }
@@ -205,9 +199,9 @@ namespace StarsiegeBot
} }
[Command("search"), Aliases("s")] [Command("search"), Aliases("s")]
[Cooldown(1,5,CooldownBucketType.Global)] [Cooldown(1, 5, CooldownBucketType.Global)]
[Description("Searches all the [T]ext and [S]ound file names for the Search input.")] [Description("Searches all the [T]ext and [S]ound file names for the Search input.")]
public async Task SearchQuickChats(CommandContext ctx, [RemainingText,Description("What to search for.")] string toSearch) public async Task SearchQuickChats(CommandContext ctx, [RemainingText, Description("What to search for.")] string toSearch)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
string output; string output;
@@ -223,7 +217,7 @@ namespace StarsiegeBot
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
DiscordMessageBuilder msg = new DiscordMessageBuilder(); DiscordMessageBuilder msg = new DiscordMessageBuilder();
int count = 0; int count = 0;
// We're going to search each QC for the stuff in toSearch. // We're going to search each QC for the stuff in toSearch.
foreach (KeyValuePair<string, Quickchat> qc in quickchats) foreach (KeyValuePair<string, Quickchat> qc in quickchats)
{ {
@@ -262,7 +256,7 @@ namespace StarsiegeBot
[Command("toggle"), Aliases("t")] [Command("toggle"), Aliases("t")]
[RequireOwner] [RequireOwner]
[Description("[Owner only] Enables or disables, or checks status of QuickChats.\r\nTo turn the feature on, use `TRUE`, `ON`, or `1`\r\nTo turn off, use `FALSE`, `OFF`, or `0`")] [Description("[Owner only] Enables or disables, or checks status of QuickChats.\r\nTo turn the feature on, use `TRUE`, `ON`, or `1`\r\nTo turn off, use `FALSE`, `OFF`, or `0`")]
public async Task ToggleQC (CommandContext ctx, [RemainingText] string isEnabled = null) public async Task ToggleQC(CommandContext ctx, [RemainingText] string isEnabled = null)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
isEnabled = isEnabled.ToLower(); isEnabled = isEnabled.ToLower();
@@ -281,7 +275,7 @@ namespace StarsiegeBot
IsEnabled = false; IsEnabled = false;
} }
output = $"Quickchats {(IsEnabled ? "Enabled":"Disabled")}"; output = $"Quickchats {(IsEnabled ? "Enabled" : "Disabled")}";
} }
else else
{ {
+6 -20
View File
@@ -1,25 +1,11 @@
#pragma warning disable IDE0060 // Remove unused parameter #pragma warning disable IDE0060 // Remove unused parameter
using System; using DSharpPlus;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext; using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes; using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities; using DSharpPlus.Entities;
using DSharpPlus.VoiceNext; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq; using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext.Exceptions;
using DSharpPlus.EventArgs;
using DSharpPlus.VoiceNext.Codec;
using Microsoft.Extensions.Logging;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using System.Threading;
namespace StarsiegeBot namespace StarsiegeBot
{ {
@@ -28,7 +14,7 @@ namespace StarsiegeBot
class WelcomeMessage : BotSettings class WelcomeMessage : BotSettings
{ {
[GroupCommand] [GroupCommand]
public async Task GeneralWelcome (CommandContext ctx) public async Task GeneralWelcome(CommandContext ctx)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
string gId = ctx.Guild.Id.ToString(); string gId = ctx.Guild.Id.ToString();
@@ -89,7 +75,7 @@ namespace StarsiegeBot
await ctx.RespondAsync(embed); await ctx.RespondAsync(embed);
} }
[Command("Channel")] [Command("Channel")]
public async Task WelcomeChannel(CommandContext ctx, [RemainingText]string here) public async Task WelcomeChannel(CommandContext ctx, [RemainingText] string here)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
string gId = ctx.Guild.Id.ToString(); string gId = ctx.Guild.Id.ToString();
@@ -109,7 +95,7 @@ namespace StarsiegeBot
} }
[Command("Message")] [Command("Message")]
[Description("Hello. Run `>welcome help` for more info.")] [Description("Hello. Run `>welcome help` for more info.")]
public async Task MessageOfWelcome(CommandContext ctx, [RemainingText]string msg) public async Task MessageOfWelcome(CommandContext ctx, [RemainingText] string msg)
{ {
await ctx.TriggerTypingAsync(); await ctx.TriggerTypingAsync();
string gId = ctx.Guild.Id.ToString(); string gId = ctx.Guild.Id.ToString();