benbot/src/Commands/Fun.php

200 lines
9.1 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace BenBot\Commands;
use BenBot\Utils;
final class Fun
{
private static $bot;
public static function register(&$that)
{
self::$bot = $that;
self::$bot->registerCommand('roll', [__CLASS__, 'rollDie'], [
'description' => 'rolls an n-sided die (defaults to 6-sided)',
'usage' => '[number of sides]',
'registerHelp' => true,
]);
self::$bot->registerCommand('8ball', [__CLASS__, 'ask8Ball'], [
'description' => 'ask the mighty 8-ball',
'usage' => '<your question to ask here>',
'registerHelp' => true,
'aliases' => [
'8b',
'fortune',
],
]);
self::$bot->registerCommand('lenny', [__CLASS__, 'lennyFace'], [
'description' => 'you should know what this does',
]);
self::$bot->registerCommand('shrug', [__CLASS__, 'shrugGuy'], [
'description' => 'meh',
'aliases' => [
'meh',
],
]);
self::$bot->registerCommand('noice', [__CLASS__, 'noice'], [
'description' => 'ayy lmao',
]);
self::$bot->registerCommand('copypasta', [__CLASS__, 'copyPasta'], [
'description' => 'get random copypasta',
]);
self::$bot->registerCommand('kaomoji', [__CLASS__, 'kaomoji'], [
'description' => 'shows a cool japanese emoji face thing',
'usage' => '[sad|happy|angry|confused|surprised]',
'registerHelp' => true,
]);
self::$bot->registerCommand('bamboozle', [__CLASS__, 'bamboozle'], [
'description' => 'bamboozled again',
'usage' => '[@user]',
]);
self::$bot->registerCommand('trap', [__CLASS__, 'trap'], [
'description' => 'hmm',
]);
echo __CLASS__ . " registered", PHP_EOL;
}
public static function rollDie($msg, $args)
{
return "{$msg->author}, you rolled a " . rand(1, $args[0] == "" ? 6 : $args[0]);
}
public static function ask8Ball($msg, $args)
{
$fortunes = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful",
];
if (count($args) > 0) {
$response = "Your question: *" . implode(" ", $args) . "*\n\n**";
$response .= $fortunes[array_rand($fortunes)] . "**";
Utils::send($msg, $response)->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
} else {
return "{$msg->author}, you have to ask a question!";
}
}
public static function lennyFace($msg, $args)
{
echo "lenny", PHP_EOL;
Utils::send($msg, "( ͡° ͜ʖ ͡°)\n--{$msg->author}")->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
}
public static function shrugGuy($msg, $args)
{
echo "meh", PHP_EOL;
Utils::send($msg, "¯\\\_(ツ)\_/¯")->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
}
public static function noice($msg, $args)
{
$bs = "
:ok_hand: :joy:
:ok_hand::joy:
  :joy:
:joy::ok_hand:
:joy: :ok_hand:
:joy:  :ok_hand:
:joy:  :ok_hand:
:joy: :ok_hand:
:joy: :ok_hand:
  :ok_hand:
 :ok_hand: :joy:
:ok_hand:  :joy:
:ok_hand:  :joy:
:ok_hand: :joy:
:ok_hand::joy:
  :joy:
:joy::ok_hand:
:joy: :ok_hand:
:joy:  :ok_hand:
:joy:  :ok_hand:
:joy: :ok_hand:
:joy: :ok_hand:
  :ok_hand:";
Utils::send($msg, $bs)->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
}
public static function copyPasta($msg, $args)
{
return self::$bot->copypastas[array_rand(self::$bot->copypastas)];
}
public static function kaomoji($msg, $args)
{
$kaomojis = [
'sad' => ['(_<。)', '(*-_-)', '(´-ω-`)', '.・゚゚・(/ω\)・゚゚・.', '(μ_μ)', '(ノД`)', '(-ω-、)', '。゜゜(´`) ゜゜。', 'o(TヘTo)', '( ; ω ; )', '(。╯3╰。)', '。・゚゚*(>д<)*゚゚・。', '( ゚_ゝ)', '(个_个)', '(╯︵╰,)', '。・゚(゚><゚)゚・。', '( ╥ω╥ )', '(╯_╰)', '(╥_╥)', '.。・゚゚・(_)・゚゚・。.', '(/ˍ・、)', '(_<、)', '(╥﹏╥)', '。゚(。ノωヽ。)゚。', '(つω`*)', '(。T ω T。)', '(ノω・、)', '・゚・(。>ω<。)・゚・', '(T_T)', '(>_<)', '(T▽T)', '。゚・ (><) ・゚。', 'o(〒﹏〒)o', '(。•́︿•̀。)', '(ಥ﹏ಥ)'],
'happy' => ['(* ^ ω ^)', '(´ ∀ ` *)', '٩(◕‿◕。)۶', '☆*:.。.o(≧▽≦)o.。.:*☆', '(o^▽^o)', '(⌒▽⌒)☆', '<( ̄︶ ̄)>', 'ヽ(・∀・)ノ', '(´。• ω •。`)', '( ̄ω ̄)', ';:゛;;・(°ε° )', '(o・ω・o)', '()', 'ヽ(*・ω・)ノ', '(o_ _)ノ彡☆', '(^人^)', '(o´▽`o)', '(*´▽`*)', '。゚( ゚^∀^゚)゚。', '( ´ ω ` )', '(((o(*°▽°*)o)))', '(≧◡≦)', '(o´∀`o)', '(´• ω •`)', '(^▽^)', '(⌒ω⌒)', '∑d(°∀°d)', '╰(▔∀▔)╯', '(─‿‿─)', '(*^‿^*)', 'ヽ(o^―^o)ノ', '(✯◡✯)', '(◕‿◕)', '(*≧ω≦*)', '(☆▽☆)', '(⌒‿⌒)', '(≧▽≦)', '⌒(oo)', '(*°▽°*)', '٩(。•́‿•̀。)۶', '(✧ω✧)', 'ヽ(*⌒▽⌒*)ノ', '(´。• ᵕ •。`)', '( ´ ▽ ` )', '( ̄▽ ̄)', '╰(*´︶`*)╯', 'ヽ(>∀<☆)', 'o(≧▽≦)o', '(☆ω☆)', '(っ˘ω˘ς )', '( ̄▽ ̄)', '(*¯︶¯*)', '(^▽^)', '٩(◕‿◕)۶', '(o˘◡˘o)', '\(★ω★)/', '\(^ヮ^)/', '(〃^▽^〃)', '(╯✧▽✧)╯', 'o(>ω<)o', 'o( ❛ᴗ❛ )o', '。゚(TヮT)゚。', '( ‾́ ◡ ‾́ )', '(ノ´ヮ`)ノ*: ・゚'],
'angry' => ['(`Д´)', '(`皿´#)', '( ` ω ´ )', 'ヽ( `д´*)', '(・`ω´・)', '(`ー´)', 'ヽ(`⌒´メ)', '凸(`△´#)', '( `ε´ )', 'ψ( ` ∇ ´ )ψ', 'ヾ(`ヘ´)ノ゙', 'ヽ(´)', '(メ` ロ ´)', '(╬`益´)', '┌∩┐(◣_◢)┌∩┐', '凸( ` ロ ´ )凸', 'Σ(▼□▼メ)', '(°ㅂ°╬)', 'ψ(▼へ▼メ)~→', '(ノ°益°)', '(҂ `з´ )', '(‡▼益▼)', '(҂` ロ ´)凸', '((╬◣﹏◢))', '٩(╬ʘ益ʘ╬)۶', '(╬ Ò﹏Ó)', '\\٩(๑`^´๑)۶//', '(凸ಠ益ಠ)凸', '↑_(ΦwΦ)Ψ', '←~(Ψ▼ー▼)∈', '୧((#Φ益Φ#))', '٩(ఠ益ఠ)۶', '(ノಥ益ಥ)ノ'],
'confused' => ['( ̄ω ̄;)', 'σ( ̄、 ̄〃)', '( ̄~ ̄;)', '(-_-;)・・・', '(・_・ヾ', '(〃 ̄ω ̄〃ゞ', '┐( ̄ヘ ̄;)┌', '(・_・;)', '( ̄_ ̄)・・・', '╮( ̄ω ̄;)╭', '( ̄. ̄;)', '(_)', '(・・;)ゞ', 'Σ( ̄。 ̄ノ)', '(・・ ) ?', '(•ิ_•ิ)?', '(◎ ◎)ゞ', '(ーー;)', 'ლ(ಠ_ಠ ლ)', 'ლ(¯ロ¯"ლ)'],
'surprised' => ['w(°o°)w', 'ヽ(°〇°)ノ', 'Σ(O_O)', 'Σ(°ロ°)', '(⊙_⊙)', '(o_O)', '(O_O;)', '(O.O)', '(°ロ°) !', '(o_O) !', '(□_□)', 'Σ(□_□)', '∑(O_O;)', '( : : )'],
'embarrassed' => ['(⌒_⌒;)', '(o^ ^o)', '(*/ω\)', '(*/。\)', '(*/_)', '(*ノωノ)', '(o-_-o)', '(*μ_μ)', '( ◡‿◡ *)', '(ᵔ.ᵔ)', '(//ω//)', '(*°▽°*)', '(*^.^*)', '(*ノ▽ノ)', '( ̄▽ ̄*)ゞ', '( ⁄•⁄ω⁄•⁄ )', '(*/▽\*)', '( >< )'],
];
if (isset($args[0]) && isset($kaomojis[$args[0]])) {
Utils::send($msg, $kaomojis[$args[0]][array_rand($kaomojis[$args[0]])] . "\n\n--{$msg->author}")->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
} else {
$allkaomojis = Utils::arrayFlatten($kaomojis);
Utils::send($msg, $allkaomojis[array_rand($allkaomojis)] . "\n\n--{$msg->author}")->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
}
}
public static function bamboozle($msg, $args)
{
$response = count($msg->mentions) > 0 ? implode(", ", array_keys($msg->mentions)) : $msg->author;
$response .= ", you've been heccin' bamboozled again!!!!!!!!!!!!!!!!!!!!!!!!";
Utils::sendFile($msg, 'img/bamboozled.jpg', 'bamboozle.jpg', $response)->then(function ($result) use ($msg) {
Utils::deleteMessage($msg);
});
}
public static function trap($msg, $args)
{
Utils::deleteMessage($msg);
Utils::send($msg, "traps are gay")->then(function ($result) {
self::$bot->loop->addTimer(5, function ($timer) use ($result) {
Utils::editMessage($result, "traps aren't gay");
});
});
}
}