#Creating a basic Prefix Command

1 messages · Page 1 of 1 (latest)

sterile dock
#

Hi all, I've just picked up HIkari and trying to make an Prefix command. Would this be the correct way of introducing a new prefix command? Currently the bot won't display nothing in discord


@bot.command
@lightbulb.command('whohastheitems', 'Requesting info')
@lightbulb.implements(lightbulb.PrefixCommand)
async def whohastheitems(ctx):
    await ctx.respond('Anda stole all the items')

bot.run()```
modest zenith
#

./tag msgcnt

sly umbraBOT
#

Why is some information about my messages from MessageCreateEvent unavailable?

You may have not enabled the Message Content Intent. This had been a thing for bots from August 31st, 2022 onward. For more info, refer to https://support-dev.discord.com/hc/en-us/articles/4404772028055

Firstly, go to your discord developer portal. In your bot application, in the bot section, tick this to be on. (check the attached screenshot: https://i.imgur.com/8Ps9Boi.png)
Secondly, in your bot's code, add the highlighted lines:

bot = hikari.GatewayBot( # or lightbulb.BotApp
    "your token",
    intents=hikari.Intents.ALL_UNPRIVILEGED | hikari.Intents.MESSAGE_CONTENT # Add this line
)

You should now receive all information about such messages. :)

Note: You will still receive this information for messages in which the bot is pinged and for any message in DMs, regardless of the intent.

modest zenith
#

I'd personally recommend against using prefix commands

#

they are practically deprecated by Discord

sterile dock
#

Oh I see, ye the slash command was working fine, I was just wondering about the prefix one

modest zenith
#

but the solution is above

sterile dock
#

Ok thank you for the quick response!

modest zenith
#

you need a priviliged intent