mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
fix: some exception handling in BotManager
This commit is contained in:
parent
a9b388f9de
commit
721527dd11
1 changed files with 69 additions and 48 deletions
|
|
@ -90,6 +90,7 @@ namespace Dalamud.DiscordBot {
|
|||
if (!this.IsConnected)
|
||||
return;
|
||||
|
||||
try {
|
||||
var contentName = cfc.Name;
|
||||
|
||||
if (this.config.CfNotificationChannel == null)
|
||||
|
|
@ -107,10 +108,17 @@ namespace Dalamud.DiscordBot {
|
|||
};
|
||||
|
||||
await channel.SendMessageAsync(embed: embedBuilder.Build());
|
||||
} catch (Exception ex) {
|
||||
Log.Error(ex, "Could not process CF pop.");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ProcessCfPreferredRoleChange(string rouletteName, string prevRoleName, string currentRoleName)
|
||||
{
|
||||
if (!this.IsConnected)
|
||||
return;
|
||||
|
||||
try {
|
||||
if (this.config.CfPreferredRoleChannel == null)
|
||||
return;
|
||||
|
||||
|
|
@ -125,7 +133,8 @@ namespace Dalamud.DiscordBot {
|
|||
{
|
||||
Title = "Roulette bonus changed: " + rouletteName,
|
||||
Description = $"From {prevRoleName} to {currentRoleName}",
|
||||
Footer = new EmbedFooterBuilder {
|
||||
Footer = new EmbedFooterBuilder
|
||||
{
|
||||
Text = $"On {world} | XIVLauncher"
|
||||
},
|
||||
Timestamp = DateTimeOffset.Now,
|
||||
|
|
@ -133,9 +142,16 @@ namespace Dalamud.DiscordBot {
|
|||
};
|
||||
|
||||
await channel.SendMessageAsync(embed: embedBuilder.Build());
|
||||
} catch (Exception ex) {
|
||||
Log.Error(ex, "Could not process preferred role.");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ProcessRetainerSale(uint itemId, int amount, bool isHq) {
|
||||
if (!IsConnected)
|
||||
return;
|
||||
|
||||
try {
|
||||
if (this.config.RetainerNotificationChannel == null)
|
||||
return;
|
||||
|
||||
|
|
@ -146,20 +162,25 @@ namespace Dalamud.DiscordBot {
|
|||
var character = this.dalamud.ClientState.LocalPlayer;
|
||||
var characterInfo = await GetCharacterInfo(character.Name, character.HomeWorld.GameData.Name);
|
||||
|
||||
var embedBuilder = new EmbedBuilder {
|
||||
var embedBuilder = new EmbedBuilder
|
||||
{
|
||||
Title = (isHq ? "<:hq:593406013651156994> " : "") + item.Name,
|
||||
Url = "https://www.garlandtools.org/db/#item/" + itemId,
|
||||
Description = "Sold " + amount,
|
||||
Timestamp = DateTimeOffset.Now,
|
||||
Color = new Color(0xd89b0d),
|
||||
ThumbnailUrl = "https://xivapi.com" + item.Icon,
|
||||
Footer = new EmbedFooterBuilder {
|
||||
Footer = new EmbedFooterBuilder
|
||||
{
|
||||
Text = $"XIVLauncher | {character.Name}",
|
||||
IconUrl = characterInfo.AvatarUrl
|
||||
}
|
||||
};
|
||||
|
||||
await channel.SendMessageAsync(embed: embedBuilder.Build());
|
||||
} catch (Exception ex) {
|
||||
Log.Error(ex, "Could not process retainer msg.");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ProcessChatMessage(XivChatType type, SeString message, SeString sender) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue