Advertisement
TheInfiniteCode

Discord.py | Kitiltás parancs

May 6th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.77 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3.  
  4. client = commands.Bot(command_prefix = "!")
  5.  
  6. footer = "TutorialBot | v1.2"
  7. botfilter = "Botok nem tudják ezt a parancsot használni!"
  8. noperm = "Nincs jogod ehhez!"
  9.  
  10. print("Betöltés...")
  11.  
  12. @client.event
  13. async def on_ready():
  14.     print("A rendszer elindult!")
  15.     await client.change_presence(game = discord.Game(name = "Tutorial videó felvétel"))
  16.  
  17. @client.command(pass_context = True)
  18. async def ban(ctx, user: discord.Member = None, *, reason: str = None):
  19.     if ctx.message.author.bot:
  20.         embed = discord.Embed(title = "Védelem", description = botfilter, colour = discord.Colour.red())
  21.         embed.set_footer(text = footer)
  22.         return await client.say(embed = embed)
  23.     if not ctx.message.author.server_permissions.ban_members:
  24.         embed = discord.Embed(title = "Hiba!", description = noperm, colour = discord.Colour.red())
  25.         embed.set_footer(text = footer)
  26.         return await client.say(embed = embed)
  27.     if user == None:
  28.         embed = discord.Embed(title = "Hiba!", description = "Használat: !ban [@felhasználó] (Indok)", colour = discord.Colour.red())
  29.         embed.set_footer(text = footer)
  30.         return await client.say(embed = embed)
  31.     try:
  32.         await client.ban(user)
  33.     except:
  34.         embed = discord.Embed(title = "Hiba!", description = "Nincs elegendő jogom kitiltani a megadott felhasználót!", colour = discord.Colour.red())
  35.         embed.set_footer(text = footer)
  36.         return await client.say(embed = embed)
  37.     if reason == None:
  38.         reason = "Nincs megadva"
  39.     embed = discord.Embed(title = "Moderáció", description = "Sikeres kitiltás!", colour = discord.Colour.green())
  40.     embed.add_field(name = "Kitiltott", value = user, inline = False)
  41.     embed.add_field(name = "Végrehajtó", value = ctx.message.author.mention, inline = False)
  42.     embed.add_field(name = "Indok", value = reason, inline = False)
  43.     embed.set_footer(text = footer)
  44.     await client.say(embed = embed)
  45.     try:
  46.         embed = discord.Embed(title = "Figyelmeztetés!", description = "Ki lettél tiltva!", colour = discord.Colour.green())
  47.         embed.add_field(name = "Szerver", value = ctx.message.server.name, inline = False)
  48.         embed.add_field(name = "Végrehajtó", value = ctx.message.author.mention, inline = False)
  49.         embed.add_field(name = "Indok", value = reason, inline = False)
  50.         embed.set_footer(text = footer)
  51.         await client.send_message(user, embed = embed)
  52.     except:
  53.         embed = discord.Embed(title = "Figyelem!", description = "Nem sikerült figyelmeztetni a kitiltott személy privátban!", colour = discord.Colour.gold())
  54.         embed.set_footer(text = footer)
  55.         await client.say(embed = embed)
  56.        
  57.  
  58. client.run("Botod tokenje")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement