mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 19:54:25 -05:00
Merge pull request #198 from ect0s/test
Added Squad Created event binding to server object
This commit is contained in:
commit
4e0dc392c4
@ -288,6 +288,16 @@ export default class SquadServer extends EventEmitter {
|
|||||||
this.logParser.on('TICK_RATE', (data) => {
|
this.logParser.on('TICK_RATE', (data) => {
|
||||||
this.emit('TICK_RATE', data);
|
this.emit('TICK_RATE', data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.logParser.on('SQUAD_CREATED', (data) => {
|
||||||
|
|
||||||
|
data.player = await this.getPlayerBySteamID(data.playerSteamID, true)
|
||||||
|
delete data.playerName
|
||||||
|
delete data.playerSteamID
|
||||||
|
delete data.squadID
|
||||||
|
|
||||||
|
this.emit('SQUAD_CREATED', data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async restartLogParser() {
|
async restartLogParser() {
|
||||||
|
@ -56,7 +56,7 @@ export default class DiscordSquadCreated extends DiscordBasePlugin {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'Player',
|
name: 'Player',
|
||||||
value: info.playerName,
|
value: info.player.name,
|
||||||
inline: true
|
inline: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,7 +66,7 @@ export default class DiscordSquadCreated extends DiscordBasePlugin {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Squad Number & Squad Name',
|
name: 'Squad Number & Squad Name',
|
||||||
value: `${info.squadID} : ${info.squadName}`
|
value: `${info.player.squadID} : ${info.squadName}`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
timestamp: info.time.toISOString()
|
timestamp: info.time.toISOString()
|
||||||
@ -75,7 +75,7 @@ export default class DiscordSquadCreated extends DiscordBasePlugin {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
await this.sendDiscordMessage(` \`\`\`Player: ${info.playerName}\n created Squad ${info.squadID} : ${info.squadName}\n on ${info.teamName}\`\`\` `)
|
await this.sendDiscordMessage(` \`\`\`Player: ${info.player.name}\n created Squad ${info.player.squadID} : ${info.squadName}\n on ${info.teamName}\`\`\` `)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user