123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- import random
- from rollbot import as_command, Message, RollbotFailure, Command, Attachment
- from rollbot.injection import (
- ChannelAdmin,
- OriginAdmin,
- Debugging,
- Args,
- SenderName,
- ArgList,
- Config,
- )
- @as_command
- def isadmin(channel: ChannelAdmin, origin: OriginAdmin):
- return f"Channel: {channel}, Origin: {origin}"
- @as_command
- def debug(message: Message, debugging: Debugging):
- return f"{message}\nLast Error: {debugging}"
- @as_command
- def echo(body: Args, name: SenderName):
- return f"'{body}' - {name}"
- @as_command
- def greet():
- return random.choice(("Hi!", "Hello!", "안녕하세요", "こんにちは", "你好", "👋"))
- @as_command
- def console(argstr: Args):
- opts = ["NEVER GIVE UP", "I believe in you!", "You're doing your best, it's okay!"]
- if len(argstr) > 0:
- opts.append("It'll be okay, {}! Keep trying!".format(argstr))
- return random.choice(opts)
- @as_command
- def choice(args: Args, arg_list: ArgList):
- for delim in ("|", ";", ","):
- if delim in args:
- opts = args.split(delim)
- break
- else:
- opts = arg_list
- chosen = random.choice(opts).strip()
- return f"Randomly chose {chosen} from {len(opts)} options"
- @as_command
- def inquire():
- opts = (
- "Yes",
- "No",
- "Maybe",
- "Perhaps",
- "I guess",
- "Probably shouldn't",
- "Ask again later",
- "u know ;)",
- "rand",
- )
- chosen = random.choice(opts)
- if chosen == "rand":
- chosen = str(random.randrange(10))
- return chosen
- @as_command
- def democracy(candidates: Config("democracy.candidates")):
- return f"Congratulations to {random.choice(candidates)}, thank you all for participating in the democratic process!"
- @as_command
- def shuffle(opts: ArgList):
- if len(opts) < 2:
- return f"You need more things to shuffle!"
- random.shuffle(opts)
- fmt = "\n".join(f"{i + 1} - {v}" for i, v in enumerate(opts))
- return "Random Order:\n" + fmt
- THE_GUY = """\
- 🖕 😎
- 🐛💤👔🐛
- ⛽ 👢
- ⚡8=👊=D💦
- 🎸 🌽
- 👢 👢
- """
- @as_command("hey")
- def the_guy(args: ArgList):
- for x, y in zip(args, ("can", "i", "have", "the", "guy")):
- if x.lower() != y:
- RollbotFailure.INVALID_ARGUMENTS.raise_exc()
- return THE_GUY
- HOUSE_TOP = """\
- ┏┓
- ┃┃╱╲ In this
- ┃╱╱╲╲ house
- ╱╱╭╮╲╲ we love
- ▔▏┗┛▕▔ & appreciate
- ╱▔▔▔▔▔▔▔▔▔▔╲
- """
- STFU_TOP = """\
- ┏┓
- ┃┃╱╲ Shut
- ┃╱╱╲╲ The
- ╱╱╭╮╲╲ Fuck
- ▔▏┗┛▕▔ Up
- ╱▔▔▔▔▔▔▔▔▔▔╲
- """
- HOUSE_BOT = """
- ╱╱┏┳┓╭╮┏┳┓ ╲╲
- ▔▏┗┻┛┃┃┗┻┛▕▔
- """
- @as_command
- def appreciate(args: Args):
- return HOUSE_TOP + (" " * (20 - len(args))) + args + HOUSE_BOT
- @as_command
- def stfu(args: Args):
- return STFU_TOP + (" " * (20 - len(args))) + args + HOUSE_BOT
- @as_command
- def meme():
- return "I love you." if random.randint(1, 20) == 20 else "fuck off"
- Fs = """
- FFFFFFFFFFFFFFFFFFFFF
- FFFFFFFFFFFFFFFFFFFFF
- FFFFFFFFFFFFFFFFFFFFF
- FFFFFFF
- FFFFFFF
- FFFFFFF
- FFFFFFFFFFFFFF
- FFFFFFFFFFFFFF
- FFFFFFFFFFFFFF
- FFFFFFF
- FFFFFFF
- FFFFFFF
- FFFFFFF
- FFFFFFF
- """.strip()
- @as_command("f")
- def finchat(cmd: Command):
- return "frick!" if cmd.raw_name == "f" else Fs
- @as_command
- def reply(msg: Message):
- return "Replying!", Attachment(name="reply", body=msg.message_id)
|