async def deleteAllChannels(ctx, *, channelType: str.lower = ''): notify = Notify(ctx=ctx, title ='Deleting All Channels...') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error(content='The server {} is being ignored'.format(ctx.guild.name)) return if(channelType == 'text'): type = ctx.guild.text_channels elif(channelType == 'voice'): type = ctx.guild.voice_channels elif(channelType == 'category'): type = ctx.guild.categories elif(channelType == 'all'): type = ctx.guild.channels else: notify.error(content='Not provided channel type:\n Text | Voice | Category | All') return for channel in type: try: await channel.delete() await asyncio.sleep(0.33) except Exception as e: error(e) pass else: if(channelType != 'all'): notify.success(content=f'Successful deleted {channelType} channels')
async def sendToEveryone(ctx, *, message): notify = Notify(ctx=ctx, title='Sending To Everyone...') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error( content='The server {} is being ignored'.format(ctx.guild.name)) return await ctx.guild.subscribe( ) # Depending on server size this can take several minutes for member in ctx.guild.members: # Maybe multi-account support to increase speed? if (member.id != ctx.author.id) or (not isStaff(member)): try: await member.send(content=message) asyncio.sleep(30) #To avoid be Phone locked except Exception as e: error(e) pass else: notify.success( content= 'The message {} has been sent to all server users successfully'. format(message))
async def renameAllChannels(ctx, *, args=''): notify = Notify(ctx=ctx, title='Renaming All Channels') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error( content='The server {} is being ignored'.format(ctx.guild.name)) return args = params.split(args) if len(args) > 1: channelType = str.lower(args[1]) if (channelType == 'text'): type = ctx.guild.text_channels elif (channelType == 'voice'): type = ctx.guild.voice_channels elif (channelType == 'category'): type = ctx.guild.categories else: notify.error( content= f'The type of channel you provide ({args[1]}) is not supported' ) else: type = ctx.guild.channels for channel in type: try: await channel.edit(name=args[0]) await asyncio.sleep(0.33) except Exception as e: error(e) pass else: notify.success(content=f'Successful renamed all channels to {args[0]}')
async def deleteAllRoles(ctx): notify = Notify(ctx=ctx, title ='Deleting All Channels...') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error(content='The server {} is being ignored'.format(ctx.guild.name)) return for role in ctx.guild.roles: try: await role.delete() await asyncio.sleep(0.33) except Exception as e: error(e) pass else: notify.success(content=f'Successful deleted all roles')
async def deleteAllMessages(ctx): notify = Notify(ctx=ctx, title='Deleting All Channel Messages...') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error( content='The server {} is being ignored'.format(ctx.guild.name)) return async for message in ctx.message.channel.history(): try: await message.delete() await asyncio.sleep(0.33) except Exception as e: error(e) pass else: notify.success(content='All messages were deleted successfully')
async def kickAll(ctx): notify = Notify(ctx=ctx, title='Kicking All Members...') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error( content='The server {} is being ignored'.format(ctx.guild.name)) return for member in ctx.guild.members: if member.id != ctx.author.id: try: await member.kick() except Exception as e: error(e) pass else: notify.success(content=f'All members successfully kicked')
async def muteAllServers(ctx): notify = Notify(ctx=ctx, title='Muting All Servers...') notify.prepair() muted_servers = 0 Embed = discord.Embed( description= f"> Servers mutated until now: **{int(muted_servers)}** / **{len(client.guilds)}**.\n> Current Status: **Starting...**", color=discord.Colour.blue()) Message = await sendEmbed(ctx, Embed) for guild in client.guilds: if str(guild.id) in ignore.getIgnore(): notify.alert( content='The server {} is being ignored'.format(guild.name)) return try: await guild.mute() muted_servers = muted_servers + 1 if (Message.embeds): Embed = discord.Embed( description= f"> Servers mutated until now: **{int(muted_servers)}** / **{len(client.guilds)}**.\n> Current Status: **In progress...**", color=discord.Colour.orange()) await Message.edit(embed=Embed) else: await Message.edit( f"> Servers mutated until now: **{int(muted_servers)}** / **{len(client.guilds)}**.\n> Current Status: **Starting...**" ) await asyncio.sleep(0.3) except Exception as e: error(e) pass notify.success( content= f"> Total number of mutated servers: **{int(muted_servers)}** / **{len(client.guilds)}**.\n> Current Status: **All Done!**" )
async def leaveServers(ctx): Total = 0 notify = Notify(ctx=ctx, title='Leaving All Servers') notify.prepair() for server in client.guilds: if str(server.id) in ignore.getIgnore(): notify.alert( content='The server {} is being ignored'.format(server.name)) return try: await server.leave() Total = Total + 1 except Exception as e: if (e.text == 'Invalid Guild'): notify.exception( content= 'You probably own this server, or this server is invalid or blocked.' ) error(e) pass notify.success( content=f'You are out of a total of {Total} servers.' ) #How the f**k will this be sent if it leaves all servers???
async def deleteMyMessages(ctx, amount, status=True): notify = Notify(ctx=ctx, title='Deleting My Messages...') notify.prepair() if str(ctx.guild.id) in ignore.getIgnore(): notify.error( content='The server {} is being ignored'.format(ctx.guild.name)) return DeletedCount = 0 MessageList = [] try: if (ctx.guild): await ctx.message.channel.purge(limit=int(amount)) notify.success( content="Deleted {} messages from the chat".format(amount)) else: Embed = discord.Embed( description= f"> Deleted messages: **{int(DeletedCount)}** / **{len(MessageList)}**.\n> Current Status: **Starting...**", color=discord.Colour.blue()) Message = await sendEmbed(ctx, Embed) async for message in ctx.message.channel.history(): try: if len(MessageList) < int( amount ) and message and not message == Message and message.author == ctx.author: MessageList.append(message) except Exception as e: error(e) pass for message in MessageList: try: await message.delete() await asyncio.sleep(0.5) DeletedCount = DeletedCount + 1 if (Message.embeds): Embed = discord.Embed( description= f"> Deleted messages until now: **{int(DeletedCount)}** / **{len(MessageList)}**.\n> Current Status: **In progress...**", color=discord.Colour.orange()) await Message.edit(embed=Embed) else: await Message.edit( f"> Deleted messages until now: **{int(DeletedCount)}** / **{len(MessageList)}**.\n> Current Status: **In progress...**" ) except Exception as e: error(e) pass if (Message.embeds): Embed = discord.Embed( description= f"> Total number deleted messages: **{int(DeletedCount)}** / **{len(MessageList)}**.\n> Current Status: **All Done!**", color=discord.Colour.green()) await Message.edit(embed=Embed) else: await Message.edit( f"> Total number deleted messages: **{int(DeletedCount)}** / **{len(MessageList)}**.\n> Current Status: **All done!**" ) await asyncio.sleep(5) await Message.delete() except Exception as e: notify.error(content="Something goes wrong, try again!")