discord-slash-commands-v12

7.9.16 • Public • Published

version downloads issue pull request license

discord-slash-commands-v12

Description

これを使えばdiscord.jsのv12でもスラッシュコマンドを操作することができます!
MessageComponentsは使えません。

Before Using

Install

npm i discord-slash-commands-v12 

Scopes
スラッシュコマンドを使うためにボットにapplication.commandsスコープを渡す必要が有ります。
↓URLの例

https://discord.com/api/oauth2/authorize?client_id={BOT_ID}&permissions=0&scope=bot%20applications.commands

Usage

setup

const { Client } = require('discord.js');
const client = new Client();
const slash = require('discord-slash-commands-v12');
slash(client);

セットアップ関数はそのものを返します。つまり、

const slash = require('discord-slash-commands-v12');
slash === slash(); //true

こういうことです;

Event Listener

client.on('commandInteraction', (data) => {
	//code
});

Ping-Pong

client.on('ready', () => {
	const ping = {
		name: 'ping',
		description: 'pong!'
	};
	client.commands.create(ping); //グローバルコマンド
	guild.commands.create(ping); //ギルドコマンド
});

client.on('commandInteraction', data => {
	if (data.commandName === 'ping') {
		data.reply.send('pong!');
	};
}); //ContextMenuも含まれます(メッセージコマンドとユーザーコマンドのことです。)

Autocomplete interaction

client.on('autocompleteInteraction', data => {});

You need more help?

my discord server

Commemt

ミスやバグを見つけたらissueやPRお願いします。

MessageComponents未対応です。

Readme

Keywords

Package Sidebar

Install

npm i discord-slash-commands-v12

Weekly Downloads

6

Version

7.9.16

License

MIT

Unpacked Size

140 kB

Total Files

73

Last publish

Collaborators

  • mametaro