async def channel(self, ctx): total = [] if 'channel' in ctx.message.content: for i in ctx.message.guild.channels: total.append('<#'+str(i.id)+'>') else: for i in ctx.message.guild.roles: total.append('<@&'+str(i.id)+'>') await ctx.send(embed=discord.Embed(description=myself.dearray(total), color=discord.Color.from_rgb(201, 160, 112)))
async def serveremojis(self, ctx): if len(ctx.guild.emojis)==0: await ctx.send(str(self.client.get_emoji(BotEmotes.error))+' | This server has no emojis!') else: try: await ctx.send(myself.dearray([str(i) for i in ctx.guild.emojis])) except: await ctx.send(str(self.client.get_emoji(BotEmotes.error))+' | This server probably has too many emojis to be listed!')
async def rhyme(self, ctx, *args): if len(list(args)) == 0: await message.channel.send( 'Please input a word! And we will try to find the word that best rhymes with it.' ) else: wait, words = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... Searching...'), [] data = myself.api( 'https://rhymebrain.com/talk?function=getRhymes&word=' + str(myself.urlify(' '.join(list(args))))) if len(data) < 1: await wait.edit( content= 'We did not find any rhyming words corresponding to that letter.' ) else: for i in range(0, len(data)): if data[i]['flags'] == 'bc': words.append(data[i]['word']) words = myself.dearray(words) if len(words) > 1950: words = myself.limitify(words) embed = discord.Embed(title='Words that rhymes with ' + str(' '.join(list(args))) + ':', description=words, colour=discord.Colour.from_rgb( 201, 160, 112)) await wait.edit(content='', embed=embed)
async def spotify(self, ctx): if len(ctx.message.mentions) == 0: source = ctx.message.author.activity else: source = ctx.message.mentions[0].activity if str(source).lower() != 'spotify': await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Nope, not listening to spotify.') else: embed = discord.Embed( url='https://open.spotify.com/track/{}'.format( source.track_id), title=source.title, description='Track ID: `' + str(source.track_id) + '`\nStarted listening since ' + str(myself.time_encode( (t.now() - source.created_at).seconds)) + ' ago', color=source.color) embed.add_field(name='Artists', value=myself.dearray(source.artists)) embed.add_field(name='Album', value=source.album) embed.set_author( name='Spotify', icon_url= 'https://images-ext-1.discordapp.net/external/myh_a7c2mTDfnh31SP2539AL_a1bhAYpafwZL5gQ99I/https/www.freepnglogos.com/uploads/spotify-logo-png/spotify-download-logo-30.png' ) embed.set_thumbnail(url=source.album_cover_url) await ctx.send(embed=embed)
async def country(self, ctx, *args): country = myself.urlify(' '.join(list(args))) c = myself.api("https://restcountries.eu/rest/v2/name/" + str(country.lower())) if len(c[0]['borders']) == 0: borderz = 'No borders.' else: borderz = myself.dearray(c[0]['borders']) embed = discord.Embed( title=c[0]['nativeName'], description='**Capital:** ' + str(c[0]['capital']) + '\n**Region: **' + str(c[0]['region']) + '\n**Sub Region: **' + str(c[0]['subregion']) + "\n**Population: **" + str(c[0]['population']) + "\n**Area: **" + str(c[0]['area']) + ' km²\n**Time Zones:** ' + str(myself.dearray(c[0]['timezones'])) + '\n**Borders: **' + str(borderz), colour=discord.Colour.from_rgb(201, 160, 112)) embed.set_author(name=c[0]['name']) await ctx.send(embed=embed)
async def tv(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | please gimme args', format(str(self.client.get_emoji(BotEmotes.error)))) query = myself.urlify(' '.join(list(args))) data = get(f'http://api.tvmaze.com/singlesearch/shows?q={query}') if data.status_code == 404: return await ctx.send('{} | Oops! did not found any movie.'.format( str(self.client.get_emoji(BotEmotes.error)))) try: data = data.json() star = str(':star:' * round(data['rating']['average'])) if data[ 'rating']['average'] != None else 'No star rating provided.' em = discord.Embed(title=data['name'], url=data['url'], description=myself.html2discord( data['summary']), color=discord.Colour.from_rgb(201, 160, 112)) em.add_field(name='General Information', value='**Status: **' + data['status'] + '\n**Premiered at: **' + data['premiered'] + '\n**Type: **' + data['type'] + '\n**Language: **' + data['language'] + '\n**Rating: **' + str(data['rating']['average'] if data['rating']['average'] != None else 'None') + '\n' + star) em.add_field(name='TV Network', value=data['network']['name'] + ' at ' + data['network']['country']['name'] + ' (' + data['network']['country']['timezone'] + ')') em.add_field( name='Genre', value=str( myself.dearray(data['genres']) if len(data['genres']) > 0 else 'no genre avaliable')) em.add_field(name='Schedule', value=myself.dearray(data['schedule']['days']) + ' at ' + data['schedule']['time']) em.set_image(url=data['image']['original']) await ctx.send(embed=em) except: await ctx.send('{} | Oops! There was an error...'.format( str(self.client.get_emoji(BotEmotes.error))))
async def roleinfo(self, ctx, *args): if len(list(args)) == 0: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + " | Please send a role name or a role mention! (don\'t)") else: data = None if '<@&' in ''.join(list(args)): data = ctx.message.guild.get_role( int( str(ctx.message.content).split('<@&')[1].split('>') [0])) else: for i in ctx.message.guild.roles: if ' '.join(list(args)).lower() == str(i.name).lower(): data = i if data == None: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Role not found!') else: if data.permissions.administrator: perm = ':white_check_mark: Server Administrator' else: perm = ':x: Server Administrator' if data.mentionable == True: men = ':warning: You can mention this role and they can get pinged.' else: men = ':v: You can mention this role and they will not get pinged! ;)' embedrole = discord.Embed( title='Role info for role: ' + str(data.name), description='**Role ID: **' + str(data.id) + '\n**Role created at: **' + myself.time_encode( (t.now() - data.created_at).seconds) + ' ago\n**Role position: **' + str(data.position) + '\n**Members having this role: **' + str(len(data.members)) + '\n' + str(men) + '\nPermissions Value: ' + str(data.permissions.value) + '\n' + str(perm), colour=data.colour) embedrole.add_field( name='Role Colour', value='**Color hex: **#' + str(myself.tohex(data.color.value)) + '\n**Color integer: **' + str(data.color.value) + '\n**Color RGB: **' + str(myself.dearray(list(data.color.to_rgb())))) await ctx.send(embed=embedrole)
def spotify(self, person, message): spt, template = person.activity, self.getImage(self.assetpath, 'spotify-template.png') draw = ImageDraw.Draw(template) ava, start = self.imagefromURL(spt.album_cover_url).resize( (275, 276)), self.getSongString(spt.created_at, t.now()) template.paste(ava, (0, 62)) percentage = round( round((t.now() - spt.created_at).total_seconds()) / round(spt.duration.total_seconds()) * 100) duration = ':'.join(str(spt.duration).split(':')[1:10])[:-7] self.drawProgressBar(draw, percentage) draw.text((15, 20), f'{person.name} is listening to', fill="white", font=self.getFont(self.fontpath, 'GothamBook', 30), align="left") draw.text((15, 350), spt.title, fill="white", font=self.getFont(self.fontpath, 'GothamBold', 30), align="left") draw.text((15, 395), spt.album, fill="white", font=self.getFont(self.fontpath, 'GothamBook', 15), align="left") draw.text((15, 378), 'by ' + myself.dearray(spt.artists), fill="white", font=self.getFont(self.fontpath, 'GothamBook', 15), align="left") draw.text((15, 439), start, fill="white", font=self.getFont(self.fontpath, 'GothamBook', 15), align="left") draw.text((485 - self.getFont(self.fontpath, 'GothamBook', 15).getsize(duration)[0], 439), duration, fill="white", font=self.getFont(self.fontpath, 'GothamBook', 15), align="right") return self.buffer(template)
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)
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)