Use ugoki server instead of hard coded gifs
This commit is contained in:
parent
159ca9e87d
commit
7527fb6a1a
|
@ -67,9 +67,16 @@ 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(
|
||||||
|
`category/${command}/gif`,
|
||||||
|
{
|
||||||
|
baseURL: ugokiRoot
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// 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, roleplay_data[command].gifs)(ctx)));
|
bot.command(command, ctx => roleplay(roleplay_data[command].forms, getGetGif(command))(ctx)));
|
||||||
|
|
||||||
bot.command("suggest", (ctx) => suggest(axios, apiToken, ugokiRoot)(ctx));
|
bot.command("suggest", (ctx) => suggest(axios, apiToken, ugokiRoot)(ctx));
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,8 @@ function joinUsers(users) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = (forms, gifs) => (ctx) => {
|
module.exports = (forms, getGif) => (ctx) => {
|
||||||
|
|
||||||
const gif = gifs[Math.floor(Math.random() * gifs.length)];
|
|
||||||
const message = ctx.message.text.replace(/^[^ ]+\s*/, "")
|
const message = ctx.message.text.replace(/^[^ ]+\s*/, "")
|
||||||
.match(/^((@\w+(\s+|$))*)(.*)/);
|
.match(/^((@\w+(\s+|$))*)(.*)/);
|
||||||
const users = message[1].trim().split(" ").filter(i => i.length);
|
const users = message[1].trim().split(" ").filter(i => i.length);
|
||||||
|
@ -39,6 +38,7 @@ module.exports = (forms, gifs) => (ctx) => {
|
||||||
reply = forms.none
|
reply = forms.none
|
||||||
.replace("{}", user);
|
.replace("{}", user);
|
||||||
|
|
||||||
ctx.replyWithAnimation(gif, {caption: reply});
|
getGif()
|
||||||
|
.then(gif => ctx.replyWithAnimation(gif.data.url, {caption: reply}));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
692
roleplay.json
692
roleplay.json
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue