不和 is a simple, small and easy-to-use library for use in Node.js to interact with the popular text and VoIP instant messaging application Discord using its official API.
Note: this package is currently maintained in 0ver, which means breaking changes may occur at our discretion in compliance with SemVer.
Node.js version 16 or higher is required for this library.
Installing with npm, Yarn or any other package manager for Node.js is simple. Simply run the following command (adapted to your current package manager, if applicable) in your terminal and you'll be ready to go!
# with npm
npm install --save fuwadiscord/fuwa
# with yarn
yarn add github:fuwadiscord/fuwa
# then, compile the code (if you're installing from GitHub)
cd node_modules/fuwa
tsc
Note: pin to a commit you like to avoid breaking changes
Fuwa is designed to be quite simple to use, and easy to transfer from other libraries like Discord.js. A simple bot would be programmed along the lines of:
import Fuwa from 'fuwa';
const client = new Fuwa.Client('my token', {
intents: [
...Fuwa.DefaultClientOptions.intents,
Fuwa.Intents.Bits.MessageContent,
],
});
client.on('messages.create', message => {
if (message.content === 'hi, bot!') {
return message.channel.createMessage('hello, ' + message.author.tag);
}
});
client.connect();
erlpack
as an npm dependency
and pass etf: true
to your Client
's options.etf
, but make sure it implements our Erlpack
interface.kleur
as an npm dependency.Generated using TypeDoc