示例#1
0
 async def morse(self, ctx, *args):
     if 'fliptext' in str(ctx.message.content).split(' ')[0][1:]:
         data = myself.jsonisp(
             "https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/upside-down.json"
         )
     elif 'cursive' in str(ctx.message.content).split(' ')[0][1:]:
         data = myself.jsonisp(
             "https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/cursive.json"
         )
     elif 'fancy' in str(ctx.message.content).split(' ')[0][1:]:
         data = myself.jsonisp(
             "https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/fancy.json"
         )
     elif 'braille' in str(ctx.message.content).split(' ')[0][1:]:
         data = myself.jsonisp(
             "https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/braille.json"
         )
     else:
         data = myself.jsonisp(
             "https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/morse.json"
         )
     total, tocon = '', str(' '.join(list(args)))
     for i in list(tocon.lower()):
         if i.lower() in ''.join(list(data.keys())):
             for j in list(data.keys()):
                 if i.lower() == j.lower():
                     total += data[j]
                     break
         else:
             total += i
         if 'morse' in str(ctx.message.content).split(' ')[0]:
             if i == ' ': i = '/'
             else: i += ' '
             total += i
     await ctx.send(total)
示例#2
0
 async def food(self, ctx, *args):
     if len(list(args))==0:
         data = myself.jsonisp('https://nekobot.xyz/api/image?type='+str(ctx.message.content[1:]))
         link = data['message'].replace('\/', '/')
         if 'food' in ctx.message.content:
             col = int(data['color'])
         elif 'coffee' in ctx.message.content:
             col, num = int(data['color']), random.randint(0, 1)
             if num==0: link = myself.jsonisp('https://coffee.alexflipnote.dev/random.json')['file']
             else: link = myself.jsonisp('https://nekobot.xyz/api/image?type=coffee')['message'].replace('\/', '/')
         async with ctx.message.channel.typing():
             data = self.canvas.urltoimage(link.replace('\/', '/'))
             await ctx.send(file=discord.File(data, ctx.message.content[1:]+'.png'))
示例#3
0
 async def iss(self, ctx):
     iss, ppl, total = myself.jsonisp(
         'https://open-notify-api.herokuapp.com/iss-now.json'
     ), myself.jsonisp(
         'https://open-notify-api.herokuapp.com/astros.json'), '```'
     for i in range(0, len(ppl['people'])):
         total += str(i + 1) + '. ' + ppl['people'][i]['name'] + (
             (20 - (len(ppl['people'][i]['name']))) *
             ' ') + ppl['people'][i]['craft'] + '\n'
     embed = discord.Embed(
         title='Position: ' + str(iss['iss_position']['latitude']) + ' ' +
         str(iss['iss_position']['longitude']),
         description='**People at craft:**\n\n' + str(total) + '```',
         colour=discord.Colour.from_rgb(201, 160, 112))
     await ctx.send(embed=embed)
示例#4
0
 async def recipe(self, ctx, *args):
     if len(list(args)) == 0:
         await ctx.send(
             embed=discord.Embed(title='Here is a recipe to cook nothing:',
                                 description='1. Do nothing\n2. Profit'))
     else:
         data = myself.jsonisp(
             "http://www.recipepuppy.com/api/?q={}".format(
                 myself.urlify(' '.join(list(args)))))
         if len(data['results']) == 0:
             await ctx.send("{} | Did not find anything.".format(
                 str(self.client.get_emoji(BotEmotes.error))))
         elif len([i for i in data['results']
                   if i['thumbnail'] != '']) == 0:
             await ctx.send(
                 "{} | Did not find anything with a delicious picture.".
                 format(str(self.client.get_emoji(BotEmotes.error))))
         else:
             total = random.choice(
                 [i for i in data['results'] if i['thumbnail'] != ''])
             embed = discord.Embed(title=total['title'],
                                   url=total['href'],
                                   description='Ingredients:\n{}'.format(
                                       total['ingredients']),
                                   color=discord.Colour.from_rgb(
                                       201, 160, 112))
             embed.set_image(url=total['thumbnail'])
             await ctx.send(embed=embed)
示例#5
0
 async def itunes(self, ctx, *args):
     if len(list(args)) == 0:
         return await ctx.send('{} | Please send a search term!'.format(
             str(self.client.get_emoji(BotEmotes.error))))
     data = myself.jsonisp(
         'https://itunes.apple.com/search?term={}&media=music&entity=song&limit=1&explicit=no'
         .format(myself.urlify(' '.join(list(args)))))
     if len(data['results']) == 0:
         return await ctx.send('{} | No music found... oop'.format(
             self.client.get_emoji(BotEmotes.error)))
     data = data['results'][0]
     em = discord.Embed(
         title=data['trackName'],
         url=data['trackViewUrl'],
         description=
         '**Artist: **{}\n**Album: **{}\n**Release Date:** {}\n**Genre: **{}'
         .format(data['artistName'], data['collectionName'],
                 data['releaseDate'].replace('T', ' ').replace('Z', ''),
                 data['primaryGenreName']),
         color=discord.Color.from_rgb(201, 160, 112))
     em.set_thumbnail(url=data['artworkUrl100'])
     em.set_author(name='iTunes',
                   icon_url='https://i.imgur.com/PR29ow0.jpg',
                   url='https://www.apple.com/itunes/')
     await ctx.send(embed=em)
示例#6
0
 async def lucario(self, ctx):
     embed = discord.Embed(title='Lucario!',
                           color=discord.Color.from_rgb(201, 160, 112))
     embed.set_image(url=myself.jsonisp(
         'http://pics.floofybot.moe/image?token=lucario&category=sfw')
                     ['image'])
     await ctx.send(embed=embed)
示例#7
0
 async def morse(self, ctx, *args):
     if len(list(args)) == 0:
         await ctx.send(
             str(self.client.get_emoji(BotEmotes.error)) +
             ' | no arguments? Really?')
     elif len(' '.join(list(args))) > 100:
         await ctx.send(
             str(self.client.get_emoji(BotEmotes.error)) +
             ' | too long....')
     else:
         async with ctx.message.channel.typing():
             res = myself.jsonisp(
                 'https://useless-api--vierofernando.repl.co/encode?text=' +
                 myself.urlify(' '.join(list(args))))
             if 'fliptext' in str(ctx.message.content).split(' ')[0][1:]:
                 data = res['styles']['upside-down']
             elif 'cursive' in str(ctx.message.content).split(' ')[0][1:]:
                 data = res['styles']['cursive']
             elif 'fancy' in str(ctx.message.content).split(' ')[0][1:]:
                 data = res['styles']['fancy']
             elif 'braille' in str(ctx.message.content).split(' ')[0][1:]:
                 data = res['braille']
             else:
                 data = res['ciphers']['morse']
             await ctx.send(f'{data}')
示例#8
0
 async def googledoodle(self, ctx):
     wait = await ctx.send(str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... This may take a few moments...')
     data = myself.jsonisp('https://www.google.com/doodles/json/{}/{}'.format(str(t.now().year), str(t.now().month)))[0]
     embed = discord.Embed(title=data['title'], colour=discord.Colour.from_rgb(201, 160, 112), url='https://www.google.com/doodles/'+data['name'])
     embed.set_image(url='https:'+data['high_res_url'])
     embed.set_footer(text='Event date: '+str('/'.join(
         [str(i) for i in data['run_date_array'][::-1]]
     )))
     await wait.edit(content='', embed=embed)
示例#9
0
 async def nasa(self, ctx, *args):
     query = 'earth' if len(list(args))==0 else myself.urlify(' '.join(list(args)))
     data = myself.jsonisp(f'https://images-api.nasa.gov/search?q={query}&media_type=image')
     await ctx.message.channel.trigger_typing()
     if len(data['collection']['items'])==0: return await ctx.send('{} | Nothing found.'.format(self.client.get_emoji(BotEmotes.error)))
     img = random.choice(data['collection']['items'])
     em = discord.Embed(title=img['data'][0]['title'], description=img['data'][0]["description"], color=discord.Colour.from_rgb(201, 160, 112))
     em.set_image(url=img['links'][0]['href'])
     await ctx.send(embed=em)
示例#10
0
 async def iotd(self, ctx):
     data = myself.jsonisp(
         'https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US'
     )['images'][0]
     embed = discord.Embed(title=data['copyright'],
                           url=data['copyrightlink'],
                           color=discord.Color.from_rgb(201, 160, 112))
     embed.set_image(url='https://bing.com' + data['url'])
     await ctx.send(embed=embed)
示例#11
0
 async def steamprofile(self, ctx, *args):
     try:
         getprof = myself.urlify(list(args)[0].lower())
         data = myself.jsonisp('https://api.alexflipnote.dev/steam/user/'+str(getprof))
         state, privacy, url, username, avatar, custom_url, steam_id = data["state"], data["privacy"], data["url"], data["username"], data["avatarfull"], data["customurl"], data["steamid64"]
         embed = discord.Embed(title=username, description='**[Profile Link]('+str(url)+')**\n**Current state: **'+str(state)+'\n**Privacy: **'+str(privacy)+'\n**[Profile pic URL]('+str(avatar)+')**', colour = discord.Color.from_rgb(201, 160, 112))
         embed.set_thumbnail(url=avatar)
         await ctx.send(embed=embed)
     except:
         await ctx.send(str(self.client.get_emoji(BotEmotes.error))+" | Error; profile not found!")
示例#12
0
 async def pandafact(self, ctx):
     if 'pandafact' in str(ctx.message.content).lower():
         link = 'https://some-random-api.ml/facts/panda'
     else:
         link = 'https://some-random-api.ml/facts/bird'
     data = myself.jsonisp(link)['fact']
     await ctx.send(
         embed=discord.Embed(title='Did you know?',
                             description=data,
                             colour=discord.Colour.from_rgb(201, 160, 112)))
示例#13
0
 async def panda(self, ctx):
     link, col, msg = random.choice([
         "https://some-random-api.ml/img/panda",
         "https://some-random-api.ml/img/red_panda"
     ]), discord.Colour.from_rgb(201, 160,
                                 112), 'Here is some cute pics of pandas.'
     data = myself.jsonisp(link)['link']
     embed = discord.Embed(title=msg, color=col)
     embed.set_image(url=data)
     await ctx.send(embed=embed)
示例#14
0
 async def factcore(self, ctx):
     data = myself.jsonisp(
         'https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/fact-core.json'
     )
     embed = discord.Embed(title='Fact Core',
                           description=random.choice(data),
                           colour=discord.Colour.from_rgb(201, 160, 112))
     embed.set_thumbnail(
         url=
         'https://i1.theportalwiki.net/img/thumb/5/55/FactCore.png/300px-FactCore.png'
     )
     await ctx.send(embed=embed)
示例#15
0
 async def temmie(self, ctx, *args):
     if len(list(args)) == 0:
         await ctx.send(
             str(self.client.get_emoji(BotEmotes.error)) +
             ' | Please send something to be encoded.')
     else:
         link, num = 'https://raw.githubusercontent.com/dragonfire535/xiao/master/assets/json/temmie.json', 1
         data = myself.jsonisp(link)
         keyz = list(data.keys())
         total = ''
         for j in range(num, len(keyz)):
             if total == '': total = ' '.join(list(args))
             total = total.replace(keyz[j], data[keyz[j]])
         await ctx.send(total)
示例#16
0
 async def dog(self, ctx):
     async with ctx.message.channel.typing():
         links = {
             "dog": "https://api.alexflipnote.dev/dogs|file",
             "cat": "https://api.alexflipnote.dev/cats|file",
             "sadcat": "https://api.alexflipnote.dev/sadcat|file",
             "bird": "https://api.alexflipnote.dev/sadcat|file",
             "fox": 'https://randomfox.ca/floof/?ref=apilist.fun|image'
         }
         for i in list(links.keys()):
             if str(ctx.message.content[1:]).lower().replace(' ', '')==i: link = links[i] ; break
         apiied = myself.jsonisp(link.split('|')[0])[link.split('|')[1]]
         data = self.canvas.urltoimage(apiied)
         await ctx.send(file=discord.File(data, 'animal.png'))
示例#17
0
 async def catfact(self, ctx):
     if 'cat' in str(ctx.message.content).lower():
         await ctx.send(
             '**Did you know?**\n' +
             str(myself.jsonisp("https://catfact.ninja/fact")['fact']))
     elif 'dog' in str(ctx.message.content).lower():
         await ctx.send('**Did you know?**\n' + str(
             myself.jsonisp("https://dog-api.kinduff.com/api/facts")
             ['facts'][0]))
     else:
         wait = await ctx.send(
             str(self.client.get_emoji(BotEmotes.loading)) +
             ' | Please wait...')
         data = myself.insp('https://bestlifeonline.com/random-fun-facts/')
         byFact = data.split('<div class="title ">')
         accepted, facts = False, []
         for a in byFact:
             if a.split('</div')[0].startswith('Superman'): accepted = True
             if accepted:
                 facts.append(a.split('</div>')[0])
             else:
                 continue
         await wait.edit(content='**Did you know?**\n' +
                         str(random.choice(facts)))
示例#18
0
 async def steamapp(self, ctx, *args):
     data = myself.jsonisp('https://store.steampowered.com/api/storesearch?term='+myself.urlify(str(' '.join(list(args))))+'&cc=us&l=en')
     if data['total']==0: await ctx.send(str(self.client.get_emoji(BotEmotes.error))+' | Did not found anything. Maybe that app *doesn\'t exist...*')
     else:
         try:
             prize = data['items'][0]['price']['initial']
             prize = str(prize / 100)+ ' ' + data['items'][0]['price']['currency']
         except KeyError: prize = 'FREE'
         if data['items'][0]['metascore']=="": rate = '???'
         else: rate = str(data['items'][0]['metascore'])
         oss_raw = []
         for i in range(0, len(data['items'][0]['platforms'])):
             if data['items'][0]['platforms'][str(list(data['items'][0]['platforms'].keys())[i])]==True:
                 oss_raw.append(str(list(data['items'][0]['platforms'].keys())[i]))
         embed = discord.Embed(title=data['items'][0]['name'], url='https://store.steampowered.com/'+str(data['items'][0]['type'])+'/'+str(data['items'][0]['id']), description='**Price tag:** '+str(prize)+'\n**Metascore: **'+str(rate)+'\n**This app supports the following OSs: **'+str(myself.dearray(oss_raw)), colour=discord.Colour.from_rgb(201, 160, 112))
         embed.set_image(url=data['items'][0]['tiny_image'])
         await ctx.send(embed=embed)
示例#19
0
 async def leet(self, ctx, *args):
     if len(list(args)) == 0:
         await ctx.send(
             str(self.client.get_emoji(BotEmotes.error)) +
             ' | No arguments? ok then! no service it is!')
     else:
         data = myself.jsonisp(
             "https://vierofernando.github.io/username601/assets/json/leet.json"
         )
         total = ''
         for i in range(0, len(' '.join(list(args)))):
             for j in list(data.keys()):
                 if str(' '.join(list(args)))[i].lower() == j.lower():
                     total += data[list(data.keys())[i]]
                     break
             if len(total) == i: total += str(' '.join(list(args)))[i]
         await ctx.send(total)
示例#20
0
 async def leet(self, ctx, *args):
     if len(list(args)) == 0:
         await ctx.send(
             str(self.client.get_emoji(BotEmotes.error)) +
             ' | No arguments? ok then! no service it is!')
     else:
         data = myself.jsonisp(
             "https://vierofernando.github.io/username601/assets/json/leet.json"
         )
         total = ''
         text = ' '.join(list(args))
         for i in list(text):
             if i.lower() in list('abcdefghijklmnopqrstuvwxyz'):
                 total += data[i]
                 continue
             total += i
         await ctx.send(total)
示例#21
0
 async def stackoverflow(self, ctx, *args):
     if len(list(args)) == 0:
         await ctx.send(
             str(self.client.get_emoji(BotEmotes.errorr)) +
             ' | Hey fellow developer, Try add a question!')
     else:
         try:
             query = myself.urlify(' '.join(list(args)))
             data = myself.jsonisp(
                 "https://api.stackexchange.com/2.2/search/advanced?q=" +
                 str(query) +
                 "&site=stackoverflow&page=1&answers=1&order=asc&sort=relevance"
             )
             leng = len(data['items'])
             ques = data['items'][0]
             tags = ''
             for i in range(0, len(ques['tags'])):
                 if i == len(ques['tags']) - 1:
                     tags += '[' + str(
                         ques['tags'][i]
                     ) + '](https://stackoverflow.com/questions/tagged/' + str(
                         ques['tags'][i]) + ')'
                     break
                 tags += '[' + str(
                     ques['tags'][i]
                 ) + '](https://stackoverflow.com/questions/tagged/' + str(
                     ques['tags'][i]) + ') | '
             embed = discord.Embed(
                 title=ques['title'],
                 description='**' + str(ques['view_count']) +
                 ' *desperate* developers looked into this post.**\n**TAGS:** '
                 + str(tags),
                 url=ques['link'],
                 colour=discord.Colour.from_rgb(201, 160, 112))
             embed.set_author(name=ques['owner']['display_name'],
                              url=ques['owner']['link'],
                              icon_url=ques['owner']['profile_image'])
             embed.set_footer(text='Shown 1 result out of ' + str(leng) +
                              ' results!')
             await ctx.send(embed=embed)
         except:
             await ctx.send(
                 str(self.client.get_emoji(BotEmotes.error)) +
                 ' | There was an error on searching! Please check your spelling :eyes:'
             )
示例#22
0
 async def pokeinfo(self, ctx, *args):
     query = 'Missingno' if (len(list(args))==0) else myself.urlify(' '.join(list(args)))
     try:
         data = myself.jsonisp('https://bulbapedia.bulbagarden.net/w/api.php?action=query&titles={}&format=json&formatversion=2&pithumbsize=150&prop=extracts|pageimages&explaintext&redirects&exintro'.format(query))
         embed = discord.Embed(
             url='https://bulbapedia.bulbagarden.net/wiki/{}'.format(query),
             color=discord.Colour.from_rgb(201, 160, 112),
             title=data['query']['pages'][0]['title'], description=myself.limitto(data['query']['pages'][0]['extract'], 1000)
         )
         try:
             pokeimg = data['query']['pages'][0]['thumbnail']['source']
             embed.set_thumbnail(url=pokeimg)
         except:
             pass
         await ctx.send(embed=embed)
     except Exception as e:
         print(e)
         return await ctx.send("{} | Pokemon not found!".format(
             str(self.client.get_emoji(BotEmotes.error))
         ))
示例#23
0
 async def programmingmeme(self, ctx):
     data = myself.jsonisp('https://useless-api.vierofernando.repl.co/programmermeme')['url']
     return await ctx.send(embed=discord.Embed(title='Programmer meme', color=discord.Colour.from_rgb(201, 160, 112)).set_image(url=data))
示例#24
0
 async def duck(self, ctx):
     await ctx.send(file=discord.File(
         Painter.urltoimage(
             myself.jsonisp('https://random-d.uk/api/v2/random?format=json')
             ['url']), 'duck.png'))
示例#25
0
 async def shibe(self, ctx):
     async with ctx.message.channel.typing():
         data = myself.jsonisp("http://shibe.online/api/shibes?count=1")[0]
         await ctx.send(
             file=discord.File(Painter.smallURL(data), 'shibe.png'))
示例#26
0
 async def help(self, ctx, *args):
     data = myself.jsonisp(
         "https://vierofernando.github.io/username601/assets/json/commands.json"
     )
     types = Config.cmdtypes
     args = list(args)
     if len(args) < 1:
         cate = ''
         for i in range(0, len(types)):
             cate += f'**{str(i+1)}. **{Config.prefix}help {str(types[i])}\n'
         embed = discord.Embed(
             title='Username601\'s commands',
             description=
             'INFO: Bot is currently being rewritten. Most commands won\'t respond yet. Sorry for the inconvenience!\n[Join the support server]('
             + str(Config.SupportServer.invite) +
             ') | [Vote us on top.gg](https://top.gg/bot/' +
             str(Config.id) +
             '/vote)\n\n**[More information on our website here.](https://vierofernando.github.io/username601/commands)**\n**Command Categories:** \n'
             + str(cate),
             colour=discord.Colour.from_rgb(201, 160, 112))
         embed.set_footer(
             text=
             f'Type {Config.prefix}help <command/category> for more details.'
         )
         await ctx.send(embed=embed)
     else:
         source = None
         typ = ''
         category_name = None
         query = ' '.join(list(args))
         for i in range(0, len(types)):
             if query == types[i].lower():
                 source = data[i][types[i]]
                 typ = 'Category'
                 category_name = types[i]
                 break
         if source == None:
             for i in range(0, len(data)):
                 for j in range(0, len(data[i][types[i]])):
                     if query == data[i][types[i]][j]['n'].lower():
                         source = data[i][types[i]][j]
                         typ = 'Command'
                         break
                 if not typ == '':
                     break
         if source == None:
             await ctx.send('Oops... Your command doesn\'t seem to exist.')
         else:
             if typ == 'Category':
                 cmds = []
                 for i in range(0, len(source)):
                     cmds.append(source[i]['n'])
                 cmds = myself.dearray(cmds)
                 embed = discord.Embed(
                     title='Category help for ' + str(category_name) + ':',
                     description='**Commands:** \n```' + str(cmds) + '```',
                     colour=discord.Colour.from_rgb(201, 160, 112))
             if typ == 'Command':
                 parameters = 'No parameters required.'
                 if len(source['p']) > 0:
                     parameters = ''
                     for i in range(0, len(source['p'])):
                         parameters += '**' + source['p'][i] + '**\n'
                 embed = discord.Embed(
                     title='Command help for ' + str(source['n']) + ':',
                     description='**Function: **' + str(source['f']) +
                     '\n**Parameters:** \n' + str(parameters),
                     colour=discord.Colour.from_rgb(201, 160, 112))
             await ctx.send(embed=embed)
示例#27
0
 async def pikachu(self, ctx):
     async with ctx.message.channel.typing():
         async with self.session.get(myself.jsonisp('https://some-random-api.ml/img/pikachu')['link']) as r:
             res = await r.read()
             await ctx.send(file=discord.File(fp=BytesIO(res), filename="pikachu.gif"))
示例#28
0
 async def catfact(self, ctx):
     if 'cat' in str(ctx.message.content).lower(): await ctx.send('**Did you know?**\n'+str(myself.jsonisp("https://catfact.ninja/fact")['fact']))
     elif 'dog' in str(ctx.message.content).lower(): await ctx.send('**Did you know?**\n'+str(myself.jsonisp("https://dog-api.kinduff.com/api/facts")['facts'][0]))
     else:
         await ctx.send('**Did you know?**\n'+str(myself.jsonisp("https://useless-api--vierofernando.repl.co/randomfact")['fact']))
示例#29
0
 async def randomword(self, ctx):
     async with ctx.message.channel.typing():
         await ctx.send(myself.jsonisp("https://random-word-api.herokuapp.com/word?number=1")[0])