Categories > Coding > Python >

[Release] Discord Bot w/ slash commands using Hikari

Posts: 1597

Threads: 166

Joined: Apr, 2021

Reputation: 13

Posted

Greetings, dear community!

Today I come with a release of a Discord bot in Python, using the Hikari library. It's fast and efficient, and it's very easy to make slash commands with it. You can learn more here.

 

Download link: https://www.mediafire.com/file/1zvrm7e66xafift/hikari.py/file

Source:

 

import os
import hikari
import lightbulb

bot = lightbulb.BotApp(
    token="YourTokenHere",
    default_enabled_guilds=YOUR_GUILD_ID_HERE,
    help_slash_command=True,
    intents=hikari.Intents.ALL
)

@Bot.command()
@lightbulb.option("text", "What do you want the bot to say")
@lightbulb.command("say", "Make the bot say something")
@lightbulb.implements(lightbulb.SlashCommand)
async def cmd_say(ctx: lightbulb.SlashContext) -> None:
    await ctx.respond(ctx.options.text)

bot.run()

 

Make sure to do

pip install hikari hikari-lightbulb

before running!

  • 0

Random quote here...

Posts: 0

Threads: 0

Joined: ?

Reputation:

Replied

Vouch! I may use that soon.

  • 0

aeon

Owner of Voyager

vip

Posts: 264

Threads: 25

Joined: Sep, 2022

Reputation: 12

Replied

vouch cool /chars

  • 0

Posts: 1226

Threads: 68

Joined: May, 2022

Reputation: 17

Replied

reject python embrace javascript

  • 0

Did I mention I use arch btw?

Posts: 1597

Threads: 166

Joined: Apr, 2021

Reputation: 13

Replied

@Whoman JavaScript is pretty confusing for me, these intents and things... but I never said it's bad. I indeed code in itz although not everything like in Python.

  • 0

Random quote here...

Alternate

stop take my rice

vip

Posts: 605

Threads: 105

Joined: Mar, 2022

Reputation: 36

Replied

@Whoman

Python better than js because elon musk said so

 

btw why not discord.py?

  • 0

we are dead

Posts: 1597

Threads: 166

Joined: Apr, 2021

Reputation: 13

Replied

@Alternate Discord.Py is pretty old and doesn't have latest updates, also Hikari is easier to use and better.

  • 0

Random quote here...

Alternate

stop take my rice

vip

Posts: 605

Threads: 105

Joined: Mar, 2022

Reputation: 36

Replied

@VoidableMethod
Even then though there are forks of it that are maintained still

  • 0

we are dead

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )