Update ai information
This commit is contained in:
parent
7f079eb43b
commit
e46c4427cc
7 changed files with 31 additions and 11 deletions
|
|
@ -21,6 +21,10 @@ const registerModuleUser = (
|
|||
startConditions: [`${config.app.triggerPrefix}me`],
|
||||
callbackFunc: onMe,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startConditions: [`${config.app.triggerPrefix}myinfo `],
|
||||
callbackFunc: onMyInfo,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startConditions: [`${config.app.triggerPrefix}leaderboard`],
|
||||
callbackFunc: onLeaderboard,
|
||||
|
|
@ -51,6 +55,22 @@ const onMe = (text: string, roomId: string, sender: string) => {
|
|||
);
|
||||
};
|
||||
|
||||
const onMyInfo = (text: string, roomId: string, sender: string) => {
|
||||
const user = getUserById(sender);
|
||||
const newInformation = text.replace(
|
||||
`${config.app.triggerPrefix}myinfo `,
|
||||
"",
|
||||
);
|
||||
|
||||
if (!user || newInformation.length < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
user.information = newInformation;
|
||||
|
||||
client.sendTextMessage(roomId, "Information updated");
|
||||
};
|
||||
|
||||
const onLeaderboard = (_text: string, roomId: string) => {
|
||||
const mapUsersToLeaderboard = (user: IUser): string => {
|
||||
const level = getLevel(user.experience);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue