Explorar o código

TerminatedLeader fixed

singulart %!s(int64=2) %!d(string=hai) anos
pai
achega
eee493060b
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  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
 }