async def daily(self, ctx, *args): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") if Economy.get(ctx.message.author.id) == None: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + " | You don't have a profile yet! Create a profile using `1new`" ) else: obj = Economy.can_vote(ctx.message.author.id) if obj['bool']: await wait.edit( content='', embed=discord.Embed( title='Vote us at top.gg!', description='**[VOTE HERE](https://top.gg/bot/' + str(Config.id) + '/vote)**\nBy voting, we will give you rewards such as ***LOTS of diamonds!***', color=discord.Colour.green())) else: await wait.edit( content='', embed=discord.Embed(title='You can vote us again in ' + str(obj['time']) + '!', colour=discord.Colour.red()))
async def slot(self, ctx): win, jackpot, slots = False, False, [] for i in range(0, 3): newslot = Games.slot() if newslot[1] == newslot[2] and newslot[1] == newslot[ 3] and newslot[2] == newslot[3]: win = True if newslot[1] == ':flushed:': jackpot = True slots.append(Games.slotify(newslot)) if win: msgslot = 'You win!' col = discord.Colour.from_rgb(201, 160, 112) if jackpot: msgslot = 'JACKPOT!' col = discord.Colour.from_rgb(201, 160, 112) if Economy.get(ctx.message.author.id) != None: reward = random.randint(500, 1000) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! you received a whopping ' + str(reward) + ' diamonds!') else: msgslot = 'You lose... Try again!' col = discord.Colour.from_rgb(201, 160, 112) embed = discord.Embed(title=msgslot, description=slots[0] + '\n\n' + slots[1] + '\n\n' + slots[2], colour=col) await ctx.send(embed=embed)
async def geoquiz(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... generating question...') data, topic = myself.api( "https://restcountries.eu/rest/v2/"), random.choice( src.getGeoQuiz()) chosen_nation_num = random.randint(0, len(data)) chosen_nation, wrongs = data[chosen_nation_num], [] data.remove(data[chosen_nation_num]) correct = str(chosen_nation[topic]) for i in range(0, 4): integer = random.randint(0, len(data)) wrongs.append(str(data[integer][str(topic)])) data.remove(data[integer]) emot, static_emot, corr_order_num = list('π¦π§π¨π©'), list( 'π¦π§π¨π©'), random.randint(0, 3) corr_order = emot[corr_order_num] emot[corr_order_num], question, guy = '0', '', ctx.message.author for emote in emot: if emote != '0': added = random.choice(wrongs) question += emote + ' ' + added + '\n' wrongs.remove(added) else: question += corr_order + ' ' + correct + '\n' embed = discord.Embed( title='Geography: ' + str(topic) + ' quiz!', description= ':nerd: Click on the reaction! **You have 20 seconds.**\n\nWhich ' + str(topic) + ' belongs to ' + str(chosen_nation['name']) + '?\n' + str(question), colour=discord.Colour.from_rgb(201, 160, 112)) await wait.edit(content='', embed=embed) for i in range(0, len(static_emot)): await wait.add_reaction(static_emot[i]) def check(reaction, user): return user == guy try: reaction, user = await self.client.wait_for('reaction_add', timeout=20.0, check=check) except asyncio.TimeoutError: await main.add_reaction('π') if str(reaction.emoji) == str(corr_order): await ctx.send( str(self.client.get_emoji(BotEmotes.success)) + ' | <@' + str(guy.id) + '>, Congrats! You are correct. :partying_face:') if Economy.get(ctx.message.author.id) != None: reward = random.randint(5, 150) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! You obtained ' + str(reward) + ' diamonds in total!') else: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | <@' + str(guy.id) + '>, You are incorrect. The answer is ' + str(corr_order) + '.')
async def reset(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() else: await wait.edit( content= ':thinking: | Are you sure? This action is irreversible!\n(Reply with yes/no)' ) def check_is_auth(m): return ctx.message.author == m.author try: waiting = await self.client.wait_for('message', check=check_is_auth, timeout=20.0) except: await ctx.send('{} | No it is then.'.format( str(self.client.get_emoji(BotEmotes.success)))) if 'y' in str(waiting.content).lower(): Economy.delete_data(ctx.author.id) await ctx.send('{} | Data deleted. Thanks for playing.'.format( str(self.client.get_emoji(BotEmotes.success)))) else: await ctx.send('{} | No it is then.'.format( str(self.client.get_emoji(BotEmotes.success))))
async def deposit(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | How many money?\nOr use `1dep all` to deposit all of your money.' .format(str(self.client.get_emoji(BotEmotes.error)))) data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() if list(args)[0].lower() == 'all': Economy.deposit(ctx.author.id, data['bal']) return await ctx.send( '{} | OK. Deposited all of your diamonds to the username601 bank.' .format(str(self.client.get_emoji(BotEmotes.success)))) try: num = int(list(args)[0]) if num > data['bal']: return await ctx.send( '{} | Your bank has more money than in your balance!'. format(str(self.client.get_emoji(BotEmotes.error)))) Economy.deposit(ctx.author.id, num) return await ctx.send( '{} | OK. Deposited {} diamonds to your bank.'.format( str(self.client.get_emoji(BotEmotes.success)), num)) except: await ctx.send('{} | Invalid number.'.format( str(self.client.get_emoji(BotEmotes.error))))
async def withdraw(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | How many money?\nOr use `1widthdraw all` to get money from the bank.' .format(str(self.client.get_emoji(BotEmotes.error)))) data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() if list(args)[0].lower() == 'all': Economy.withdraw(ctx.author.id, data['bankbal']) return await ctx.send( '{} | OK. Withdrawed all of your diamonds from the username601 bank.' .format(str(self.client.get_emoji(BotEmotes.success)))) try: num = int(list(args)[0]) if num > data['bankbal']: return await ctx.send( '{} | Your number is more than the one in your bank!'. format(str(self.client.get_emoji(BotEmotes.error)))) Economy.withdraw(ctx.author.id, num) return await ctx.send( '{} | OK. Withdrawed {} diamonds from your bank.'.format( str(self.client.get_emoji(BotEmotes.success)), num)) except: await ctx.send('{} | Invalid number.'.format( str(self.client.get_emoji(BotEmotes.error))))
async def work(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") data = Economy.get(ctx.author.id) if data == None: await ctx.send( "you dont have a profile yet! Create a profile using `1new`") else: reward = str(random.randint(100, 500)) new_data = Economy.addbal(ctx.message.author.id, int(reward)) job = random.choice( loads( open('/home/runner/hosting601/assets/json/work.json', 'r').read())['works']) if new_data == 'success': await wait.edit( content=str(self.client.get_emoji(BotEmotes.success)) + f" | {ctx.message.author.name} worked {job} and earned {reward} diamonds!" ) else: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + f" | Oops there was an error... Please report this to the owner using `1feedback.`\n`{new_data}`" )
async def guessnum(self, ctx): num = random.randint(5, 100) username = ctx.message.author.display_name user_class = ctx.message.author embed = discord.Embed( title='Starting the game!', description= 'You have to guess a *secret* number between 5 and 100!\n\nYou have 20 attempts, and 20 second timer in each attempt!\n\n**G O O D L U C K**', colour=discord.Colour.from_rgb(201, 160, 112)) await ctx.send(embed=embed) gameplay = True attempts = 20 while gameplay == True: if attempts < 1: await ctx.send('Time is up! The answer is **' + str(num) + '.**') gameplay = False break def check_not_stranger(m): return m.author == user_class try: trying = await self.client.wait_for('message', check=check_not_stranger, timeout=20.0) except asyncio.TimeoutError: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | You did not respond for the next 20 seconds!\nGame ended.' ) gameplay = False break if trying.content.isnumeric() == False: await ctx.send('That is not a number!') attempts = int(attempts) - 1 else: if int(trying.content) < num: await ctx.send('Higher!') attempts = int(attempts) - 1 if int(trying.content) > num: await ctx.send('Lower!') attempts = int(attempts) - 1 if int(trying.content) == num: await ctx.send( str(self.client.get_emoji(BotEmotes.success)) + ' | You are correct!\n**The answer is ' + str(num) + '!**') if Economy.get(ctx.message.author.id) != None: reward = random.randint(5, 50) Economy.addbal(ctx.message.author.id, reward) await ctx.send( 'thanks for playing! You get an extra ' + str(reward) + ' diamonds!') gameplay = False break
async def trivia(self, ctx): al = None try: wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... generating quiz...') auth = ctx.message.author data = myself.api( 'https://wiki-quiz.herokuapp.com/v1/quiz?topics=Science') q = random.choice(data['quiz']) choices = '' for i in range(0, len(q['options'])): al = list('π¦π§π¨π©') if q['answer'] == q['options'][i]: corr = al[i] choices = choices + al[i] + ' ' + q['options'][i] + '\n' embed = discord.Embed( title='Trivia!', description='**' + q['question'] + '**\n' + choices, colour=discord.Colour.from_rgb(201, 160, 112)) embed.set_footer( text='Answer by clicking the reaction! You have 60 seconds.') await wait.edit(content='', embed=embed) for i in range(0, len(al)): await wait.add_reaction(al[i]) except Exception as e: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + f' | An error occurred!\nReport this using {prefix}feedback.\n```{e}```' ) guy = ctx.message.author def check(reaction, user): return user == guy try: reaction, user = await self.client.wait_for('reaction_add', timeout=60.0, check=check) except asyncio.TimeoutError: await wait.add_reaction('π') if str(reaction.emoji) == str(corr): await ctx.send( str(self.client.get_emoji(BotEmotes.success)) + ' | <@' + str(guy.id) + '>, Congrats! You are correct. :partying_face:') if Economy.get(ctx.author.id) != None: reward = random.randint(250, 400) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! You get also a ' + str(reward) + ' diamonds as a prize!') else: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | <@' + str(guy.id) + '>, You are incorrect. The answer is ' + str(corr) + '.')
async def rps(self, ctx): main = await ctx.send(embed=discord.Embed( title='Rock Paper Scissors game.', description='Click the reaction below. And game will begin.', colour=discord.Colour.from_rgb(201, 160, 112))) exp = ['β', 'ποΈ', 'β'] for i in range(0, len(exp)): await main.add_reaction(exp[i]) def check(reaction, user): return user == ctx.message.author try: reaction, user = await self.client.wait_for('reaction_add', timeout=15.0, check=check) except asyncio.TimeoutError: await main.add_reaction('π') emojiArray, ran, given, beginGame = None, None, None, False if str(reaction.emoji) in exp: emotes = ["fist", "hand_splayed", "v"] num = myself.findNum(str(reaction.emoji), exp) beginGame = True res = Games.rps(emotes[num]) given = emotes[num] msgId = res[0] emojiArray = emotes ran = res[1] messages = [ "Congratulations! " + str(ctx.message.author.name) + " WINS!", "It's a draw.", "Oops, " + str(ctx.message.author.name) + " lost!" ] colors = [ discord.Colour.from_rgb(201, 160, 112), discord.Colour.orange(), discord.Colour.from_rgb(201, 160, 112) ] if beginGame: embed = discord.Embed(title=messages[msgId], colour=colors[msgId]) embed.set_footer(text='Playin\' rock paper scissors w/ ' + str(ctx.message.author.name)) embed.set_author(name="Playing Rock Paper Scissors with " + str(ctx.message.author.name)) embed.add_field(name=str(ctx.message.author.name), value=':' + given + ':', inline="True") embed.add_field(name='Username601', value=':' + str(emojiArray[ran]) + ':', inline="True") await main.edit(embed=embed) if msgId == 1 and Economy.get(ctx.message.author.id) != None: reward = random.randint(5, 100) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thank you for playing! you earned ' + str(reward) + ' as a prize!')
async def beg(self, ctx): c = random.randint(1, 4) if Economy.get(ctx.author.id) == None: raise myself.noProfile() if c == 1: award = random.randint(100, 500) Economy.addbal(ctx.author.id, award) return await ctx.send( '{} | You begged and got {} diamonds!'.format( self.client.get_emoji(BotEmotes.success), award)) await ctx.send('{} | Stop begging! Try again later.'.format( self.client.get_emoji(BotEmotes.error)))
async def buylist(self, ctx): source = ctx.author if len( ctx.message.mentions) == 0 else ctx.message.mentions[0] if Economy.get(ctx.author.id) == None: raise myself.noProfile() try: data = Economy.getBuyList(source) assert data['error'] == False, data['ctx'] return await ctx.send(embed=discord.Embed( title='{}\'s buy list'.format(source.name), description=data['ctx'], color=discord.Colour.from_rgb(201, 160, 112))) except Exception as e: return await ctx.send('{} | {}!'.format( self.client.get_emoji(BotEmotes.error), str(e)))
async def bal(self, ctx, *args): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") src, ava = myself.getUser(ctx, args), myself.getUserAvatar(ctx, args) if Economy.get(src.id) == None: raise myself.noProfile() else: img = self.canvas.profile( ava, src, Economy.getProfile( src.id, [i.id for i in ctx.guild.members if not i.bot])) await wait.delete() await ctx.send(file=discord.File(img, 'profile.png'))
async def setbal(self, ctx, *args): if ctx.message.author.id==Config.owner.id: await ctx.message.add_reaction(self.client.get_emoji(BotEmotes.loading)) resp = Economy.setbal(int(list(args)[0]), int(list(args)[1])) await ctx.send(resp) else: await ctx.send('no u.')
async def leaderboard(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait...') data = Economy.leaderboard(ctx.guild.members) if len(data) == 0: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + ' | This server doesn\'t have any members with profiles...') else: total, bals, ids = [], sorted([int(a.split('|')[1]) for a in data])[::-1][0:20], [] for a in range(0, len(bals)): person = [{ 'userid': int(i.split('|')[0]), 'bal': int(i.split('|')[1]) } for i in data if int(i.split('|')[1]) == bals[a] and int(i.split('|')[0]) not in ids][0] ids.append(person['userid']) user = ctx.guild.get_member(person['userid']) total.append('{}. {}#{} - **{}** :gem:'.format( a + 1, user.name, user.discriminator, person['bal'])) await wait.edit(content='', embed=discord.Embed( title=ctx.guild.name + '\'s leaderboard', description='\n'.join(total), color=discord.Colour.from_rgb(201, 160, 112)))
async def new(self, ctx): data = Economy.get(ctx.message.author.id) wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait... creating your profile...") if data != None: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + " | You already have a profile!") else: data = Economy.new(ctx.message.author.id) if data != 'done': await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + f" | Oops! there was an error: {data}") else: await wait.edit( content=str(self.client.get_emoji(BotEmotes.success)) + f" | Created your profile!")
async def bal(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") src = ctx.message.author if len( ctx.message.mentions) == 0 else ctx.message.mentions[0] if Economy.get(src.id) == None: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + " | You don't have a profile yet! Create a profile using `1new`" ) else: img = Painter.profile( str(src.avatar_url).replace('.gif', '.webp').replace( '.webp?size=1024', '.png?size=512'), src, Economy.getProfile( src.id, [i.id for i in ctx.guild.members if not i.bot])) await wait.delete() await ctx.send(file=discord.File(img, 'profile.png'))
async def fish(self, ctx): if Economy.get(ctx.author.id) == None: raise myself.noProfile() wait = await ctx.send('{} | {}'.format( self.client.get_emoji(BotEmotes.loading), random.choice( loads( open('/home/runner/hosting601/assets/json/fish.json', 'r').read())['waiting']))) await sleep(random.randint(3, 10)) res = self.randomfish() if res['catched']: awards = random.randint(res['ctx']['worth']['min'], res['ctx']['worth']['max']) Economy.addbal(ctx.author.id, awards) return await wait.edit( content= '{} | Congratulations! You caught a {} and sell it worth for {} diamonds!' .format(res['ctx']['emote'], res['ctx']['name'], awards)) return await wait.edit(content='{} | You only caught {}...'.format( self.client.get_emoji(BotEmotes.error), res['ctx']))
async def setdesc(self, ctx, *args): if len(list(args)) == 0: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | What is the new description?') else: if len(list(args)) > 50: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Your description is too long!') elif '://' in str(' '.join(list(args))): await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Please don\'t use links in the description! We don\'t allow that!' ) elif 'discord.gg' in str(' '.join(list(args))): await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Please don\'t use server invite links in the description! We don\'t allow that!' ) else: wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait...') if Economy.get(ctx.message.author.id) == None: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + ' | You haven\'t created a profile yet! use `1new`!') else: data = Economy.setdesc(ctx.message.author.id, str(' '.join(list(args)))) if data == 'error': await wait.edit(content=str( self.client.get_emoji(BotEmotes.error)) + ' | Oopsies! There was an error...') else: await wait.edit(content=str( self.client.get_emoji(BotEmotes.success)) + ' | Updated your description!')
async def buy(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | Please use the following parameters:\n`{}buy <name>`'. format(self.client.get_emoji(BotEmotes.error), Config.prefix)) if Economy.get(ctx.author.id) == None: raise myself.noProfile() try: data = Shop.buy(' '.join(list(args)), ctx.author) assert data['error'] == False, data['ctx'] return await ctx.send('{} | {}!'.format( self.client.get_emoji(BotEmotes.success), data['ctx'])) except Exception as e: await ctx.send('{} | {}!'.format( self.client.get_emoji(BotEmotes.error), str(e)))
async def mathquiz(self, ctx): arrayId, num1, num2, symArray = random.randint(0, 4), random.randint( 1, 100), random.randint(1, 100), ['+', '-', 'x', ':', '^'] ansArray = [ num1 + num2, num1 - num2, num1 * num2, num1 / num2, num1**num2 ] sym = symArray[arrayId] await ctx.send('**MATH QUIZ (15 seconds)**\n' + str(num1) + ' ' + str(sym) + ' ' + str(num2) + ' = ???') def is_correct(m): return m.author == ctx.message.author answer = round(ansArray[arrayId]) try: trying = await self.client.wait_for('message', check=is_correct, timeout=15.0) except asyncio.TimeoutError: return await ctx.send( ':pensive: No one? Okay then, the answer is: {}.'.format( answer)) if str(trying.content) == str(answer): await ctx.send( str(self.client.get_emoji(BotEmotes.success)) + ' | <@' + str(ctx.message.author.id) + '>, You are correct! :tada:') if Economy.get(ctx.message.author.id) != None: reward = random.randint(5, 50) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! we added an extra ' + str(reward) + ' diamonds to your profile.') else: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | <@' + str(ctx.message.author.id) + '>, Incorrect. The answer is {}.'.format(answer))
async def coin(self, ctx, *args): if 'coin' in ctx.message.content: res = random.choice(['***heads!***', '***tails!***']) await ctx.send(res) if len(list(args)) > 0 and args[0].lower() == res.replace( '*', '').replace( '!', '') and Economy.get(ctx.message.author.id) != None: prize = random.randint(50, 200) Economy.addbal(ctx.message.author.id, prize) await ctx.send('your bet was right! you get ' + str(prize) + ' diamonds.') else: res = random.randint(1, 6) await ctx.send(':' + src.num2word(res) + ':') if len(list(args)) > 0 and args[0] == str(res) and Economy.get( ctx.message.author.id) != None: prize = random.randint(50, 100) Economy.addbal(ctx.message.author.id, prize) await ctx.send('your bet was right! you get ' + str(prize) + ' diamonds.')
async def transfer(self, ctx, *args): if len(list(args)) == 0 or len(ctx.message.mentions) == 0: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | gimme some tag and some amount.') else: wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait...?') amount = None for i in list(args): if i.isnumeric(): amount = int(i) break if amount == None: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + ' | Give me some valid amount!') elif amount < 1: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + ' | Invalid amount!') elif Economy.get(ctx.message.author.id) == None or Economy.get( ctx.message.mentions[0].id) == None: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + ' | One of them doesn\'t have a profile!') else: if amount not in range(-2147483648, 2147483648): return ctx.send( '{} | woah lol. the amount is hella crazy!'.format( str(self.client.get_emoji(BotEmotes.error)))) Economy.addbal(ctx.message.mentions[0].id, amount) Economy.delbal(ctx.message.author.id, amount) # EFFICIENT CODE LMFAO await wait.edit( content=str(self.client.get_emoji(BotEmotes.success)) + f' | Done! Transferred {str(amount)} diamonds to {ctx.message.mentions[0].name}!' )
async def guessavatar(self, ctx): if len(ctx.message.guild.members) > 500: await ctx.send( 'Sorry, to protect some people\'s privacy, this command is not available for Large servers. (over 500 members)' ) else: wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... generating question...\nThis process may take longer if your server has more members.' ) avatarAll, nameAll = [], [] for ppl in ctx.guild.members: if ctx.guild.get_member(int(ppl.id)).status.name != 'offline': avatarAll.append( str(ppl.avatar_url).replace('webp', 'png')) nameAll.append(ppl.display_name) if len(avatarAll) <= 4: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Need more online members! :x:') else: numCorrect = random.randint(0, len(avatarAll) - 1) corr_avatar, corr_name = avatarAll[numCorrect], nameAll[ numCorrect] nameAll.remove(corr_name) wrongArr = [] for i in range(0, 3): wrongArr.append(random.choice(nameAll)) abcs, emots = list('π¦π§π¨π©'), list('π¦π§π¨π©') randomInt = random.randint(0, 3) corr_order = random.choice(abcs[randomInt]) abcs[randomInt] = '0' question, chooseCount = '', 0 for assign in abcs: if assign != '0': question += '**' + str(assign) + '.** ' + str( wrongArr[chooseCount]) + '\n' chooseCount += 1 else: question += '**' + str(corr_order) + '.** ' + str( corr_name) + '\n' embed = discord.Embed( title='What does the avatar below belongs to?', description= ':eyes: Click the reactions! **You have 20 seconds.**\n\n' + str(question), colour=discord.Colour.from_rgb(201, 160, 112)) embed.set_footer( text= 'For privacy reasons, the people displayed above are online users.' ) embed.set_image(url=corr_avatar) main = await ctx.send(embed=embed) for i in emots: await main.add_reaction(i) def is_correct(reaction, user): return user == ctx.message.author try: reaction, user = await self.client.wait_for( 'reaction_add', check=is_correct, timeout=20.0) except asyncio.TimeoutError: return await ctx.send( ':pensive: No one? Okay then, the answer is: ' + str(corr_order) + '. ' + str(corr_name)) if str(reaction.emoji) == str(corr_order): await ctx.send( str(self.client.get_emoji(BotEmotes.success)) + ' | <@' + str(ctx.message.author.id) + '>, You are correct! :tada:') if Economy.get(ctx.message.author.id) != None: reward = random.randint(5, 100) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! You received ' + str(reward) + ' extra diamonds!') else: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | <@' + str(ctx.message.author.id) + '>, Incorrect. The answer is ' + str(corr_order) + '. ' + str(corr_name))
async def rob(self, ctx, *args): if len(ctx.message.mentions) == 0 or len(list(args)) == 0: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Who?') else: if ctx.message.mentions[0].id == ctx.message.author.id: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Seriously? Robbing yourself?') else: amount2rob = None for i in list(args): if i.isnumeric(): amount2rob = int(i) break if amount2rob == None: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | How many diamonds shall be robbed?') elif amount2rob > 9999: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Dude, you must be crazy. That\'s too many diamonds!' ) elif amount2rob < 0: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | minus??? HUH?') else: wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | *Please wait... robbing...*') victim, stealer = Economy.get( ctx.message.mentions[0].id), Economy.get( ctx.message.author.id) if victim == None or stealer == None: await wait.edit( content=str( self.client.get_emoji(BotEmotes.loading)) + ' | you/that guy doesn\'t even have a profile!') else: if victim['bal'] > stealer['bal']: return await wait.edit( content= '{} | You cannot rob who is richer than you.'. format( str(self.client.get_emoji( BotEmotes.error)))) data = random.choice( loads( open( '/home/runner/hosting601/assets/json/steal.json', 'r').read())) if not str(data['amount']).replace('-', '').isnumeric(): if data['amount'] == '{SAME_AMOUNT}': robamount = -amount2rob elif data['amount'] == '{REAL}': robamount = int(amount2rob) else: robamount = -Economy.get( ctx.message.author.id)['bal'] else: robamount = data['amount'] if robamount > 0: Economy.addbal(ctx.message.author.id, robamount) Economy.delbal(ctx.message.mentions[0].id, robamount) statement = f'You stole {str(robamount)} in total.' elif robamount == 0: statement = f'You left empty-handed.' else: Economy.delbal(ctx.message.author.id, robamount * -1) Economy.addbal(ctx.message.mentions[0].id, robamount * -1) statement = f'You lost {str(robamount)} diamonds.' embed = discord.Embed( title= f'{ctx.message.author.name} robbing {ctx.message.mentions[0].name} scene be like', description=data['statement'].replace( '{NL}', '\n').replace( '{D1}', ctx.message.author.name).replace( '{D2}', ctx.message.mentions[0].name), color=discord.Colour.red()) embed.set_footer(text=statement) await wait.edit(content='', embed=embed)
async def hangman(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... generating...') the_word = myself.api( "https://random-word-api.herokuapp.com/word?number=1") main_guess_cor, main_guess_hid = list(the_word[0]), [] server_id, wrong_guesses = ctx.message.guild.id, '' for i in range(0, len(main_guess_cor)): main_guess_hid.append('\_ ') guessed, gameplay, playing_with, playing_with_id, level = [], True, ctx.message.author, int( ctx.message.author.id), 0 while gameplay: if ctx.message.content == Config.prefix + 'hangman' and ctx.message.author.id != int( playing_with_id) and ctx.message.guild.id == server_id: await ctx.send( '<@' + str(ctx.message.author.id) + '>, cannot play hangman when a game is currently playing!') newembed = discord.Embed( title=''.join(main_guess_hid), description='Wrong guesses: ' + str(wrong_guesses), colour=discord.Colour.from_rgb(201, 160, 112)) newembed.set_image( url= f'https://raw.githubusercontent.com/vierofernando/username601/master/assets/pics/hangman_{str(level)}.png' ) newembed.set_footer( text='Type "showanswer" to show the answer and end the game.') await ctx.send(embed=newembed) if '\_ ' not in ''.join(main_guess_hid): await ctx.send( f'Congratulations! <@{str(playing_with_id)}> win! :tada:\nThe answer is "' + str(''.join(main_guess_cor)) + '".') if Economy.get(ctx.message.author.id) != None: reward = random.randint(5, 500) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! you get an extra ' + str(reward) + ' diamonds!') gameplay = False break if level > 7: await ctx.send( f'<@{str(playing_with_id)}> lost! :(\nThe answer is actually "' + str(''.join(main_guess_cor)) + '".') gameplay = False break def is_not_stranger(m): return m.author == playing_with try: trying = await self.client.wait_for('message', check=is_not_stranger, timeout=20.0) except asyncio.TimeoutError: await ctx.send( f'<@{str(playing_with_id)}> did not response in 20 seconds so i ended the game. Keep un-AFK!\nOh and btw, the answer is ' + str(''.join(main_guess_cor)) + '. :smirk:') gameplay = False break if str(trying.content).lower() == 'showanswer': await ctx.send('The answer is actually ' + str(''.join(main_guess_cor) + '.')) gameplay = False break elif len(str(trying.content)) > 1: await ctx.send('One word at a time. Game ended!') gameplay = False break elif str(trying.content).lower() in guessed: await ctx.send( f'<@{str(playing_with_id)}>, You have guessed that letter!' ) level = int(level) + 1 elif str( trying.content).lower() in ''.join(main_guess_cor).lower(): guessed.append(str(trying.content).lower()) for i in range(0, len(main_guess_cor)): if main_guess_cor[i].lower() == str( trying.content).lower(): main_guess_hid[i] = str(trying.content).lower() else: level = int(level) + 1 wrong_guesses = wrong_guesses + str( trying.content).lower() + ', '
async def pokequiz(self, ctx): return await ctx.send('sorry! this command is temporarily closed.') wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait... Generating quiz...') num = random.randint(1, 800) try: corr = pb.pokemon(str(num)).name except Exception as e: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + f' | An error occurred! ```{e}```') hint, attempt = 2, 10 gameplay = True guy = ctx.message.author while gameplay == True: newembed = discord.Embed( title='Pokemon Quiz!', description= f'Guess the pokemon\'s name!\nTimeout: 45 seconds.\nHint left: **{str(hint)}** | Attempts left: **{str(attempt)}**', colour=discord.Colour.from_rgb(201, 160, 112)) newembed.set_image( url= f'https://assets.pokemon.com/assets/cms2/img/pokedex/full/{str(num)}.png' ) newembed.set_footer( text='Type "hint" to give.. uh... the HINT! :D') newembed.set_thumbnail( url= f'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/{str(num)}.png' ) await wait.edit(content='', embed=newembed) if int(attempt) < 1: await ctx.send('You lose! The pokemon is **' + str(corr) + '**!') gameplay = False break def checking(m): return m.author == guy try: guessing = await self.client.wait_for('message', check=checking, timeout=45.0) except asyncio.TimeoutError: await ctx.send('Too late! Game ended... :pensive:') gameplay = False break if str(guessing.content).lower() == corr: currentmsg = guessing await currentmsg.add_reaction('β ') await ctx.send( str(self.client.get_emoji(BotEmotes.success)) + ' | You are correct! The pokemon is **' + str(corr) + '**') if Economy.get(ctx.message.author.id) != None: reward = random.randint(50, 250) Economy.addbal(ctx.message.author.id, reward) await ctx.send('thanks for playing! You get also a ' + str(reward) + ' diamonds as a prize!') gameplay = False break elif str(guessing.content).lower() == 'hint': currentmsg = guessing if hint < 1: await currentmsg.add_reaction('β') attempt -= -1 else: await currentmsg.add_reaction('β ') thehint = random.choice([ myself.hintify(corr), 'Pokemon name starts with "' + str(list(corr)[0]) + '"', 'Pokemon name has ' + str(len(corr)) + ' letters!', 'Pokemon name ends with "' + str(list(corr)[len(corr) - 1]) + '"' ]) await ctx.send('Hint: ' + thehint + '!') hint -= 1 attempt -= 1 else: if attempt != 0: await guessing.add_reaction('β') attempt -= 1 else: await guessing.add_reaction('β') await ctx.send('You lose! The pokemon is **' + str(corr) + '**!') gameplay = False break