Exemple #1
0
def inlinequery(update, context):
    query = context.inline_query.query
    results = []
    for game in Global.games:
        if query.lower() in game.lower():
            results.append(
                InlineQueryResultGame(id=str(uuid4()), game_short_name=game))
    context.inline_query.answer(results)
    def test_equality(self):
        a = InlineQueryResultGame(self.id, self.game_short_name)
        b = InlineQueryResultGame(self.id, self.game_short_name)
        c = InlineQueryResultGame(self.id, '')
        d = InlineQueryResultGame('', self.game_short_name)
        e = InlineQueryResultVoice(self.id, '', '')

        assert a == b
        assert hash(a) == hash(b)
        assert a is not b

        assert a == c
        assert hash(a) == hash(c)

        assert a != d
        assert hash(a) != hash(d)

        assert a != e
        assert hash(a) != hash(e)
Exemple #3
0
def inlineGame(bot, update):
    games = getBotSettings()['games']
    query = update.inline_query.query
    inline_games = list()
    for game in games:
        if game['name'].startswith(query):
            inline_games.append(
                InlineQueryResultGame(type='game',
                                      id=str(uuid4()),
                                      game_short_name=game['game_short_name']))
    update.inline_query.answer(inline_games)
Exemple #4
0
def inlinequery(bot, update):
    """Handle the inline query."""
    
    query = update.inline_query.query
    results = [
      
        InlineQueryResultGame(
            id=uuid4(),
            game_short_name="Obstacle_2D"
            )
        ]

    update.inline_query.answer(results)
def inline_query_result_game():
    return InlineQueryResultGame(
        TestInlineQueryResultGame.id,
        TestInlineQueryResultGame.game_short_name,
        reply_markup=TestInlineQueryResultGame.reply_markup)
Exemple #6
0
def show(update, context):
    idd = str(uuid4())
    print(idd)
    game = InlineQueryResultGame(idd, "Binod")
    x = update.inline_query.answer([game])
    print(x)
Exemple #7
0
def inline_handler(update: Update, ctx: CallbackContext):
    query: InlineQuery = update.inline_query
    ctx.bot.answer_inline_query(inline_query_id=query.id,
                                results=[InlineQueryResultGame(id='play2048', game_short_name=config.game_name)])