fix: fix dcs changes

This commit is contained in:
Lala Sabathil 2025-02-11 10:24:29 +01:00
parent a02fd32990
commit 1b2fc0f3b9
No known key found for this signature in database
4 changed files with 24 additions and 24 deletions

View file

@ -1,4 +1,4 @@
// Project Makoto // Project Makoto
// Copyright (C) 2024 Fortunevale // Copyright (C) 2024 Fortunevale
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -180,7 +180,7 @@ public sealed partial class DebugCommands : ApplicationCommandsModule
} }
} }
[SlashCommand("developertools", "Developer Tools used to manage Makoto.", dmPermission: false, defaultMemberPermissions: (long)Permissions.None)] [SlashCommand("developertools", "Developer Tools used to manage Makoto.", defaultMemberPermissions: (long)Permissions.None, allowedContexts: [InteractionContextType.Guild])]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0075:Simplify conditional expression", Justification = "<Pending>")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0075:Simplify conditional expression", Justification = "<Pending>")]
public async Task DevTools(InteractionContext ctx, public async Task DevTools(InteractionContext ctx,
[Autocomplete(typeof(MaintainerAutoComplete))][Option("command", "The command to run.", true)] string command, [Autocomplete(typeof(MaintainerAutoComplete))][Option("command", "The command to run.", true)] string command,

View file

@ -1,4 +1,4 @@
// Project Makoto // Project Makoto
// Copyright (C) 2024 Fortunevale // Copyright (C) 2024 Fortunevale
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -225,7 +225,7 @@ internal sealed class CustomEmbedCommand : BaseCommand
var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream));
GeneratedEmbed.Author.IconUrl = asset.Attachments[0].Url; GeneratedEmbed.Author.IconUrl = asset.Attachments[0].Url.ToString();
continue; continue;
} }
else if (Menu2.GetCustomId() == SetByUser.CustomId) else if (Menu2.GetCustomId() == SetByUser.CustomId)
@ -320,7 +320,7 @@ internal sealed class CustomEmbedCommand : BaseCommand
var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream));
GeneratedEmbed.Thumbnail.Url = asset.Attachments[0].Url; GeneratedEmbed.Thumbnail.Url = asset.Attachments[0].Url.ToString();
continue; continue;
} }
else if (Menu1.GetCustomId() == SetDescription.CustomId) else if (Menu1.GetCustomId() == SetDescription.CustomId)
@ -384,7 +384,7 @@ internal sealed class CustomEmbedCommand : BaseCommand
var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream));
GeneratedEmbed.ImageUrl = asset.Attachments[0].Url; GeneratedEmbed.ImageUrl = asset.Attachments[0].Url.ToString();
continue; continue;
} }
else if (Menu1.GetCustomId() == SetColor.CustomId) else if (Menu1.GetCustomId() == SetColor.CustomId)
@ -499,7 +499,7 @@ internal sealed class CustomEmbedCommand : BaseCommand
var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream)); var asset = await (await ctx.Client.GetChannelAsync(ctx.Bot.status.LoadedConfig.Channels.OtherAssets)).SendMessageAsync(new DiscordMessageBuilder().WithContent($"{ctx.User.Mention} `{ctx.User.GetUsernameWithIdentifier()} ({ctx.User.Id})`").WithFile($"{Guid.NewGuid()}.png", stream.stream));
GeneratedEmbed.Footer.IconUrl = asset.Attachments[0].Url; GeneratedEmbed.Footer.IconUrl = asset.Attachments[0].Url.ToString();
continue; continue;
} }
else if (Menu2.GetCustomId() == SetByUser.CustomId) else if (Menu2.GetCustomId() == SetByUser.CustomId)

View file

@ -1,4 +1,4 @@
// Project Makoto // Project Makoto
// Copyright (C) 2024 Fortunevale // Copyright (C) 2024 Fortunevale
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -63,7 +63,7 @@ internal sealed class EmbedMessagesEvents(Bot bot) : RequiresTranslation(bot)
ImageUrl = (message.Attachments?.Count > 0 && (message.Attachments[0].Filename.EndsWith(".png") ImageUrl = (message.Attachments?.Count > 0 && (message.Attachments[0].Filename.EndsWith(".png")
|| message.Attachments[0].Filename.EndsWith(".jpeg") || message.Attachments[0].Filename.EndsWith(".jpeg")
|| message.Attachments[0].Filename.EndsWith(".jpg") || message.Attachments[0].Filename.EndsWith(".jpg")
|| message.Attachments[0].Filename.EndsWith(".gif")) ? message.Attachments[0].Url : ""), || message.Attachments[0].Filename.EndsWith(".gif")) ? message.Attachments[0].Url.ToString() : ""),
Timestamp = message.Timestamp, Timestamp = message.Timestamp,
}).AddComponents(JumpToMessage, Delete)); }).AddComponents(JumpToMessage, Delete));
} }

View file

@ -1,4 +1,4 @@
// Project Makoto // Project Makoto
// Copyright (C) 2024 Fortunevale // Copyright (C) 2024 Fortunevale
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -159,23 +159,23 @@ public static class DiscordExtensions
}))}" + }))}" +
$"{string.Join("", msg.Attachments?.Select(x => $"{string.Join("", msg.Attachments?.Select(x =>
{ {
var tempUrl = x.Url.TruncateAt(true, '?'); var tempUrl = x.Url.ToString().TruncateAt(true, '?');
var type = string.Empty; var type = string.Empty;
var alt = x.Description; var alt = x.Description;
if (x.Url.EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase) || if (x.Url.ToString().EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".jpeg", StringComparison.InvariantCultureIgnoreCase) || x.Url.ToString().EndsWith(".jpeg", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase) || x.Url.ToString().EndsWith(".png", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".webp", StringComparison.InvariantCultureIgnoreCase) || x.Url.ToString().EndsWith(".webp", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".gifv", StringComparison.InvariantCultureIgnoreCase) || x.Url.ToString().EndsWith(".gifv", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase)) x.Url.ToString().EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase))
type = "image"; type = "image";
else if (x.Url.EndsWith(".webm", StringComparison.InvariantCultureIgnoreCase) || else if (x.Url.ToString().EndsWith(".webm", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".mp4", StringComparison.InvariantCultureIgnoreCase)) x.Url.ToString().EndsWith(".mp4", StringComparison.InvariantCultureIgnoreCase))
type = "video"; type = "video";
else if (x.Url.EndsWith(".wav", StringComparison.InvariantCultureIgnoreCase) || else if (x.Url.ToString().EndsWith(".wav", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase) || x.Url.ToString().EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase) ||
x.Url.EndsWith(".mp3", StringComparison.InvariantCultureIgnoreCase)) x.Url.ToString().EndsWith(".mp3", StringComparison.InvariantCultureIgnoreCase))
type = "audio"; type = "audio";
else else
{ {
@ -551,10 +551,10 @@ public static class DiscordExtensions
=> DigitsToEmotes(i.ToString()); => DigitsToEmotes(i.ToString());
public static string ToTimestamp(this DateTime dateTime, TimestampFormat format = TimestampFormat.RelativeTime) public static string ToTimestamp(this DateTime dateTime, TimestampFormat format = TimestampFormat.RelativeTime)
=> Formatter.Timestamp(dateTime, format); => dateTime.Timestamp(format);
public static string ToTimestamp(this DateTimeOffset dateTime, TimestampFormat format = TimestampFormat.RelativeTime) public static string ToTimestamp(this DateTimeOffset dateTime, TimestampFormat format = TimestampFormat.RelativeTime)
=> Formatter.Timestamp(dateTime, format); => dateTime.Timestamp(format);
public static string GetCommandMention(this DiscordClient client, Bot bot, string command) public static string GetCommandMention(this DiscordClient client, Bot bot, string command)
=> (bot.status.LoadedConfig.IsDev ? => (bot.status.LoadedConfig.IsDev ?