Advertisement
Guest User

Untitled

a guest
Sep 25th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.29 KB | None | 0 0
  1. import discord
  2. import random
  3. from discord.ext import commands
  4.  
  5.  
  6. client = discord.ext.commands.Bot(command_prefix='?')
  7.  
  8.  
  9. #Mute auf Zeit
  10. @client.command(aliases=['tempmute'])
  11. @commands.has_permissions(kick_members = True)
  12. async def mute(ctx, member : discord.Member = None, time = None, *, reason = None) :
  13.  
  14.      if not member:
  15.         await ctx.send("Du musst einen Nutzer angeben!")
  16.  
  17.      elif not time :
  18.          await ctx.send("Du musst eine Zeit angeben!")
  19.      else :
  20.          if not reason :
  21.              reason = 'Kein Grund angegeben!'
  22.          try:
  23.              s = time[:-1]
  24.              d = time[:-1]
  25.  
  26.              if d == 's' :
  27.                  s = seconds *1
  28.  
  29.              elif d == 'm' :
  30.                  s = seconds *60
  31.  
  32.              elif d == 'h' :
  33.                  s = seconds *60 *60
  34.  
  35.              else :
  36.                 await ctx.send('Kein gültiger Time-Input!')
  37.                 return
  38.  
  39.            except Exception as e :
  40.              print(e)
  41.              await  ctx.send('Kein Gültiger Time-Input!')
  42.              return
  43.  
  44.     guild = ctx.guild
  45.     Muted = discord.utils.get(guild.roles, name = 'Muted')
  46.  
  47.     if not Muted :
  48.         Muted = await guild.create_role(name = 'Muted')
  49.         for channel in guild.channels :
  50.             await channel.set_permissions(mutedRole, speak = False, send_messages=False, read_Messages_history = True, read_Messages = True)
  51.  
  52.     await member.add_roles(mutedRole, reason = reason)
  53.  
  54. muted_muted_embed = discord.Embed(title="Tempmute", description=f"{member.mention} wurde von {ctx.author.mention} wegen {reason} {time} gemutet!", colour=discord.Colour.red())
  55. await ctx.send(embed=muted_embed)
  56. await asyncio.sleep(seconds)
  57. await member.remove_roles(Muted)
  58. unmute_embed = discord.Embed(title="Unmute!", description=f"{ctx.author.mention} mute für {member.mention} wegen {reason} ist nach {time} zu Ende!")
  59. await ctx.send(embed=unmute_embed)
  60.  
  61.  
  62.  
  63. Error beim runnen:
  64.   File "C:\Dp\Sideswitch -- Bot.py", line 103
  65.     except Exception as e :
  66.                            ^
  67. IndentationError: unindent does not match any outer indentation level
  68.  
  69. andere Errors:
  70.  
  71. Unindent does not match any outer indentation level
  72.  
  73.  
  74. Unindent does not match any outer indentation level
  75.  
  76.  
  77. Unexpected indent
  78.  
  79.  
  80. Statement expected, found Py:DEDENT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement