コード例 #1
0
ファイル: setup.py プロジェクト: pavirp29/TacoBot
def new_chat_callback(bot, message):
    """ triggers when bot gets added to new chat """

    cid = get_cid(message)
    store_name(message)

    invited_by = message.from_user

    Chats.create(cid=cid, invited_by=invited_by.id)

    Tacos.create(chat=cid)

    bot.send_message(cid, chat_enabled_phrase, parse_mode='html')
コード例 #2
0
def new_chat_callback(update,
                      context):  # triggers when bot gets added to new chat
    cid = get_cid(update)
    store_name(update)

    invited_by = update.effective_message.from_user

    name = store_name(update)

    Chats.create(cid=cid, invited_by=invited_by.id)

    context.bot.send_message(cid,
                             new_group_phrase.format(name),
                             parse_mode=ParseMode.HTML)
コード例 #3
0
ファイル: setup.py プロジェクト: ulpaulpa/TacoBot
def new_chat_callback(bot, message):
    """ triggers when bot gets added to new chat """

    cid = get_cid(message)
    if message.from_user is not None:
        store_name(message.from_user)

    invited_by = message.from_user
    if invited_by is None:
        invited_by = -1
    else:
        invited_by = invited_by.id

    with db:
        Chats.create(cid=cid, invited_by=invited_by)

        Tacos.create(chat=cid)

    bot.send_message(cid, chat_enabled_phrase, parse_mode='html')