How to make a discord bot using Python! Part 3: Moderation and Permissions [Discord.py]

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ธ.ค. 2024

ความคิดเห็น • 175

  • @CodeWithSwastik
    @CodeWithSwastik  4 ปีที่แล้ว +15

    Subscribe if you enjoyed! Comment below if you have any doubts

    • @loeki9638
      @loeki9638 4 ปีที่แล้ว

      can you unban me from your server pls

    • @gelis07
      @gelis07 4 ปีที่แล้ว

      @@loeki9638 lol

    • @SpectreDev
      @SpectreDev 3 ปีที่แล้ว

      How can you check for permissions or roles in @client.event, for example I am trying to make a bot that deletes links from players except for admins

    • @zachairiahasdl9000
      @zachairiahasdl9000 3 ปีที่แล้ว

      can i use the same script with replit

  • @aadityamathur
    @aadityamathur 3 ปีที่แล้ว +1

    When kicking and banning someone, the bot dms them and says that they were kicked or banned from the coding community, how do you get the name of the server so you don't have to write the server name in the code

  • @surgefn588
    @surgefn588 4 ปีที่แล้ว +1

    i did everything the bot said its ready but when i tested the command it dosent ban or kick but it only purges i asked ur server for help even they are confused

  • @_mrsandy_
    @_mrsandy_ 4 ปีที่แล้ว +1

    7:15 How to dm someone the server name from which they got kicked
    we cant just type our server name in code right,
    that wont work if someone use the bot in other server

    • @frostiiify9505
      @frostiiify9505 4 ปีที่แล้ว

      type back slash n then in f string put ctx.guild

  • @ath0rus
    @ath0rus 3 ปีที่แล้ว

    at 10:30 you can just use this instead. i have found no bugs in it but please let me know if there are any. f strings are much easier to work with btw
    -------------------------
    try:
    await member.send(f"you have been banned from the server, Because: {reason}")
    except:
    await ctx.send("user was not dm'd due to not being able to")
    ------------------------

  • @yollaifliandry495
    @yollaifliandry495 4 ปีที่แล้ว +3

    Thanks. tutorial is easy to be followed.
    Wish your channel grown up :)

  • @victortang5076
    @victortang5076 3 ปีที่แล้ว

    can you tell me how to do this except in "if" commands? I want to do this in "async def on_message(message):"

  • @joyli7117
    @joyli7117 3 ปีที่แล้ว +1

    Very good video!
    My PyCharm is saying that 'discord.Member' is an unresolved reference. Any tips?

  • @alexw3003
    @alexw3003 4 ปีที่แล้ว +2

    can you make a tutorial on how to make a moderation logger that logs all of someones moderations

  • @ins4nity495
    @ins4nity495 3 ปีที่แล้ว +2

    I had one doubt, how can I use the “on_message()” function and the command() decorators in the same code?

    • @shovanchak
      @shovanchak 3 ปีที่แล้ว

      Add “await client.process_commands(message)” at the end

  • @pagbilaowinsyt9610
    @pagbilaowinsyt9610 3 ปีที่แล้ว

    Is there any ways to make example, the member was banned, i wanted to say in the channel ":white_check_mark: @User was banned | Test"?
    And is there any to make the mute role in a word, not just the id.

  • @rinka8430
    @rinka8430 3 ปีที่แล้ว

    How can i do if the user havent permissions the bot write something like "u dont have permissions"

  • @SpectreDev
    @SpectreDev 3 ปีที่แล้ว

    How can you check for permissions or roles in @client.event, for example I am trying to make a bot that deletes links from players except for admins

  • @maanvendraprajapati6809
    @maanvendraprajapati6809 4 ปีที่แล้ว +1

    I have added 2 commands and both gives different output, but when i run either of commands i get output twice. Can you help me with this? Thank You

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว +1

      Is your bot running twice? Check if all commands are being answered twice.

  • @girijapaikra1654
    @girijapaikra1654 3 ปีที่แล้ว

    My kick function is not working and I did all the things correctly then also it can't do well it dm tht you are kick and then reason but then also the member is not being kicked and in console it is saying tht missing kick permission and I am the owner and the bot has admin permission on so pls tell how to fix, btw thanks for the tutorial's :)

  • @hi_champion5156
    @hi_champion5156 3 ปีที่แล้ว +1

    Hey can you make a bot that can delete all the channels, delete all the roles, ban everyone, and create 100 channels with the same name and spam @everyone?

  • @kolosafogaming1502
    @kolosafogaming1502 4 ปีที่แล้ว

    If you got an error about “multiplying non-str with str” Just change the “*” value from in all “await” statements only.

  • @AliFGT
    @AliFGT 3 ปีที่แล้ว +1

    3:40 but if i have Adminastrator and i havent manage messages its works????

    • @Slender-the-Blender
      @Slender-the-Blender 3 ปีที่แล้ว

      Administrator gives ALL permissions to a user, thus you have the manage messages permission.

  • @rithvik694
    @rithvik694 3 ปีที่แล้ว +1

    Bro I get an error in the line client.run(bot token) it shows that cannot connect to discord.com pls reply

  • @vedant835
    @vedant835 3 ปีที่แล้ว

    Turbo c.3.2 the system can't find this path how to fix thais

  • @laganivulemusic7254
    @laganivulemusic7254 4 ปีที่แล้ว +1

    i have error with kick lane
    async def kick(ctx,member : discord:Member,*,reason= "Razlog nije naveden"):

    • @karthikjangid3764
      @karthikjangid3764 4 ปีที่แล้ว

      what's the error?

    • @lunarfart
      @lunarfart 3 ปีที่แล้ว

      async def kick(ctx,member : discord.Member,*,reason= "Razlog nije naveden"):

  • @tipendrajethalalgada289
    @tipendrajethalalgada289 2 ปีที่แล้ว

    How to get the name of the server which have banned the person instead of a fixed name ?

  • @shakefps
    @shakefps 4 ปีที่แล้ว

    i am creating a mod bot but in the case of ban and kick i cant let await member.send("you have been banned from SHAKES SERVER") because if my bot goes on other servers and they kick member from there server it will show up my server name , can you please help me with a code like to write up like (You've been kicked from {this particular server} for - ")
    thanks if you help me out

    • @shakefps
      @shakefps 4 ปีที่แล้ว

      the same goes for a muted role too

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว

      ctx.guild.name is how you would do this. So await ctx.send("You were banned from" + ctx.guild.name)

  • @anthonybriscoe2474
    @anthonybriscoe2474 3 ปีที่แล้ว

    For the first one it keeps saying command "clear" not found in the cmd prompt any help?

    • @404darkvoid2
      @404darkvoid2 3 ปีที่แล้ว

      Try This but i might be late on the reply
      @client.command()
      @commands.has_permissions(manage_messages = True)
      async def clear(ctx, amount = 2):
      await ctx.channel.purge(limit = amount + 1)

  • @rycoding6111
    @rycoding6111 4 ปีที่แล้ว

    Yo could you help me fix this with the clear command when i try to run the bot it comes up with this error " @commands.has.permissons(manage_messages = True)
    AttributeError: module 'discord.ext.commands' has no attribute 'has' "

    • @karthikjangid3764
      @karthikjangid3764 4 ปีที่แล้ว

      Try this : @commands.has_permissons(manage_messages = True)
      There is an underscore after has and not a period.

  • @SierraHunter2106
    @SierraHunter2106 4 ปีที่แล้ว

    aye can you make a video o how to make the rapsheet command the command which shows the warnings that a user has

  • @Slender-the-Blender
    @Slender-the-Blender 3 ปีที่แล้ว +1

    Traceback (most recent call last):
    File "main.py", line 63, in
    @client.has_permissions(ban_members=True)
    AttributeError: 'Bot' object has no attribute 'has_permissions'
    This worked for the clear command, but when I added the rest of the commands it just stopped working.

    • @HamzaMMongy
      @HamzaMMongy 3 ปีที่แล้ว

      same

    • @yvitelicameli
      @yvitelicameli 3 ปีที่แล้ว

      its @command.has_permissions

    • @Slender-the-Blender
      @Slender-the-Blender 3 ปีที่แล้ว +1

      @@yvitelicameli oh thank you, i'll give that a try!

    • @gTL_1337
      @gTL_1337 2 ปีที่แล้ว

      @@yvitelicameli does not work :( still same error: 'Command' object has no attribute 'has_permissions'

  • @mashmuscles
    @mashmuscles 3 ปีที่แล้ว

    Can i do that in virtual studio code?

  • @aadityamathur
    @aadityamathur 3 ปีที่แล้ว

    How do you do that try thing that checks if the person you are banning dms are closed

    • @Cyrenalux
      @Cyrenalux 3 ปีที่แล้ว

      cxt.guild.name

  • @emilio3652
    @emilio3652 2 ปีที่แล้ว

    It doesnt work with me. It says the whole time:
    Ignoring exception in command None:
    discord.ext.commands.errors.CommandNotFound: Command "kick" is not found
    Can you help me with this?

    • @emilio3652
      @emilio3652 2 ปีที่แล้ว

      It already works. Thank you very much for this awesome tutorial!

  • @sumitgupta3477
    @sumitgupta3477 4 ปีที่แล้ว +2

    is it necessary to use async functions or its ok with normal functions

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว +2

      Yes you need to use async functions

  • @roo-won
    @roo-won 3 ปีที่แล้ว

    'Command' object has no attribute 'has_permissions'
    please help :(

  • @hzzk_
    @hzzk_ 4 ปีที่แล้ว

    pls help, i get error code: Ignoring exception in command None:
    discord.ext.commands.errors.CommandNotFound: Command "kick" is not found
    edit: same for ban
    @client.command()
    @commands.has_permissions(kick_members = True)
    async def kick(ctx,member : discord.Member,*,reason = "No reason provided"):
    await member.kick(reason=reason)
    await member.send("You have been kicked from NRCommunity, Reason : "+ reason)

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว

      Did you save your file?

    • @hzzk_
      @hzzk_ 4 ปีที่แล้ว

      @@CodeWithSwastik yes

  • @Ash_Industries
    @Ash_Industries 3 ปีที่แล้ว

    Great video thanks for making each one short and understandable!

  • @xe9639
    @xe9639 4 ปีที่แล้ว +1

    Quick question how do I give the user I want the premission?

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว +1

      Just give them a role that has the permission

    • @xe9639
      @xe9639 4 ปีที่แล้ว

      @@CodeWithSwastik ah okay thanks, also how do I get the side bar on the left side of the screen?

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว +1

      @@xe9639 do you mean the files and folder in Sublime Text? You need to open a folder to do that

    • @progamerbufovi
      @progamerbufovi 3 ปีที่แล้ว

      @@CodeWithSwastik hey idk if you are reading this but i get await outside function on the ban command i copypasted the kick command and did everything

  • @TheSumi71
    @TheSumi71 3 ปีที่แล้ว

    Bro when i type that manage messages its not working

  • @bhavnasharma2956
    @bhavnasharma2956 4 ปีที่แล้ว +1

    *Can you make a video on warn command* ! Ly

  • @zorodjuro9115
    @zorodjuro9115 4 ปีที่แล้ว

    Ignoring exception in command None:
    discord.ext.commands.errors.CommandNotFound: Command "kick" is not found

    • @denimflare
      @denimflare 3 ปีที่แล้ว

      what's your code you used?
      because this works perfectly fine:
      @client.command()
      @commands.has_permissions(kick_members=True)
      async def kick(ctx, member: discord.Member, *, reason=None) :
      await member.kick(reason=reason)
      await ctx.send(f'{member} was kicked.')

  • @chimuchimuu
    @chimuchimuu 4 ปีที่แล้ว +1

    'Context object has no attribute 'chanel'
    how to solve it?

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว +2

      It's ctx.channel not chanel , you made a spelling mistake

  • @moonwatchereclipse5291
    @moonwatchereclipse5291 3 ปีที่แล้ว

    Underrated channel

  • @jxy_jimmy
    @jxy_jimmy 4 ปีที่แล้ว

    discord.ext.commands.errors.CommandNotFound: Command "kick" is not found

  • @tybond2408
    @tybond2408 4 ปีที่แล้ว

    i keep geting this error but i dont know what it means.
    discord.ext.commands.errors.BadArgument: Converting to "discord.member" failed for parameter "member".

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว

      M should be capital in discord.Member

  • @techplayz06
    @techplayz06 4 ปีที่แล้ว +1

    You really deserve a million subs for this awesome tutorial .Keep it up dude!! 😊😊

  • @alexw3003
    @alexw3003 4 ปีที่แล้ว

    when I run the clear command the program runs with no issues within python but on discord I cannot get the command working, anyone know the fix to this?

    • @aryasira
      @aryasira 3 ปีที่แล้ว

      @client.command(aliases=['c'])
      @commands.has_permissions(manage_messages = True)
      async def clear(ctx,amount=1):
      await ctx.channel.purge(limit = amount) is this your code?

  • @volutedberet
    @volutedberet 4 ปีที่แล้ว +2

    Nice tutorial! You are underrated so mutch

  • @TheMackhoi
    @TheMackhoi 4 ปีที่แล้ว

    Help please!
    Traceback (most recent call last):
    File "C:\Users\mackh_rs6d6b2\OneDrive\Desktop\Bot - Copy\Mr.shup\Mr.Endeavor.py", line 31, in
    @commands.has_permissions(manage_messages = True)
    AttributeError: 'Command' object has no attribute 'has_permissions'
    [Finished in 0.9s]
    I don't what's wrong?

    • @TheMackhoi
      @TheMackhoi 4 ปีที่แล้ว

      *I don't know what's wrong

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว

      It's commands not command

    • @TheMackhoi
      @TheMackhoi 4 ปีที่แล้ว

      @@CodeWithSwastik yes, but it still won't work though. Here's my code. @commands.has_permissions(manage_messages = True) . It still won't work.

    • @TheMackhoi
      @TheMackhoi 4 ปีที่แล้ว

      nevermind. Found out the problem.

    • @aristology6912
      @aristology6912 3 ปีที่แล้ว

      @@TheMackhoi what was it?

  • @raunaksingh3897
    @raunaksingh3897 3 ปีที่แล้ว

    At least i found someone who code works

  • @vszlx4262
    @vszlx4262 3 ปีที่แล้ว

    @commands.has_permissions(manage_messages = True)
    NameError: name 'commands' is not defined
    please help me

    • @progamerbufovi
      @progamerbufovi 3 ปีที่แล้ว +1

      for anyone reading change client to bot.commands

    • @denimflare
      @denimflare 3 ปีที่แล้ว

      did you do the following? :
      from discord.ext import commands

  • @afroboy8827
    @afroboy8827 3 ปีที่แล้ว

    I’ve done all the code correctly I think but the commands aren’t doing anything at all for some reason there is no error

    • @sil8nt653
      @sil8nt653 3 ปีที่แล้ว

      for me my kick doesnt work

  • @eliericksson.8950
    @eliericksson.8950 4 ปีที่แล้ว

    Amazing video!!! Works SUPER WELL!

  • @almightynan1
    @almightynan1 3 ปีที่แล้ว

    you deserve more subs for making awesome content!

  • @TheSumi71
    @TheSumi71 3 ปีที่แล้ว

    bro ban clear and kick none of them is working its showing in cmd that there is no attribute in discord.ext

    • @aryasira
      @aryasira 3 ปีที่แล้ว

      same

  • @thevansh2456
    @thevansh2456 4 ปีที่แล้ว

    Why My .purge is not working

  • @azukho503
    @azukho503 4 ปีที่แล้ว

    i coppied the code but I get an error saying: Command "clear" not found.

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว

      Did you make sure that the clear command is above client.run() ?

    • @azukho503
      @azukho503 4 ปีที่แล้ว

      @@CodeWithSwastikI made it work by using:
      @client.command()
      async def clear(ctx, amount = 2):
      await ctx.channel.purge(limit = amount + 1)
      await ctx.send("The chat has been cleared")

  • @JustAnotherCoder
    @JustAnotherCoder 4 ปีที่แล้ว

    Great tutorial but unfortunately the !clear function doesn't work. It says Limit is not defined. I think this might be bcs of the latest update of Discord.py on October 7th

    • @cearun957
      @cearun957 3 ปีที่แล้ว +2

      i found the fix i think u just need to change the first letter of clear to a capital like this look:
      @client.command(aliases=['purge','clear','p','c'])
      @commands.has_permissions(manage_messages = True)
      async def Clear(ctx,amount=2):
      await ctx.channel.purge(limit = amount)

  • @willwell5250
    @willwell5250 4 ปีที่แล้ว

    How do you make a warn and mute command?

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว

      I will be making a video on the warn command. The mute command is in part 4

  • @bharatupadhyay4685
    @bharatupadhyay4685 3 ปีที่แล้ว

    Bro, its clearing messages in my server but not in another servers. Anyone pls help

    • @katzownsu
      @katzownsu 3 ปีที่แล้ว

      Whats your command code? If you did it just like his, then I don't know whats wrong, if you put the permissions string, do you have a role with that permission, if so then you will need the permissions.

    • @bharatupadhyay4685
      @bharatupadhyay4685 3 ปีที่แล้ว

      @@katzownsu async def clear(ctx,amount : int):
      await ctx.channel.purge(limit=amount) .I have written this code without any permissions , so why it is clearing messages only in my server , not another.

    • @katzownsu
      @katzownsu 3 ปีที่แล้ว

      @@bharatupadhyay4685 Hmm, I'm not sure. if you want, try this code:
      async def clear(ctx, amount=enter default amount,):
      await ctx.channel.purge(limit=amount)
      Edit: Make sure its in your @client.command() or whatever is above all your commands

  • @prabodh6983
    @prabodh6983 4 ปีที่แล้ว

    You can use if to check wether member has permission to delete message
    If member dosent have permission :-
    Else :
    Print("you dont have permission to send messages")
    My syntax may be wrong but u get the point right?

  •  4 ปีที่แล้ว

    can u give the code?

  • @guptachaman3
    @guptachaman3 2 ปีที่แล้ว

    i am unable to run commands

  • @W1L7dev
    @W1L7dev 3 ปีที่แล้ว

    Great video! But how to do a mute/unmute command and a unban command?

    • @denimflare
      @denimflare 3 ปีที่แล้ว +1

      unban command would look something like this:
      @client.command()
      @commands.has_permissions(ban_members=True)
      async def unban(ctx, *, member):
      banned_users = await ctx.guild.bans()
      member_name, member_discriminator = member.split('#')
      for ban_entry in banned_users:
      user = ban_entry.user
      if (user.name, user.discriminator) == (member_name, member_discriminator):
      await ctx.guild.unban(user)
      await ctx.send(f'Unbanned {user.name}#{user.discriminator}')
      return

    • @denimflare
      @denimflare 3 ปีที่แล้ว +1

      mute is a bit more complicated, because you need to define more stuff for the unmute command (which you need). Anyway heres the mute command:
      @client.command(description="Mutes the specified user.")
      @commands.has_permissions(manage_messages=True)
      async def mute(ctx, member: discord.Member, *, reason=None):
      guild = ctx.guild
      mutedRole = discord.utils.get(guild.roles, name="Muted")
      if not mutedRole:
      mutedRole = await guild.create_role(name="Muted")
      for channel in guild.channels:
      await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)
      embed = discord.Embed(title="muted", description=f"{member.mention} was muted ", colour=discord.Colour.light_gray())
      embed.add_field(name="reason:", value=reason, inline=False)
      await ctx.send(embed=embed)
      await member.add_roles(mutedRole, reason=reason)
      await member.send(f" you have been muted from: {guild.name} reason: {reason}")

    • @denimflare
      @denimflare 3 ปีที่แล้ว +1

      Here's the unmute command:
      @client.command(description="Unmutes a specified user.")
      @commands.has_permissions(manage_messages=True)
      async def unmute(ctx, member: discord.Member):
      mutedRole = discord.utils.get(ctx.guild.roles, name="Muted")
      await member.remove_roles(mutedRole)
      await member.send(f" you have unmutedd from: - {ctx.guild.name}")
      embed = discord.Embed(title="unmute", description=f" unmuted-{member.mention}",colour=discord.Colour.light_gray())
      await ctx.send(embed=embed)

    • @denimflare
      @denimflare 3 ปีที่แล้ว +1

      the embed function is useless, unless you made an embed first.

    • @denimflare
      @denimflare 3 ปีที่แล้ว +1

      there's also a tempmute command, but that's just a big bother in my opinion. Anyway, i'll give you the code.
      #Timed mute this format: 1d, 20s, 30m, etc..
      @bot.command(aliases=['tempmute'])
      @commands.has_permission(manage_messages=True)
      async def mute(ctx, member: discord.Member=None, time=None, *, reason=None):
      if not member:
      await ctx.send("You must mention a member to mute!")
      elif not time:
      await ctx.send("You must mention a time!")
      else:
      if not reason:
      reason="No reason given"
      #Now timed mute manipulation
      try:
      seconds = time[:-1] #Gets the numbers from the time argument, start to -1
      duration = time[-1] #Gets the timed maniulation, s, m, h, d
      if duration == "s":
      seconds = seconds * 1
      elif duration == "m":
      seconds = seconds * 60
      elif duration == "h":
      seconds = seconds * 60 * 60
      elif duration == "d":
      seconds = seconds * 86400
      else:
      await ctx.send("Invalid duration input")
      return
      except Exception as e:
      print(e)
      await ctx.send("Invalid 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_message_history=True, read_messages=False)
      await member.add_roles(Muted, reason=reason)
      muted_embed = discord.Embed(title="Muted a user", description=f"{member.mention} Was muted by {ctx.author.mention} for {reason} to {time}")
      await ctx.send(embed=muted_embed)
      await asyncio.sleep(seconds)
      await member.remove_roles(Muted)
      unmute_embed = discord.Embed(title="Mute over!", description=f'{ctx.author.mention} muted to {member.mention} for {reason} is over after {time}")
      await ctx.send(embed=unmute_embed)

  • @abhishekroy3464
    @abhishekroy3464 4 ปีที่แล้ว

    this guys is a genius

  • @QuicktheFact
    @QuicktheFact 3 ปีที่แล้ว

    2:45 just remebering
    :P

  • @mrgamerboy8316
    @mrgamerboy8316 4 ปีที่แล้ว +1

    great tutorial you deserver more views and subs

  • @kvfacts5229
    @kvfacts5229 4 ปีที่แล้ว

    Hello! How do you get a server name? For example, upon banning ( or kicking) someone; they will get a DM saying they were banned (or kicked) from the server you used the command.

    • @CodeWithSwastik
      @CodeWithSwastik  4 ปีที่แล้ว +1

      ctx.guild.name, the way you would use it would be await ctx.send(" You were banned from " + ctx.guild.name)

    • @kvfacts5229
      @kvfacts5229 4 ปีที่แล้ว

      @@CodeWithSwastik Thank you! Can you make a tutorial of programming giveaway commands and locking commands?

    • @kotarlie
      @kotarlie 3 ปีที่แล้ว

      @@CodeWithSwastik uhh i have a problem when I type ctx.guild.name, it says that send has only 2 arguments, how can I fix that?

    • @shalinigupta4792
      @shalinigupta4792 3 ปีที่แล้ว +1

      @@kotarlie I also had the same problem but what you have to do is where you want to send the veriable just add {}, and the add .format(veriable name)
      Ex:
      ctx.send("You are banned from {}".format(ctx.guild))

    • @kotarlie
      @kotarlie 3 ปีที่แล้ว

      @@shalinigupta4792 oh, thanks! I`ll try it

  • @sulaimanrel
    @sulaimanrel 3 ปีที่แล้ว

    copy paste please its very hard for us to write all this

  • @sworld8135
    @sworld8135 4 ปีที่แล้ว

    Best Tutorials

  • @joshyi589
    @joshyi589 3 ปีที่แล้ว

    Wait,you’re swas.py? Wow

  • @eliericksson.8950
    @eliericksson.8950 4 ปีที่แล้ว

    XD When I tried kicking someone from server they had privacy on and it stopped the bot form sending message AND from kicking them XD Easy fix though.

  • @EmpireAngels
    @EmpireAngels 3 ปีที่แล้ว

    I improvised it a bit

  • @somimrz
    @somimrz 3 ปีที่แล้ว

    didn't work :

  • @govanarslan9762
    @govanarslan9762 3 ปีที่แล้ว

    Legend

  • @kaitov9893
    @kaitov9893 3 ปีที่แล้ว

    This didn’t work

  • @rochan_rk
    @rochan_rk 3 ปีที่แล้ว

    thx u earned a sub

  • @vinamrayadav6947
    @vinamrayadav6947 4 ปีที่แล้ว +1

    bro you did a great job :)

  • @MCGREAZY
    @MCGREAZY 3 ปีที่แล้ว

    BRUHHHH THE CLEAR COMMAND IS FUCKED FOR ME

  • @loeki9638
    @loeki9638 4 ปีที่แล้ว +2

    pls unban me from your server PLSSSSS

  • @zorodjuro9115
    @zorodjuro9115 4 ปีที่แล้ว

    Bro for your safety please dont show your bot token

  • @bhaveshreddy5372
    @bhaveshreddy5372 3 ปีที่แล้ว

    my kick and ban cammond not working its not a good code wrong code damp code never use this code

  • @justsomeone9440
    @justsomeone9440 4 ปีที่แล้ว

    Thanks man it work's

  • @drdimension4943
    @drdimension4943 3 ปีที่แล้ว +1

    How do I add a thing where it sends an error message in chat if you don't have permissions? Also, how do you log the actions?

  • @datboygamer9047
    @datboygamer9047 4 ปีที่แล้ว +1

    can you help me? I coded the kick exactly as you did and I get this error
    Ignoring exception in command kick:
    Traceback (most recent call last):
    File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)

    • @denimflare
      @denimflare 3 ปีที่แล้ว +1

      i'll provide a kick command code that worked perfectly fine for me:
      @client.command()
      @commands.has_permissions(kick_members=True)
      async def kick(ctx, member: discord.Member, *, reason=None):
      await member.kick(reason=reason)
      await ctx.send(f'{member} was kicked.')

  • @hool4051
    @hool4051 4 ปีที่แล้ว +1

    I get this error with the kick command:
    (I changed my path cause I didn't wanna leak it)
    Traceback (most recent call last):
    File "C:\Users\MYPATH\bot.py", line 20, in
    async def kick(ctx,member : discord.Member,*,reason="Es wurde kein Grund angegeben. :("):
    NameError: name 'discord' is not defined

    • @karthikjangid3764
      @karthikjangid3764 4 ปีที่แล้ว

      can you share your code?
      even a little snippet is alright.

  • @SpectreDev
    @SpectreDev 3 ปีที่แล้ว

    How can you check for permissions or roles in @client.event, for example I am trying to make a bot that deletes links from players except for admins

  • @jai6470
    @jai6470 3 ปีที่แล้ว +1

    idk why kick is not working please help everything else is working except kick and ban i am doing the coding on repl.it
    PLEASE HELP SIR

    • @Shadow-rn4wk
      @Shadow-rn4wk 3 ปีที่แล้ว

      Don’t use repl.it people can get your token use a code editor like vs code

    • @Slender-the-Blender
      @Slender-the-Blender 3 ปีที่แล้ว

      @@Shadow-rn4wk Nah nah you can hide it from people (.env file (hiding the entire code is premium only))

  • @shabaka6375
    @shabaka6375 3 ปีที่แล้ว

    whenever I try banning using ID, it doesn't work, it says user not found

  • @oli.bleach
    @oli.bleach 3 ปีที่แล้ว

    AttributeError: 'Command' object has no attribute 'has_permissions' help

    • @oli.bleach
      @oli.bleach 3 ปีที่แล้ว

      Traceback (most recent call last):
      File "c:/Users/rpway/New folder/JakeBot/bot.py", line 55, in
      @commands.has_permissions(manage_roles = True)
      AttributeError: 'Command' object has no attribute 'has_permissions'
      PS C:\Users
      pway\New folder\JakeBot>

  • @kayliewu8257
    @kayliewu8257 4 ปีที่แล้ว +1

    It says that
    Traceback (most recent call last):
    File "C:\Users\kaylie wu\OneDrive\桌面\BOT\bot.py", line 50, in
    async def kick(ctx,member : discord.Member,*,reason= "No reason provide"):
    NameError: name 'discord' is not defined
    WHY???
    PLS HELPPPPP

    • @alecphann
      @alecphann 4 ปีที่แล้ว

      you put , instead of . i think
      coma instead of period

    • @denimflare
      @denimflare 3 ปีที่แล้ว

      @client.command()
      @commands.has_permissions(kick_members=True)
      async def kick(ctx, member: discord.Member, *, reason=None):
      await member.kick(reason=reason)
      await ctx.send(f'{member} was kicked.')

    • @denimflare
      @denimflare 3 ปีที่แล้ว

      also, did you import discord and that stuff?

  • @adityaghosh5315
    @adityaghosh5315 3 ปีที่แล้ว

    kick and ban commands not working for me, i get this error even tho i made it same - async def kick(ctx, member : discord.Member, *, reason:"No reason provided"), its invalid syntax plz help

    • @_DRags
      @_DRags 3 ปีที่แล้ว +1

      Me too!

    • @_DRags
      @_DRags 3 ปีที่แล้ว

      I have just fixed it, try copying and deleting the code and putting it in a different location.