Exemplo n.º 1
0
 async def car(self, ctx, id):
     try:
       id2 = id.replace("_", " ")
       print(id2)
     except:
       print('not replaced')
       pass
     text = requests.get('https://www.nitrotype.com/index/d8dad03537419610ef21782a075dde2d94c465c61266-1266/bootstrap.js').text
     result = re.search(r'\[\{\"id\"\:\d+,\"carID\":\d+.*\]', text).group()
     data = json.loads('{"list": '+''.join(list(result)[:-1])+'}')
     for elem in data['list']:
         for v in elem.values():
             try:
                 if re.search(str(id2).lower(), str(v).lower()).group():
                     cardata = elem
                     break
             except:
                 continue
         else:
             continue
         break
     else:
         embed = Embed(':frame_photo:  Car Image', 'Search Query: `'+str(id2)+'`')
         embed.field('Results', 'None')
         embed.footer('Not the car you\'re looking for? Replace all spaces with _ .')
         return await embed.send(ctx)
     embed = Embed('Car Image', 'Search Query: `'+str(id)+'`')
     embed.image('https://www.nitrotype.com/cars/'+cardata['options']['largeSrc'])
     embed.footer('Not the car you\'re looking for? Replace all spaces with _ .')
     for k, v in cardata.items():
         embed.field(k, v)
     return await embed.send(ctx)
Exemplo n.º 2
0
 async def id(self, ctx, user=None):
     #data = json.loads(requests.get('https://test-db.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)
     if user == None:
         success, result = await get_username(str(ctx.author.id))
         if success:
             racer = result
         else:
             embed = result
             await embed.send(ctx)
             return
         if racer.success:
             success, result = await get_username(str(ctx.author.id), get_id=True)
             userid = result
     if user != None:
         racer = await Racer(user)
         success, result = await get_username(racer.username.lower(), get_id=True)
         if racer.success:            
             userid = result
     if not racer.success:
         userid = str(''.join(list(user)[3:-1]))
         success, result = await get_username(str(userid))
         if success:
             racer = result
         else:
             userid = str(''.join(list(user)[2:-1]))
             success, result = await get_username(str(userid))
             if success:
                 racer = result
             else:
                 success, result = await get_username(str(userid))
                 if success:
                     racer = result
                 else:
                     userid = str(user)
                     success, result = await get_username(str(userid))
                     if success:
                         racer = result
                     else:
                         embed = result
                         await embed.send(ctx)
                         return
     try:
         embed = Embed('Identification', f'<@'+userid+'>\'s NT Profile [:link:](https://www.nitrotype.com/racer/'+racer.username+')')
     except:
         embed = Embed('Identification', f'{racer.username}\'s NT Profile [:link:](https://www.nitrotype.com/racer/'+racer.username+')')
     embed.field('Nitrotype username ', '`'+racer.username+'`', inline=True)
     embed.field('Nitrotype Display name', '`'+racer.name+'`', inline=True)
     embed.field('Nitrotype ID', '`'+str(racer.userid)+'`', inline=True)
     try:
         embed.field('Discord ID', '`'+userid+'`', inline=True)
         embed.field('Discord Mention', '<@'+userid+'>', inline=True)
     except:
         pass
     await embed.send(ctx)
Exemplo n.º 3
0
 async def uptime(self, ctx):
     # Uptime
     current_time = time.time()
     difference = int(round(current_time - start_time))
     uptime = str(datetime.timedelta(seconds=difference))
     # Runtime
     current_time2 = time.time()
     difference2 = int(round(current_time2 - run_time))
     uptime2 = str(datetime.timedelta(seconds=difference2))
     # Embed
     embed = Embed(':green_circle:  Lacan NTSport\'s Uptime',
                   'Check my uptime stats!',
                   color=0xc8dc6c)
     # Embed Fields
     # Uptime
     embed.field(name="__Uptime__", value='`' + uptime + '`')
     # Runtime
     embed.field(name="__Runtime__", value='`' + uptime2 + '`')
     # Birthday
     embed.field(name=':birthday: __Birthday__',
                 value="**Fri, May 22, 2020 7:29 AM**")
     # Explaination
     embed.field(
         name="Restarting",
         value=
         "The uptime resets every hour because of the bot being automatically restarted."
     )
     try:
         await embed.send(ctx)
     except discord.HTTPException:
         await ctx.send("Current uptime: " + uptime)
Exemplo n.º 4
0
 async def dm(self, ctx, user: discord.Member = None, *, message = 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!')
     developers = [505338178287173642, 396075607420567552]
     if ctx.author.id in developers:
       if user == None:
         return await ctx.send('Please specify a user you\'re sending your message to.')
       else:
         pass
       if message == None:
         return await ctx.send('Please specify a message you want to send.')
       else:
         embed=Embed('New Direct Message', 'speech_left')
         embed.field('Author:', f'Message sent by {ctx.author}')
         embed.field('Message:', f'Following message was sent: {message}')
         return await user.send(embed=Embed.default_embed())
     else:
         return await ctx.send('You do not have perms, dude.')
Exemplo n.º 5
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
Exemplo n.º 6
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('❌')
Exemplo n.º 7
0
    def create_embed(self, starting, ending):
        data = requests.get('https://NTLB.adl212.repl.co/tdata.json').text
        data = json.loads(data)
        players = []
        points = []
        speeds = []
        accuracys = []
        races = []
        displays = []
        for elem in data['teams']:
            players.append(elem['tag'])
            points.append(elem['points'])
            speeds.append(round(elem['speed']))
            accuracys.append(round(elem['accuracy']))
            races.append(elem['races'])
            displays.append(elem['name'])
        
        zipped_lists = zip(points, players)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sortedlb = [element for _, element in sorted_zipped_lists]

        zipped_lists = zip(points, displays)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sorteddisplay = [element for _, element in sorted_zipped_lists]

        zipped_lists = zip(points, players)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sortedusername = [element for _, element in sorted_zipped_lists]

        zipped_lists = zip(points, races)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sortedraces = [element for _, element in sorted_zipped_lists]

        zipped_lists = zip(points, speeds)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sortedspeeds = [element for _, element in sorted_zipped_lists]

        zipped_lists = zip(points, accuracys)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sortedaccuracy = [element for _, element in sorted_zipped_lists]

        zipped_lists = zip(points, points)
        sorted_zipped_lists = sorted(zipped_lists, reverse=True)
        sortedpoints = [element for _, element in sorted_zipped_lists]
    
        embed = Embed('Nitrotype Team Leaderboards!', f'{str(starting)} - {str(ending)} Teams in Our Database!')
        links = []
        x = starting
        for display in sortedlb[starting:ending]:
            links.append(f'[:link:](https://www.nitrotype.com/team/{sortedlb[x]})')
            x = x + 1
        points = []
        for point in sortedpoints[starting:ending]:
            points.append(fn(point))
        embed.field('Teams', '\n'.join(sortedlb[starting:ending]))

        embed.field('Points', '\n'.join(points))
        embed.field('Links', '\n'.join(links))
        return embed
Exemplo n.º 8
0
    async def value(self, ctx, username=None):
        dtree = DecisionTreeRegressor()
        df = pandas.read_csv('./commands/market/data.csv')
        f_names = ['races','wpm_average','wpm_high','longestSession','membership','cars_owned','views','first','second','third','created']

        features = df[f_names]
        targets = df['price']
        dtree = dtree.fit(features, targets)
        racer = await Racer(username)
        if not racer.success:
            embed=Embed(':warning:  Error!', f'The requested Nitrotype User **{username}** [:link:](https://nitrotype.com/racer/{username}) couldn\'t be found.')
            return await embed.send(ctx)
        l = f"{int(racer.races.replace(',', ''))},{racer.wpm_average},{racer.wpm_high},{racer.newdata['longestSession']},{1 if racer.newdata['membership'] == 'gold' else 0},{racer.cars_owned},{racer.views.replace(',', '')},{racer.first.replace(',', '')},{racer.second.replace(',', '')},{racer.third.replace(',', '')},{racer.newdata['createdStamp']}".split(',')
        pred = dtree.predict([l])
        rawval = str(pred[0]*10**6)
        print(rawval)
        roundval = round(float(rawval))
        print(roundval)
        formval = "{:,}".format(roundval)
        print(formval)
        embed=Embed('Account Value', 'This value is calculated by Machine Learning.', 'money with wings')
        embed.field('__Nitrotype User__', f'{racer.username} [:link:](https://nitrotype.com/racer/{racer.username})')
        embed.field('__Value__', f'$**{formval}**')
        await embed.send(ctx)
Exemplo n.º 9
0
    async def check_giveaways(self):
        #print('running check gw script')
        dbclient = DBClient()
        collection = dbclient.db.giveaways
        documents = collection.find({})
        async for data in documents:
            #print('in documents')
            #print(int(time.time()))
            #print(data['endtime'])
            #print(data['ended'])
            if int(time.time()) >= data['endtime'] and data['ended'] == False:
                print('big enough')
                old = copy.deepcopy(data)
                channel = get(self.client.get_all_channels(),
                              id=data['channelID'])
                print('got the channel')
                try:
                    msg = get(await channel.history(limit=1000).flatten(),
                              id=data['messageID'])
                    print('g1')
                except:
                    data['ended'] = True
                    await dbclient.update_array(collection, old, data)
                    print('g2')
                amt_winners = data['winners']
                if msg == None:
                    data['ended'] = True
                    await dbclient.update_array(collection, old, data)
                    print('g3')
                    continue
                prize = data['gwcontent']
                try:
                    try:
                        winners = ''
                        winners = random.choices(data['joined'],
                                                 k=int(amt_winners))
                    except IndexError:
                        try:
                            winners = [random.choice(data['joined'])]
                        except IndexError:
                            await msg.channel.send(
                                f'No one won \n{msg.jump_url}')
                    mentions = ''
                    for winner in winners:
                        mentions += f'<@{winner}> '
                    print({winner})
                    print({mentions})
                    embed = msg.embeds[0]
                    embed.description += f'\n\nWinners: {mentions}'
                    embed.color = 0xFF0000
                    await msg.edit(embed=embed)
                    if data['joined'] == []:
                        await msg.channel.send(
                            f'I couldn\'t determine a winner for {msg.jump_url}'
                        )
                    else:
                        await msg.channel.send(
                            f'{mentions} won the giveaway for **{prize}**! {msg.jump_url}'
                        )
                        embed = Embed('🎉 Congratulations! 🎉',
                                      f'You won **{prize}**!')
                        embed.field('🔗  Link',
                                    f'**[Giveaway Link]({msg.jump_url})**')
                        embed.field(
                            '🛠️  Support Server',
                            'Join the official **[Support Server](https://discord.gg/Wj96Ehg)**!'
                        )
                        embed.field(
                            '⬆️  Vote',
                            'Vote for me **[here](https://top.gg/bot/713352863153258556)**.'
                        )
                        embed.field(
                            '🔗  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.'
                        )
                        for winner in winners:
                            try:
                                user = await self.client.fetch_user(int(winner)
                                                                    )
                                await user.send(embed=embed.default_embed())
                            except:
                                pass

                except Exception as e:
                    await msg.channel.send(
                        f'I couldn\'t determine a winner for{msg.jump_url}.')

                data['ended'] = True
                await dbclient.update_array(collection, old, data)
            else:
                continue
Exemplo n.º 10
0
 async def checkbot(self, ctx, username):
     # 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.')
     racer = await Racer(username)
     if not racer.success:
         return Embed('Error!', 'That account does not exist!')
     prediction = await check(username)
     print(prediction)
     pred = prediction['botornot'][1]
     botornot_value = prediction['botornot'][0]
     accuracy = sum(prediction['accuracy']) / 2
     df = pandas.read_csv("data.csv")
     features = ['avgSpeed', 'highSpeed', 'racesTotal', 'highestSession']
     avgdivhigh = []
     racesTotal = list(df['racesTotal'])
     highest = []
     highest_int = 0
     for x in df['racesTotal']:
         avgSpeed = int(
             list(df['avgSpeed'])[list(df['racesTotal']).index(x)])
         highSpeed = int(
             list(df['highSpeed'])[list(df['racesTotal']).index(x)])
         highestSession = int(
             list(df['highestSession'])[list(df['racesTotal']).index(x)])
         if list(df['Go'])[list(df['racesTotal']).index(x)] == 1:
             del racesTotal[list(racesTotal).index(x)]
             continue
         avgdivhigh.append(
             (int(x) - highestSession) * (highSpeed - avgSpeed))
     plt.scatter(racesTotal, avgdivhigh, color='blue')
     '''
     slope, intercept, r, p, std_err = stats.linregress(racesTotal, avgdivhigh)
     def myfunc(x):
         return slope * x + intercept
     #print(myfunc(234061))
     mymodel = list(map(myfunc, racesTotal))
     '''
     mymodel = numpy.poly1d(numpy.polyfit(racesTotal, avgdivhigh, 3))
     myline = numpy.linspace(1, 700000, 700000)
     plt.plot(myline, mymodel(myline), color='blue')
     plt.xlabel('Races')
     plt.ylabel('Formula')
     plt.scatter([int(racer.races.replace(',', ''))],
                 [(int(racer.races.replace(',', '')) -
                   int(racer.newdata['longestSession'])) *
                  (int(racer.wpm_high.replace(',', '')) -
                   int(racer.wpm_average.replace(',', '')))],
                 color='red')
     plt.savefig('graph.png')
     plt.cla()
     embed = Embed('Botting Or Not?', 'Analysis of **' + username + '**')
     if racer.success == False:
         embed.field('Error!', 'I could not find that account!')
     else:
         embed.field('Bot Or Not',
                     '__BOT__' if botornot_value == 1 else '__LEGIT__')
         embed.field('Chance Of Being A Bot',
                     str(round(pred * 100, 2)) + '%')
         embed.field('Accuracy', '`' + str(accuracy) + '`%')
     file = discord.File("graph.png", filename="graph.png")
     embed.image(url="attachment://graph.png")
     await ctx.send(file=file, embed=embed.default_embed())
Exemplo n.º 11
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())
Exemplo n.º 12
0
async def verify_race(ctx):
    dbclient = clientDB()
    collection = dbclient.db.NT_to_discord
    dbdata = await dbclient.get_array(collection, {})
    async for elem in dbdata:
        old = copy.deepcopy(elem)
        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? 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)
                elem['verifyCar'] = None
                elem['verified'] = 'in progress'
                dbclient = DBClient()
                collection = dbclient.db.NT_to_discord
                await dbclient.update_array(collection, old, elem)
                async with aiohttp.ClientSession() as s:
                    await fetch(s,'https://Lacan-Verification.try2win4code.repl.co')
                break
            if elem['verified'] == 'in progress':
                async with aiohttp.ClientSession() as s:
                    response = await 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_array(collection, old, elem)
                    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 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)
Exemplo n.º 13
0
    def get_page(self, page_number, ctx, data, dbdata=None):
        n = page_number
        embed = Embed(
            ':shopping_cart:  Shop',
            f'*{str(ctx.author)} entered the shop.* \nBuy epic stuff to enjoy the bot even more!'
        )
        if n == 0:
            try:
                embed.field('Currently equipped',
                            f'__Name:__ `{dbdata["equipped"]["car"]}`')
                embed.image(
                    f'https://www.nitrotype.com/cars/{dbdata["equipped"]["img"]}'
                )
            except:
                embed.field('Currently equipped', 'None')

            embed.field(
                'Buy / equip items',
                'Use `n.buy [Item ID]` to buy an item and `n.equip [Item ID]` to equip an item'
            )
            embed.field(
                'Reward',
                'Equip your cars and get epic multipliers in the economy category!'
            )
            embed.footer('Get amazing perks with items!')
            return embed
        if n == 1:
            f = open('weeklyupdate.txt')
            timeleft = int(f.readlines()[0]) - round(time.time())
            embed.field(
                'Weekly Items:',
                f'__Name:__ `{data["weekly"]["car"]}`\n__Price:__ `{str(data["weekly"]["price"])}` Lacans\n__Time left:__ `{self.format_time(timeleft)}` hours'
            )
            embed.footer('Get amazing perks with items!')
            embed.image(
                f'https://www.nitrotype.com/cars/{data["weekly"]["img"]}')
            return embed
        if n == 2:
            f = open('dailyupdate.txt')
            timeleft = int(f.readlines()[0]) - round(time.time())
            embed.field(
                'Daily Items:',
                f'__Name:__ `{data["daily"]["car"]}`\n__Price:__ `{str(data["daily"]["price"])}` Lacans\n__Time left:__ `{self.format_time(timeleft)}` hours'
            )
            embed.footer('Get amazing perks with items!')
            embed.image(
                f'https://www.nitrotype.com/cars/{data["daily"]["img"]}')
            return embed
Exemplo n.º 14
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)
Exemplo n.º 15
0
    async def giveaway(self, ctx):
        role1 = get(ctx.message.guild.roles, name='Giveaways')
        for role in ctx.author.roles:
            if role.name.lower() == "giveaways":
                has_perm = True
                break
        #else:
        #has_perm = False
        #if has_perm == False:
        #pass
        if ctx.author.guild_permissions.manage_guild:
            has_perm = True
        elif ctx.author.guild_permissions.administrator:
            has_perm = True
        elif ctx.author.id in [505338178287173642]:
            has_perm = True
        elif role.name.lower() == "giveaways":
            has_perm = True
        else:
            has_perm = False
        if has_perm == False:
            pass
        print(has_perm)
        if has_perm == False:
            embed = Embed(
                ':warning:  Error!',
                'Seems like you don\'t have the permission to use this command.\n\nThis command requires a role called `Giveaways`.'
            )
            return await embed.send(ctx)
        embed = Embed(
            ':partying_face:  Create A Giveaway: Step 1 - Channel  :partying_face:',
            'In what channel do you want the giveaway to be hosted?',
            color=0x00FF00)
        embed.field(
            '__Instructions:__',
            'Type in a channel ID or mention of the channel where the giveaway should be hosted!\n\n*Example response: **#giveaways***'
        )
        await embed.send(ctx)
        msg = await self.wait_for_msg(ctx)
        if msg[0] == False:
            return msg[1].send(ctx)
        else:
            msg = msg[1]
        if ''.join(list(msg.content)[:2]) == "<#":
            channel = ''.join(list(msg.content)[2:-1])
        elif list(msg.content)[:2] == "<!#":
            channel = ''.join(list(msg.content)[3:-1])
        elif msg.content.isdigit():
            channel = msg.content
        else:
            embed = Embed(':warning:  Error!',
                          'You didn\'t give a valid channel ID or mention!')
            return await embed.send(ctx)
        embed = Embed(
            ':partying_face:  Create A Giveaway: Step 2 - Duration  :partying_face:',
            'How Long Is Your Giveaway going to last?',
            color=0x00FF00)
        embed.field(
            '__Instructions:__',
            'Use `s` for seconds, `m` for minutes, `h` for hours and `d` for days.\n\n*Example response: **1d***'
        )
        await embed.send(ctx)
        msg = await self.wait_for_msg(ctx)
        if msg[0] == False:
            return msg[1].send(ctx)
        else:
            msg = msg[1]
        msg = msg.content
        if len(msg.split('s')) == 2:
            msg = msg.split('s')
            if not msg[0].isdigit():
                embed = Embed(':warning:  Error!', 'Invalid amount of time!')
                return await embed.send(ctx)
            gwtime = ('seconds', int(msg[0]))
        elif len(msg.split('m')) == 2:
            msg = msg.split('m')
            if not msg[0].isdigit():
                embed = Embed(':warning:  Error!', 'Invalid amount of time!')
                return await embed.send(ctx)
            gwtime = ('minutes', int(msg[0]))
        elif len(msg.split('h')) == 2:
            msg = msg.split('h')
            if not msg[0].isdigit():
                embed = Embed(':warning:  Error!', 'Invalid amount of time!')
                return await embed.send(ctx)
            gwtime = ('hours', int(msg[0]))
        elif len(msg.split('d')) == 2:
            msg = msg.split('d')
            if not msg[0].isdigit():
                embed = Embed(':warning:  Error!', 'Invalid amount of time!')
                return await embed.send(ctx)
            gwtime = ('days', int(msg[0]))
        else:
            embed = Embed(':warning:  Error!',
                          'You didn\'t give a valid amount of time!')
            return await embed.send(ctx)
        embed = Embed(
            ':partying_face:  Create A Giveaway: Step 3 - Winners  :partying_face:',
            'How Many Winners should this giveaway have?',
            color=0x00FF00)
        embed.field(
            '__Instructions:__',
            'Reply with the amount of winners you wish this giveaway to have.\n\n*Example response: **1***'
        )
        await embed.send(ctx)
        msg = await self.wait_for_msg(ctx)
        if msg[0] == False:
            return msg[1].send(ctx)
        else:
            msg = msg[1]
        msg = msg.content
        if msg.isdigit:
            winners = msg
        else:
            embed = Embed(':warning:  Error!',
                          'You didn\'t give a valid number of winners!')
            return await embed.send(ctx)
        embed = Embed(
            ':partying_face:  Create A Giveaway: Step 4 - Prize  :partying_face:',
            'What should the prize of this giveaway be?',
            color=0x00FF00)
        embed.field(
            '__Instructions:__',
            'What are you giving away?\n\n*Example response: **100K NT cash ~courtesy of âš¡Try2Win4Gloryâš¡***'
        )
        await embed.send(ctx)
        msg = await self.wait_for_msg(ctx)
        if msg[0] == False:
            return msg[1].send(ctx)
        else:
            msg = msg[1]
        prize = msg.content
        embed = Embed(
            ':partying_face:  Create A Giveaway: Step 5 - Requirements  :partying_face:',
            'Should this giveaway have requirements?',
            color=0x00FF00)
        embed.field(
            '__Instructions:__',
            'Reply with `y` if you want to include requirements, reply with `n` if you\'d like to start the giveaway without requirements\n\n*Example response: **y***'
        )
        await embed.send(ctx)
        msg = await self.wait_for_msg(ctx)
        if msg[0] == False:
            return msg[1].send(ctx)
        else:
            msg = msg[1]
        requirements = {}
        if msg.content.lower() in ['y', 'n']:
            if msg.content.lower() in ['y']:
                while True:
                    embed = Embed(
                        ':partying_face:  Create A Giveaway: Step 5 - Requirements  :partying_face:',
                        'What type of requirement do you want?',
                        color=0x00FF00)
                    embed.field(
                        '__Instructions:__',
                        'You can have `team` and `membership` requirements currently! Type one of them in! Type `none` to create the giveaway!'
                    )
                    await embed.send(ctx)
                    msg = await self.wait_for_msg(ctx)
                    if msg[0] == False:
                        return msg[1].send(ctx)
                    else:
                        msg = msg[1]
                    if msg.content.lower() == "team":
                        embed = Embed(
                            ':partying_face:  Create A Giveaway: Step 5 - Requirements  :partying_face:',
                            'What team does the user have to be in?',
                            color=0x00FF00)
                        embed.field(
                            '__Instructions:__',
                            'Give a valid team name or team tag here!')
                        await embed.send(ctx)
                        msg = await self.wait_for_msg(ctx)
                        if msg[0] == False:
                            return msg[1].send(ctx)
                        else:
                            msg = msg[1]
                        team = await Team(msg.content)
                        if team.data == {}:
                            embed = Embed('Invalid Team!',
                                          'Oops you messed up!')
                            await embed.send(ctx)
                            continue
                        else:
                            requirements.update({"team": msg.content})
                            continue
                    if msg.content.lower() == "membership":
                        embed = Embed(
                            ':partying_face:  Create A Giveaway: Step 5 - Requirements  :partying_face:',
                            'What type of membership does a person have to have?',
                            color=0x00FF00)
                        embed.field(
                            '__Instructions:__',
                            'Type `gold` or `basic`, depending on the membership the users needs to have.'
                        )
                        await embed.send(ctx)
                        msg = await self.wait_for_msg(ctx)
                        if msg[0] == False:
                            return msg[1].send(ctx)
                        else:
                            msg = msg[1]
                        if msg.content.lower() == "gold":
                            requirements.update({"membership": "gold"})
                        if msg.content.lower() == "basic":
                            requirements.update({"membership": "basic"})
                        else:
                            embed = Embed('Invalid Membership',
                                          'Oops you messed up!')
                            await embed.send(ctx)
                            continue
                    if msg.content.lower() == "none":
                        break

            else:
                if msg.content in ['n']:
                    pass
            embed = Embed(
                ':white_check_mark:  Success!',
                f'You\'ve created a giveaway that will be hosted in channel <#{str(channel)}>, lasts **{gwtime[1]}** **{gwtime[0]}**, has **{winners}** winners, and you\'re giving away **{prize}**',
                color=0x00FF00)
            await embed.send(ctx)
            addedtime = 0
            if gwtime[0] == "seconds":
                addedtime = gwtime[1]
            elif gwtime[0] == "minutes":
                addedtime = 60 * gwtime[1]
            elif gwtime[0] == "hours":
                addedtime = 60 * 60 * gwtime[1]
            elif gwtime[0] == "days":
                addedtime = 24 * 60 * 60 * gwtime[1]
            if requirements == {}:
                reqs = 'none'
            else:
                reqs = ''.join(list(str(requirements))[1:-1])
            try:
                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)

                embed = Embed(
                    ':tada:  Giveaway  :tada:',
                    f'\n\n**Entry:** React with {random_lacan}!\n\n**Prize:** {prize}\n\n**Winners:** {winners}\n\n**Hosted by:** {ctx.author.mention}',
                    timestamp=(datetime.fromtimestamp(
                        int(
                            int(datetime.timestamp(datetime.now())) +
                            addedtime))),
                    color=0x00FF00)
                '''embed.field('Prize', gwcontent)
                embed.field('Winners', winners)
                embed.field('To Enter', f'React With {random_lacan} !')'''
                embed.field('Requirements', reqs)
                embed.footer('Ends at')
                c = discord.utils.get(ctx.guild.channels, id=int(channel))
                '''message = await c.send(content=":partying_face:", embed=embed.default_embed())'''
                message = await c.send(embed=embed.default_embed())

                await message.add_reaction(random_lacan)
            except:

                embed = Embed(
                    ':tada:  Giveaway  :tada:',
                    f'\n\n**Entry:** React with :moneybag:!\n\n**Prize:** {prize}\n\n**Winners:** {winners}\n\n**Hosted by:** {ctx.author.mention}',
                    timestamp=(datetime.fromtimestamp(
                        int(
                            int(datetime.timestamp(datetime.now())) +
                            addedtime))),
                    color=0x00FF00)
                '''embed.field('Prize', prize)
                embed.field('Winners', winners)
                embed.field('To Enter', 'React With :moneybag: !')'''
                embed.field('Requirements', reqs)
                embed.footer('Ends at')
                c = discord.utils.get(ctx.guild.channels, id=int(channel))
                message = await c.send(
                    content=
                    "I am missing `Use external emoji` permissions. Make sure to give me those in order to enjoy giveaways even more!",
                    embed=embed.default_embed())
                #message = await c.send(embed=embed.default_embed())
                await message.add_reaction('💰')
            dbclient = DBClient()
            collection = dbclient.db.giveaways
            await dbclient.create_doc(
                collection, {
                    "endtime":
                    int(int(datetime.timestamp(datetime.now())) + addedtime),
                    "messageID":
                    message.id,
                    "channelID":
                    message.channel.id,
                    "ended":
                    False,
                    "requirements":
                    requirements,
                    "gwcontent":
                    prize,
                    "winners":
                    winners
                })
            print('gw in db')
        else:
            embed = Embed(
                'Error!'
                'You gave an invalid response! Your giveaway has been canceled.'
            )
            return await embed.send(ctx)
Exemplo n.º 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)
                }]
            })
        user = data
        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)
Exemplo n.º 17
0
 async def checkbot(self, ctx, username):
     # 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.')
     racer = await Racer(username)
     async with aiohttp.ClientSession() as s:
         botornot = await self.fetch(
             'https://Lacan-Checkbot.try2win4code.repl.co',
             s,
             data={'username': username})
         print(botornot)
         csvdata = await self.fetch(
             'https://Lacan-Checkbot.try2win4code.repl.co/data.csv', s)
     with open('data.csv', 'w') as f:
         f.write(csvdata)
     df = pandas.read_csv("data.csv")
     features = ['avgSpeed', 'highSpeed', 'racesTotal', 'highestSession']
     avgdivhigh = []
     racesTotal = list(df['racesTotal'])
     highest = []
     highest_int = 0
     for x in df['racesTotal']:
         avgSpeed = int(
             list(df['avgSpeed'])[list(df['racesTotal']).index(x)])
         highSpeed = int(
             list(df['highSpeed'])[list(df['racesTotal']).index(x)])
         highestSession = int(
             list(df['highestSession'])[list(df['racesTotal']).index(x)])
         if list(df['Go'])[list(df['racesTotal']).index(x)] == 1:
             del racesTotal[list(racesTotal).index(x)]
             continue
         avgdivhigh.append(
             (int(x) - highestSession) * (highSpeed - avgSpeed))
     plt.scatter(racesTotal, avgdivhigh, color='blue')
     '''
     slope, intercept, r, p, std_err = stats.linregress(racesTotal, avgdivhigh)
     def myfunc(x):
         return slope * x + intercept
     #print(myfunc(234061))
     mymodel = list(map(myfunc, racesTotal))
     '''
     mymodel = numpy.poly1d(numpy.polyfit(racesTotal, avgdivhigh, 3))
     myline = numpy.linspace(1, 700000, 700000)
     plt.plot(myline, mymodel(myline), color='blue')
     plt.xlabel('Races')
     plt.ylabel('Formula')
     plt.scatter([int(racer.races.replace(',', ''))],
                 [(int(racer.races.replace(',', '')) -
                   int(racer.newdata['longestSession'])) *
                  (int(racer.wpm_high.replace(',', '')) -
                   int(racer.wpm_average.replace(',', '')))],
                 color='red')
     plt.savefig('graph.png')
     plt.cla()
     embed = Embed('Botting Or Not?', 'Analysis of **' + username + '**')
     if botornot['botornot'] == 'error':
         embed.field('Error!', 'I could not find that account!')
     else:
         embed.field(
             'Bot Or Not',
             '__BOT__' if botornot['botornot'][0] == 1 else '__LEGIT__')
         embed.field('Chance Of Being A Bot',
                     str(botornot['botornot'][1] * 100) + '%')
         embed.field(
             'Accuracy', '`' + str(
                 ((botornot['accuracy'][0] * 100) +
                  (botornot['accuracy'][1] * 100)) / 2) + '`%')
     file = discord.File("graph.png", filename="graph.png")
     embed.image(url="attachment://graph.png")
     await ctx.send(file=file, embed=embed.default_embed())
Exemplo n.º 18
0
async def on_message(message):
    if message.author.bot == True and (
            message.content.startswith('n.')
            or message.content.startswith('N.')
            or message.content.startswith('<@!713352863153258556>')
            or message.content.startswith('<@713352863153258556>')):
        print('Stop using bots on user accounts!')
        embed = Embed(
            '<:bruh:834049885414227998>  Bruh',
            'What are you thinking? If you want to use me, get on a user account. You can\'t use commands through bots. <a:keka:800338138802946098>'
        )
        ctx = await client.get_context(message)
        return await embed.send(ctx)
    else:
        if message.content == "<@!713352863153258556>" or message.content == "<@713352863153258556>":
            ctx = await client.get_context(message)
            #return
            #embed=Embed('Lacan NTSport', 'Test')
            #await embed.send
            #return

            embed = Embed(
                'Lacan NTSport',
                '**__FAQ:__**\n\nWho am I?\nI\'m Lacan NTSport, a multi purpose discord bot for the game [nitrotype](https://nitrotype.com/).\n\nWhat\'s my prefix?\nMy prefix is `n.` or `N.`.\n\nHow do I get a list of commands?\nIn order to get a full list of commands make sure to run `n.help`.\n\nHow can you invite me to your server?\nIn order to invite me to your server, run `n.invite`.\n\nWho are my developers?\nI was developed by <@505338178287173642>, <@396075607420567552>, <@637638904513691658>.\n\nWhat\'s premium? How can I get it?\nIn order to learn more about premium, make sure to run `n.premium`.',
                'information source')
            return await embed.send(ctx, dm=False)
            #return await message.channel.send('<@505338178287173642> **YOU F*****G BASTARD**')
        if message.author.id == 713352863153258556:
            return
        if "780980594892341288" in message.content.split(' '):
            return
        '''#Permanent Bans:
    ctx = await client.get_context(message)
    if message.author.id == permbanned[0] and (

                message.content.startswith('n.')
                or message.content.startswith('N.')
                or message.content.startswith('<@!713352863153258556>') or message.content.startswith('<@713352863153258556>')) or int(message.guild.id) == 799733929481207858:
      embed=Embed(':hammer_pick:  Banned  :hammer_pick:', f'<@{message.author.id}> has been banned from the bot.\n\n__**Duration:**__ **`Permanent`**\n\n__**Reason:**__ ```Insanely high amounts of activity.```\n\n*If you believe this ban is an error, contact <@505338178287173642> for more information.*')
      return await embed.send(ctx, dm=False)
      return'''
        '''
    if message.author.id != 396075607420567552:
        return
    '''
        try:
            if int(message.author.id) in banned and (
                    message.content.startswith('n.')
                    or message.content.startswith('N.')
                    or message.content.startswith('<@!713352863153258556>')
                    or message.content.startswith('<@713352863153258556>')
            ) or int(message.guild.id) == 799733929481207858:
                ctx = await client.get_context(message)
                embed = Embed(
                    'Ooops!',
                    'Looks like you are **BANNED** from the bot!\n\n__Reason:__ `Sending bot commands too fast.`\n\n*You will be unbanned upon the bot restart.* \n*If you believe this is an error, make sure to contact one of the developers (`n.info`).*',
                    'tools')
                return await embed.send(ctx, dm=False)
                #return await message.channel.send('Your banned from the bot!')
            if message.author.id == 780980594892341288 and (
                    message.content.startswith('n.')
                    or message.content.startswith('N.')
                    or message.content.startswith('<@!713352863153258556>')
                    or message.content.startswith('<@713352863153258556>')):
                return await message.channel.send(
                    'Happy living as a weasel. -the devs')
            else:
                if (message.content.startswith('n.')
                        or message.content.startswith('N.')
                        or message.content.startswith('<@!713352863153258556>')
                        or
                        message.content.startswith('<@713352863153258556>')):
                    if message.author.id not in [713352863153258556]:
                        timestamps.append(round(time.time()))
                        authors.append(message.author.id)
                        indices = sorted([
                            i for i, x in enumerate(authors)
                            if x == message.author.id
                        ])
                        if len(indices) <= 10:
                            pass
                        else:
                            inbetweens = []
                            timestamp1 = 0
                            timestamp2 = 0
                            for i in indices:
                                if timestamp1 == 0:
                                    timestamp1 = timestamps[i]
                                    continue
                                if timestamp2 == 0:
                                    timestamp2 = timestamps[i]
                                else:
                                    inbetweens.append(timestamp2 - timestamp1)
                                    timestamp1 = 0
                                    timestamp2 = 0
                            if mean(inbetweens) <= 2:
                                channel = discord.utils.get(
                                    client.get_all_channels(),
                                    id=807659844089806898)
                                await channel.send('<@&808658319648227328>')
                                embed = Embed(':tools:  Banned Member!',
                                              str(message.author))
                                embed.field('Author ID',
                                            f' `{str(message.author.id)}`')
                                embed.field('Author Guild',
                                            f'**{str(message.guild)}**')
                                embed.field('Author Guild ID',
                                            f'`{str(message.guild.id)}`')
                                await channel.send(embed=embed.default_embed())
                                banned.append(message.author.id)

                    #check for botters
                    #print(f"{message.content} | {message.author.id} | {str(message.author)} | {message.guild.id} | {str(message.guild)}")
                    async with message.channel.typing():
                        await asyncio.sleep(random.uniform(0.05, 0.1))
                    #return await client.process_commands(message)
                    try:
                        ctx = await client.get_context(message)
                        await ctx.command.invoke(ctx)
                    except Exception as e:
                        raise e
                        shouldraise = True
                        if isinstance(e, AttributeError):
                            embed = Embed(
                                '<a:error:800338727645216779>  Error!',
                                '**Unrecognized command!**\nFor a full list of commands, make sure to use `n.help`.',
                                color=0xff0000)
                            await embed.send(ctx)
                            shouldraise = False
                        else:

                            embed = Embed(
                                '<a:error:800338727645216779>  Error!',
                                f'```{e}```\nThe developers have received your error message.\nUse `n.errors` for an explaination on your error.'
                            )
                            await embed.send(ctx)
                        channel = discord.utils.get(client.get_all_channels(),
                                                    id=787018607481192479)
                        channel2 = discord.utils.get(client.get_all_channels(),
                                                     id=803938544175284244)
                        '''embed = Embed('__**Command Log**__', str(message.author))

                    embed.field('__Command__', f'`n.{("".join(list(message.content)[2:]))}`')
                    embed.field('__User ID__', f'`{str(message.author.id)}`')
                    embed.field('__Guild ID__', f'`{str(message.guild.id)}`')
                    embed.field('__Guild Name__',f' **{str(message.guild.name)}**')
                    embed.field('__Channel ID__', f'`{str(ctx.message.channel.id)}`')
                    try:
                      try:
                        invitelink = await ctx.channel.create_invite(max_age=300, max_uses=100, unique='False', reason='Better support features - instant developer notification, easier to help people. Don\'t want this? Remove my permission to create invites, but then don\'t expect immediate support.')
                      except:
                        invitelink = await ctx.channel.create_invite(max_age=300, max_uses=100, unique='True', reason='Better support features - instant developer notification, easier to help people. Don\'t want this? Remove my permission to create invites, but then don\'t expect immediate support.')
                      embed.field('__Invite__', f'{invitelink}')
                    except:
                      pass
                    embed.field('__Error__', f'```{e}```')
                    await channel.send(embed=embed.default_embed())
                    await channel2.send(embed=embed.default_embed())'''
                        if shouldraise:
                            raise e
                        return
                    '''channel = discord.utils.get(client.get_all_channels(), id=787018607481192479)
                channel2 = discord.utils.get(client.get_all_channels(), id = 803938544175284244)
                embed = Embed('__**Command Log**__', str(message.author), color=0x2ecc71)
                embed.field('__Command__', f'`n.{("".join(list(message.content)[2:]))}`')
                embed.field('__User ID__', f'`{str(message.author.id)}`')
                embed.field('__Guild ID__', f'`{str(message.guild.id)}`')
                embed.field('__Guild Name__',f' **{str(message.guild.name)}**')
                try:
                    try:
                        invitelink = await ctx.channel.create_invite(max_age=300, max_uses=100, unique='False', reason='Better support features - instant developer notification, easier to help people. Don\'t want this? Remove my permission to create invites, but then don\'t expect immediate support.')
                    except:
                        invitelink = await ctx.channel.create_invite(max_age=300, max_uses=100, unique='True', reason='Better support features - instant developer notification, easier to help people. Don\'t want this? Remove my permission to create invites, but then don\'t expect immediate support.')
                    embed.field('__Invite__', f'{invitelink}')
                except:
                      pass
                embed.field('__Channel ID__', f'`{str(ctx.message.channel.id)}`')
                await channel.send(embed=embed.default_embed())
                await channel2.send(embed=embed.default_embed())'''
        except:
            return
            ctx = await client.get_context(message)
            await ctx.command.invoke(ctx)
Exemplo n.º 19
0
    async def stats(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!')
        #data = json.loads(requests.get('https://test-db.nitrotypers.repl.co', data={'key': os.getenv('DB_KEY')}).text)
        if user == None:
            try:
              racer = await get_username(str(ctx.author.id))
            except:
              embed=Embed('Error!', 'Couldn\'t find that user', 'warning')
        else:
            racer = await get_username(user, True)
        try:
            if racer[0] == True:
                racer = racer[1]
            else:
                return await racer[1].send(ctx)
        except:
            embed = Embed('Error!', 'Couldn\'t find that user', 'warning')
            return await embed.send(ctx)
        
        if racer.membership == 'basic':
          embed = Embed(f'{racer.username} ({racer.name})\'s stats', racer.tag_and_name, 'race car', 0xfc3503)
          embed.footer(f'{racer.name.title()} has a Standard account. \nThese stats are brought to you by adl212, Try2Win4Glory and Joshua_Kim.', 'https://media.discordapp.net/attachments/719414661686099993/765110312482766919/NT_Server_Halloween_Logo_2020_GIF.gif')

          if (ctx.author.id) not in []:
              embed.footer(f'{racer.name.title()} has a Standard account.\nThese stats are brought to you by adl212 and Try2Win4Glory','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')

        elif racer.membership == 'gold':
          embed = Embed(f'{racer.username} ({racer.name})\'s stats', racer.tag_and_name, 'race car', 0xfac32d)
          embed.footer(f'{racer.name.title()} has a Gold account. \nThese stats are brought to you by adl212, Try2Win4Glory and Joshua_Kim.', 'https://cdn.discordapp.com/attachments/719414661686099993/754971786231283712/season-callout-badge.png')

          if (ctx.author.id) not in [505338178287173642, 637638904513691658, 396075607420567552]:
              embed.footer(f'{racer.name.title()} has a Gold account. Become a premium 💠 member today! \nThese stats are brought to you by adl212 and Try2Win4Glory.','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')
        
        '''try:
          if racer.car == 'https://www.nitrotype.com/cars/17_large_1.png' and racer.car.id != '17':
            pass
            print(racer.car.name)
          else:
            embed.thumbnail(racer.car)
            print(racer.car.name)
        except:
          embed.thumbnail(racer.car)'''
        '''if racer.car == 'https://www.nitrotype.com/cars/110_large_1.png':
            print('Minnie the coper alarm')
        else:'''
        embed.thumbnail(racer.car)


        print(racer.name+' is from '+racer.country)

        embed.field('__General Info__', f':small_blue_diamond: Level: **{racer.level}**\n:small_blue_diamond: XP: **{racer.experience}** \n:small_blue_diamond: **{racer.country}**\n:eyes: **{racer.views}** \n :birthday: **{racer.created}**', inline=True)

        #Achievement points: **{racer.points}**

        #embed.field('\n\u200b', '\n\u200b')

        embed.field('__Speed__', f':stopwatch: Avg: **{racer.wpm_average}**\n:stopwatch: High: **{racer.wpm_high}**')

        #embed.field('\n\u200b', '\n\u200b')

        embed.field('__Races__', f':checkered_flag: **{racer.races}** \n:first_place: **{racer.first}** (**{racer.first_perc}%**)\n:second_place: **{racer.second}** (**{racer.second_perc}%**)\n:third_place: **{racer.third}** (**{racer.third_perc}%**)', inline=True)

        #embed.field('\n\u200b', '\n\u200b')

        embed.field('__Cars__', f':race_car: **{racer.cars_owned}** owned\n:race_car: **{racer.cars_sold}** sold\n:race_car: **{racer.cars_total}** total\n:race_car: **{racer.current_car}**')

        #embed.field('\n\u200b', '\n\u200b')

        embed.field('__Nitros__', f':zap: **{racer.nitros}** owned\n:zap: **{racer.nitros_used}** used\n:zap: **{racer.nitros_total}** total')

        #embed.field('\u200b', '\u200b')

        '''
        embed.field('__Money__', f':dollar: **{racer.money}**\n:dollar: **{racer.money_spent}** spent\n:dollar: **{racer.money_total}** total')
        '''
        try:
            embed.field('__Daily__', f':trophy: **{fn(racer.daily_races)}** races\n :trophy: **{fn(racer.daily_pre["errs"])}** errors \n :trophy: **{fn(racer.daily_pre["typed"])}** words\n :trophy: **{str(round(racer.daily_speed, 2))}** WPM\n :trophy: **{str(round(racer.daily_accuracy, 2))}**% acc')
        except:
            pass

        try:
            embed.field('__Season__', f':trophy: **{fn(racer.season_races)}** races\n :trophy: **{fn(racer.season_pre["errs"])}** errors \n :trophy: **{fn(racer.season_pre["typed"])}** words\n :trophy: **{str(round(racer.season_speed, 2))}** WPM\n :trophy: **{str(round(racer.season_accuracy, 2))}**% acc')
        except:
            pass

        embed.field('__Settings__', f':gear: Friends: {racer.friend_reqs_allowed}\n:gear: Team invite: {racer.looking_for_team}')


        await embed.send(ctx)
Exemplo n.º 20
0
 async def welcome(self, ctx):
     has_perm = False
     if ctx.author.guild_permissions.manage_guild:
         has_perm = True
     elif ctx.author.guild_permissions.administrator:
         has_perm = True
     elif ctx.author.id == 505338178287173642:
         has_perm = True
     if has_perm == False:
         embed = Embed(
             ':warning:  Error!',
             'Seems like you don\'t have the permission to use this command.\n\nThis command requires administrator or manage server perms.'
         )
         return await embed.send(ctx)
     dbclient = DBClient()
     collection = dbclient.db.servers
     data = await dbclient.get_array(collection, {'serverID': ctx.guild.id})
     try:
         for x in data:
             server_exists = True
             server_data = x
             break
     except:
         server_exists = False
         server_data = {}
         pass
     server_data['serverID'] = ctx.guild.id
     embed = Embed(
         'Welcoming Message: Step 1 - Channel',
         'In what channel do you want the message to be sent to?')
     embed.field(
         '__Instructions:__',
         'Type in a channel ID or mention of the channel where the message should be sent!\n\n*Example response: **#welcome***'
     )
     await embed.send(ctx)
     msg = await self.wait_for_msg(ctx)
     if msg[0] == False:
         return await msg[1].send(ctx)
     else:
         msg = msg[1]
     if ''.join(list(msg.content)[:2]) == "<#":
         channel = ''.join(list(msg.content)[2:-1])
     elif list(msg.content)[:2] == "<!#":
         channel = ''.join(list(msg.content)[3:-1])
     elif msg.content.isdigit():
         channel = msg.content
     else:
         embed = Embed(':warning:  Error!',
                       'You didn\'t give a valid channel ID or mention!')
         return await embed.send(ctx)
     c = discord.utils.get(ctx.guild.channels, id=int(channel))
     server_data['channel_id'] = c.id
     embed = Embed('Welcoming Message: Step 2 - Message',
                   'What message should be sent?')
     embed.field(
         '__Instructions:__',
         'Type in a message including variables to create your own custom welcoming system!'
     )
     embed.field('__Variables:__',
                 'Put `{{` and `}}` around text to define a variable.')
     embed.field(
         '__Types Of Variables:__',
         '`user.mention`, `user.id`, `user.racer.username`, `user.racer.speed`, `user.racer.accuracy`, `user.racer.races`, `user.racer.membership'
     )
     embed.field(
         '__Example:__',
         '{{user.mention}} has joined the server. :tada:\n\nThey are linked to {{user.racer.username}}.\n\nFollowing roles should be given:\n{{user.racer.races}}, {{user.racer.speed}}, {{user.racer.accuracy}}'
     )
     await embed.send(ctx)
     msg = await self.wait_for_msg(ctx)
     if msg[0] == False:
         return await msg[1].send(ctx)
     else:
         msg = msg[1]
     server_data['message'] = msg.content
     embed = Embed('Your Welcoming System Is Complete!', 'YAY')
     embed.field('Channel', c.mention)
     embed.field('Message', msg.content)
     await embed.send(ctx)
     if server_exists:
         await dbclient.update_array(collection, {'serverID': ctx.guild.id},
                                     server_data)
     else:
         await dbclient.create_doc(collection, server_data)
Exemplo n.º 21
0
    async def id(self, ctx, user=None):
        #data = 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
        data = await dbclient.get_big_array(collection, 'registered')
        if user == None:
            for elem in data['registered']:
                userid = str(ctx.author.id)
                if str(ctx.author.id) == elem['userID']:
                    if elem['verified'] == 'true':
                        racer = await Racer(elem['NTuser'])
                        break
                    else:
                        embed = Embed('Error!', 'You\'re not verified yet!',
                                      'warning')
                        await embed.send(ctx)
                        return
            else:
                embed = Embed('Error!', 'Couldn\'t find that user', 'warning')
                await embed.send(ctx)
                return
        if user != None:
            racer = await Racer(user)
        if racer.success:
            for elem in data['registered']:
                if elem['NTuser'] == user:
                    userid = elem['userID']
                    break
        if not racer.success:
            userid = str(''.join(list(user)[3:-1]))
            for elem in data['registered']:
                if userid == elem['userID']:
                    if elem['verified'] == 'true':
                        racer = await Racer(elem['NTuser'])
                        break
                    else:
                        embed = Embed('Error!', 'You\'re not verified yet!',
                                      'warning')
                        await embed.send(ctx)
                        break
                if str(''.join(list(user)[2:-1])) == elem['userID']:
                    if elem['verified'] == 'true':
                        racer = await Racer(elem['NTuser'])
                        break
                    else:
                        embed = Embed('Error!', 'You\'re not verified yet!',
                                      'warning')
                        await embed.send(ctx)
                        break
            else:
                userid = str(user)
                for elem in data['registered']:
                    if str(user) == elem['userID']:
                        if elem['verified'] == 'true':
                            racer = await Racer(elem['NTuser'])
                            break
                        else:
                            embed = Embed('Error!',
                                          'You\'re not verified yet!',
                                          'warning')
                            await embed.send(ctx)
                            break
                else:
                    embed = Embed('Error!', 'Couldn\'t find that user',
                                  'warning')
                    await embed.send(ctx)
                    return
        embed = Embed(
            'Identification', f'<@' + userid +
            '>\'s NT Profile [:link:](https://www.nitrotype.com/racer/' +
            racer.username + ')')

        embed.field('Nitrotype username ',
                    '`' + racer.username + '`',
                    inline=True)
        embed.field('Nitrotype Display name',
                    '`' + racer.name + '`',
                    inline=True)
        embed.field('Nitrotype ID', '`' + str(racer.userid) + '`', inline=True)
        try:
            embed.field('Discord ID', '`' + userid + '`', inline=True)
            embed.field('Discord Mention', '<@' + userid + '>', inline=True)
        except:
            pass
        await embed.send(ctx)
Exemplo n.º 22
0
    async def typerace(self, ctx):

        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

        with open('text.txt') as f:
            sentences = f.readlines()
        t = random.choice(sentences).strip()
        start = random.randint(1, 5)
        end = random.randint(start+4, start+8)
        t = ' '.join(((base64.standard_b64decode(t)).decode().split())[start:end])
        await self.create_image(t)
        embed = Embed("Type The Text!", "Type faster for bonus "+random_lacan+"!", "keyboard") #creates embed
        file = discord.File("text.png", filename="text.png")
        embed.image(url="attachment://text.png")
        await ctx.send(file=file, embed=embed.default_embed())
        def check(message: discord.Message):
            return message.author.id == ctx.author.id
        start = round(time.time())
        try:
            response = await self.client.wait_for('message', timeout=15, check=check)
        except asyncio.exceptions.TimeoutError:
            embed = Embed('<a:error:800338727645216779>  Error!', 'You ran out of time because you took longer than `15` seconds to respond!')
            return await embed.send(ctx)
        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

        if ctx.author.id not in [505338178287173642, 637638904513691658, 396075607420567552]:
            cooldown_add(str(ctx.author))
        if response.content == t:
            data = json.loads(requests.get('https://lacanitemshop.nitrotypers.repl.co/data.json').text)
            shopcars = [data['daily']['img'], data['weekly']['img']]
            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 = copy.deepcopy(user)
                for car in user['cars']:
                    if user['equipped']['img'] in shopcars:
                        carbonus = True
                        break
                else:
                    carbonus = False
            except:
                carbonus = False
            end = round(time.time())
            total = end-start
            bonus = round(5/total)
            if carbonus:
                default = 3
                earned = (default+bonus)*2
            else:
                default = 3
                earned = default+bonus
            embed = Embed('<a:Check:797009550003666955>  Congrats!', f'You Earned {random_lacan}!')
            embed.field('Default', str(default))
            embed.field('Bonus', str(bonus))
            embed.field('Total', str(earned))
            if carbonus:
                embed.field('Multiplier', 'X2')
                embed.footer('You earned double lacans by equipping the daily or weekly car!')
            await embed.send(ctx)
            try:
                if user['userid'] == str(ctx.author.id):
                    user['points'] += earned
                    await dbclient.update_array(collection, old, user)
            except UnboundLocalError:
                await dbclient.create_doc(collection, {'userid': str(ctx.author.id), 'points': earned})

        else:
            embed = Embed('<a:false:800330847865143327>  Oops!', 'You messed up sadly... and lost **3** '+random_lacan+'.')
            await embed.send(ctx)
            #Loose lacans
            dbclient = DBClient()
            collection = dbclient.db.pointsdb
            data = await dbclient.get_array(collection, {'$and': [{'userid': str(ctx.author.id)}, {'userid': str(ctx.author.id)}]})
            lost = -3
            async for d in data:
                user = d
                break
            try:
                old = user.copy()
                if user['userid'] == str(ctx.author.id):
                    user['points'] += lost
                    await dbclient.update_array(collection, old, user)
                else:
                    await dbclient.create_doc(collection, {'userid': str(ctx.author.id), 'points': lost})
            except UnboundLocalError:
                await dbclient.create_doc(collection, {'userid': str(ctx.author.id), 'points': lost})
            return
Exemplo n.º 23
0
    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)
Exemplo n.º 24
0
 async def rules(self, ctx):
     if await ImproperType.check(ctx): return
     embed = Embed('Rules', 'This bot\'s rules, make sure to follow them!',
                   'scroll')
     embed.field(
         'Rule 1',
         '__Begging is prohibited.__\n\nBegging for any currency, races or account selling or trading is strictly prohibited.'
     )
     embed.field(
         'Rule 2',
         '__No inappropriate command language.__\n\nThis is a clean bot, any use of commands with any sexual language or harashment comments within the `n.` prefix are not allowed.'
     )
     embed.field(
         'Rule 3',
         '__Respect Discord and NitroType TOS.__\n\nAs a verified discord bot for NitroType, in order to use this bot you have to respect the discord and NitroType TOS.'
     )
     embed.field(
         'Rule 4',
         '__No autotypers or other kind of bots.__\n\nAuto typers or other features making it easier for you to earn currency are strictly prohibited and will (in most of the cases) result in a global ban from the bot.'
     )
     embed.field(
         'Rule 5',
         '__No currency exchange.__\n\nTrading this bot\'s currency for dank memer cash / Nitro Type cash / other currencies is prohibited.'
     )
     embed.field(
         'Rule 6',
         '__No raiding.__\n\nAdding this bot to small servers just to then run commands on autotypers without even answering, just to make sure the bot developer has a hard time with the bot\'s uptime, is strictly prohibited and will have the same consequences as rule 4.'
     )
     embed.field(
         'Rule 7',
         '__Personal information written to the bot remains private.__\n\nAsking for personal information, such as password shared to the bot before is not allowed.'
     )
     embed.field(
         'Rule 8',
         '__No complaining without reading.__\n\nPlease abide from complaining about the bot (for example verification waiting times) if it clearly states that this feature takes its time.'
     )
     embed.field(
         'Rule 9',
         '__No scamming or botting support.__\n\nThis bot does not support botters or scammers and it\'s not allowed to use it for any features like that.'
     )
     embed.field(
         'Rule 10',
         '__Reuse of the code is not permitted.__\n\nThe code for this bot is public, but any reuse of the code is strictly prohibited and subject to an immediate ban from the bot.'
     )
     embed.footer(
         str(ctx.author) +
         ' • © 2020 / 2021 Try2Win4Glory, adl212, Typerious')
     return await embed.send(ctx)