Message commands extension for discord-py-interactions

Overview

interactions-message-commands

Message commands extension for discord-py-interactions

README IS NOT FINISHED YET BUT IT IS A GOOD START

Installation

pip install -U interactions-message-commands

Usage

Here is the example code for how to use message commands:

import interactions
from interactions.ext.message_commands import MessageCommands, MessageContext

bot = interactions.Client(
    token="token here"
)
cmd = MessageCommands(bot, "!")


@cmd.message()
async def ping(ctx):
    await ctx.send("pong")


@cmd.message(name="hello")
async def hi(ctx: MessageContext, name: str):
    await ctx.send(f"Hello, {name}!")


bot.start()

First, you need to initialize your client.

Next, you need to initialize MessageCommands().

  • Multiple string prefixes in a list, tuple, or set is also allowed!

Then, you need to register your message commands.

  • @cmd.message(): register a message command
    • Only keyword argument at the time is name to override function name
    • name is optional, if not specified, the function name will be used
    • In the function, ctx is required.
    • You can have as many arguments and keyword arguments as you want! *args is supported, but not **kwargs. However, *, is supported.

Finally, start the bot.

Use message commands in the Discord chat, and the bot will respond!

Example: !ping or !hello John

There is also when_mentioned() and when_mentioned_or() for the prefix:

from interactions.ext.message_commands import MessageCommands, when_mentioned_or

cmd = MessageCommands(bot, when_mentioned_or("!", "?"))
You might also like...
tox-server is a command line tool which runs tox in a loop and calls it with commands from a remote CLI.

Tox Server tox-server is a command line tool which runs tox in a loop and calls it with commands from a remote CLI. It responds to commands via ZeroMQ

🐍The nx-python plugin allows users to create a basic python application using nx commands.
🐍The nx-python plugin allows users to create a basic python application using nx commands.

🐍 NxPy: Nx Python plugin This project was generated using Nx. The nx-python plugin allows users to create a basic python application using nx command

CryptoCo-py is a Python CLI application that uses CoinGecko API to allow the user to query cryptocurrency information by typing simple commands.

CryptoCo-py is a Python CLI application that uses CoinGecko API to allow the user to query cryptocurrency information by typing simple com

Interactive Python interpreter for executing commands within Node.js

Python Interactive Interactive Python interpreter for executing commands within Node.js. This module provides a means of using the Python interactive

Linux commands Interpreter for Windows and Mac based systems using Python
Linux commands Interpreter for Windows and Mac based systems using Python

DBHTermEcIbP Linux commands Interpreter for Windows and Mac based systems using Python Basic Linux commands supported viewing current working director

A CLI for advanced management of your notes with simple commands

PyNoteManager This is a CLI for advanced management of your notes with simple co

A Multipurpose bot with many Commands made using Pycord

This repo has all of the commands you will ever need in a discord bot. a Multipurpose discord bot

A Bot Which Send Automatically Commands To Karuta Hub to Gain it's Currency

A Bot Which Send Automatically Commands To Karuta Hub to Gain it's Currency

Releases(0.1.1)
Owner
null
A selfbot made with DPY, doesn't have much commands but there's some useful commands to use.

Phantom Selfbot A selfbot made in DPY, made by Zenith. How to use Add your token in token = 'YOUR-MOMS-TOKEN-HERE' Change the prefix in prefix = > If

[Ͼ⁴] Ƶephyr 2 Dec 2, 2021
A multipurpose discord bot with more than 220 commands

Welcome WM Bot A advanced bot with more than 220 commands to fit your needs Explore the commands » View Demo · Report Bug · Request Feature Table of C

Wasi Master 12 Dec 16, 2022
Python commandline tool for remembering linux/terminal commands

ehh Remember linux commands Commandline tool for remembering linux/terminal commands. It stores your favorite commands in ~/ehh.json in your homedir a

null 56 Nov 10, 2022
Management commands to help backup and restore your project database and media files

Django Database Backup This Django application provides management commands to help backup and restore your project database and media files with vari

null 687 Jan 4, 2023
commandpack - A package of modules for working with commands, command packages, files with command packages.

commandpack Help the project financially: Donate: https://smartlegion.github.io/donate/ Yandex Money: https://yoomoney.ru/to/4100115206129186 PayPal:

null 4 Sep 4, 2021
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
Output Analyzer for you terminal commands

Output analyzer (OZER) You can specify a few words inside config.yaml file and specify the color you want to be used. installing: Install command usin

Ehsan Shirzadi 1 Oct 21, 2021
CLI/GUI Math commands based on python 3

PyMath Commands Syntax Installation Commands: pymath add: usage: pymath add 12.5 12.5 sub: usage: pymath sub 25 12.5 div: usage: pymath div 144 12 mul

eggsnham07 0 Nov 22, 2021
A terminal tool for git. When we use git, do you feel very uncomfortable with too long commands

PIGIT A terminal tool for git. When we use git, do you feel very uncomfortable with too long commands. For example: git status --short, this project c

Zachary 1 Apr 9, 2022
⚙ A lightweight command line interface library for creating commands.

⚙ A lightweight command line interface library for creating cli commands. About | Installation | Usage | Features | Contributors | License About Next:

Serum 16 Sep 25, 2022