import random from rollbot import as_plugin from config import get_secret @as_plugin def isadmin(message): return message.from_admin @as_plugin def debug(message): return message @as_plugin def echo(message): return "'%s' - %s" % (message.raw_args or "", message.name) @as_plugin def greet(): return random.choice(("Hi!", "Hello!", "안녕하세요", "こんにちは", "你好", "👋")) @as_plugin def console(message): argstr = message.raw_args opts = [ "NEVER GIVE UP", "I believe in you!", "You're doing your best, it's okay!" ] if argstr is not None: opts.append("It'll be okay, {}! Keep trying!".format(argstr)) return random.choice(opts) @as_plugin def choice(message): opts = list(message.args()) chosen = random.choice(opts) return f"Randomly chose {chosen} from {len(opts)} options" @as_plugin def inquire(message): opts = "Yes", "No", "Maybe", "Perhaps", "I guess", "Probably shouldn't", "rand" chosen = random.choice(opts) if chosen == "rand": chosen = str(random.randrange(10)) return chosen @as_plugin def democracy(): chosen = random.choice(get_secret("democracy.candidates")) return f"Congratulations to {chosen}, thank you all for participating in the democratic process!"