#Banning

1 messages · Page 1 of 1 (latest)

tardy cloud
#

Hello,

I'm using lightbulb and the extensions/plugins how would I make a ban command?

Thanks!

#

With premissions

dense bone
#

First one

#

You can use the function to ban a user

#

And how to take in the user in a slash command and setup permissions you can find in lightbulbs guide

tardy cloud
#

Thanks

#

So would i write it as:

import hikari

plugin3 = lightbulb.Plugin('ban')

@plugin3.listener(hikari.GuildMessageCreateEvent)
async def print_messages(event):
    print(event.content)

@plugin3.command
@lightbulb.command('ban', 'shhhh')
@lightbulb.option("Reason", "ban Reason")
@lightbulb.implements(lightbulb.SlashCommand)
async ban_user(guild, user, *, delete_message_days=30, delete_message_seconds=undefined.UNDEFINED, reason=ctx.options.Reason)

def load(bot):
    bot.add_plugin(plugin3)```?
tardy cloud
tardy cloud
dense bone
#

The docs specify what arguments the function takes in

#

To call the function, you can use:

await ctx.bot.rest.ban_user(ctx.guild_id, ...)

# ... Implying any other args you want to pass in
tardy cloud
#

Idk if when you are online you can help:

import hikari

plugin3 = lightbulb.Plugin('ban')

@plugin3.listener(hikari.GuildMessageCreateEvent)
async def print_messages(event):
    print(event.content)

@plugin3.command
@lightbulb.option('user', 'user to ban')
@lightbulb.command('ban', 'shhhh')
@lightbulb.implements(lightbulb.SlashCommand)
async def ban(ctx):
    await ctx.bot.rest.ban_user(ctx.guild_id, ctx.user == ctx.option.user)

def load(bot):
    bot.add_plugin(plugin3)```

Sorry i don't know much im new to python and this.
dense bone
#
import lightbulb
import hikari

plugin3 = lightbulb.Plugin('ban')

@plugin3.listener(hikari.GuildMessageCreateEvent)
async def print_messages(event):
    print(event.content)

@plugin3.command
@lightbulb.option('user', 'user to ban', type=hikari.User)
@lightbulb.command('ban', 'shhhh')
@lightbulb.implements(lightbulb.SlashCommand)
async def ban(ctx):
    await ctx.bot.rest.ban_user(ctx.guild_id, ctx.option.user)

def load(bot):
    bot.add_plugin(plugin3)
tardy cloud
#

And im getting this