Discord Bot Kick Command Doesn't Work As Expected Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Discord Bot Kick CommandDiscord bot can´t kick with admin privilegesFlask + Discord Bot doesn't workHow to capture output of subprocess.callDiscord Invoke command for discord botRandom function doesn't work within discord botDiscord Bot game emojiInvalid syntax for discord bot (python)Discord Bot does not respond to commandsDiscord Bot Check Permissions In Kick Command

How to avoid introduction cliches

Multiple fireplaces in an apartment building?

What ability score does a Hexblade's Pact Weapon use for attack and damage when wielded by another character?

How long after the last departure shall the airport stay open for an emergency return?

Expansion//Explosion and Siren Stormtamer

Where did Arya get these scars?

What's the difference between using dependency injection with a container and using a service locator?

What do you call the part of a novel that is not dialog?

Justification for leaving new position after a short time

Married in secret, can marital status in passport be changed at a later date?

Why did C use the -> operator instead of reusing the . operator?

All ASCII characters with a given bit count

How to keep bees out of canned beverages?

c++ diamond problem - How to call base method only once

Putting Ant-Man on house arrest

Can you stand up from being prone using Skirmisher outside of your turn?

Did the Roman Empire have penal colonies?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

What is the term for a person whose job is to place products on shelves in stores?

With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space

What is it called when you ride around on your front wheel?

What is the best way to deal with NPC-NPC combat?

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

Passing args from the bash script to the function in the script



Discord Bot Kick Command Doesn't Work As Expected



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Discord Bot Kick CommandDiscord bot can´t kick with admin privilegesFlask + Discord Bot doesn't workHow to capture output of subprocess.callDiscord Invoke command for discord botRandom function doesn't work within discord botDiscord Bot game emojiInvalid syntax for discord bot (python)Discord Bot does not respond to commandsDiscord Bot Check Permissions In Kick Command



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I need help with my kick command. I don't get any error,But the result is something else then what I expected,My code is below.



@bot.command(pass_context=True, name="kick")

@has_permissions(kick_members=True)

async def kick(ctx, *, target: Member):

if target.server_permissions.administrator:

await bot.say("Target is an admin")
else:
try:
await bot.kick(target)
await bot.say('Kicked'.format(member.mention))
except Exception:
await bot.say("Something went wrong")

@kick.error
async def kick_error(error, ctx):

if isinstance(error, CheckFailure):

await bot.send_message(ctx.message.channel, "You do not have permissions")
elif isinstance(error, BadArgument):
await bot.send_message(ctx.message.channel, "Could not identify target")
else:
raise error


But the commands do kick the member but it doesn't says kicked (MEMBERNAME).
Instead it says 'something went wrong'. Also there are two commands Which work for my kick command.










share|improve this question




























    1















    I need help with my kick command. I don't get any error,But the result is something else then what I expected,My code is below.



    @bot.command(pass_context=True, name="kick")

    @has_permissions(kick_members=True)

    async def kick(ctx, *, target: Member):

    if target.server_permissions.administrator:

    await bot.say("Target is an admin")
    else:
    try:
    await bot.kick(target)
    await bot.say('Kicked'.format(member.mention))
    except Exception:
    await bot.say("Something went wrong")

    @kick.error
    async def kick_error(error, ctx):

    if isinstance(error, CheckFailure):

    await bot.send_message(ctx.message.channel, "You do not have permissions")
    elif isinstance(error, BadArgument):
    await bot.send_message(ctx.message.channel, "Could not identify target")
    else:
    raise error


    But the commands do kick the member but it doesn't says kicked (MEMBERNAME).
    Instead it says 'something went wrong'. Also there are two commands Which work for my kick command.










    share|improve this question
























      1












      1








      1








      I need help with my kick command. I don't get any error,But the result is something else then what I expected,My code is below.



      @bot.command(pass_context=True, name="kick")

      @has_permissions(kick_members=True)

      async def kick(ctx, *, target: Member):

      if target.server_permissions.administrator:

      await bot.say("Target is an admin")
      else:
      try:
      await bot.kick(target)
      await bot.say('Kicked'.format(member.mention))
      except Exception:
      await bot.say("Something went wrong")

      @kick.error
      async def kick_error(error, ctx):

      if isinstance(error, CheckFailure):

      await bot.send_message(ctx.message.channel, "You do not have permissions")
      elif isinstance(error, BadArgument):
      await bot.send_message(ctx.message.channel, "Could not identify target")
      else:
      raise error


      But the commands do kick the member but it doesn't says kicked (MEMBERNAME).
      Instead it says 'something went wrong'. Also there are two commands Which work for my kick command.










      share|improve this question














      I need help with my kick command. I don't get any error,But the result is something else then what I expected,My code is below.



      @bot.command(pass_context=True, name="kick")

      @has_permissions(kick_members=True)

      async def kick(ctx, *, target: Member):

      if target.server_permissions.administrator:

      await bot.say("Target is an admin")
      else:
      try:
      await bot.kick(target)
      await bot.say('Kicked'.format(member.mention))
      except Exception:
      await bot.say("Something went wrong")

      @kick.error
      async def kick_error(error, ctx):

      if isinstance(error, CheckFailure):

      await bot.send_message(ctx.message.channel, "You do not have permissions")
      elif isinstance(error, BadArgument):
      await bot.send_message(ctx.message.channel, "Could not identify target")
      else:
      raise error


      But the commands do kick the member but it doesn't says kicked (MEMBERNAME).
      Instead it says 'something went wrong'. Also there are two commands Which work for my kick command.







      python-3.x discord.py






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 9 at 6:20









      bos gamerbos gamer

      198




      198






















          1 Answer
          1






          active

          oldest

          votes


















          1














          I don't really get why you try to except an exception if it isn't the case.



          I deleted the * in async def kick() function as you only require the member not multiple arguments so it's kinda pointless to have it there and I also removed the try and except thing which in my opinion is useless in this case.



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error


          If you want to check for example if the moderator or the person who uses the command is also putting a user in the command that should be kicked , you could do it with an if statement which would check if the discord.Member function is still none if yes it would output a message in chat. In this case I've put the message "You forgot the user"



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          elif target = None:
          await bot.say("You forgot the user")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error





          share|improve this answer























          • Sir, Thankyou very much it helped me alot.

            – bos gamer
            Mar 10 at 6:33











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074618%2fdiscord-bot-kick-command-doesnt-work-as-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I don't really get why you try to except an exception if it isn't the case.



          I deleted the * in async def kick() function as you only require the member not multiple arguments so it's kinda pointless to have it there and I also removed the try and except thing which in my opinion is useless in this case.



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error


          If you want to check for example if the moderator or the person who uses the command is also putting a user in the command that should be kicked , you could do it with an if statement which would check if the discord.Member function is still none if yes it would output a message in chat. In this case I've put the message "You forgot the user"



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          elif target = None:
          await bot.say("You forgot the user")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error





          share|improve this answer























          • Sir, Thankyou very much it helped me alot.

            – bos gamer
            Mar 10 at 6:33















          1














          I don't really get why you try to except an exception if it isn't the case.



          I deleted the * in async def kick() function as you only require the member not multiple arguments so it's kinda pointless to have it there and I also removed the try and except thing which in my opinion is useless in this case.



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error


          If you want to check for example if the moderator or the person who uses the command is also putting a user in the command that should be kicked , you could do it with an if statement which would check if the discord.Member function is still none if yes it would output a message in chat. In this case I've put the message "You forgot the user"



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          elif target = None:
          await bot.say("You forgot the user")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error





          share|improve this answer























          • Sir, Thankyou very much it helped me alot.

            – bos gamer
            Mar 10 at 6:33













          1












          1








          1







          I don't really get why you try to except an exception if it isn't the case.



          I deleted the * in async def kick() function as you only require the member not multiple arguments so it's kinda pointless to have it there and I also removed the try and except thing which in my opinion is useless in this case.



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error


          If you want to check for example if the moderator or the person who uses the command is also putting a user in the command that should be kicked , you could do it with an if statement which would check if the discord.Member function is still none if yes it would output a message in chat. In this case I've put the message "You forgot the user"



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          elif target = None:
          await bot.say("You forgot the user")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error





          share|improve this answer













          I don't really get why you try to except an exception if it isn't the case.



          I deleted the * in async def kick() function as you only require the member not multiple arguments so it's kinda pointless to have it there and I also removed the try and except thing which in my opinion is useless in this case.



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error


          If you want to check for example if the moderator or the person who uses the command is also putting a user in the command that should be kicked , you could do it with an if statement which would check if the discord.Member function is still none if yes it would output a message in chat. In this case I've put the message "You forgot the user"



          @bot.command(pass_context=True, name="kick")

          @has_permissions(kick_members=True)

          async def kick(ctx, target: discord.Member=None):

          if target.server_permissions.administrator:

          await bot.say("Target is an admin")
          elif target = None:
          await bot.say("You forgot the user")
          else:
          await bot.kick(target)
          await bot.say('Kicked'.format(target.mention))

          @kick.error
          async def kick_error(error, ctx):

          if isinstance(error, CheckFailure):

          await bot.send_message(ctx.message.channel, "You do not have permissions")
          elif isinstance(error, BadArgument):
          await bot.send_message(ctx.message.channel, "Could not identify target")
          else:
          raise error






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 10 at 0:27









          SirFulgeruLSirFulgeruL

          998




          998












          • Sir, Thankyou very much it helped me alot.

            – bos gamer
            Mar 10 at 6:33

















          • Sir, Thankyou very much it helped me alot.

            – bos gamer
            Mar 10 at 6:33
















          Sir, Thankyou very much it helped me alot.

          – bos gamer
          Mar 10 at 6:33





          Sir, Thankyou very much it helped me alot.

          – bos gamer
          Mar 10 at 6:33



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074618%2fdiscord-bot-kick-command-doesnt-work-as-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко