Browse Source

TerminatedLeader fixed

singulart 2 years ago
parent
commit
eee493060b
2 changed files with 4 additions and 2 deletions
  1. 2 2
      scripts/wg-bot/src/joystream/discord.ts
  2. 2 0
      scripts/wg-bot/src/simulate.ts

+ 2 - 2
scripts/wg-bot/src/joystream/discord.ts

@@ -103,10 +103,10 @@ export const processBlock = async (api: ApiPromise, client: Discord.Client, bloc
                     case "TerminatedLeader":
                     case "TerminatedWorker":
                         const terminatedId = data[0] as WorkerId;
-                        const terminatedReason = (data[1] as RationaleText).toString();
+                        const terminatedReason = (data[1] as RationaleText).toHuman();
                         const terminatedIdWorker = await getWorker(api, section, hash, terminatedId.toNumber());
                         const terminatedMember = await getMember(api, terminatedIdWorker.member_id);
-                        channel.send({ embeds: [getWorkerTerminatedEmbed(terminatedMember, terminatedReason, blockNumber, value)] });
+                        channel.send({ embeds: [getWorkerTerminatedEmbed(terminatedMember, terminatedReason.toString(), blockNumber, value)] });
                         break;
                     case "WorkerExited":
                         const exitedId = data[0] as WorkerId;

+ 2 - 0
scripts/wg-bot/src/simulate.ts

@@ -13,6 +13,8 @@ const eventsMapping = {
     'StakeIncreased': 4264798,
     'StakeDecreased': 4264862,
     'BeganApplicationReview': 4276739,
+    'TerminatedLeader': 4282370,
+    'LeaderUnset': 4282370
 }