コード例 #1
0
ファイル: start.py プロジェクト: Divirad/pokemonadventurebot
    def no_name(self, bot: Bot, update: Update, trainer: Trainer,
                database: Database):
        """Dont want to Rename"""
        delete_message(bot, update)
        bot.send_message(
            trainer.id,
            text="Nice! Have fun with your new friend! You two seem very strong!"
            " Click on the button bellow to show the Mainmenu.",
            reply_markup=InlineKeyboardMarkup([[
                InlineKeyboardButton("Menu",
                                     callback_data=str(ButtonId.MAINMENU))
            ]]))

        trainer.menu_id = int(MenuId.MAIN_MENU)
        trainer.lastcatched = None
        trainer.update_values(database, "menu_id, lastcatched")
コード例 #2
0
ファイル: start.py プロジェクト: Divirad/pokemonadventurebot
    def choosed(self, bot: Bot, update: Update, trainer: Trainer,
                database: Database):
        """Choose Pokemon"""
        data = update.callback_query.data
        species = int(data.replace(str(ButtonId.CHOOSE_STARTER), ""))

        poke = Pokemon.create_new(database, all_species[species], 5, trainer)
        delete_message(bot, update)
        bot.sendSticker(trainer.id, Stickerpacks.get_item(0))
        bot.send_message(trainer.id,
                         text="Nice, " + poke.name +
                         " is your first Pokémon!\n" +
                         poke.species.pokedextext +
                         "\nDo you want to give your Pokémon a nickname?",
                         reply_markup=self.return_rename_buttons())
        trainer.menu_id = int(MenuId.CHOOSE_IF_RENAME)
        trainer.lastcatched = poke.id
        trainer.update_values(database, "menu_id, lastcatched")
        dexter = Pokedex(poke.id, trainer.id)
        dexter.create_new(database, poke.species.id, trainer)
コード例 #3
0
ファイル: start.py プロジェクト: Divirad/pokemonadventurebot
    def rename(self, bot: Bot, update: Update, trainer: Trainer,
               database: Database):
        """Rename Pokemon"""
        trainer.load_values(database=database, values="lastcatched")
        poke = Pokemon(trainer.lastcatched)
        poke.load_values(database, "species_id")

        name = update.message.text[0:16].replace(" ", "")

        c = True

        for c in name:
            if (not (c.isupper() or c.islower())):
                c = False

        if c:
            poke.name = name
            trainer.menu_id = int(MenuId.MAIN_MENU)
            trainer.lastcatched = None
            trainer.update_values(database, "menu_id, lastcatched")
            poke.update_values(database, "name")
            bot.send_message(
                trainer.id,
                text=
                "You want to call your {1} {0}? Great! I think you will become good friends. Your {0} seems very strong! Click on the button bellow to show the Mainmenu."
                .format(poke.name, poke.species.name),
                reply_markup=InlineKeyboardMarkup([[
                    InlineKeyboardButton("Menu",
                                         callback_data=str(ButtonId.MAINMENU))
                ]]))

        else:
            bot.send_message(
                trainer.id,
                text=
                "Youuuu little rascal. There were bad character in this name, try it again."
            )