Skip to content

Commit

Permalink
Merge branch 'main' into floatingmilkshake/dsp-command-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Dec 15, 2024
2 parents 18b6699 + db92550 commit 08c424a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 83 deletions.
10 changes: 5 additions & 5 deletions Cliptok.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

<ItemGroup>
<PackageReference Include="Abyssal.HumanDateParser" Version="2.0.0-20191113.1" />
<PackageReference Include="DSharpPlus" Version="5.0.0-nightly-02426" />
<PackageReference Include="DSharpPlus.Commands" Version="5.0.0-nightly-02426" />
<PackageReference Include="DSharpPlus" Version="5.0.0-nightly-02430" />
<PackageReference Include="DSharpPlus.Commands" Version="5.0.0-nightly-02430" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="4.1.0" />
<PackageReference Include="Serilog" Version="4.2.0" />
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Grafana.Loki" Version="8.3.0" />
<PackageReference Include="Serilog.Sinks.TextWriter" Version="3.0.0" />
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
<PackageReference Include="StackExchange.Redis" Version="2.8.22" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>
Expand Down
77 changes: 0 additions & 77 deletions Commands/DebugCmds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,83 +625,6 @@ public async Task SearchMembersCmd(TextCommandContext ctx, string regex)
await ctx.Channel.SendMessageAsync(await StringHelpers.CodeOrHasteBinAsync(JsonConvert.SerializeObject(memberIdsTonames, Formatting.Indented), "json"));
}

[Command("rawmessage")]
[Description("Dumps the raw data for a message.")]
[TextAlias("rawmsg")]
[IsBotOwner]
public async Task DumpRawMessage(TextCommandContext ctx, [Description("The message whose raw data to get.")] string msgLinkOrId)
{
DiscordMessage message;
if (Constants.RegexConstants.discord_link_rx.IsMatch(msgLinkOrId))
{
// Assume the user provided a message link. Extract channel and message IDs to get message content.

// Pattern to extract channel and message IDs from URL
var idPattern = new Regex(@"(?:.*\/)([0-9]+)\/([0-9]+)$");

// Get channel ID
var targetChannelId = Convert.ToUInt64(idPattern.Match(msgLinkOrId).Groups[1].ToString().Replace("/", ""));

// Try to fetch channel
DiscordChannel channel;
try
{
channel = await ctx.Client.GetChannelAsync(targetChannelId);
}
catch
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I couldn't fetch the channel from your message link! Please try again.");
return;
}

// Get message ID
var targetMessage = Convert.ToUInt64(idPattern.Match(msgLinkOrId).Groups[2].ToString().Replace("/", ""));

// Try to fetch message
try
{
message = await channel.GetMessageAsync(targetMessage);
}
catch
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I couldn't fetch the message from your message link! Please try again.");
return;
}
}
else
{
if (msgLinkOrId.Length < 17)
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That doesn't look right. Try again.");
return;
}

ulong messageId;
try
{
messageId = Convert.ToUInt64(msgLinkOrId);
}
catch
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That doesn't look like a valid message ID. Try again.");
return;
}

try
{
message = await ctx.Channel.GetMessageAsync(messageId);
}
catch
{
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I wasn't able to read that message! Please try again.");
return;
}
}

var rawMsgData = JsonConvert.SerializeObject(message, Formatting.Indented);
await ctx.RespondAsync(await StringHelpers.CodeOrHasteBinAsync(rawMsgData, "json"));
}

private static async Task<(bool success, ulong failedOverwrite)> ImportOverridesFromChannelAsync(DiscordChannel channel)
{
// Imports overrides from the specified channel to the database. See 'debug overrides import' and 'debug overrides importall'
Expand Down
9 changes: 9 additions & 0 deletions Commands/UtilityCmds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ namespace Cliptok.Commands
{
public class UtilityCmds
{
[Command("Dump message data")]
[SlashCommandTypes(DiscordApplicationCommandType.MessageContextMenu)]
[AllowedProcessors(typeof(MessageCommandProcessor))]
public async Task DumpMessage(MessageCommandContext ctx, DiscordMessage targetMessage)
{
var rawMsgData = JsonConvert.SerializeObject(targetMessage, Formatting.Indented);
await ctx.RespondAsync(await StringHelpers.CodeOrHasteBinAsync(rawMsgData, "json"), ephemeral: true);
}

[Command("Show Avatar")]
[SlashCommandTypes(DiscordApplicationCommandType.UserContextMenu)]
[AllowedProcessors(typeof(UserCommandProcessor))]
Expand Down
1 change: 1 addition & 0 deletions GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
global using DSharpPlus.Commands.ContextChecks;
global using DSharpPlus.Commands.EventArgs;
global using DSharpPlus.Commands.Exceptions;
global using DSharpPlus.Commands.Processors.MessageCommands;
global using DSharpPlus.Commands.Processors.SlashCommands;
global using DSharpPlus.Commands.Processors.SlashCommands.ArgumentModifiers;
global using DSharpPlus.Commands.Processors.TextCommands;
Expand Down
7 changes: 6 additions & 1 deletion Lists/scams.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ in just 72 hours without no doubts from the crypto market
you will have to pay me my commission! Once you receive your profit!
jennyRol221
3729830
I'll teach 10 people to earn $30K within a week. But you’ll pay me 10% of your profits when you receive it. Drop a message let's get started by asking (HOW) via
I'll teach 10 people to earn $30K within a week
But you’ll pay me 10% of your profits when you receive it
WhatsApp: +1 (862) 707‑4856
Official_Mark0
if anyone that’s new to trading and needs help learning
Expand Down Expand Up @@ -539,3 +540,7 @@ interested on how to start earning $100k
Free deposit 100$
Promocode:Open2024
gambler.icu
serious about earning over $50K weekly in the digital market
% of your profits once you start seeing earnings
get started by asking (How)
coach_davidrobert

0 comments on commit 08c424a

Please sign in to comment.