Skip to content

Commit

Permalink
Add world name to character name.
Browse files Browse the repository at this point in the history
Add workflow for discord updates
  • Loading branch information
RenNagasaki committed Sep 7, 2024
1 parent e0355fb commit 07e8f1f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/github-releases-to-discord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
release:
types: [published]

jobs:
github-releases-to-discord:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Github Releases To Discord
uses: SethCohen/[email protected]
with:
webhook_url: ${{ secrets.WEBHOOK_URL }}
color: "2105893"
username: "New Release"
avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png"
content: "<@&1263501199156445265> - There's a new Release for Echosync!"
footer_title: "New release"
footer_icon_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png"
footer_timestamp: true
6 changes: 3 additions & 3 deletions Echosync/Helper/AddonTalkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private unsafe void OnPostDraw(AddonEvent type, AddonArgs args)
{
activeDialogue = dialogue;
SyncClientHelper.CurrentEvent = LogHelper.EventId(MethodBase.GetCurrentMethod().Name, Enums.TextSource.Sync);
SyncClientHelper.CreateMessage(SyncMessages.JoinDialogue, clientState.LocalPlayer?.Name.TextValue ?? "TEST", activeDialogue);
SyncClientHelper.CreateMessage(SyncMessages.JoinDialogue, activeDialogue);
}


Expand All @@ -81,7 +81,7 @@ private unsafe void OnPostDraw(AddonEvent type, AddonArgs args)
if (!visible && !string.IsNullOrWhiteSpace(activeDialogue) && SyncClientHelper.Connected)
{
LogHelper.Info(MethodBase.GetCurrentMethod().Name, $"Addon closed", SyncClientHelper.CurrentEvent);
SyncClientHelper.CreateMessage(SyncMessages.LeaveDialogue, clientState.LocalPlayer?.Name.TextValue ?? "TEST", activeDialogue);
SyncClientHelper.CreateMessage(SyncMessages.LeaveDialogue, activeDialogue);
LogHelper.End(MethodBase.GetCurrentMethod().Name, SyncClientHelper.CurrentEvent);
readySend = false;
SyncClientHelper.AllReady = false;
Expand Down Expand Up @@ -110,7 +110,7 @@ private unsafe void OnPreReceiveEvent(AddonEvent type, AddonArgs args)

if (!readySend)
{
SyncClientHelper.CreateMessage(SyncMessages.Click, clientState.LocalPlayer?.Name.TextValue ?? "TEST", activeDialogue);
SyncClientHelper.CreateMessage(SyncMessages.Click, activeDialogue);
readySend = true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Echosync/Helper/SyncClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static void RequestChannel(SyncMessages message, string channel)
}
}

public static void CreateMessage(SyncMessages message, string extra = "", string extra2 = "")
public static void CreateMessage(SyncMessages message, string extra = "")
{
try
{
Expand All @@ -149,10 +149,10 @@ public static void CreateMessage(SyncMessages message, string extra = "", string
return;
}

var characterName = "|" + ClientState.LocalPlayer?.Name.TextValue + "@" + ClientState.LocalPlayer?.HomeWorld.Id ?? "TEST";
extra = !string.IsNullOrWhiteSpace(extra) ? "|" + extra : "";
extra2 = !string.IsNullOrWhiteSpace(extra2) ? "|" + extra2 : "";

var bodyString = $"{((int)message)}{extra}{extra2}";
var bodyString = $"{((int)message)}{characterName}{extra}";
WebSocket.Send(bodyString);
LogHelper.Info(MethodBase.GetCurrentMethod().Name, $"Sent '{message.ToString()}' to channel: {ActiveChannel}", CurrentEvent);
}
Expand Down

0 comments on commit 07e8f1f

Please sign in to comment.