Ejemplo n.º 1
0
def ctx_to_mention(ctx):
    """Convert requester name to Mention"""
    if user_is_irc_bot(ctx):
        return Mention.string_mention(get_name_string(ctx))
    else:
        return Mention.id_mention(get_database_user(ctx.author).id)
Ejemplo n.º 2
0
    ]

    db_session.add_all(users)

    db_session.add_all(TEST_QUOTES)

    # Add some opt-outs
    db_session.add(QuoteOptouts(user_type=MentionType.ID, user_id=3, user_string=None))

    db_session.commit()
    return db_session


QUERY_QUOTES = {
    "By ID": (1, [TEST_QUOTES[0]]),
    "By Author (Discord)": (Mention.id_mention(1), [TEST_QUOTES[0], TEST_QUOTES[4]]),
    "By Author (IRC/String)": (
        Mention.string_mention("ircguy"),
        [TEST_QUOTES[1], TEST_QUOTES[3]],
    ),
    "By Topic": ("irc", [TEST_QUOTES[1], TEST_QUOTES[3], TEST_QUOTES[4]]),
    "No valid quotes": ("blargleargle", []),
}

ADD_QUOTES = {
    "Discord user quote": (
        Mention.id_mention(1),
        "Foo said this",
        datetime(1998, 12, 24),
        7,
        '**#7:** "Foo said this" - <@1000> (24/12/1998)',