async def leave(self, ctx): obj = get_object(ctx) await obj.to_clear() channel = ctx.message.author.voice.channel voice = get(bot.voice_clients, guild=ctx.guild) if voice and voice.is_connected(): print(f'Disconnected from {channel}', end='') functions.log_ctx(ctx) await voice.disconnect() else: text = f'I was not at the {channel}.' await self.send_embed(ctx, text)
async def join(self, ctx): author_voice_state = ctx.message.author.voice #Checks if the author is in a voice channel if not author_voice_state: text = 'You need to be in a voice channel!' await self.send_embed(ctx, text) return current_channel = get(bot.voice_clients, guild=ctx.guild) author_channel = ctx.message.author.voice.channel if current_channel == None: print(f'Connected to <{author_channel}>', end='') functions.log_ctx(ctx) await author_channel.connect() elif current_channel.channel != author_channel: text = 'I am already in another channel in this server!' await self.send_embed(ctx, text) else: text = 'I am already in your channel' await self.send_embed(ctx, text)
async def coin(self, ctx): '''Jogarei a moeda pra você, fi!''' print('Thrown a coin', end='') functions.log_ctx(ctx) await ctx.send(choice(cc))
async def draw(self, ctx): C = ctx.message.content.split() C = C[1:] shuffle(C) if len(C) == 6: print('Made a 3x3 draw', end='') functions.log_ctx(ctx) await ctx.send('So it is a 3x3 draw, wait a second.') sleep(2) embed1 = discord.Embed(title='This is the first team!', colour=discord.Colour.blue()) embed1.add_field(name='Players', value=' \n- {}\n\n- {}\n\n- {}'.format( C[0], C[1], C[2])) embed2 = discord.Embed(title='This is the second team!', colour=discord.Colour.red()) embed2.add_field(name='Players', value=' \n- {}\n\n- {}\n\n- {}'.format( C[3], C[4], C[5])) await ctx.send(embed=embed1) await ctx.send(embed=embed2) elif len(C) == 8: print('Made a 4x4 draw', end='') functions.log_ctx(ctx) await ctx.send('So it is a 4x4 draw, wait a second.') sleep(2) embed1 = discord.Embed(title='This is the first team!', colour=discord.Colour.blue()) embed1.add_field( name='Players', value=' \n- {}\n\n- {}\n\n- {}\n\n- {}'.format( C[0], C[1], C[2], C[3])) embed2 = discord.Embed(title='This is the second team!', colour=discord.Colour.red()) embed2.add_field( name='Players', value=' \n- {}\n\n- {}\n\n- {}\n\n- {}'.format( C[4], C[5], C[6], C[7])) await ctx.send(embed=embed1) await ctx.send(embed=embed2) elif len(C) == 10: print('Made a 5x5 draw', end='') functions.log_ctx(ctx) await ctx.send('So it is a 5x5 draw, wait a second.') sleep(2) embed1 = discord.Embed(title='This is the first team!', colour=discord.Colour.blue()) embed1.add_field( name='Players', value=' \n- {}\n\n- {}\n\n - {}\n\n- {}\n\n- {}'.format( C[0], C[1], C[2], C[3], C[4])) embed2 = discord.Embed(title='This is the second team!', colour=discord.Colour.red()) embed2.add_field( name='Players', value=' \n- {}\n\n- {}\n\n- {}\n\n- {}\n\n- {}'.format( C[5], C[6], C[7], C[8], C[9])) await ctx.send(embed=embed1) await ctx.send(embed=embed2) else: print('Invalid draw', end='') functions.log_ctx(ctx) text = 'Invalid quantity of people' await self.send_embed(ctx, text)