fish.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:apex-sigma 作者: lu-ci 项目源码 文件源码
def fish(cmd, message, args):
    all_fish = get_all_items('fish', cmd.resource('data'))
    if not cmd.cooldown.on_cooldown(cmd, message):
        cmd.cooldown.set_cooldown(cmd, message, 60)
        kud = cmd.db.get_points(message.author)
        if kud['Current'] >= 20:
            cmd.db.take_points(message.guild, message.author, 20)
            rarity = roll_rarity()
            if args:
                if message.author.id in permitted_id:
                    try:
                        rarity = int(args[0])
                    except TypeError:
                        pass
            all_items_in_rarity = get_items_in_rarity(all_fish, rarity)
            item = secrets.choice(all_items_in_rarity)
            value = item.value
            connector = 'a'
            if item.rarity_name[0].lower() in ['a', 'e', 'i', 'o', 'u']:
                connector = 'an'
            if value == 0:
                response_title = f'{item.icon} You caught {connector} {item.name} and threw it away!'
            else:
                response_title = f'{item.icon} You caught {connector} {item.rarity_name} {item.name}!'
                item_id = make_item_id()
                data_for_inv = {
                    'item_id': item_id,
                    'item_file_id': item.item_file_id,
                }
                cmd.db.inv_add(message.author, data_for_inv)
            response = discord.Embed(color=item.color, title=response_title)
            response.set_author(name=message.author.display_name, icon_url=user_avatar(message.author))
            if item.rarity >= 5:
                await notify_channel_of_special(message, cmd.bot.get_all_channels(), ItemWinChannelID, item)
        else:
            response = discord.Embed(color=0xDB0000, title=f'? You don\'t have enough {Currency}!')
    else:
        timeout = cmd.cooldown.get_cooldown(cmd, message)
        response = discord.Embed(color=0x696969, title=f'?? Your new bait will be ready in {timeout} seconds.')
    await message.channel.send(embed=response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号