Allow aliases in roleplay.json. Add runs, sob, sobs, handhold aliases

This commit is contained in:
Ceda EI 2021-10-06 22:59:08 +05:30
parent f1740ce4c0
commit 4b8aecf28a
2 changed files with 44 additions and 7 deletions

View File

@ -67,16 +67,35 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay
+ "chatting with me in private, you are most likely doing it wrong. " + "chatting with me in private, you are most likely doing it wrong. "
+ "Add me to a group for fun. To give feedback, use /feedback")); + "Add me to a group for fun. To give feedback, use /feedback"));
const getGetGif = (command) => () => axios.get( function getGetGif(command) {
const alias = roleplay_data[command].alias;
if (alias)
return getGetGif(alias);
return () => axios.get(
`category/${command}/gif`, `category/${command}/gif`,
{ {
baseURL: ugokiRoot baseURL: ugokiRoot
} }
); );
}
function getForms(name) {
if (roleplay_data[name].forms)
return roleplay_data[name].forms;
return getForms(roleplay_data[name].alias);
}
// Add all roleplay commands // Add all roleplay commands
Object.keys(roleplay_data).map(command => Object.keys(roleplay_data).map(command =>
bot.command(command, ctx => roleplay(roleplay_data[command].forms, getGetGif(command))(ctx))); bot.command(command,
(ctx) => roleplay(getForms(command), getGetGif(command))(ctx)
)
);
bot.command("suggest", (ctx) => suggest(axios, apiToken, ugokiRoot)(ctx)); bot.command("suggest", (ctx) => suggest(axios, apiToken, ugokiRoot)(ctx));

View File

@ -143,6 +143,9 @@
"both": "{} is glomping {} for {}" "both": "{} is glomping {} for {}"
} }
}, },
"handhold": {
"alias": "holdhands"
},
"happy": { "happy": {
"forms": { "forms": {
"none": "{} is happy", "none": "{} is happy",
@ -319,6 +322,9 @@
"both": "{} is running from {} for {}" "both": "{} is running from {} for {}"
} }
}, },
"runs": {
"alias": "run"
},
"shoot": { "shoot": {
"forms": { "forms": {
"none": "{} is shooting", "none": "{} is shooting",
@ -359,6 +365,18 @@
"both": "{} is sleeping {} for {}" "both": "{} is sleeping {} for {}"
} }
}, },
"sob": {
"alias": "sobs"
},
"sobs": {
"alias": "cry",
"forms": {
"none": "{} is sobbing",
"others": "{} is sobbing due to {}",
"reason": "{} is sobbing because {}",
"both": "{} is sobbing due to {} because {}"
}
},
"snuggle": { "snuggle": {
"forms": { "forms": {
"none": "{} is snuggling", "none": "{} is snuggling",