logoCustom Commands
    BlogPrivacyPremiumSupport
Back to blog
// blog

Lets make a strike command using custom commands bot

We are going to make a command which gives a user strike and 3 strike = kick/ban

Md Shahriyar Alam

2 years ago

·1 min read

Lets make a /strike command which we can use to strike a member and if the member gets more than 3 strikes the bot will kick him.

Command

  • Name: strike
  • Description: Give strike to a member

Arguments

  • Name: target
  • Description: The target member to strike
  • Type: MEMBER

Hooks

Pre

py
require_permission("administrator") # You can also use allowed_roles()

current_strikes = member_var("strikes", member=target.id, default=0)
new_strikes = number(current_strikes) + 1
remaining_strikes = 3 - new_strikes

update_member_var("strikes", new_strikes, member=target.id)

response = (
  f"{target.mention} has been striked. Total strikes **{new_strikes}**\n"
  f"If you get **{remaining_strikes}** more strikes you will get kicked from this server."
)

if new_strikes >= 3:
  kick_member(target, message=f"You got {new_strikes} strikes and kiked from {server.name}")
  response = f"{target} has been kicked from the server for getting 3 strikes"

Response

Content

py
{response}

Now you can run this command and give strike to member

/strike @Shahriyar

Loading comments…

{}

Need help?

Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.

DiscordJoin support server
logoCustom Commands

The #1 custom commands Discord bot — build commands, events and databases with zero boilerplate.

stripe

Links

HomeBlogPrivacySupport

Contact

[email protected]

2 Frederick StreetLondon, WC1X 0ND

{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.