2019-02-11 21:23:32 +01:00
const random = require ( "./random" ) ;
const insults _fun = require ( "./insult" ) ;
2019-02-11 23:02:53 +01:00
const words _fun = require ( "./words" ) ;
2019-02-11 21:23:32 +01:00
const is = require ( "./is" ) ;
2019-02-12 00:07:50 +01:00
const weebify = require ( "./weebify" ) ;
2019-02-12 00:15:02 +01:00
const absurdify = require ( "./absurdify" ) ;
2019-02-12 08:40:01 +01:00
const feedback = require ( "./feedback" ) ;
2019-02-12 14:32:38 +01:00
const media _wiki = require ( "./media_wiki" ) ;
2019-02-12 19:28:22 +01:00
const info = require ( "./info" ) ;
2020-04-22 18:26:31 +02:00
const expand = require ( "./expand" ) ;
2021-06-21 19:15:23 +02:00
const roleplay = require ( "./roleplay" ) ;
2021-09-27 18:06:21 +02:00
const suggest = require ( "./suggest" ) ;
2023-10-14 17:47:06 +02:00
const dice = require ( "./dice" ) ;
2019-02-12 08:40:01 +01:00
2021-09-27 18:06:21 +02:00
module . exports = ( bot , [ questions , kys , insults , commands _list , words , roleplay _data ] , feedback _id , apiToken , ugokiRoot , axios ) => {
2019-02-11 21:23:32 +01:00
bot . command ( "question" , ( ctx ) => ctx . reply ( random ( questions ) ( ) ) ) ;
2019-02-11 23:02:53 +01:00
bot . command ( "word" , ( ctx ) => ctx . reply ( random ( words ) ( ) ) ) ;
bot . command ( "words" , ( ctx ) => ctx . reply ( words _fun ( random , words ) ( ctx ) ) ) ;
2019-02-11 22:39:42 +01:00
bot . telegram . getMe ( )
. then ( bot _user => {
2019-02-11 21:23:32 +01:00
2019-02-11 22:39:42 +01:00
const default _text = ( command , text ) => ` Do you want to ${ text } `
+ ` yourself? \n If no, reply to someone with / ${ command } to kill `
+ ` them or run / ${ command } username/name. \n You can suggest `
+ ` more / ${ command } replies using /feedback ` ;
bot . command ( "insult" , ( ctx ) => ctx . reply ( insults _fun ( random ,
insults , default _text ( "insult" , "insult" ) , "Watch who you talk"
+ " to." , [ "@" + bot _user . username , bot _user . firstName ] ) ( ctx ) ) ) ;
bot . command ( "kys" , ( ctx ) => ctx . reply ( insults _fun ( random , kys ,
default _text ( "kys" , "kill" ) , "I can't be killed." ,
[ "@" + bot _user . username , bot _user . firstName ] ) ( ctx ) ) ) ;
} ) ;
2019-02-11 21:23:32 +01:00
2021-06-21 19:48:13 +02:00
bot . command ( "commands" , ( ctx ) => ctx . reply ( commands _list . join ( "\n" ) , { parse _mode : "html" } ) ) ;
2019-02-11 21:33:56 +01:00
bot . command ( "is" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "are" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "can" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "will" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "shall" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "was" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "do" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "does" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "did" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
bot . command ( "should" , ( ctx ) => ctx . reply ( is ( random ) ( ctx ) ) ) ;
2019-02-11 21:23:32 +01:00
bot . command ( "coin" , ( ctx ) => ctx . reply ( random ( [ "Heads" , "Tails" ] ) ( ) ) ) ;
2019-02-11 23:20:29 +01:00
bot . command ( "help" , ( ctx ) => ctx . reply ( "You can either check /commands "
+ "for a short overview or check the [Help Page]"
+ "(https://t.me/quadnite/9)." , { parse _mode : "Markdown" } ) ) ;
bot . command ( "rate" , ( ctx ) => ctx . reply ( "[Vote for me on Telegram "
+ "Directory!](https://t.me/tgdrbot?start=quadnite_bot)" , { parse _mode :
"Markdown" } ) ) ;
2019-02-12 00:07:50 +01:00
bot . command ( "weebify" , ( ctx ) => ctx . reply ( weebify ( ) ( ctx ) ) ) ;
2019-02-12 00:15:02 +01:00
bot . command ( "absurdify" , ( ctx ) => ctx . reply ( absurdify ( ) ( ctx ) ) ) ;
2024-04-16 15:45:54 +02:00
bot . command ( "feedback" , ( ctx ) => ctx . reply ( feedback ( bot , feedback _id ) ( ctx ) ) ) ;
2019-02-12 14:32:38 +01:00
bot . command ( "wiki" , ( ctx ) => media _wiki ( axios ,
"https://en.wikipedia.org/w/api.php" ) ( ctx ) . then ( x => ctx . reply ( x ,
{ parse _mode : "HTML" } ) ) ) ;
bot . command ( "arch_wiki" , ( ctx ) => media _wiki ( axios ,
"https://wiki.archlinux.org/api.php" ) ( ctx ) . then ( x => ctx . reply ( x ,
{ parse _mode : "HTML" } ) ) ) ;
2019-02-12 19:28:22 +01:00
bot . command ( "info" , ( ctx ) => ctx . reply ( info ( ) ( ctx ) , { parse _mode : "Markdown" } ) ) ;
2020-04-22 18:26:31 +02:00
bot . command ( "expand" , ( ctx ) => ctx . reply ( expand ( words ) ( ctx ) ) ) ;
2019-07-17 11:22:12 +02:00
bot . command ( "start" , ( ctx ) => ctx . reply ( "Hi! I'm Octanite. Sibling of @quadnite_bot. My creator @ceda_ei created me as 'another option' to users who want the bot in their groups to have privacy mode enabled. \n\nPrivacy mode? Wut is that?\n- Well basically disabling privacy mode enables a bot to read all the messages. @quadnite_bot has that disabled. Enabling privacy mode causes the bot to not recieve messages at some times. To circumvet that, you need to append @octanite_bot to your commands or simply use @quadnite_bot. \n\n[P.S. - My creator doesn't store any messages or personal data. It's safe to use any of the two bots.]\nTo give feedback, use /feedback" ) ) ;
2023-10-19 17:50:20 +02:00
bot . hears ( /^\/?(\d*)d(\d+)(@\w+)?(\s*([-+])\s*(\d+))?$/i , dice ( ) ) ;
2019-02-11 21:23:32 +01:00
2021-10-06 19:29:08 +02:00
function getGetGif ( command ) {
const alias = roleplay _data [ command ] . alias ;
if ( alias )
return getGetGif ( alias ) ;
return ( ) => axios . get (
` category/ ${ command } /gif ` ,
{
baseURL : ugokiRoot
}
) ;
}
function getForms ( name ) {
if ( roleplay _data [ name ] . forms )
return roleplay _data [ name ] . forms ;
return getForms ( roleplay _data [ name ] . alias ) ;
}
2019-02-11 21:23:32 +01:00
2021-06-21 19:15:23 +02:00
// Add all roleplay commands
Object . keys ( roleplay _data ) . map ( command =>
2021-10-06 19:29:08 +02:00
bot . command ( command ,
( ctx ) => roleplay ( getForms ( command ) , getGetGif ( command ) ) ( ctx )
)
) ;
2021-06-21 19:15:23 +02:00
2021-09-27 18:06:21 +02:00
bot . command ( "suggest" , ( ctx ) => suggest ( axios , apiToken , ugokiRoot ) ( ctx ) ) ;
2021-06-21 19:15:23 +02:00
2019-02-11 21:23:32 +01:00
} ;