[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.
/ discord-tnt Public archive

A simple to use discord api wrapper written in node.js under developement

License

Notifications You must be signed in to change notification settings

ravener/discord-tnt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple to use discord api wrapper written in node.js under developement

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published