mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 12:44:16 +01:00
Revert "fix: catch some discord bot errors"
This reverts commit 64f07a8c02.
This commit is contained in:
parent
64f07a8c02
commit
5410981beb
3 changed files with 17 additions and 31 deletions
|
|
@ -75,7 +75,7 @@ namespace Dalamud.Injector {
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
#if NO
|
#if DEBUG
|
||||||
// Inject exception handler
|
// Inject exception handler
|
||||||
NativeInject(process);
|
NativeInject(process);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -188,35 +188,27 @@ namespace Dalamud.DiscordBot {
|
||||||
string senderName;
|
string senderName;
|
||||||
string senderWorld;
|
string senderWorld;
|
||||||
|
|
||||||
if (this.dalamud.ClientState.LocalPlayer != null) {
|
if (playerLink == null) {
|
||||||
if (playerLink == null)
|
// chat messages from the local player do not include a player link, and are just the raw name
|
||||||
|
// but we should still track other instances to know if this is ever an issue otherwise
|
||||||
|
|
||||||
|
// Special case 2 - When the local player talks in party/alliance, the name comes through as raw text,
|
||||||
|
// but prefixed by their position number in the party (which for local player may always be 1)
|
||||||
|
if (sender.TextValue.EndsWith(this.dalamud.ClientState.LocalPlayer.Name))
|
||||||
{
|
{
|
||||||
// chat messages from the local player do not include a player link, and are just the raw name
|
senderName = this.dalamud.ClientState.LocalPlayer.Name;
|
||||||
// but we should still track other instances to know if this is ever an issue otherwise
|
|
||||||
|
|
||||||
// Special case 2 - When the local player talks in party/alliance, the name comes through as raw text,
|
|
||||||
// but prefixed by their position number in the party (which for local player may always be 1)
|
|
||||||
if (sender.TextValue.EndsWith(this.dalamud.ClientState.LocalPlayer.Name))
|
|
||||||
{
|
|
||||||
senderName = this.dalamud.ClientState.LocalPlayer.Name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.Error("playerLink was null. Sender: {0}", BitConverter.ToString(sender.Encode()));
|
|
||||||
|
|
||||||
senderName = wasOutgoingTell ? this.dalamud.ClientState.LocalPlayer.Name : sender.TextValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
senderWorld = this.dalamud.ClientState.LocalPlayer.HomeWorld.GameData.Name;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
senderName = wasOutgoingTell ? this.dalamud.ClientState.LocalPlayer.Name : playerLink.PlayerName;
|
Log.Error("playerLink was null. Sender: {0}", BitConverter.ToString(sender.Encode()));
|
||||||
senderWorld = playerLink.World.Name;
|
|
||||||
|
senderName = wasOutgoingTell ? this.dalamud.ClientState.LocalPlayer.Name : sender.TextValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
senderWorld = this.dalamud.ClientState.LocalPlayer.HomeWorld.GameData.Name;
|
||||||
} else {
|
} else {
|
||||||
senderName = string.Empty;
|
senderName = wasOutgoingTell ? this.dalamud.ClientState.LocalPlayer.Name : playerLink.PlayerName;
|
||||||
senderWorld = string.Empty;
|
senderWorld = playerLink.World.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rawMessage = message.TextValue;
|
var rawMessage = message.TextValue;
|
||||||
|
|
|
||||||
|
|
@ -170,13 +170,7 @@ namespace Dalamud.Game {
|
||||||
|
|
||||||
var messageCopy = message;
|
var messageCopy = message;
|
||||||
var senderCopy = sender;
|
var senderCopy = sender;
|
||||||
Task.Run(async () => {
|
Task.Run(() => this.dalamud.BotManager.ProcessChatMessage(type, messageCopy, senderCopy));
|
||||||
try {
|
|
||||||
await this.dalamud.BotManager.ProcessChatMessage(type, messageCopy, senderCopy);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Log.Error(ex, "Could not process discord bot message.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle all of this with SeString some day
|
// Handle all of this with SeString some day
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue