30 lines
691 B
Python
30 lines
691 B
Python
import random
|
|
|
|
from ..functions import reply
|
|
from ..models import Message
|
|
|
|
HELP = """Entscheidet zwischen A und B.
|
|
@me: <A> oder <B>?
|
|
"""
|
|
|
|
|
|
def init(bot):
|
|
bot.on_message(handle)
|
|
|
|
|
|
async def handle(message: Message):
|
|
if not (
|
|
message.text.endswith("?") and "oder" in message.tokens and message.is_for_me
|
|
):
|
|
return
|
|
|
|
_, text = message.text.split(None, 1)
|
|
args = text[:-1].split(" oder ")
|
|
if ":" in args[0]:
|
|
args[0] = args[0].split(":", 1)[1]
|
|
elif "-" in args[0]:
|
|
args[0] = args[0].split("-", 1)[1]
|
|
choice = random.choice(args).strip(" ,.:")
|
|
if not choice:
|
|
return
|
|
await reply(message, plain=choice, with_name=True)
|