コード例 #1
0
 async def on_dbl_test(self, data):
     """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
     member = data['user']
     member = await self.bot.fetch_user(int(member))
     dbclient = DBClient()
     collection = dbclient.db.pointsdb
     data = await dbclient.get_array(
         collection,
         {'$and': [{
             'userid': str(member.id)
         }, {
             'userid': str(member.id)
         }]})
     async for d in data:
         user = d
         break
     old = user.copy()
     try:
         if user['userid'] == str(member.id):
             print(user)
             user['points'] += 5
     except:
         dbclient.create_doc(collection, {
             'userid': str(member.id),
             'points': 5
         })
     await dbclient.update_array(collection, old, user)
     try:
         await member.send('Thanks for voting! You\'ve been given 5 Lacans!'
                           )
     except:
         pass
コード例 #2
0
 async def remove(self, ctx, userid, amount):
     #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
     if (ctx.author.id) not in [505338178287173642, 637638904513691658, 396075607420567552]:
         embed = Embed('Error!', 'Lol, did you really think it\'s possible for you to add <:Lacan:766669740545540097> to a user when you are not a dev? Click [here](https://www.latlmes.com/entertainment/dev-application-1) to apply for dev.', 'warning')
         embed.footer('⚙️This command is a 🛠️developer🛠️ only command.⚙️', 'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png')
         await embed.send(ctx)
         return
     #data = json.loads(requests.get('https://pointsdb.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)['data']
     dbclient = DBClient()
     collection = dbclient.db.pointsdb
     data = await dbclient.get_array(collection, {'$and': [{'userid': str(userid)}, {'userid': str(userid)}]})
     async for d in data:
         user = d
         break
     try:
         old = user.copy()
         if user['userid'] == str(userid):
             user['points'] -= int(amount)
             userpoints = user['points']
             data = await dbclient.update_array(collection, old, user)
     except:
         dbclient.create_doc(collection, {'userid': str(userid), 'points': userpoints})
     embed = Embed('Success!', f'<@{ctx.author.id}> just removed **{amount}** <:Lacan:766669740545540097> from <@{userid}>\'s balance. \n<@{userid}> now has **{userpoints}** <:Lacan:766669740545540097>!', 'white_check_mark')
     embed.footer('Discord user '+str(ctx.author.name + '#' + ctx.author.discriminator)+' is a developer of this bot. \n⚙️This command is a 🛠️developer🛠️ only command.⚙️', 'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png')
     try:
       await ctx.message.delete()
     except:
       pass
     await embed.send(ctx)
コード例 #3
0
ファイル: verify.py プロジェクト: Lacan-NTSport/NB-alpha
    async def verify(self, ctx, type="race"):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        if type == 'car':
            return await verify(ctx)
        if type == 'race':
            #return await ctx.send('**Your** security is important for **us**! Because of security reasons, this command has been taken down and will be back soon. Thanks for your understanding.')
            dbclient = DBClient()
            collection = dbclient.db.NT_to_discord
            dbdata = await dbclient.get_big_array(collection, 'registered')
            for elem in dbdata['registered']:
                if elem['userID'] == str(ctx.author.id):
                    if elem['verified'] == 'false':
                        username = elem['NTuser']
                        embed = Embed(':clipboard:  Verify your Identity!', f'Join the race to verify **{username}** is owned by you. You don\'t own **{username}**? Run `n.unregister` to unlink your discord from this account.')
                        embed.field('__Instructions__', 'Once you join the race, the race leader will leave and you just have to type `n.verify` again to verify. If this does not work after several times typing `n.verify`, please try unregistering and registering again.')
                        embed.field('__Short instructions__', '**1.** Run `n.verify`\n**2.** Join the race track shown under the link category.\n**3.** Run `n.verify` again.')
                        embed.field('__Common errors__', 'Is the race leader not joining the race? Refresh your page, after maximal **4** refreshs the race leader joins and you can attempt to verify.')
                        embed.field('__Link__', 'Join [this](https://www.nitrotype.com/race/lacanverification) race to verify your identity.')
                        await embed.send(ctx)
                        elem['verifyCar'] = None
                        elem['verified'] = 'in progress'
                        dbclient = DBClient()
                        collection = dbclient.db.NT_to_discord
                        await dbclient.update_big_array(collection, 'registered', dbdata)
                        async with aiohttp.ClientSession() as s:
                            await self.fetch(s,'https://Lacan-Verification.try2win4code.repl.co')
                        break
                    if elem['verified'] == 'in progress':
                        async with aiohttp.ClientSession() as s:
                            response = await self.fetch(s,'https://Lacan-Verification.try2win4code.repl.co', method='GET')

                        data = json.loads(response)
                        if elem['NTuser'] in data['verified']:
                            elem['verified'] = 'true'
                            dbclient = DBClient()
                            await dbclient.update_big_array(collection, 'registered', dbdata)
                            embed = Embed('<a:Check:797009550003666955>  Success', 'You\'ve been verified! In case this is a premium 💠 server do `n.update` to update your roles.')
                            await embed.send(ctx)
                            break
                        else:
                            username = elem['NTuser']
                            embed = Embed('Nearly there!', f'You\'re nearly done - just one more step to go!\nYou are just about to verify your ownership for **{username}**. Not you? Run `n.unregister` to unlink your discord from this account.', 'warning')
                            embed.field('__Instructions__', 'Please join the race and run `n.verify` again.')
                            embed.field('__Common errors__', 'Is the race leader not joining the race? Run `n.verify` again and refresh your page, after maximal **5** times running the command, the race leader joins and you can attempt to verify.')
                            embed.field('__Link__', 'Join [this](https://www.nitrotype.com/race/lacanverification) race to verify your identity.')
                            await embed.send(ctx)
                            async with aiohttp.ClientSession() as s:
                                await self.fetch(s,'https://Lacan-Verification.try2win4code.repl.co')
                            break
                    if elem['verified'] == 'true':
                        embed = Embed('Error!', 'You are already verified :rofl:', 'joy')
                        return await embed.send(ctx)
            else:
                embed = Embed('Error!', 'You have not registered yet. Make sure to run `n.register <username>`', 'warning')
                await embed.send(ctx)
コード例 #4
0
    async def servernum(self, ctx):
        #activeservers = list (self.client.guilds)
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        #if (ctx.author.id) in [505338178287173642, 637638904513691658, 396075607420567552]:

        dbclient = DBClient()
        pcollection = dbclient.db.premium
        pdata = await dbclient.get_big_array(pcollection, 'premium')
        premnum = len(pdata['premium'])
        prempercentage = premnum / len(self.client.guilds) * 100

        totalusers = 0
        for guild in self.client.guilds:
            totalusers += guild.member_count
        comma_users = "{:,}".format(totalusers)

        guilds = len(self.client.guilds)
        divided_users = totalusers / guilds

        #Counts users in current guild
        #mcnew = len([m for m in ctx.guild.members if not m.bot])
        mcnew = sum([len(guild.members) for guild in self.client.guilds])
        mcnew = "{:,}".format(mcnew)

        dbclient = DBClient()
        collection = dbclient.db.NT_to_discord
        registeredusers = await collection.count_documents({})
        registered_users = "{:,}".format(registeredusers)

        verifiedusers = await collection.count_documents({"verified": "true"})
        verified_users = "{:,}".format(verifiedusers)

        verpercent = (verifiedusers / registeredusers) * 100
        '''embed=Embed(':1234:  Server Number', f'Check in how many servers I\'m used in!')
        embed.field('**__Guilds:__**', f'**`{len(self.client.guilds)}`**')
        embed.field('**__Total users:__**', f'**`{comma_users}`**')
        embed.field('**__Average users per guild:__**', f'**`{round(divided_users, 2)}`**')
        embed.field('**__Invite me:__**', '**`n.invite`**')
        embed.thumbnail('https://cdn.discordapp.com/avatars/713352863153258556/47823ecf46a380f770769b7a4a7c3449.png?size=256')
        return await embed.send(ctx)'''

        embed = Embed(
            'Server Number',
            f'**__Guilds:__ `{len(self.client.guilds)}`**\n\n**__Premium guilds:__ **`{premnum} ({round(prempercentage,2)}%)`\n\n**__Total users:__ `{mcnew}`**\n\n**__Registered users:__ `{registered_users}`**\n\n**__Verified users:__ `{verified_users} ({round(verpercent,2)}%)`**\n\n**__Users per guild:__ `{round(divided_users, 2)}`**\n\n**__Invite me:__ `n.invite`**',
            '1234')
        embed.thumbnail(
            'https://cdn.discordapp.com/avatars/713352863153258556/47823ecf46a380f770769b7a4a7c3449.png?size=256'
        )
        return await embed.send(ctx)
        '''embed=Embed('Server Number', f'Lacan NTSport is currently used in `{len(self.client.guilds)}` servers by `{comma_users}` users. \nThis is an average of `{round(divided_users, 2)}` users per server.\nIn order to invite me to your server, use `n.invite.`', '1234')
コード例 #5
0
    async def addpremium(self, ctx):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')

      

        if (ctx.author.id) not in [396075607420567552, 505338178287173642, 637638904513691658]:
            embed = Embed('Error!', 'You\'re not a developer of this bot! Click [here](https://www.latlmes.com/entertainment/dev-application-1) to apply for dev.', 'warning')

            embed.footer(f'⚙️This command is a 🛠️developer🛠️ only command.⚙️', 'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png')

            return await embed.send(ctx)
            
        #data = json.loads(requests.get('https://test-db.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)
        dbclient = DBClient()
        collection = dbclient.db.premium
        data = await dbclient.get_big_array(collection, 'premium')
        for x in data['premium']:
            if x['serverID'] == str(ctx.author.guild.id):
                embed = Embed('Error!', 'This server is already premium!', 'warning')
                embed.footer(f'⚙️This command is a 🛠️developer🛠️ only command.⚙️','https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png')
                return await embed.send(ctx)
        data['premium'].append({'serverID': str(ctx.author.guild.id)})
        #requests.post('https://test-db.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY'), 'data': json.dumps(data)})
        await dbclient.update_big_array(collection, 'premium', data)
        embed = Embed('Success!', f'Server {str(ctx.author.guild.id)} has been added to premium! Run `n.roles` to create the roles for the server!', 'white_check_mark')
        embed.footer(f'⚙️This command is a 🛠️developer🛠️ only command.⚙️', 'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png')
        await embed.send(ctx)
        try:
          await ctx.message.delete()
        except:
          pass
コード例 #6
0
 async def equip(self, ctx, index):
     if index == None:
         embed = Embed(
             'Error!',
             'Please choose which car you want to equip by index! Your first car will have the index 1.'
         )
         return await embed.send(ctx)
     dbclient = DBClient()
     collection = dbclient.db.pointsdb
     dbdata = await dbclient.get_array(
         collection, {
             '$and': [{
                 'userid': str(ctx.author.id)
             }, {
                 'userid': str(ctx.author.id)
             }]
         })
     async for d in dbdata:
         user = d
         break
     old = user.copy()
     try:
         user['equipped'] = user['cars'][int(index) - 1]
     except:
         embed = Embed(
             'Error!',
             f"Can't equip the car with index {index}! Run `n.cars` if you\'re not sure what Index your car, you want to equip, has.'"
         )
         return await embed.send(ctx)
     await dbclient.update_array(collection, old, user)
     embed = Embed(
         'Success!',
         f"You have equipped **{user['cars'][int(index)-1]['car']}**. In case this is currently a weekly or daily car, you\'ll earn double Lacans.'"
     )
     return await embed.send(ctx)
コード例 #7
0
 async def get_user_cred(self, userid):
     dbclient = DBClient()
     collection = dbclient.db.NT_to_discord
     data = await dbclient.get_array(collection, {})
     async for user in data:
         if user['userID'] == str(userid):
             return user['NTuser'], await self.decrypt(user['password'])
コード例 #8
0
 async def end(self, ctx, messageID: int):
     dbclient = DBClient()
     collection = dbclient.db.giveaways
     dbdata = await dbclient.get_array(collection, {"$and": [{"messageID": messageID}, {"messageID": messageID}]})
     async for d in dbdata:
         giveaway = d
         old = giveaway.copy()
         break
     try:
         giveaway['ended']
     except:
         embed = Embed('Error!', f'No giveaway found with message ID {messageID}')
         return await embed.send(ctx)
     if giveaway['ended'] == True:
         embed = Embed('Error!', 'This giveaway has ended! Try `n.reroll` to get another winner!')
         return await embed.send(ctx)
     channel = get(self.client.get_all_channels(), id=giveaway['channelID'])
     msg = get(await channel.history(limit=1000).flatten(), id=giveaway['messageID'])
     try:
         winner = random.choice(giveaway['joined'])
         if giveaway['joined'] == []:
             await msg.channel.send(f'No one won \n{msg.jump_url}')
         else:
             await msg.channel.send(f'<@{winner}> won {msg.jump_url}')
             
     except KeyError:
         await msg.channel.send(f'No one won because no one joined!\n{msg.jump_url}')
     giveaway['ended'] = True
     await dbclient.update_array(collection, old, giveaway)
コード例 #9
0
    async def password(self, ctx):

        var = await get_username(str(ctx.author.id))
        if var[0] == False:
            return await var[1].send(ctx)
        #embed=Embed('Password', 'Please enter your password **without** prefix below.')
        #await ctx.author.send(embed=embed.default_embed())
        await ctx.author.send('What is your password?')
        try:
            response = await self.client.wait_for(
                'message',
                check=self.message_check(channel=ctx.author.dm_channel),
                timeout=30)
        except asyncio.exceptions.TimeoutError:
            return await ctx.author.send(
                "You didn't type your password in time!")
        dbclient = DBClient()
        collection = dbclient.db.NT_to_discord
        data = await dbclient.get_big_array(collection, 'registered')
        for user in data['registered']:
            if user['userID'] == str(ctx.author.id) or user['NTuser'].lower(
            ) == var[1].username.lower():
                user['password'] = self.encrypt(response.content)
                break
        await dbclient.update_big_array(collection, 'registered', data)
        thepassword = (response.content)
        username = user['NTuser']
        embed = Embed(
            'Success!',
            f"Your password for your account `{username}` was successfuly set to `{thepassword}`, encrypted and added into the database!\n\n__Your Data:__\nusername: `{user['NTuser']}`\npassword: `{thepassword}` \n\n__Please note that:__ \n*1. This password is **safe**, it doesn't even exist unencrypted anymore.*\n*2. Wrong use of this command like putting wrong data into the bot on purpose can end in a **ban** of this bot as our database does not have enough space for wrong data.*",
            'white check mark')
        await embed.send(ctx, dm=True)
コード例 #10
0
    async def send(self, ctx, dm=False):
        if self.footer_exist == False:
            if ctx.author.id:
                pfp = ctx.author.avatar_url
                self.footer(self.content, pfp)

                dbclient = DBClient()
                pcollection = dbclient.db.premium
                pdata = await dbclient.get_big_array(pcollection, 'premium')
                for server in pdata['premium']:
                    if str(ctx.author.guild.id) == server['serverID']:
                        list_of_footers = [
                            'Thanks for being a premium 💠 server!💖'
                        ]
                        break
                else:
                    list_of_footers = ['Become a premium 💠 server today!']
                random_footer = random.choice(list_of_footers)
                self.embed.set_footer(icon_url=pfp,
                                      text=str(ctx.author) + ' • ' +
                                      random_footer)
            else:
                pfp = 'https://images-ext-1.discordapp.net/external/kTCQEW4t9lrrrjOSzuvR57sawc-ErICSo3wpT37klVE/https/media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
                self.embed.set_footer(
                    icon_url=pfp,
                    text='Discord user ' +
                    str(ctx.author.name + '#' + ctx.author.discriminator) +
                    ' is a developer of this bot.')
        if dm == True:
            return await ctx.author.send(embed=self.embed, content=None)
        self.sent = await ctx.send(embed=self.embed, content=None)
コード例 #11
0
 async def buy(self, ctx, item=None):
     if item == None:
         embed = Embed(
             'Error!',
             'Please choose to either buy the daily or weekly car! Ex: `n.buy daily`'
         )
         return await embed.send(ctx)
     dbclient = DBClient()
     collection = dbclient.db.pointsdb
     dbdata = await dbclient.get_array(
         collection, {
             '$and': [{
                 'userid': str(ctx.author.id)
             }, {
                 'userid': str(ctx.author.id)
             }]
         })
     async for d in dbdata:
         user = d
         break
     old = deepcopy(user)
     data = json.loads(
         requests.get(
             'https://lacanitemshop.nitrotypers.repl.co/data.json').text)
     if item == 'daily':
         data = data['daily']
         if user['points'] < int(data['price']):
             embed = Embed('Error!', 'You don\'t have enough lacans!')
             return await embed.send(ctx)
         try:
             if data in user['cars']:
                 embed = Embed('Error!',
                               "You've already bought the daily car!")
                 return await embed.send(ctx)
             user['cars'].append(data)
         except KeyError:
             user['cars'] = [data]
             user['equipped'] = data
         user['points'] -= int(data['price'])
         await dbclient.update_array(collection, old, user)
         embed = Embed('Success!', f"You've bought the {data['car']}")
         return await embed.send(ctx)
     elif item == 'weekly':
         data = data['weekly']
         if user['points'] < int(data['price']):
             embed = Embed('Error!', 'You don\'t have enough lacans!')
             return await embed.send(ctx)
         try:
             if data in user['cars']:
                 embed = Embed('Error!',
                               "You've already bought the weekly car!")
                 return await embed.send(ctx)
             user['cars'].append(data)
         except KeyError:
             user['cars'] = [data]
             user['equipped'] = data
         user['points'] -= int(data['price'])
         await dbclient.update_array(collection, old, user)
         embed = Embed('Success!', f"You've bought the {data['car']}")
         return await embed.send(ctx)
コード例 #12
0
 async def update_db(self, ctx):
     return
     f = open('pointsdb.json')
     data = json.loads(f.read())
     dbclient = DBClient()
     collection = dbclient.db.pointsdb
     for user in data['users']:
         await dbclient.create_doc(collection, user)
コード例 #13
0
 async def buypremium(self, ctx):
     dbclient = DBClient()
     collection = dbclient.db.premium
     data = await dbclient.get_big_array(collection, 'premium')
     for x in data['premium']:
         if x['serverID'] == str(ctx.author.guild.id):
             embed = Embed('Error!', 'This server is already premium!',
                           'warning')
             return await embed.send(ctx)
     else:
         del collection
         del data
     collection = dbclient.db.pointsdb
     data = await dbclient.get_array(
         collection, {
             '$and': [{
                 'userid': str(ctx.author.id)
             }, {
                 'userid': str(ctx.author.id)
             }]
         })
     async for d in data:
         data = d
         old = data.copy()
         break
     try:
         points = data['points']
     except:
         embed = Embed('Error!', 'The user doesn\'t have any lacans!')
         return await embed.send(ctx)
     data['points'] = int(points) - 3000
     if data['points'] < 0:
         embed = Embed('Error!', 'You do not have 3000 lacans!', 'rofl')
         return await embed.send(ctx)
     await dbclient.update_array(collection, old, data)
     embed = Embed(
         'Success!',
         'You have bought premium for this server, pending dev verification. \n\n*Please wait for a developer to accept your server for premium. If you get rejected, your lacans will be refunded.*',
         'white check mark')
     await embed.send(ctx)
     channel = discord.utils.get(self.client.get_all_channels(),
                                 id=810296381779476510)
     embed = Embed(
         'Someone Wants Premium!',
         'Click :ballot_box_with_check: to accept or :x: to deny.')
     embed.field('Guild ID', f'{str(ctx.guild.id)}')
     embed.field('Guild Name', f'{str(ctx.guild)}')
     embed.field('Buyer ID', f'{str(ctx.author.id)}')
     embed.field('Buyer Name', str(ctx.author))
     msg = await channel.send(embed=embed.default_embed())
     await msg.add_reaction('☑️')
     await msg.add_reaction('❌')
コード例 #14
0
ファイル: reroll.py プロジェクト: Lacan-NTSport/NB-alpha
    async def reroll(self, ctx, messageID: int):
        dbclient = DBClient()
        collection = dbclient.db.giveaways
        dbdata = await dbclient.get_array(collection, {"$and": [{"messageID": messageID}, {"messageID": messageID}]})
        giveaway = dbdata
        try:
            giveaway['ended']
        except:
            embed = Embed('Error!', f'No giveaway found with message ID `{messageID}`', 'warning')
            return await embed.send(ctx)
        if giveaway['ended'] == False:
            embed = Embed('Error!', 'This giveaway hasn\'t ended! Try `n.end` to end the giveaway!', 'warning')
            return await embed.send(ctx)
        channel = get(self.client.get_all_channels(), id=giveaway['channelID'])
        msg = get(await channel.history(limit=1000).flatten(), id=giveaway['messageID'])
        try:
          if ctx.message.channel.id == giveaway['channelID']:
            users = await msg.reactions[0].users().flatten()
            print(users)
            winner = []
            print(winner)

            list_of_lacans = ['<:lacan_economy_1:801006407536607262>','<:lacan_economy_2:801004873612132382>','<:lacan_economy_3:801004873214722079>','<:lacan_economy_4:801004868126113822>','<:lacan_economy_5:801004868348936203>','<:lacan_economy_6:801004863433605160>','<:lacan_economy_7:801004870643220481>','<:lacan_economy_8:801004872820457483>','<:lacan_economy_9:801004872417804298>','<:lacan_economy_10:801004872811413514>']
            random_lacan = random.choice(list_of_lacans)
            #lacan = ctx.message.get_member("713352863153258556")
            #reaction = random_lacan
            winner = random.choice(users)
            for winner in ['713352863153258556']:
              print('1')
              print(winner)
              if winner == '713352863153258556':
                print('wintrue')
                winner = random.choice(users)
              while winner == '713352863153258556':
                  print('2')
                  winner = random.choice(users)
                  continue
              else:
                  print('3')
                  break
            if giveaway['joined'] == []:
                await msg.channel.send(f':weary:No one won\n{msg.jump_url}:weary:')
            else:
                await msg.channel.send(f':tada:The new winner is {winner.mention}{msg.jump_url} ! :tada:')
          else:
            print('wrong server')
            return
                
        except KeyError:
            await msg.channel.send(f'No one won because no one joined!\n{msg.jump_url}')
コード例 #15
0
 async def unban(self, ctx, userid):
     #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
     if ctx.author.id not in [
             505338178287173642, 637638904513691658, 396075607420567552
     ]:
         embed = Embed('Error!', 'You are not a dev!', 'warning')
         if (ctx.author.id) not in [
                 505338178287173642, 637638904513691658, 396075607420567552
         ]:
             embed.footer(
                 '⚙️This command is a 🛠️developer🛠️ only command.⚙️ \nBecome a premium 💠 member today!',
                 'https://media.discordapp.net/attachments/719414661686099993/765110312482766919/NT_Server_Halloween_Logo_2020_GIF.gif'
             )
         else:
             embed.footer(
                 '⚙️This command is a 🛠️developer🛠️ only command.⚙️ \nDiscord user '
                 + str(ctx.author.name + '#' + ctx.author.discriminator) +
                 ' is a 🛠️developer🛠️ of this bot.',
                 'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
             )
         return await embed.send(ctx)
     else:
         #data = json.loads(requests.get('https://blacklisted-db.nitrotypers.repl.co', data={"key": os.getenv('DB_KEY')}).text)['data']
         dbclient = DBClient()
         collection = dbclient.db.blacklisted
         data = await dbclient.get_big_array(collection, 'banned')
         index = data['banned'].index(userid)
         del data['banned'][index]
         #requests.post('https://blacklisted-db.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY'), 'data': json.dumps(data)})
         await dbclient.update_big_array(collection, 'banned', data)
         embed = Embed('Success!',
                       f'Unbanned user <@{str(userid)}> from the bot!',
                       'white_check_mark')
         if (ctx.author.id) not in [
                 505338178287173642, 637638904513691658, 396075607420567552
         ]:
             embed.footer(
                 '⚙️This command is a 🛠️developer🛠️ only command.⚙️ \nBecome a premium 💠 member today!',
                 'https://media.discordapp.net/attachments/719414661686099993/765110312482766919/NT_Server_Halloween_Logo_2020_GIF.gif'
             )
         else:
             embed.footer(
                 '⚙️This command is a 🛠️developer🛠️ only command.⚙️ \n Discord user '
                 + str(ctx.author.name + '#' + ctx.author.discriminator) +
                 ' is a 🛠️developer🛠️ of this bot.',
                 'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
             )
             return await embed.send(ctx)
コード例 #16
0
    async def gamble(self, ctx, amount):

        list_of_lacans = ['<:lacan_economy_1:801006407536607262>','<:lacan_economy_2:801004873612132382>','<:lacan_economy_3:801004873214722079>','<:lacan_economy_4:801004868126113822>','<:lacan_economy_5:801004868348936203>','<:lacan_economy_6:801004863433605160>','<:lacan_economy_7:801004870643220481>','<:lacan_economy_8:801004872820457483>','<:lacan_economy_9:801004872417804298>','<:lacan_economy_10:801004872811413514>']
        random_lacan = random.choice(list_of_lacans)

        dbclient = DBClient()
        collection = dbclient.db.pointsdb
        data = await dbclient.get_array(collection, {'$and': [{'userid': str(ctx.author.id)}, {'userid': str(ctx.author.id)}]})
        async for d in data:
            user = d
            break
        old = user.copy()
        if int(amount) <= 5:
            embed = Embed('Gambling Too Little!', f'We the casino want you to gamble more than `5` '+random_lacan+' at a time.', 'warning')
            return await embed.send(ctx)
        try:
            if user['userid'] == str(ctx.author.id):
                if int(user['points']) < int(amount):
                    embed = Embed('<a:error:800338727645216779>  Error!', 'So you want negative '+random_lacan+' if you lose right? <a:keka:800338138802946098>')
                    return await embed.send(ctx)
        except:
            embed = Embed('<a:error:800338727645216779>  Error!', 'You haven\'t won a guess game yet! You have to win a game and will then be able to gamble!')
            return embed.send(ctx)
        numbers = [1, 2, 3, 4, 5, 6]
        if ctx.author.id not in [637638904513691658, 505338178287173642, 396075607420567552]:
            bot_rolled = random.choices(numbers, [1, 1, 1, 2, 2, 3])[0]
            user_rolled = random.choices(numbers, [1, 1, 1, 1, 1, 1])[0]
        else:
            bot_rolled = random.choices(numbers, [1, 0, 0, 0, 0, 0])[0]
            user_rolled = random.choices(numbers, [0, 1, 1, 1, 1, 1])[0]
        if bot_rolled >= user_rolled:
            embed = Embed('You Lost!', 'Gambling Results', 'weary', color=0xff0000)
            embed.field('Your Roll', f'\n`{str(user_rolled)}`\n')
            embed.field('Bot Roll', f'\n`{str(bot_rolled)}`\n')
            embed.field('Loss', f'You lost {str(amount)} '+random_lacan+'!', inline=False)
            user['points'] -= int(amount)
            await embed.send(ctx)
        if bot_rolled < user_rolled:
            embed = Embed('You Won!', 'Gambling Results', 'tada', color=0x00ff00)
            embed.field('Your Roll', f'\n`{str(user_rolled)}`\n')
            embed.field('Bot Roll', f'\n`{str(bot_rolled)}`\n')
            embed.field('Winnings', f'You won {str(math.floor(int(amount)/2)+(user_rolled-bot_rolled))} '+random_lacan+'!', inline=False)
            user['points'] += math.floor(int(amount)/2)+(user_rolled-bot_rolled)
            await embed.send(ctx)
        await dbclient.update_array(collection, old, user)
コード例 #17
0
    async def cars(self, ctx, user=None):
        dbclient = DBClient()
        collection = dbclient.db.pointsdb
        dbdata = await dbclient.get_array(
            collection, {
                '$and': [{
                    'userid': str(ctx.author.id)
                }, {
                    'userid': str(ctx.author.id)
                }]
            })
        async for d in dbdata:
            data = d
            break
        page = 0

        def check(reaction: Reaction, user: User):
            return user.id == ctx.author.id

        embed = Embed('Cars You Own!', 'The cars you bought with lacans!')
        embed.field('Equipped Car!', data['equipped']['car'])
        embed.image('https://www.nitrotype.com/cars/' +
                    data['equipped']['img'].replace('small', 'large'))
        embed.footer('You can buy cars or equip cars using n.buy or n.equip!')
        message = await ctx.send(embed=embed.default_embed())
        await message.add_reaction('🔄')
        while True:
            try:
                reaction, user = await self.client.wait_for('reaction_add',
                                                            timeout=120,
                                                            check=check)
            except TimeoutError:
                break
            embed = Embed('Cars You Own!', 'The cars you bought with lacans!')
            embed.field(f'Car Index {page+1}', data["cars"][page]["car"])
            embed.image(
                f"https://www.nitrotype.com/cars/{data['cars'][page]['img'].replace('small', 'large').strip()}"
            )
            await message.remove_reaction(reaction, user)
            await message.edit(embed=embed.default_embed())
            page += 1
            if page >= len(data['cars']):
                page = 0
コード例 #18
0
 async def password(self, ctx):
     if ctx.guild.id in [564880536401870858]:
         embed = Embed(
             'Error!',
             'This server has been **blacklisted** from using this command.',
             'warning')
         return await embed.send(ctx)
     else:
         var = await get_username(str(ctx.author.id))
         if var[0] == False:
             return await var[1].send(ctx)
         #embed=Embed('Password', 'Please enter your password **without** prefix below.')
         #await ctx.author.send(embed=embed.default_embed())
         await ctx.author.send('What is your password?')
         try:
             response = await self.client.wait_for(
                 'message',
                 check=self.message_check(channel=ctx.author.dm_channel),
                 timeout=30)
         except asyncio.exceptions.TimeoutError:
             return await ctx.author.send(
                 "You didn't type your password in time!")
         dbclient = DBClient()
         collection = dbclient.db.NT_to_discord
         data = await dbclient.get_array(
             collection, {
                 '$or': [{
                     'userID': str(ctx.author.id),
                     'NTuser': var[1].username.lower()
                 }]
             })
         async for user in data:
             old = user.copy()
             user['password'] = self.encrypt(response.content)
         await dbclient.update_array(collection, old, user)
         thepassword = (response.content)
         username = user['NTuser']
         embed = Embed(
             'Success!',
             f"Your password for your account `{username}` was successfuly set to `{thepassword}`, encrypted and added into the database!\n\n__Your Data:__\nusername: `{user['NTuser']}`\npassword: `{thepassword}` \n\n__Please note that:__ \n*1. This password is **safe**, it doesn't even exist unencrypted anymore.*\n*2. Wrong use of this command like putting wrong data into the bot on purpose can end in a **ban** of this bot as our database does not have enough space for wrong data.*",
             'white check mark')
         await embed.send(ctx, dm=True)
コード例 #19
0
 async def event(self, payload):
     dbclient = DBClient()
     collection = dbclient.db.giveaways
     dbdata = await dbclient.get_array(
         collection, {
             '$and': [{
                 'messageID': payload.message_id
             }, {
                 'messageID': payload.message_id
             }]
         })
     async for d in dbdata:
         user = d
         break
     try:
         old = copy.deepcopy(user)
         user['joined'].remove(payload.user_id)
     except:
         return
     await dbclient.update_array(collection, old, user)
コード例 #20
0
 async def event(self, member):
     dbclient = DBClient()
     collection = dbclient.db.servers
     server = await dbclient.get_array(collection, {'serverID': member.guild.id})
     try:
         async for x in server:
             data = x
             break
     except:
         return
     try:
         print(data)
         channel_id = data['channel_id']
         channel = discord.utils.get(self.client.get_all_channels(), id=channel_id)
         message = data['message']
     except:
         return
     try:
         racer = await NT_to_discord(member.id)
         racer = racer[1]
         username = racer.username
         speed = racer.speed_role
         accuracy = racer.accuracy_role
         races = racer.race_role
     #except Exception as e:
         #print(e)
     except:
         embed=Embed('Welcome to the server! :wave:', f'{member.mention} unfortunately isn\'t associated to a Nitro Type account yet. Please type `n.register` to start the verification process.')
         return await channel.send(embed=embed.default_embed())
     message = message.replace('{{user.mention}}', member.mention)
     message = message.replace('{{user.id}}', str(member.id))
     message = message.replace('{{user.racer.username}}', username)
     message = message.replace('{{user.racer.speed}}', speed)
     message = message.replace('{{user.racer.accuracy}}', accuracy)
     message = message.replace('{{user.racer.races}}', races)
     embed=Embed(f'Welcome to the server! :wave:', message)
     try:
         await channel.send(embed=embed.default_embed())
     except:
         embed=Embed('Welcome to the server! :wave:', f'{member.mention} unfortunately isn\'t associated to a Nitro Type account yet. Please type `n.register` to start the verification process.')
         return await channel.send(embed=embed.default_embed())
コード例 #21
0
    async def shop(self, ctx):
        data = json.loads(
            requests.get(
                'https://lacanitemshop.nitrotypers.repl.co/data.json').text)
        dbclient = DBClient()
        collection = dbclient.db.pointsdb
        dbdata = await dbclient.get_array(
            collection, {
                '$and': [{
                    'userid': str(ctx.author.id)
                }, {
                    'userid': str(ctx.author.id)
                }]
            })
        async for d in dbdata:
            dbuser = d
            break
        page = 0

        def check(reaction: Reaction, user: User):
            return user.id == ctx.author.id

        embed = self.get_page(page, ctx, data, dbdata=dbuser)
        message = await ctx.send(embed=embed.default_embed())
        await message.add_reaction('🔄')
        while True:
            try:
                reaction, user = await self.client.wait_for('reaction_add',
                                                            timeout=120,
                                                            check=check)
            except TimeoutError:
                break
            if page + 1 > 2:
                page = 0
            else:
                page += 1
            embed = self.get_page(page, ctx, data, dbdata=dbuser)
            await message.remove_reaction(reaction, user)
            await message.edit(embed=embed.default_embed())
コード例 #22
0
 async def event(self, payload):
     if payload.user_id == 713352863153258556:
         return
     dbclient = DBClient()
     collection = dbclient.db.giveaways
     dbdata = await dbclient.get_array(collection, {'$and': [{'messageID': payload.message_id}, {'messageID': payload.message_id}]})
     async for d in dbdata:
         user = d
         break
     try:
         old = copy.deepcopy(user)
         req_passed = await check_perms(payload.user_id, user['requirements'])
         if not req_passed:
             channel = discord.utils.get(self.client.get_all_channels(), id=int(payload.channel_id))
             msg = discord.utils.get(await channel.history().flatten(), id=int(payload.message_id))
         else:
             return await msg.remove_reaction(payload.emoji, payload.member)
         if payload.user_id in user['joined']:
             return
         user['joined'].append(payload.user_id)
         embed = Embed(':partying_face:  You entered the giveaway!  :partying_face:', 'You successfully entered the giveaway!')
         embed.field('Link', f'[Giveaway Link](https://discord.com/channels/{str(payload.guild_id)}/{str(payload.channel_id)}/{str(payload.message_id)}')
         await payload.member.send(embed=embed.default_embed())
         return await dbclient.update_array(collection, old, user)
     except:
         try:
             req_passed = await check_perms(payload.user_id, user['requirements'])
             if req_passed:
                 channel = discord.utils.get(self.client.get_all_channels(), id=int(payload.channel_id))
                 msg = discord.utils.get(await channel.history().flatten(), id=int(payload.message_id))
                 user['joined'] = [payload.user_id]
                 embed = Embed(':partying_face:  Entry approved!  :partying_face:', 'You successfully entered the giveaway!')
                 embed.field(':link:  Link', f'**[Giveaway Link](https://discord.com/channels/{str(payload.guild_id)}/{str(payload.channel_id)}/{str(payload.message_id)})**')
                 embed.field(':tools:  Support Server', 'Join the official **[Support Server](https://discord.gg/Wj96Ehg)**!')
                 embed.field(':arrow_up:  Vote', 'Vote for me **[here](https://top.gg/bot/713352863153258556)**.')
                 embed.field(':link:  Invite', 'Invite me through **[this](https://discord.com/oauth2/authorize?client_id=713352863153258556&permissions=2617633857&redirect_uri=https%3A%2F%2Fnitrotype.com&scope=bot)** link.')
                 await payload.member.send(embed=embed.default_embed())
                 return await dbclient.update_array(collection, old, user)
             else:
                 await msg.remove_reaction(payload.emoji, payload.member)
         except Exception as e:
             pass
     if int(payload.channel_id) == 810296381779476510:
         emoji = payload.emoji
     else:
         return
     if str(emoji) == '☑️':
         accepted = True
     else:
         accepted = False
     channel = discord.utils.get(self.client.get_all_channels(), id=int(payload.channel_id))
     msg = discord.utils.get(await channel.history().flatten(), id=int(payload.message_id))
     data = []
     for field in (msg.embeds[0].fields):
         data.append((field.name, field.value))
     data = dict(data)
     dbclient = DBClient()
     collection = dbclient.db.premium
     dbdata = await dbclient.get_big_array(collection, 'premium')
     if {"serverID": str(data['Guild ID'])} in dbdata['premium']:
         return
     if accepted == False:
         user = await self.client.fetch_user(int(data['Buyer ID']))
         embed = Embed(':weary:  Declined!', 'Your server\'s premium application has been denied. It will not be given premium. You have been refunded the Lacans.')
         collection = dbclient.db.pointsdb
         data = await dbclient.get_array(collection, {'$and': [{'userid': str(data['Buyer ID'])}, {'userid': str(data['Buyer ID'])}]})
         async for d in data:
             data = d
             old = copy.deepcopy(data)
             break
         points = data['points']
         data['points'] = int(points) + 3000
         await dbclient.update_array(collection, old, data)
         await msg.delete()
         return await user.send(embed=embed.default_embed())
     else:
         listofroles = [">99% Accuracy", "99% Accuracy", "98% Accuracy", "97% Accuracy", "96% Accuracy", "94-95% Accuracy", "90-93% Accuracy", "87-89% Accuracy", "84-86% Accuracy", "80-83% Accuracy", "75-79% Accuracy", "<75% Accuracy", "220+ WPM", "210-219 WPM", "200-209 WPM", "190-199 WPM", "180-189 WPM", "170-179 WPM", "160-169 WPM", "150-159 WPM", "140-149 WPM", "130-139 WPM", "120-129 WPM", "110-119 WPM", "100-109 WPM", "90-99 WPM", "80-89 WPM", "70-79 WPM", "60-69 WPM", "50-59 WPM", "40-49 WPM", "30-39 WPM", "20-29 WPM", "10-19 WPM", "1-9 WPM", "500000+ Races", "250000-499999 Races", "200000-249999 Races", "150000-199999 Races", "100000-149999 Races", "75000-99999 Races", "50000-74999 Races", "40000-49999 Races", "30000-39999 Races", "20000-29999 Races", "10000-19999 Races", "5000-9999 Races", "3000-4999 Races", "1000-2999 Races","500-999 Races", "100-499 Races", "50-99 Races", "1-49 Races"]
         guild = discord.utils.get(self.client.guilds, id=int(data['Guild ID']))
         dbdata['premium'].append({'serverID': str(guild.id)})
         await dbclient.update_big_array(collection, 'premium', dbdata)
         await guild.create_role(name="Gold Member", colour=discord.Colour(0xFFFF00))
         for role in listofroles:
             await guild.create_role(name=role)
         user = await self.client.fetch_user(int(data['Buyer ID']))
         embed = Embed('Success!', 'Your server has been given premium!')
         await msg.delete()
         channel1 = discord.utils.get(self.client.get_all_channels(), id=812375645828153385)
         channel2 = discord.utils.get(self.client.get_all_channels(), id=812268302117634078)
         list_of_lacans = ['<:lacan_economy_1:801006407536607262>','<:lacan_economy_2:801004873612132382>','<:lacan_economy_3:801004873214722079>','<:lacan_economy_4:801004868126113822>','<:lacan_economy_5:801004868348936203>','<:lacan_economy_6:801004863433605160>','<:lacan_economy_7:801004870643220481>','<:lacan_economy_8:801004872820457483>','<:lacan_economy_9:801004872417804298>','<:lacan_economy_10:801004872811413514>']
         random_lacan = random.choice(list_of_lacans)
         #data['Buyer ID'] is the buyer id/ctx.author.id
         #data['Buyer Name'] is the buyer name/str(ctx.author)
         #data['Guild ID'] is the guild id/ctx.guild.id
         #data['Guild Name'] is the guild name/str(ctx.guild)
         author = data['Buyer ID']
         guildid = data['Guild ID']
         guildname = data['Guild Name']
         amount = 3000
         embed=Embed(':diamond_shape_with_a_dot_inside:  New premium guild!', f'Lacan NTSport just sold a new premium server for `{amount}` {random_lacan}!')
         embed.field('Buyer ID', f'`{author}`')
         embed.field('Buyer Mention', f'<@{author}>')
         embed.field('Guild ID', f'`{guildid}`')
         embed.field('Guild Name', f'**{guildname}**')
         await channel1.send(embed=embed.default_embed())
         await channel2.send(embed=embed.default_embed())
コード例 #23
0
    async def hourly(self, ctx):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        #data = json.loads(requests.get('https://pointsdb.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)['data']

        list_of_lacans = [
            '<:lacan_economy_1:801006407536607262>',
            '<:lacan_economy_2:801004873612132382>',
            '<:lacan_economy_3:801004873214722079>',
            '<:lacan_economy_4:801004868126113822>',
            '<:lacan_economy_5:801004868348936203>',
            '<:lacan_economy_6:801004863433605160>',
            '<:lacan_economy_7:801004870643220481>',
            '<:lacan_economy_8:801004872820457483>',
            '<:lacan_economy_9:801004872417804298>',
            '<:lacan_economy_10:801004872811413514>'
        ]
        random_lacan = random.choice(list_of_lacans)
        channels = self.client.get_all_channels()
        channel = get(channels, id=803879362226946088)
        green = 0x40AC7B
        red = 0xE84444
        orange = 0xF09F19

        dbclient = DBClient()
        collection = dbclient.db.pointsdb
        data = await dbclient.get_array(
            collection, {
                '$and': [{
                    'userid': str(ctx.author.id)
                }, {
                    'userid': str(ctx.author.id)
                }]
            })
        async for d in data:
            user = d
            break
        embed = Embed('<a:success:800340618579935233>  Success!',
                      'You\'ve collected your hourly succesfully!')
        try:
            old = user.copy()
            if ((round(time.time()) - user['hourlystamp'] >= 3600)):
                user['points'] += 3
                user['hourlystamp'] = round(time.time())
                await dbclient.update_array(collection, old, user)
                #Embed for lacan Log
                #embed1 = discord.Embed(title=f'{random_lacan}  Lacan Log', description=str(ctx.author), color= green)
                #embed1.add_field(name='__Won__', value=f'3')
                #embed1.add_field(name='__Command__', value='`n.hourly`')
                #embed1.add_field(name='__Type__', value='*Claimed*')
                #embed1.add_field(name='__Total__', value=f'{total_points}')
                #embed1.add_field(name='__User ID__', value=f'`{ctx.author.id}`')
                #await channel.send(embed=embed1)
            else:
                import datetime
                timeleft = str(
                    datetime.timedelta(
                        seconds=3600 -
                        (round(time.time()) - user['hourlystamp'])))
                embed = Embed(
                    '<a:error:800338727645216779>  Error!',
                    'You\'ve already collected your hourly ' + random_lacan +
                    ' today! Your next claim is available in **' + timeleft +
                    '**.')
            return await embed.send(ctx)
        except KeyError:
            if user['userid'] == str(ctx.author.id):
                user['points'] += 3
                user['hourlystamp'] = round(time.time())
                await dbclient.update_array(collection, old, user)
                embed = Embed('<a:success:800340618579935233>  Success!',
                              'You\'ve collected your hourly succesfully!')
                #Embed for lacan Log
                #embed1 = discord.Embed(title=f'{random_lacan}  Lacan Log', description=str(ctx.author), color= green)
                #embed1.add_field(name='__Won__', value=f'3')
                #embed1.add_field(name='__Command__', value='`n.hourly`')
                #embed1.add_field(name='__Type__', value='*Claimed*')
                #embed1.add_field(name='__Total__', value=f'{total_points}')
                #embed1.add_field(name='__User ID__', value=f'`{ctx.author.id}`')
                #await channel.send(embed=embed1)
            else:
                await dbclient.create_doc(
                    collection, {
                        'userid': str(ctx.author.id),
                        'points': 3,
                        'hourlystamp': round(time.time())
                    })
        except UnboundLocalError:
            await dbclient.create_doc(
                collection, {
                    'userid': str(ctx.author.id),
                    'points': 3,
                    'hourlystamp': round(time.time())
                })
        await embed.send(ctx)
コード例 #24
0
    async def update(self, ctx):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')

        #Define Time variables
        #Variables = date(year, month, day)
        d1 = date(2021, 4, 1)
        dcurrent = date.today()

        thelistofroles = [
            "Gold Member",
            [
                ">99% Accuracy", "99% Accuracy", "98% Accuracy",
                "97% Accuracy", "96% Accuracy", "94-95% Accuracy",
                "90-93% Accuracy", "87-89% Accuracy", "84-86% Accuracy",
                "80-83% Accuracy", "75-79% Accuracy", "<75% Accuracy"
            ],
            [
                "220+ WPM", "210-219 WPM", "200-209 WPM", "190-199 WPM",
                "180-189 WPM", "170-179 WPM", "160-169 WPM", "150-159 WPM",
                "140-149 WPM", "130-139 WPM", "120-129 WPM", "110-119 WPM",
                "100-109 WPM", "90-99 WPM", "80-89 WPM", "70-79 WPM",
                "60-69 WPM", "50-59 WPM", "40-49 WPM", "30-39 WPM",
                "20-29 WPM", "10-19 WPM", "1-9 WPM"
            ],
            [
                "500000+ Races", "250000-499999 Races", "200000-249999 Races",
                "150000-199999 Races", "100000-149999 Races",
                "75000-99999 Races", "50000-74999 Races", "40000-49999 Races",
                "30000-39999 Races", "20000-29999 Races", "10000-19999 Races",
                "5000-9999 Races", "3000-4999 Races", "1000-2999 Races",
                "500-999 Races", "100-499 Races", "50-99 Races", "1-49 Races"
            ]
        ]
        listofroles = [
            "Gold Member", ">99% Accuracy", "99% Accuracy", "98% Accuracy",
            "97% Accuracy", "96% Accuracy", "94-95% Accuracy",
            "90-93% Accuracy", "87-89% Accuracy", "84-86% Accuracy",
            "80-83% Accuracy", "75-79% Accuracy", "<75% Accuracy", "220+ WPM",
            "210-219 WPM", "200-209 WPM", "190-199 WPM", "180-189 WPM",
            "170-179 WPM", "160-169 WPM", "150-159 WPM", "140-149 WPM",
            "130-139 WPM", "120-129 WPM", "110-119 WPM", "100-109 WPM",
            "90-99 WPM", "80-89 WPM", "70-79 WPM", "60-69 WPM", "50-59 WPM",
            "40-49 WPM", "30-39 WPM", "20-29 WPM", "10-19 WPM", "1-9 WPM",
            "500000+ Races", "250000-499999 Races", "200000-249999 Races",
            "150000-199999 Races", "100000-149999 Races", "75000-99999 Races",
            "50000-74999 Races", "40000-49999 Races", "30000-39999 Races",
            "20000-29999 Races", "10000-19999 Races", "5000-9999 Races",
            "3000-4999 Races", "1000-2999 Races", "500-999 Races",
            "100-499 Races", "50-99 Races", "1-49 Races"
        ]
        teamswithroles = [
            # Insert Global Team Tags Here
        ]

        #Team N8TE | Server Owner: 630761745140547625
        if ctx.guild.id in [636582509429260289]:
            teamswithroles.append('[N8TE]')
        #Team DRPT | Server Owner: 723224207651111003
        if ctx.guild.id in [742854336618561608]:
            teamswithroles.append('[DRPT]')
        #Team RRN | Server Owner: 653772108815532053
        if ctx.guild.id in [696055942055198760]:
            teamswithroles.append('[RRN]')
        #Team NEWS | Server Owner: 272370019894165505
        if ctx.guild.id in [835305919679692850]:
            teamswithroles.append('[NEWS]')
        #Team TEST | Server Owner: 505338178287173642
        if ctx.guild.id in [833317505888026644]:
            teamswithroles.append('[TEST]')
        #data = requests.get('https://test-db.nitrotypers.repl.co', data={"key": os.getenv('DB_KEY')}).text
        #data = json.loads(data)
        dbclient = DBClient()
        pcollection = dbclient.db.premium
        pdata = await dbclient.get_big_array(pcollection, 'premium')
        for server in pdata['premium']:
            if str(ctx.author.guild.id) == server['serverID']:
                break
        else:
            embed = Embed(
                'Error!',
                'Unfortunately, this isn\'t a premium server! Run `n.premium` to learn more about premium!',
                'warning')

            if (ctx.author.id) not in [
                    505338178287173642, 637638904513691658, 396075607420567552
            ]:
                embed.footer(
                    'Become a premium 💠 member today!',
                    'https://media.discordapp.net/attachments/719414661686099993/765110312482766919/NT_Server_Halloween_Logo_2020_GIF.gif'
                )

            else:
                embed.footer(
                    'Discord user ' +
                    str(ctx.author.name + '#' + ctx.author.discriminator) +
                    ' is a 🛠️developer🛠️ of this bot. \n⚙️This command is a premium 💠 only command.⚙️',
                    'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
                )

            return await embed.send(ctx)
        roles_to_remove = []
        for role in (ctx.author.roles):
            name = role.name
            if name in listofroles or name in teamswithroles:
                role = get(ctx.message.guild.roles, id=role.id)
                roles_to_remove.append(role)
        await ctx.author.remove_roles(*roles_to_remove)
        success, ntuser = await get_username(str(ctx.author.id))
        if success:
            pass
        else:
            embed = Embed('Error!', 'Doesn\'t seem like you\'re registered!',
                          'warning')
            return await embed.send(ctx)
        racer = ntuser
        if ctx.author.id in [505338178287173642]:
            roles_to_add = []
            #T2W4G's Speed Role
            listofroles = thelistofroles[2]
            role = get(ctx.message.guild.roles, name=listofroles[12])
            roles_to_add.append(role)
            #T2W4G's Accuracy Role
            listofroles = thelistofroles[1]
            role = get(ctx.message.guild.roles, name=listofroles[0])
            roles_to_add.append(role)
            #T2W4G's Races Role
            listofroles = thelistofroles[3]
            role = get(ctx.message.guild.roles, name=listofroles[8])
            roles_to_add.append(role)
            #T2W4G's Gold Member Role
            role = get(ctx.message.guild.roles, name="Gold Member")
            roles_to_add.append(role)
            #T2W4G's Registered Role
            role = get(ctx.message.guild.roles, name='Registered')
            roles_to_add.append(role)
            #await ctx.author.add_roles(roles_to_add)
            #Add role
            '''role = get(ctx.message.guild.roles, name='Moderator')
            await ctx.author.add_roles(role)
            #Remove role
            role = get(ctx.message.guild.roles, name='Admin')
            await ctx.author.remove_roles(role)'''
            #Remove Unregistered Role Try
            try:
                role = get(ctx.message.guild.roles, name='Unregistered')
                await ctx.author.remove_roles(role)
            except:
                pass
            #T2W4G's Edit Nickname Try
            try:
                #T2W4G's Edit Nickname Success
                await ctx.author.edit(nick='⚡Try2Win4Glory⚡')
                #T2W4G's Edit Nickname Success Embed
                embed = Embed(
                    'Success!', 'Developer ' +
                    str(ctx.author.name + '#' + ctx.author.discriminator) +
                    ' \'s roles were updated. :-)', 'white check mark')
                #T2W4G's Embed Send
                await embed.send(ctx)
            except Exception:
                #T2W4G's Edit Nickname Fail
                embed = Embed(
                    'Rip!',
                    'I don\'t have the `Manage Nickames` permission! \n\nI updated your roles, but am missing the permission to change your nickname. :grinning:',
                    'poop')
                #T2W4G's Embed Send
                await embed.send(ctx)
            '''if str(racer.tag) in teamswithroles:
                print('yessir')
                try:
                    guild=ctx.author.guild
                    role = get(ctx.message.guild.roles, name=f'{racer.tag}')
                    await ctx.author.add_roles(role)
                    print('pog')
                    return
                except:
                    guild=ctx.author.guild
                    await guild.create_role(name=racer.tag)
                    role = get(ctx.message.guild.roles, name=f'{racer.tag}')
                    await ctx.author.add_roles(role)
                    print('created')
                    return
            else:
                #embed=Embed('Error!', 'Team tag: '+racer.tag+'', 'warning')
                #return await embed.send(ctx)
                 pass'''

            return

        else:
            roles_to_add = []
            role = get(ctx.message.guild.roles, name=racer.speed_role)
            roles_to_add.append(role)
            role = get(ctx.message.guild.roles, name=racer.accuracy_role)
            roles_to_add.append(role)
            role = get(ctx.message.guild.roles, name=racer.race_role)
            roles_to_add.append(role)

            if racer.membership == 'gold':
                role = get(ctx.message.guild.roles, name="Gold Member")
                roles_to_add.append(role)

            role = get(ctx.message.guild.roles, name='Registered')
            try:
                roles_to_add.append(role)

            except Exception:
                embed = Embed(
                    'Error!',
                    'The bot is not able to update your roles. Make sure I have the `Manage Roles` permission, am ranked higher than that roles and you did a season race yet.'
                )
                await embed.send(ctx)
        #Teamroles
            if str(racer.tag) in teamswithroles:
                print('yessir')
                try:
                    guild = ctx.author.guild
                    role = get(ctx.message.guild.roles, name=f'{racer.tag}')
                    roles_to_add.append(role)
                    print('pog')
                except:
                    guild = ctx.author.guild
                    await guild.create_role(name=racer.tag)
                    role = get(ctx.message.guild.roles, name=f'{racer.tag}')
                    roles_to_add.append(role)
                    print('created')
            else:
                #embed=Embed('Error!', 'Team tag: '+racer.tag+'', 'warning')
                #return await embed.send(ctx)
                pass
            await ctx.author.add_roles(*roles_to_add)
            try:
                role = get(ctx.message.guild.roles, name='Unregistered')
                await ctx.author.remove_roles(role)
            except:
                pass

            #Start of April Script
            if d1 == dcurrent:
                #The current date matches the specified date:
                print('Hehe april fools day')
                random_names = [
                    'Huge Elephant', 'Slimy Snail', 'Fat Panda', 'April Cat',
                    'Silent Spy', 'Lacan NTSport Developer',
                    '10FF better than NT?', 'April Joke', 'Joker Typer',
                    'Keyboard Pig', 'Typing Nerd', 'adl212 is cool',
                    '⚡Try2Win4Glory⚡ is pog', 'Lacan = Best Car',
                    'I love Typerush.com!', 'Whining Dog', 'Potaytoes',
                    'Chicken Typer', 'Command Spammer', 'The one and only',
                    'I bot on NitroType!', 'Ban me plz!',
                    'Happy April fools day!'
                ]
                random_name = random.choice(random_names)
                try:
                    await ctx.author.edit(nick='[APRIL] ' + random_name + '')
                    embed = Embed(
                        'Success!',
                        'Successfully updated your roles and nickname!',
                        'white_check_mark')
                    embed.footer('Happy April fools day! :-)')
                    return await embed.send(ctx)
                except Exception:
                    embed = Embed(
                        'Error!',
                        'The bot needs following permissions: `Manage Nicknames` \n \n **Note:** If you are the server owner or not ranked lower than my highest role, I won\'t be able to update your nickname, but I will update your roles. :grinning:',
                        'warning')
                    embed.footer(
                        'This command is a premium 💠 only command. Run n.premium to learn more about premium.',
                        'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png'
                    )
                    return await embed.send(ctx)
            else:
                try:
                    await ctx.author.edit(nick=racer.tag + ' ' + racer.name)
                except Exception:
                    embed = Embed(
                        'Error!',
                        'The bot needs following permissions: `Manage Nicknames` \n \n **Note:** If you are the server owner or not ranked lower than my highest role, I won\'t be able to update your nickname, but I will update your roles. :grinning:',
                        'warning')
                    if (ctx.author.id) not in [
                            505338178287173642, 637638904513691658,
                            396075607420567552
                    ]:
                        embed.footer(
                            'This command is a premium 💠 only command. Run n.premium to learn more about premium.',
                            'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png'
                        )

                    else:
                        embed.footer(
                            'Discord user ' + str(ctx.author.name + '#' +
                                                  ctx.author.discriminator) +
                            ' is a 🛠️developer🛠️ of this bot. \nThis command is a premium 💠 only command.',
                            'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
                        )
                        return await embed.send(ctx)
                embed = Embed('Success!',
                              'Successfully updated your roles and nickname!',
                              'white_check_mark')
                if (ctx.author.id) not in [
                        505338178287173642, 637638904513691658,
                        396075607420567552
                ]:
                    embed.footer(
                        'This command is a premium 💠 only command. Run n.premium to learn more about premium.',
                        'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png'
                    )
                else:
                    embed.footer(
                        'Discord user ' +
                        str(ctx.author.name + '#' + ctx.author.discriminator) +
                        ' is a 🛠️developer🛠️ of this bot. \nThis command is a premium 💠 only command.',
                        'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
                    )
                await embed.send(ctx)
コード例 #25
0
    async def give(self, ctx, giveto: discord.Member, amount):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')

        list_of_lacans = ['<:lacan_economy_1:801006407536607262>','<:lacan_economy_2:801004873612132382>','<:lacan_economy_3:801004873214722079>','<:lacan_economy_4:801004868126113822>','<:lacan_economy_5:801004868348936203>','<:lacan_economy_6:801004863433605160>','<:lacan_economy_7:801004870643220481>','<:lacan_economy_8:801004872820457483>','<:lacan_economy_9:801004872417804298>','<:lacan_economy_10:801004872811413514>']
        random_lacan = random.choice(list_of_lacans)

        dbclient = DBClient()
        collection = dbclient.db.pointsdb
        data = await dbclient.get_array(collection, {'$and': [{'userid': str(ctx.author.id)}, {'userid': str(ctx.author.id)}]})
        async for d in data:
            user = d
            break
        old = user.copy()
        try:
            if user['userid'] == str(ctx.author.id):
                if user['points'] < int(amount):
                    embed = Embed('Error!', 'You don\'t have that amount of '+random_lacan+'!')
                    return await embed.send(ctx)
                if int(amount)<0:
                    embed=Embed('Error!', f'Did you seriously just attempt to get yourself more {random_lacan} by giving your friend **{int(amount)}**{random_lacan}`:flushed:?', 'warning')
                    return await embed.send(ctx)
                user['points'] -= int(amount)
                await dbclient.update_array(dbclient.db.pointsdb, old, user)
        except:
            embed = Embed('<a:error:800338727645216779>  Error!', 'Unfortunately, you haven\'t won a guess game yet so you have no '+random_lacan+' to give!')
            return await embed.send(ctx)
        userid = giveto.id or giveto
        data = await dbclient.get_array(collection, {'$and': [{'userid': str(userid)}, {'userid': str(userid)}]})
        async for d in data:
            user = d
            break
        old = user.copy()
        try:
            if user['userid'] == str(giveto):
                user['points'] += int(amount)
            elif user['userid'] == str(giveto.id):
                user['points'] += int(amount)
            await dbclient.update_array(collection, old, user)
        except:
            embed = Embed('Error!', 'This person you want to send to doesn\'t exist in the database!', 'rofl')
            return await embed.send(ctx)

        embed = Embed('<a:success:800340618579935233>  Success!', '<@'+str(ctx.author.id)+'> has succesfully given '+giveto.mention+' **'+amount+'** '+random_lacan+'.')

        if (ctx.author.id) not in [505338178287173642, 637638904513691658, 396075607420567552]:
          try:
            await giveto.send(':gift: **You just received a gift!** :gift: \n\nYou have been sent **'+amount+'** '+random_lacan+' from '+str(ctx.author)+'!')
          except:
            embed=Embed('<a:error:800338727645216779>  Error!',''+giveto.mention+' has received '+str(ctx.author)+'\'s **'+amount+'** '+random_lacan+', but they have their DMs turned off so I couldn\'t Direct message '+giveto.mention+'.')
          await embed.send(ctx)
          await dbclient.update_array(collection, old, user)
          try:
            await ctx.message.delete()
          except:
            pass
          #return await embed.send(ctx)
        else:
          try:
            await giveto.send(':tada: :gift: :tada: **WOAH Dude! One of the __DEVS__ just sent you a gift!** :tada: :gift: :tada:\n\nYou have been sent **'+amount+'** '+random_lacan+'> from '+str(ctx.author)+'!')
          except:
            embed=Embed('Error!',''+giveto.mention+' has received '+str(ctx.author)+'\'s **'+amount+'** '+random_lacan+', but they have their DMs turned off so I couldn\'t Direct message '+giveto.mention+'.', 'warning')
        await embed.send(ctx)
        try:
            await ctx.message.delete()
        except:
            pass
        return
コード例 #26
0
    async def devunregister(self, ctx, discordid):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        dbkey = os.getenv('DB_KEY')
        #dbdata = json.loads(requests.get('https://test-db.nitrotypers.repl.co', data={"key": dbkey}).text)
        dbclient = DBClient()
        collection = dbclient.db.NT_to_discord
        for role in ctx.author.roles:
            if role.id in [
                    #Insert permitted role IDs here
            ]:
                bypass = True
                break
        else:
            bypass = False
        if (ctx.author.id) not in [
                #Try2Win4Glory
                505338178287173642,
                #adl212
                396075607420567552
        ] and not bypass:
            embed = Embed(
                'Error!',
                'Lol, did you really think it\'s possible for you to unregister a user when you are not a dev? Click [here](https://www.latlmes.com/entertainment/dev-application-1) to apply for dev.',
                'warning')
            embed.footer(
                '⚙️This command is a 🛠️developer🛠️ only command.⚙️',
                'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png'
            )
            await embed.send(ctx)
            return
        premiumserver = False
        pcollection = dbclient.db.premium
        pdata = await dbclient.get_big_array(pcollection, 'premium')
        discordid0 = discordid.replace("<@!", "")
        discordid1 = discordid0.replace(">", "")
        dbdata = await dbclient.get_array(collection,
                                          {'userID': str(discordid1)})
        for x in pdata['premium']:
            if x['serverID'] == str(ctx.author.guild.id):
                premiumserver = True
                break
        async for x in dbdata:
            await collection.delete_one(x)
            #--Success Embed--#
            embed = Embed('Success!',
                          'Unregistered discord user <@' + discordid1 + '>!',
                          'white_check_mark')

            #--Footer--#
            if (ctx.author.id) in [
                    396075607420567552, 505338178287173642, 637638904513691658
            ]:
                embed.footer(
                    'Discord user ' +
                    str(ctx.author.name + '#' + ctx.author.discriminator) +
                    ' is a 🛠️developer🛠️ of this bot. \n⚙️This command is a 🛠️developer🛠️ and verified helper only command.⚙️',
                    'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png'
                )
            else:
                embed.footer(
                    'Discord user ' +
                    str(ctx.author.name + '#' + ctx.author.discriminator) +
                    ' is a verified helper of this bot. \n⚙️This command is a 🛠️developer🛠️ and ✅ verified helper only command.⚙️',
                    'https://cdn.discordapp.com/attachments/765547632072196116/781838805044166676/output-onlinepngtools6.png'
                )
            try:
                await ctx.message.delete()
            except:
                pass
            await embed.send(ctx)
            break
            #return
        #Remove roles if the server is premium:
        try:
            thelistofroles = [
                "Gold Member",
                [
                    ">99% Accuracy", "99% Accuracy", "98% Accuracy",
                    "97% Accuracy", "96% Accuracy", "94-95% Accuracy",
                    "90-93% Accuracy", "87-89% Accuracy", "84-86% Accuracy",
                    "80-83% Accuracy", "75-79% Accuracy", "<75% Accuracy"
                ],
                [
                    "220+ WPM", "210-219 WPM", "200-209 WPM", "190-199 WPM",
                    "180-189 WPM", "170-179 WPM", "160-169 WPM", "150-159 WPM",
                    "140-149 WPM", "130-139 WPM", "120-129 WPM", "110-119 WPM",
                    "100-109 WPM", "90-99 WPM", "80-89 WPM", "70-79 WPM",
                    "60-69 WPM", "50-59 WPM", "40-49 WPM", "30-39 WPM",
                    "20-29 WPM", "10-19 WPM", "1-9 WPM"
                ],
                [
                    "500000+ Races", "250000-499999 Races",
                    "200000-249999 Races", "150000-199999 Races",
                    "100000-149999 Races", "75000-99999 Races",
                    "50000-74999 Races", "40000-49999 Races",
                    "30000-39999 Races", "20000-29999 Races",
                    "10000-19999 Races", "5000-9999 Races", "3000-4999 Races",
                    "1000-2999 Races", "500-999 Races", "100-499 Races",
                    "50-99 Races", "1-49 Races"
                ]
            ]
            listofroles = [
                "Gold Member", ">99% Accuracy", "99% Accuracy", "98% Accuracy",
                "97% Accuracy", "96% Accuracy", "94-95% Accuracy",
                "90-93% Accuracy", "87-89% Accuracy", "84-86% Accuracy",
                "80-83% Accuracy", "75-79% Accuracy", "<75% Accuracy",
                "220+ WPM", "210-219 WPM", "200-209 WPM", "190-199 WPM",
                "180-189 WPM", "170-179 WPM", "160-169 WPM", "150-159 WPM",
                "140-149 WPM", "130-139 WPM", "120-129 WPM", "110-119 WPM",
                "100-109 WPM", "90-99 WPM", "80-89 WPM", "70-79 WPM",
                "60-69 WPM", "50-59 WPM", "40-49 WPM", "30-39 WPM",
                "20-29 WPM", "10-19 WPM", "1-9 WPM", "500000+ Races",
                "250000-499999 Races", "200000-249999 Races",
                "150000-199999 Races", "100000-149999 Races",
                "75000-99999 Races", "50000-74999 Races", "40000-49999 Races",
                "30000-39999 Races", "20000-29999 Races", "10000-19999 Races",
                "5000-9999 Races", "3000-4999 Races", "1000-2999 Races",
                "500-999 Races", "100-499 Races", "50-99 Races", "1-49 Races"
            ]
            teamswithroles = [
                # Insert Global Team Tags Here
            ]

            #Team N8TE | Server Owner: 630761745140547625
            if ctx.guild.id in [636582509429260289]:
                teamswithroles.append('[N8TE]')
            #Team DRPT | Server Owner: 723224207651111003
            if ctx.guild.id in [742854336618561608]:
                teamswithroles.append('[DRPT]')
            #Team RRN | Server Owner: 653772108815532053
            if ctx.guild.id in [696055942055198760]:
                teamswithroles.append('[RRN]')
            #Team NEWS | Server Owner: 272370019894165505
            if ctx.guild.id in [835305919679692850]:
                teamswithroles.append('[NEWS]')
            #Team TEST | Server Owner: 505338178287173642
            if ctx.guild.id in [833317505888026644]:
                teamswithroles.append('[TEST]')
            registered = ['Registered']
            user = await ctx.guild.fetch_member(discordid)
            for role in (user.roles):
                name = role.name
                if name in listofroles or name in teamswithroles or name in registered:
                    role = get(ctx.message.guild.roles, id=role.id)
                    await user.remove_roles(role)
                    try:
                        role = get(ctx.message.guild.roles,
                                   name='Unregistered')
                        await user.add_roles(role)
                    except:
                        pass
        except:
            pass
コード例 #27
0
    async def team(self, ctx, team_name=''):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        #thedata = json.loads(requests.get('https://test-db.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)
        dbclient = DBClient()
        collection = dbclient.db.NT_to_discord
        thedata = await dbclient.get_array(collection, {})
        if team_name == '':
            async for player in thedata:
                if player['userID'] == str(ctx.author.id):
                    racer = await Racer(player['NTuser'])
                    tname = ''.join(list(racer.tag)[1:-1])
                    team = await Team(tname)
                    if tname == '':
                        return await Embed('Error!',
                                           'Couldn\'t find that team',
                                           'warning').send(ctx)
                    break
        else:
            team = await Team(team_name)
        if team.data == {} or team.success == False:
            userid = str(''.join(list(team_name)[3:-1]))
            async for elem in thedata:
                if userid == elem['userID']:
                    racer = await Racer(elem['NTuser'])
                    team_name = racer.tag
                    team = await Team(team_name)
                    if team_name == '':
                        return await Embed('Error!',
                                           'Couldn\'t find that team',
                                           'warning').send(ctx)
                    break
                if str(''.join(list(team_name)[2:-1])) == elem['userID']:
                    racer = await Racer(elem['NTuser'])
                    team_name = racer.tag
                    team = await Team(team_name)
                    if team_name == '':
                        return await Embed('Error!',
                                           'Couldn\'t find that team',
                                           'warning').send(ctx)
                    break
            else:
                async for elem in thedata:
                    if str(team_name) == elem['userID']:
                        racer = await Racer(elem['NTuser'])
                        team_name = racer.tag
                        team = await Team(team_name)
                        if team_name == '':
                            return await Embed('Error!',
                                               'Couldn\'t find that team',
                                               'warning').send(ctx)
                        break
                else:
                    return await Embed('Error!', 'Couldn\'t find that team',
                                       'warning').send(ctx)
        if team.data == {} or team.success == False:
            await Embed('Error!', 'Couldn\'t find that team',
                        'warning').send(ctx)
            return

        info = team.info
        data = team.data
        #info section of embed
        embed = Embed(f"[{info['tag']}] {info['name']}", team.tag_and_name,
                      'race car')
        createdstamp = info['createdStamp']
        birthday = datetime.fromtimestamp(int(createdstamp))

        embed.field(
            'Info',
            f" :busts_in_silhouette: Members: {str(len(data['members']))}\n:eyes: Team Views: {info['profileViews']}\n:birthday: Birthday: {birthday}"
        )
        #requirements to be able to join/apply for the team
        embed.field(
            'Requirements',
            f":stopwatch: Min Speed: {info['minSpeed']}\n:checkered_flag: Min Races: {info['minRaces']}"
        )
        #officers/captain of team
        leaders = f":tools: **{team.captain[1]}**[:link:](https://www.nitrotype.com/racer/{team.captain[0]})\n"
        for elem in team.leaders:
            if elem[1] is None:
                leaders += ':man_police_officer: **' + elem[
                    0] + '**[:link:](https://www.nitrotype.com/racer/' + elem[
                        0] + ')\n'
            else:
                leaders += ':man_police_officer: **' + elem[
                    1] + '**[:link:](https://www.nitrotype.com/racer/' + elem[
                        0] + ')\n'
        embed.field('Leaders', leaders)
        #Team Description
        embed.field('Description', f" {info['otherRequirements']}")
        #team stats
        embed.field(
            'Stats',
            f":trophy: **Daily**\n{team.daily_races} races ({round(int(team.daily_speed), 2)} wpm, {round(team.daily_accuracy, 2)}% acc)\n{round(team.daily_points, 2)} points\n:trophy: **Season**\n{team.season_races} races ({round(int(team.season_speed), 2)} wpm, {round(team.season_accuracy, 2)}% acc)\n{round(team.season_points, 2)} points\n:trophy: **All-Time**\n{team.alltime_races} races ({round(int(team.alltime_speed), 2)} wpm, {round(team.alltime_accuracy, 2)}% acc)\n{round(team.alltime_points, 2)} points"
        )
        #send the embed
        await embed.send(ctx)
コード例 #28
0
    async def register(self, ctx, user=None):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        if user == None:
            embed = Embed(
                'Error!',
                'How are you supposed to register without a nitrotype account? Make sure to add your username by sending `n.register <username>` without the `<>`.',
                'warning')
            #if (ctx.author.id) not in [505338178287173642, 637638904513691658, 396075607420567552]:

            #embed.footer('Make sure to use n.register <username>!\nBecome a premium 💠 member today! Run n.premium for more info.', 'https://media.discordapp.net/attachments/719414661686099993/765110312482766919/NT_Server_Halloween_Logo_2020_GIF.gif')
            #else:
            #embed.footer('Discord user '+str(ctx.author.name + '#' + ctx.author.discriminator)+' is a developer of this bot.', 'https://media.discordapp.net/attachments/719414661686099993/765490220858081280/output-onlinepngtools_32.png')
            return await embed.send(ctx)
        if ''.join(list(user)[0:32]) == 'https://www.nitrotype.com/racer/':
            racer = await Racer(''.join(list(user)[32:]))
        else:
            try:
                racer = await Racer(user)
            except AttributeError:
                embed = Embed(
                    'Error!',
                    'Couldn\'t find that user. Make sure to use `n.register <username>`.',
                    'warning')
                await embed.send(ctx)
                return
        if not racer.success:
            embed = Embed(
                'Error!',
                'Couldn\'t find that user. Make sure to use `n.register <username>`.',
                'warning')
            await embed.send(ctx)
            return
        #dbdata = json.loads(requests.get('https://test-db.nitrotypers.repl.co', data={"key": dbkey}).text)
        dbclient = DBClient()
        collection = dbclient.db.NT_to_discord
        dbdata = await dbclient.get_array(collection, {})
        async for x in dbdata:
            if str(ctx.author.id) == x['userID']:
                embed = Embed(
                    'Error!',
                    'You\'ve already registered!\nRun `n.verify` to check if you already verified your identity and in case this is a premium :diamond_shape_with_a_dot_inside: server and you are already verified, run `n.update` to update your roles.',
                    'warning')
                await embed.send(ctx)
                return
            if user == x['NTuser']:
                embed = Embed(
                    'Error!',
                    'Someone is already registered to this account!\nFor more information on who is registered to **'
                    + x['NTuser'] + '**, run `n.id ' + x['NTuser'] + '`.',
                    'warning')
                await embed.send(ctx)
                return
        else:
            await dbclient.create_doc(
                collection, {
                    "userID": str(ctx.author.id),
                    "NTuser": racer.username.lower(),
                    "verified": "false"
                })
            #if json.loads(requests.post('https://test-db.nitrotypers.repl.co', data={"key": dbkey, "data": json.dumps(dbdata)}).text)['success'] == 'true':
        dbclient = DBClient()
        collection = dbclient.db.NT_to_discord
        #await dbclient.update_big_array(collection, 'registered', dbdata)
        embed = Embed(
            'Success!',
            'You are now registered to `' + racer.username.lower() +
            '`. Type `n.verify` to verify your ownership!', 'white_check_mark')
        await embed.send(ctx)
コード例 #29
0
    async def noobguess(self, ctx):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')

        list_of_lacans = [
            '<:lacan_economy_1:801006407536607262>',
            '<:lacan_economy_2:801004873612132382>',
            '<:lacan_economy_3:801004873214722079>',
            '<:lacan_economy_4:801004868126113822>',
            '<:lacan_economy_5:801004868348936203>',
            '<:lacan_economy_6:801004863433605160>',
            '<:lacan_economy_7:801004870643220481>',
            '<:lacan_economy_8:801004872820457483>',
            '<:lacan_economy_9:801004872417804298>',
            '<:lacan_economy_10:801004872811413514>'
        ]
        random_lacan = random.choice(list_of_lacans)

        if str(ctx.author) in rateLimit:
            embed = Embed(
                'Cooldown!',
                'You are on cooldown. Wait `5` seconds before running this command again.',
                'alarm clock')
            return await embed.send(ctx)
        if await ImproperType.check(ctx): return
        if ctx.author.id not in [
                505338178287173642, 637638904513691658, 396075607420567552
        ]:
            cooldown_add(str(ctx.author))

        def check(message: Message):
            return message.author.id == ctx.author.id

        guesser = Guesser(shadow=False)
        embed = Embed('Guess That Car!', guesser.formatted, 'game die')
        embed.image(guesser.pic)
        await embed.send(ctx)

        try:
            response = await self.client.wait_for('message',
                                                  timeout=20,
                                                  check=check)
        except TimeoutError:
            embed = Embed(
                '<a:error:800338727645216779>  Error!',
                'You ran out of time because you took longer than `20` seconds to respond!'
            )
            await embed.send(ctx)
        else:
            if response.content.lower() in list('abcd'):
                if response.content.lower() == guesser.correct:
                    embed = Embed(
                        '<a:Check:797009550003666955>  Correct!',
                        'Your answer was right! You also earned **1** ' +
                        random_lacan + '!')
                    await embed.send(ctx)
                    dbclient = DBClient()
                    collection = dbclient.db.pointsdb
                    data = await dbclient.get_array(
                        collection, {
                            '$and': [{
                                'userid': str(ctx.author.id)
                            }, {
                                'userid': str(ctx.author.id)
                            }]
                        })
                    async for d in data:
                        user = d
                        break
                    try:
                        old = user.copy()
                        if user['userid'] == str(ctx.author.id):
                            user['points'] += 1
                            await dbclient.update_array(collection, old, user)
                    except:
                        await dbclient.create_doc(collection, {
                            'userid': str(ctx.author.id),
                            'points': 1
                        })
                else:
                    embed = Embed(
                        '<a:false:800330847865143327>  Wrong!',
                        f'Your answer was wrong! The correct answer was **{guesser.options[guesser.correct]}**. You also lost **1** '
                        + random_lacan + '.')
                    await embed.send(ctx)
                    dbclient = DBClient()
                    collection = dbclient.db.pointsdb
                    data = await dbclient.get_array(
                        collection, {
                            '$and': [{
                                'userid': str(ctx.author.id)
                            }, {
                                'userid': str(ctx.author.id)
                            }]
                        })
                    async for d in data:
                        user = d
                        break
                    try:
                        old = user.copy()
                        if user['userid'] == str(ctx.author.id):
                            user['points'] -= 1
                            await dbclient.update_array(collection, old, user)
                    except:
                        await dbclient.create_doc({
                            'userid': str(ctx.author.id),
                            'points': -1
                        })

            else:
                embed = Embed(
                    '<a:false:800330847865143327>  Wrong!',
                    f'You didn\'t give a valid response! The correct answer was **{guesser.options[guesser.correct]}**. You also lost **1** '
                    + random_lacan + '.')
                await embed.send(ctx)
                dbclient = DBClient()
                collection = dbclient.db.pointsdb
                data = await dbclient.get_array(
                    collection, {
                        '$and': [{
                            'userid': str(ctx.author.id)
                        }, {
                            'userid': str(ctx.author.id)
                        }]
                    })
                async for d in data:
                    user = d
                    break
                try:
                    old = user.copy()
                    if user['userid'] == str(ctx.author.id):
                        user['points'] -= 1
                        await dbclient.update_array(collection, old, user)
                except:
                    await dbclient.create_doc({
                        'userid': str(ctx.author.id),
                        'points': -1
                    })
コード例 #30
0
ファイル: bal.py プロジェクト: Lacan-NTSport/NB-alpha
    async def bal(self, ctx, userid=None):
        #return await ctx.send('This command is currently under maintenance. The developers will try to get it up again as soon as possible. In the meantime feel free to use `n.help` to get the other commands. Thank you for your understanding!')
        #data = json.loads(requests.get('https://pointsdb.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)['data']
        list_of_lacans = [
            '<:lacan_economy_1:801006407536607262>',
            '<:lacan_economy_2:801004873612132382>',
            '<:lacan_economy_3:801004873214722079>',
            '<:lacan_economy_4:801004868126113822>',
            '<:lacan_economy_5:801004868348936203>',
            '<:lacan_economy_6:801004863433605160>',
            '<:lacan_economy_7:801004870643220481>',
            '<:lacan_economy_8:801004872820457483>',
            '<:lacan_economy_9:801004872417804298>',
            '<:lacan_economy_10:801004872811413514>'
        ]
        random_lacan = random.choice(list_of_lacans)
        channels = self.client.get_all_channels()
        channel = get(channels, id=803938544175284244)
        green = 0x40AC7B
        red = 0xE84444
        orange = 0xF09F19

        dbclient = DBClient()
        collection = dbclient.db.pointsdb
        if userid == None:
            data = await dbclient.get_array(
                collection, {
                    '$and': [{
                        'userid': str(ctx.author.id)
                    }, {
                        'userid': str(ctx.author.id)
                    }]
                })
        else:
            data = await dbclient.get_array(
                collection, {'$and': [{
                    'userid': userid
                }, {
                    'userid': userid
                }]})
        try:
            embed = Embed('Your Balance',
                          f'You have **{data["points"]}** {random_lacan}.',
                          'moneybag')
        except:
            userid = ''.join(list(userid)[2:-1])
            data = await dbclient.get_array(
                collection, {'$and': [{
                    'userid': userid
                }, {
                    'userid': userid
                }]})
            try:
                embed = Embed(
                    'Your Balance',
                    f'You have **{data["points"]}** {random_lacan}.',
                    'moneybag')
            except:
                userid = ''.join(list(userid)[1:])
                data = await dbclient.get_array(
                    collection,
                    {'$and': [{
                        'userid': userid
                    }, {
                        'userid': userid
                    }]})
                try:
                    embed = Embed(
                        'Your Balance',
                        f'You have **{data["points"]}** {random_lacan}.',
                        'moneybag')
                except:
                    embed = Embed('Error!',
                                  'The user doesn\'t have any lacans!')
        return await embed.send(ctx)