Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

feat: Add SkillAttribution and DeleteSkillAttribution events to socket definition #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions src/defs/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,91 @@ export interface IClearMessage {
user_level: number;
};
}

export interface ISkillAttribution {
/**
* The Id of the message.
*/
id: string;
/**
* The skill being triggered
*/
skill: {
/**
* The skill's Id.
*/
skill_id: string;
/**
* The skill's name.
*/
skill_name: string;
/**
* The skill's execution id.
*/
execution_id: string;
/**
* The skill's icon url.
*/
icon_url: string;
/**
* The amount of currency used to trigger skill.
*/
cost: number;
/**
* The type of currency used to trigger skill.
*/
currency: 'Sparks' | 'Embers';
};
/**
* The user's Id.
*/
user_id: number;
/**
* The user's level.
*/
user_level: number;
/**
* The user's name.
*/
user_name: string;
/**
* The roles the user has.
*/
user_roles: string[];
/**
* The user's avatar url
*/
user_avatar: string;
/**
* The message payload.
*/
message: IMessagePacketComponents;
}

export interface IDeleteSkillAttribution {
/**
* The skill's execution id.
*/
execution_id: string;
/**
* The moderator that performed the action.
*/
moderator: {
/**
* The moderator's Id.
*/
user_id: number;
/**
* The moderator's name.
*/
user_name: string;
/**
* The roles the moderator has.
*/
user_roles: string[];
/**
* The level of the moderator
*/
user_level: number;
};
}
4 changes: 4 additions & 0 deletions src/socket/Socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
IUserConnection,
IUserTimeout,
IUserUpdate,
IDeleteSkillAttribution,
ISkillAttribution,
} from '../defs/chat';
import {
AuthenticationFailedError,
Expand Down Expand Up @@ -182,6 +184,8 @@ export class Socket extends EventEmitter {
public on(event: 'UserLeave', cb: (join: IUserConnection) => any): this;
public on(event: 'UserTimeout', cb: (timeout: IUserTimeout) => any): this;
public on(event: 'UserUpdate', cb: (update: IUserUpdate) => any): this;
public on(event: 'SkillAttribution', cb: (update: ISkillAttribution) => any): this;
public on(event: 'DeleteSkillAttribution', cb: (update: IDeleteSkillAttribution) => any): this;
// tslint:disable-next-line: no-unnecessary-override
public on(event: string, cb: any): this {
return super.on(event, cb);
Expand Down