I decided to go back to a bot project that I was working on in 2022. I upgraded it from .NetFramework to .Net Core 7.0, and it builds. (somehow)
I've run into an issue though. When I send a command, my bot receives the event, but the message content is empty (As shown in the image). The DSharp+ version being used previously was 4.2.0.0 (According to the CSProj), I'm now using 4.4.3.
This is the method that handles commands once they're sent (Gotten from some YouTube tutorial):
private async Task CommandHandler(DiscordClient client, MessageCreateEventArgs e)
{
var cnext = client.GetCommandsNext();
var msg = e.Message;
var cmdStart = msg.GetStringPrefixLength("!");
if (cmdStart == -1)
cmdStart = msg.GetStringPrefixLength("/");
if (cmdStart == -1)
return;
var cmdString = msg.Content[cmdStart..];
var command = cnext.FindCommand(cmdString, out var args);
if (command is null)
{
Logging.LogError($"\n[CB] Command \n<\n Author : {msg.Author}\n Message : {msg.Content}\n " +
$" Channel : {msg.Channel}\n Guild : {msg.Channel.Guild.Name} ({msg.Channel.Guild.Id})\n>" +
$"\nFailed execution => Command not found");
Logging.Send($"Could not find a command by the name of '{cmdString.Split()[0]}'", e.Channel.Id);
}
else
Logging.Log($"\n[CB] Command found \n<\n Author : {msg.Author}\n Message : {msg.Content}\n " +
$" Channel : {msg.Channel}\n Guild : {msg.Channel.Guild.Name} ({msg.Channel.Guild.Id})\n>\n");
}
Congrats if you managed to get through this code without having a seizure, cause I sure did.
Is there something wrong with this code, did I set it up wrong somewhere else?
I'll gladly give more code/information if needed.
Thanks in advance!