I dont remember what I did, sorry!

This commit is contained in:
Christopher Darnell committed 2021-04-19 05:09:08 -07:00
1 parent 86b8dc9c6a
commit 7a868c8ce8
4 files changed
+24 -23

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ namespace StarsiegeBot
[Command("dice"), Aliases("r", "d", "roll")]
[Description("A classic dice throwing command. Limited to 1 use per 2 seconds. Format: <NumberOfDice>d<SidesOnDie> ")]
[Cooldown(1, 2, CooldownBucketType.User)]
[Cooldown(1, 2, CooldownBucketType.Guild)]
public async Task Dice(CommandContext ctx, [RemainingText,Description("XdY")] String throwing = "d")
{
await ctx.TriggerTypingAsync();
-17
View File
@@ -281,23 +281,6 @@ namespace StarsiegeBot
// let's log the error details
e.Context.Client.Logger.LogError(BotEventId, $"{e.Context.User.Username} tried executing '{e.Command?.QualifiedName ?? "<unknown command>"}' but it errored: {e.Exception.GetType()}: {e.Exception.Message ?? "<no message>"}", DateTime.Now);
// let's check if the error is a result of lack
// of required permissions
if (e.Exception is ChecksFailedException)
{
// yes, the user lacks required permissions,
// let them know
var emoji = DiscordEmoji.FromName(e.Context.Client, ":no_entry:");
// let's wrap the response into an embed
var embed = new DiscordEmbedBuilder
{
Title = "Access denied",
Description = $"{emoji} You do not have the permissions required to execute this command.",
Color = new DiscordColor(0xFF0000) // red
};
await e.Context.RespondAsync("", embed: embed);
}
}
private Task Event_InteractionCreated(DiscordClient d, InteractionCreateEventArgs e)
+19 -5
View File
@@ -22,6 +22,7 @@ namespace StarsiegeBot
[Group("deathmessage"), Aliases("dm")]
[Description("Gives a random death message. Or interacts with the death messages.")]
[Cooldown(1, 2, CooldownBucketType.Guild)]
class DeathMessages : BaseCommandModule
{
private readonly Random rnd = new Random();
@@ -118,6 +119,7 @@ namespace StarsiegeBot
[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.")]
[Cooldown(1, 2, CooldownBucketType.Guild)]
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.
@@ -130,12 +132,18 @@ namespace StarsiegeBot
// Let Discord know we're typing.
await ctx.TriggerTypingAsync();
// Message the owner know some one wants to add a new death message, along with a code block to that message.
await Program.notify.SendMessageAsync($"{ctx.Message.Author.Username} wantes to add the death messages. ```{msg}```");
// if the Queue is null, make it exist.
if (dmLines.queue is null)
dmLines.queue = new List<string>();
// add the message to the queue list.
dmLines.queue.Add(msg);
// Store the new stuff to file...
await StoreDeathMessages();
// Tell the person that the message has been added to a 'queue'.
await ctx.RespondAsync("Your request has been added to the pending queue of requests.");
}
[Command("script")]
[Description("Gets a script file for all the death messages on the bot.")]
public async Task DeathMessagesScript(CommandContext ctx)
@@ -201,6 +209,13 @@ namespace StarsiegeBot
// We're done with the file, so close access to it.
sound.Close();
}
private async Task StoreDeathMessages()
{
string output = JsonConvert.SerializeObject(dmLines);
await File.WriteAllTextAsync("DeathMessages.json", output);
return;
}
}
class DeathMessageLines
{
@@ -211,9 +226,8 @@ namespace StarsiegeBot
[JsonProperty("generic")]
public string[] generic { get; set; }
public string[] flagged { get; set; }
public List<String> flagged { get; set; }
public string[] queue { get; set; }
public List<String> queue { get; set; }
}
}