Removed all local copies of Random rnd in favor of using Program.rnd. Fixed lack of DM command usage. Coverted more responses to use DiscordEmbedBuilder
This commit is contained in:
1 parent
0479d443b8
commit
7cefceb48e
10 files changed
+115
-86
No files matched your search
@@ -25,7 +25,6 @@ namespace StarsiegeBot
|
||||
[Cooldown(1, 2, CooldownBucketType.Guild)]
|
||||
class DeathMessages : BaseCommandModule
|
||||
{
|
||||
private readonly Random rnd = new Random();
|
||||
private DeathMessageLines dmLines;
|
||||
private bool DeathMessagesEnabled;
|
||||
|
||||
@@ -136,7 +135,7 @@ namespace StarsiegeBot
|
||||
// if there is no target, we're going to "kill" the author.
|
||||
if (target == null)
|
||||
{
|
||||
int choice = rnd.Next(0, dmLines.Generic.Length);
|
||||
int choice = Program.rnd.Next(0, dmLines.Generic.Length);
|
||||
line = dmLines.Generic[choice];
|
||||
await ctx.RespondAsync(string.Format(line, ctx.Message.Author.Mention));
|
||||
}
|
||||
@@ -144,18 +143,18 @@ namespace StarsiegeBot
|
||||
else
|
||||
{
|
||||
// Pick a death message type at random.
|
||||
int opt = rnd.Next(1, 3);
|
||||
int opt = Program.rnd.Next(1, 3);
|
||||
// If we picked active death messages...
|
||||
if (opt == 1)
|
||||
{
|
||||
// Pick an Active death message at random, and set our output to it.
|
||||
int choice = rnd.Next(0, dmLines.Active.Length);
|
||||
int choice = Program.rnd.Next(0, dmLines.Active.Length);
|
||||
line = dmLines.Active[choice];
|
||||
}
|
||||
else if (opt == 2)
|
||||
{
|
||||
// We picked a Passive death message type. Pick the exact line at random. Set it to the output.
|
||||
int choice = rnd.Next(0, dmLines.Passive.Length);
|
||||
int choice = Program.rnd.Next(0, dmLines.Passive.Length);
|
||||
line = dmLines.Passive[choice];
|
||||
}
|
||||
// Give the selected death message to the user.
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace StarsiegeBot
|
||||
[Group("functions"), Aliases("func")]
|
||||
class Functions : BaseCommandModule
|
||||
{
|
||||
private readonly Random rnd = new Random();
|
||||
private Dictionary<string, SSFunction> ssFunctions;
|
||||
private bool FunctionsEnabled;
|
||||
|
||||
@@ -94,7 +93,7 @@ namespace StarsiegeBot
|
||||
// set the timestamp to now... why, idk, its not really needed actually.
|
||||
embed.WithTimestamp(DateTime.Now);
|
||||
// add a random color to the left side bar of the embed.
|
||||
embed.WithColor(Program.colours[rnd.Next(0, Program.colours.Length)]);
|
||||
embed.WithColor(Program.colours[Program.rnd.Next(0, Program.colours.Length)]);
|
||||
// Message Description, I dont remember what it is any more, sorry!
|
||||
embed.WithDescription(outItem.description);
|
||||
// iterate over each field item, and add them to the embed.
|
||||
|
||||
@@ -65,9 +65,11 @@ namespace StarsiegeBot
|
||||
{
|
||||
return;
|
||||
}
|
||||
DiscordEmbedBuilder embed = new DiscordEmbedBuilder();
|
||||
embed.Title = "Master|Game Server Overview";
|
||||
embed.Description = "Number of Master, and Game servers. Along with number of errors.";
|
||||
DiscordEmbedBuilder embed = new DiscordEmbedBuilder
|
||||
{
|
||||
Title = "Master|Game Server Overview",
|
||||
Description = "Number of Master, and Game servers. Along with number of errors."
|
||||
};
|
||||
embed.AddField("Masters", gameData.Masters.Length.ToString(),true);
|
||||
embed.AddField("Games", gameData.Games.Length.ToString(),true);
|
||||
embed.AddField("Errors", gameData.Errors.Length.ToString(),true);
|
||||
@@ -91,8 +93,10 @@ namespace StarsiegeBot
|
||||
{
|
||||
return;
|
||||
}
|
||||
DiscordMessageBuilder msg = new DiscordMessageBuilder();
|
||||
msg.Content = "Server Listing Errors:\r\n";
|
||||
DiscordMessageBuilder msg = new DiscordMessageBuilder
|
||||
{
|
||||
Content = "Server Listing Errors:\r\n"
|
||||
};
|
||||
foreach (var item in gameData.Errors)
|
||||
{
|
||||
msg.Content += $"{item}\r\n";
|
||||
@@ -117,8 +121,10 @@ namespace StarsiegeBot
|
||||
{
|
||||
return;
|
||||
}
|
||||
DiscordMessageBuilder msg = new DiscordMessageBuilder();
|
||||
msg.Content = "```csharp\r\n";
|
||||
DiscordMessageBuilder msg = new DiscordMessageBuilder
|
||||
{
|
||||
Content = "```csharp\r\n"
|
||||
};
|
||||
int count = 0;
|
||||
foreach (var item in gameData.Masters)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace StarsiegeBot
|
||||
class Quickchat : BaseCommandModule
|
||||
{
|
||||
private List<Quickchats> Quickchats;
|
||||
private readonly Random rnd = new Random();
|
||||
private bool QuickChatsEnabled;
|
||||
|
||||
public Quickchat()
|
||||
@@ -154,7 +153,7 @@ namespace StarsiegeBot
|
||||
id = Math.Abs(id);
|
||||
if (id == -1 || id > Quickchats.Count)
|
||||
{
|
||||
int idnum = rnd.Next(Quickchats.Count);
|
||||
int idnum = Program.rnd.Next(Quickchats.Count);
|
||||
chat = Quickchats[idnum];
|
||||
msg.Content = $"[{idnum}] " + chat.text;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user