Untitled
unknown
python
2 years ago
2.9 kB
12
Indexable
Never
import discord from discord.ext import commands from discord.ext.commands import has_permissions, MissingPermissions from discord.colour import Colour from discord import Intents token = 'TOKEN' intents = Intents.default() intents.members = True client = commands.Bot(command_prefix='.', intents=Intents.all()) @client.event async def on_ready(): await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='something SUS')) @client.command() @has_permissions(kick_members=True) async def kick(ctx, kick_member: discord.Member, *, reason=None): if kick_member == client.user: await ctx.send("You can't kick me! I'm the Valley's watchman! :angry:") elif kick_member.id == "Another Bot's Id": await ctx.send("You can't kick my friend :angry:") elif kick_member == ctx.author: await ctx.send("You can't kick yourself") elif kick_member.top_role >= ctx.author.top_role: await ctx.send("This person's role is higher or equal to yours!") else: await kick_member.kick(reason=reason) await ctx.send(f"Kicked {kick_member} for {reason}") @client.command() @has_permissions(ban_members=True) async def ban(ctx, ban_member: discord.Member, *, reason=None): if ban_member == client.user: await ctx.send("You can't ban me! I'm the Valley's watchman! :angry:") elif ban_member.id == "Another Bot's Id": await ctx.send("You can't ban my friend :angry:") elif ban_member == ctx.author: await ctx.send("You can't ban yourself") elif ban_member.top_role >= ctx.author.top_role: await ctx.send("This person's role is higher or equal to yours!") else: await ban(ban_member, reason=reason) @kick.error async def kick_error(message, error): if isinstance(error, MissingPermissions): await message.send("You don't have permission to do that!") @ban.error async def ban_error(message, error): if isinstance(error, MissingPermissions): await message.send("You dont have permission to do that!") @client.command() async def credits(ctx): myCredits = discord.Embed(title="MrMomo's official bot", color=Colour.dark_red()).set_author(name="MrWick") myCredits.add_field(name="Made By", value="dumb#5886") myCredits.add_field(name="Tested On", value="Karma#6031") await ctx.send(embed=myCredits) @client.command() async def unban(ctx, *, member): bannedUsers = await ctx.guild.bans() member_name, member_discriminator = member.split("#") for ban_entry in bannedUsers: user = ban_entry.user if (user.name, user.discriminator) == (member_name, member_discriminator): await ctx.guild.unban(user) await ctx.send(f"Unbanned {user.mention}") return client.run(token)