Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/legend-js-dev/discord-utils.js
discord-utils.js is a cool package for discord bots (can be used for something else too) which has alot of stuff like image manupulation, random stuff, etc
https://github.com/legend-js-dev/discord-utils.js
Last synced: 19 days ago
JSON representation
discord-utils.js is a cool package for discord bots (can be used for something else too) which has alot of stuff like image manupulation, random stuff, etc
- Host: GitHub
- URL: https://github.com/legend-js-dev/discord-utils.js
- Owner: legend-js-dev
- License: apache-2.0
- Created: 2021-02-08T08:07:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-15T12:46:00.000Z (over 3 years ago)
- Last Synced: 2024-10-13T11:43:47.840Z (about 1 month ago)
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Discord-utils.js
## This package is an api wrapper for the [devs hub api](https://api.devs-hub.xyz) (made by me) & [cool-img-api](https://api.cool-img-api.ml) (made by my friend)
### Installing the package:
```
npm i discord-utils.js
```
### Getting started:
```js
const Discord = require("discord.js")
const { Client } = require("discord.js")
const util = require("discord-utils.js")
const client = new Client()client.on("message", async (message) => {
if (message.content.startsWith("!communist")) {
let user = message.mentions.users.first()
let avatar = user.displayAvatarURL({ format: "png" })
let image = await util.Canvas.communist(avatar)
message.channel.send({
files: [{
name: "image.png",
attachment: image
}]
})
}
})client.login("token")
```
### if you use a command handler it would look like this:
```js
const { Canvas } = require("discord-utils.js")module.exports = {
name: "communist",
description: "sends an image with the communist filter",
run: async (client, message, args) => {
let user = message.mentions.users.first() || message.author
let avatar = user.displayAvatarURL()
let image = await Canvas.communist(avatar)
message.channel.send({
files: [{
name: "image.png",
attachment: image
}]
})
}
}
```
### for random cats, dogs, or birds:
```js
const { random } = require("discord-utils.js")module.exports = {
name: "dog",
description: "sends a random dog picture",
run: async (client, message, args) => {
let image = await random.dog()
message.channel.send({
files: [{
name: "image.png",
attachment: image
}]
})
}
}
```### for using the util stuff:
```js
const { Utils } = require("discord-utils.js")module.exports = {
name: "emojify",
description: "emojifies provided text",
run: async (client, message, args) => {
let text = args.join(" ")
if (!text) return message.channel.send("Provide text to emojify!")
try {
let emojify = await Utils.emojify(text)
return message.channel.send(emojify)
} catch (error) {
console.log(error)
} //if you get errors join the support server on discord
}
}
```
### using the djsDocs method on Utils:
```js
const { Utils } = require("discord-utils.js")module.exports = {
name: "docs",
aliases: ["djs"],
description: "searches the djs docs for the provided query",
run: async (client, message, args) => {
let text = args.join(" ")
if (!text) return message.channel.send("Provide the query!")
try {
let embed = await Utils.djsDocs(text)
return message.channel.send({
embed: embed
})
} catch (error) {
console.log(error)
} //if you get errors join the support server on discord
}
}
```### Links:
- Discord Server - [click here](https://discord.gg/BPCs7qXXbk)
- Documentation - [click here](https://l3g3nd-0001.gitbook.io/discord-utils-js/)
- Surprise - [click here](https://youtu.be/dQw4w9WgXcQ)#### Note: the list of Canvas methods are listed on the documentation