10000 discord-tnt/README.md at master · ravener/discord-tnt · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Latest commit

 

History

History
76 lines (61 loc) · 2.91 KB

README.md

File metadata and controls

76 lines (61 loc) · 2.91 KB

NOTE

This library is discontinued as this project was just me playing around.

It was made in the early days of my JavaScript to practice and learn about the Discord API. It is archived now, it may be a good starting point for some other interested users but use at your own risk, the code quality is terrible and all since as I said I made it when I was fairly new to JavaScript.

DiscordTNT

Node.js Discord Library. Wrote using WS library for websocket connections and superagent library for http requests. under development.

Warning

The Library is highly unstable for now library is under development, please open a pull request if you would like to contribute, this is mainly a practice and I can't gurantee a perfect library but as I learn I'll be releasing new versions with better things.

  • Easy to use
  • Covers most of discord api , Not yet tho
  • Active development
  • Free and open to contribute/suggest a feature.

Installation

Run this in a command prompt in your project's directory

npm i freetnt5852/discord-tnt --save

this requires you to have git. will be in npm later once confirmed to be stable.

Example usage

Here's a basic usage of the library:

const DiscordTNT = require("discord-tnt");
// create a client instance.
const client = new DiscordTNT.Client({TOKEN:"Your Bot TOKEN"}); // Look at docs for other options the client accepts.

const prefix = "+" // many ways to set prefix pick your way

client.on('ready', () => {
	console.log("Bot is online!");
	console.log(`Logged in as ${client.self.username}`);
	client.setPresence("with NodeJS");
}); // ready event


client.on('messageCreate', message => {
	if(message.content.startsWith(prefix + "ping")) {
		client.sendMessage(message.channel_id, "Pong!");
	}
}); // register msg listener and check for msg content and reply

client.connect();
// log in the bot

Webhooks

DiscordTNT Supports lightweight webhook usage without using a real bot token and authenticating stuff, here's an example usage of webhooks:

const DiscordTNT = require("discord-tnt");
const client = new DiscordTNT.WebhookClient({
	TOKEN:"Webhook Token",
	ID:"Webhook ID"
});

client.sendMessage("Hello, World!"); // send text message.
client.setName("Cool Webhook"); // change name
client.destroy(); // Deletes webhook forever, goodbye.

Useful links

License

Released under MIT License. see License file for more info

Contributing

If you want to contribute please send a pull request with your changes and describe the changes, open an issue if you found a bug or suggesting an idea. Read CONTRIBUTING.md file for more info about contributing.

0