Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import random
- from discord.ext import commands
- client = discord.ext.commands.Bot(command_prefix='?')
- #Mute auf Zeit
- @client.command(aliases=['tempmute'])
- @commands.has_permissions(kick_members = True)
- async def mute(ctx, member : discord.Member = None, time = None, *, reason = None) :
- if not member:
- await ctx.send("Du musst einen Nutzer angeben!")
- elif not time :
- await ctx.send("Du musst eine Zeit angeben!")
- else :
- if not reason :
- reason = 'Kein Grund angegeben!'
- try:
- s = time[:-1]
- d = time[:-1]
- if d == 's' :
- s = seconds *1
- elif d == 'm' :
- s = seconds *60
- elif d == 'h' :
- s = seconds *60 *60
- else :
- await ctx.send('Kein gültiger Time-Input!')
- return
- except Exception as e :
- print(e)
- await ctx.send('Kein Gültiger Time-Input!')
- return
- guild = ctx.guild
- Muted = discord.utils.get(guild.roles, name = 'Muted')
- if not Muted :
- Muted = await guild.create_role(name = 'Muted')
- for channel in guild.channels :
- await channel.set_permissions(mutedRole, speak = False, send_messages=False, read_Messages_history = True, read_Messages = True)
- await member.add_roles(mutedRole, reason = reason)
- muted_muted_embed = discord.Embed(title="Tempmute", description=f"{member.mention} wurde von {ctx.author.mention} wegen {reason} {time} gemutet!", colour=discord.Colour.red())
- await ctx.send(embed=muted_embed)
- await asyncio.sleep(seconds)
- await member.remove_roles(Muted)
- unmute_embed = discord.Embed(title="Unmute!", description=f"{ctx.author.mention} mute für {member.mention} wegen {reason} ist nach {time} zu Ende!")
- await ctx.send(embed=unmute_embed)
- Error beim runnen:
- File "C:\Dp\Sideswitch -- Bot.py", line 103
- except Exception as e :
- ^
- IndentationError: unindent does not match any outer indentation level
- andere Errors:
- Unindent does not match any outer indentation level
- Unindent does not match any outer indentation level
- Unexpected indent
- Statement expected, found Py:DEDENT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement