Explorar el Código

README, bugfix in apply for opening event handler

singulart hace 2 años
padre
commit
956e01b5d5

+ 5 - 1
scripts/wg-bot/README.md

@@ -2,9 +2,13 @@
 
 Discord Bot which informs Joystream DAO about the important events related to working groups: new openings, review periods, hires, fires, applications etc. Built in Node.js.
 
-Supports new Working Groups introduced in Olympia network. (Add context link)
+Supports new Working Groups [introduced in Giza network](https://github.com/Joystream/helpdesk/tree/master/roles). 
 
 
+# Configuration
+
+The main configuration file is `src/config.ts`. Here, the mapping between the Working Groups and Discord channels is kept. You may map several Working Groups to a single channnel, or have each Working Group notifications sent to a dedicated channel, depending on your needs. Make sure your bot has appropriate permissions to channels you configured in `src/config.ts`. 
+
 # Installation
 
 Build with `yarn`

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

@@ -50,7 +50,7 @@ export const processBlock = async (api: ApiPromise, client: Discord.Client, bloc
                         const applicationOpeningId = data[0] as OpeningId;
                         const applicationId = data[1] as ApplicationId;
                         const application = await getApplication(api, section, hash, applicationId);
-                        const hiringApplication = await getHiringApplication(api, section, hash, applicationId);
+                        const hiringApplication = await getHiringApplication(api, section, hash, application.application_id);
                         const hiringApplicationText = JSON.parse(hiringApplication.human_readable_text.toString());
                         const openingObject = await getOpening(api, section, hash, applicationOpeningId);
                         const hiringOpening = await getHiringOpening(api, hash, openingObject.hiring_opening_id);

+ 1 - 1
scripts/wg-bot/src/joystream/embeds.ts

@@ -3,7 +3,7 @@ import { formatBalance } from '@polkadot/util';
 import { u128 } from '@polkadot/types';
 import { EventRecord } from '@polkadot/types/interfaces';
 import Discord from 'discord.js';
-import { ApplicationId, ApplicationOf, Membership, OpeningOf, RewardRelationship, Stake, WorkerOf } from '@joystream/types/augment-codec/all';
+import { ApplicationId, ApplicationOf, Membership, OpeningOf, RewardRelationship, Stake } from '@joystream/types/augment-codec/all';
 
 
 export const getMintCapacityChangedEmbed = (minted: number, mint: u128, blockNumber: number, event: EventRecord): Discord.MessageEmbed => {

+ 1 - 1
scripts/wg-bot/src/simulate.ts

@@ -9,7 +9,7 @@ const eventsMapping = {
     'OpeningFilled': 4206250,
     'OpeningAdded': 4224720,
     'WorkerRewardAmountUpdated': 4222426,
-    'AppliedOnOpening': 4252114,
+    'AppliedOnOpening': 4264168,
 }