Giter VIP home page Giter VIP logo

guide's People

Contributors

1computer1 avatar aircraftoverviewer avatar almostsouji avatar anandre avatar castdrian avatar danktuary avatar darqam avatar dastormer avatar dependabot[bot] avatar devyukine avatar drahcirius avatar goddere2d avatar idris1401 avatar ishibi avatar j-human avatar jiralite avatar lewdcario avatar lolollllo avatar megatank58 avatar monbrey avatar notsugden avatar novara754 avatar rafer45 avatar rdambrosio016 avatar renal-of-loon avatar sdanialraza avatar tipaka avatar vvito7 avatar wisedevhelper avatar yuta0801 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

guide's Issues

A very basic example on making a music system.

I'm not too sure if it'd even be worth the effort, if not, even I would be happy to PR a guide page, but a basic music guide would be cool (that contains queues, skipping, all that).

It is a bit of a big topic I guess, but it'd be useful for beginners.

Guide on Permissions

Common question: how does discords permission system work
And yeah, it's hard to wrap your head around at first. I played around with it for quite some time since discords beta through various changes and the question comes up a lot in the supportchannels as well.
Long story short: i'm going to write a guide on it.

Planned coverage:

  • What are permissions
  • What are overwrites
  • Explicit Allow/Deny
  • How all of that works with the different Tiers
  • How do Categories play into all of that

Questions I have for you:

  1. Where do you think this belongs? Common Questions? Popular topics?
  2. Anything else you'd like to see covered?
  3. What should an example for this look like in your opinion?
  4. Should i include role hierarchy/Admin/Owner overwrites or do you think that deserves its own paragraph?

Markdown for Discord Messages

Create a feature which allows guide authors to fake discord messages directly in the markdown instead of having to embed screenshots from Discord.

Possible misspell in tutorial #basic-arguments

https://discordjs.guide/creating-your-bot/commands-with-user-input.html#basic-arguments

Shouldn't there be if at the beginning? Because it doesn't work with else if, but works with if. Took me a while to figure it out.

// using the new `command` variable, this makes it easier to manage!
// you can switch your other commands to this format as well
else if (command === 'args-info') {
	if (!args.length) {
		return message.channel.send(`You didn't provide any arguments, ${message.author}!`);
	}

	message.channel.send(`Command name: ${command}\nArguments: ${args}`);
}

indenting in the menu is a little unclear

image

I don't know if it's just me, but it's hard to see where one section ends and the next begins when we get to the sub-sub-topic level, since we're mixing whether the sub-articles get indented or not. It's more clear in the light mode version since bold stands out a bit more.

Multiple versions

Support for multiple versions would be nice. You could have one version for stable and one for master for example. The user could then choose with a dropdown menu.

Issue in retrieving reactions while processing old messages

I have followed this snippet to retrieve reactions on old/uncached messages from discord. While this works fine, I am facing a problem in retrieving users list who reacted on the message.

My goal is to be able to receive reactions on messages, as well as usernames who reacted. For this, I am using messageReactionAdd and messageReactionRemove events; then inside the event, I use message.reactions.users. This works fine on cached messages, i.e I am able to retrieve users list who reacted. However, when working with the raw event as described in the snippet, message.reactions.users is always an empty list.

I hope I made myself clear. Please let me know if you need any more information.

DB error

"sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/queryin"

When trying to run the currency example on your git I get the above error.

Hence the !inventory and other DB based commands do not work.

Image buffer displays outside of embed

It looks like there is no way to have image buffer display in embed properly - it displays outside and not inside. What's worse it messes up notifications that just become "uploaded file.jpg" instead of the title/description.

To reproduce:

var img = await Jimp.read('https://i.imgur.com/wSTFkRM.png');
var imgBuf = await img.getBufferAsync(Jimp.AUTO);

const exampleEmbed = new Discord.RichEmbed()
.setTitle('important title')
.setDescription('meaningful description')
.attachFiles([imgBuf])
.setImage('attachment://imgBuf');

discordChannel.send(exampleEmbed);

results in:

image

image

Add information on how to securely store API keys/pass

Multiple servers were taken over recently. Many of them followed discordjs' guide on how to connect a bot. While looking it over, I see no information or warning to keep your credentials secure (.gitignore, system variable, pass thru commandline, etc).
People are hardcoding keys into public git repos and being taken over. Please consider adding a warning and ways to securely store auth keys.

Canvas.loadImage() stop the process

i tested a simple code with loadImage and nothing happened. What's wrong with Canvas.loadImage()?

const Canvas = require('canvas');
const background = Canvas.loadImage('https://i.imgur.com/3VlcfVT.jpg')
background.then(()=>{
    console.log(1)
}).catch(()=>{
    console.log(2);
})

Adding information on long arguments.

I'm trying to make a command with what I call long arguments. When I do !args-info "This is a long arg" it responds with
Arguments: "This,is,a,long,arg" Arguments length: 5
but If a user puts words in quotes, I want to make it be one long argument. eg:
Arguments: This is a long arg Arguments length: 1
I think there should be a section on this.

Sidebar Improvements

Would be nice to see the currently open page being highlighted, like the currently open headline.
I think that would make navigating the sidebar a bit easier.
(The top most Adding more commands in this case)
example

Maybe even change the background of the currently open section in the sidebar a bit, so you can easily see where the next page is. Or indicate it some other way.

Update docs to suggest using dotenv

Currently the docs suggest using a config.json file for managing config variables.

Most people are probably going to be using a free hosting service such as heroku to host their node bots and generally these hosting services are configured via git & environment variables. I think it's a good practice to suggest to use dotenv as it has several benefits and very easy to configure out of the box, even for newbies.

I can make a PR to suggest this, but just wanted to make sure this fits inline with something you guys would be open to?

Web Dashboard Tutorial Request

A tutorial on how to make a super simple HTML base for a web dashboard and how to connect to it from a website would be really nice. I can't find one and I've been trying to do this for a while. I'm new to website stuff and I've been told WebSockets and stuff are necessary but a simple example would be really cool.

Self assignable roles using reactions

It is a command that sends a message to a channel and adds reactions to it then when a user clicks on a reaction he gets a role when he clicks again the role is removed

Add a Help command with pages and categories

I saw the guide for the help command and while it is basic, I think having one with Pages (Reactions) and Categories would also be very beneficial as it would look more clean and sleek. Would recommend be used with Embeds (I.e RichEmbed)

Canvas Erorr

(node:681) UnhandledPromiseRejectionWarning: TypeError: Canvas.createCanvas is not a function

at Client.client.on (/app/server.js:48:24)
i keep getting this error and i'm new to canvas so i'm not sure what to do

Statuses

Add a page regarding setting presences like:
Playing some-random-bot.xyz
Watching the Server
Listening to Communication

Bot crashes after a while for no clear reason?

My bot works fine and then after a while it crashed because of an error. I don't know where to look to fix this error.
Is this an error with discordjs itself? I'd like to know. here's an error.

events.js:173
throw err; // Unhandled 'error' event
^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Commando.emit (events.js:171:17)
at WebSocketConnection.onError (G:\RustBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:374:17)
at WebSocket.onError (G:\RustBot\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:182:13)
at _receiver.cleanup (G:\RustBot\node_modules\ws\lib\websocket.js:211:14)
at Receiver.cleanup (G:\RustBot\node_modules\ws\lib\receiver.js:557:13)
at WebSocket.finalize (G:\RustBot\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)

Adding a section on handling timeouts

Seeing as many, including myself, have had issues with getting ECONNRESET it might be worth adding instructions in the guide on how to best handle it. Even just a notice would have saved me a lot of time debugging (as the timout would only occur every 2-5 days).

It would hopefully decrease the number of people putting up related issues on the discordjs API.

No link to official Documentation

There is no link from the discordjs.guide page to the official documentation at discord.js.org that I could find. Might be helpful to have a link somewhere on that to the API of the discord client, took me a long time to find it.

Edit: Also if it is there and I just can't read well, apologies ๐Ÿ˜…

help command says function map of undefined cannot be read

ive done it exactly as it is listed in the guide and i still get an TypeError: Cannot read property forEach of undefined.
Does anyone have an idea why this error happens and how i can resolve it?

Attached are error logs & a code snippet (help.js) where the error happens.

Thank you very much in advance!

Help.js code snippet
codesnippet

Error Log (PM2)
consoleerror

Improve canvas example

In the canvas example snekfetch is being used:

const { body: buffer } = await snekfetch.get(member.user.displayAvatarURL);
const avatar = await Canvas.loadImage(buffer);

Since snekfetch is deprecated, this example could be improved by using node-fetch instead. There is however an even more easy way. The Canvas.loadImage function accepts URLs already, as you can see over here: https://www.npmjs.com/package/canvas#loadimage

Therefore, I would recommend modifying those two lines into:

const avatar = await Canvas.loadImage(member.user.displayAvatarURL);

And change the descriptions accordingly.

I accidentally created a spam bot

There are no problems detected at all, and I'm really intrigued as to how I accidentally made a really special spam bot
Also I programmed the bot using Visual Studio Code and used java
Here's the code:
const Discord = require('discord.js');
const config = require('./config.json');
const client = new Discord.Client();

client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (message.content === 'e(ping') {
message.channel.send('pong!');
};
if (message.content === 'e(where am I') {
message.channel.send('here');
};
if (message.content === 'e(where are you') {
message.channel.send('not there');
};
if (message.content === 'e(what does sparkling water taste like') {
message.channel.send('TV static');
};
if (message.content === 'e(enter daco belll') {
message.channel.send('hola welcome to daco belll, can i take your order?');
};
if (message.content === 'e(yes I would like one jason derulo') {
message.channel.send('large, medium, or small?');
};
if (message.content === 'e(yes', 'e(no') {
message.channel.send('here you go enjoy');
};
if (message.content === 'e(enter dcmonalds') {
message.channel.send('dcmonalds, may i take your order?');
};
if (message.content === 'e(hamburger') {
message.channel.send('would you like a napkin?');
};
if (message.content === 'e(large', 'e(medium', 'e(small') {
message.channel.send('ok bye enjoy');
};
});
client.login('<the token I don't wanna share>');

Inventory command Doesn't work [ Currency System ]

I had followed the tutorial and made currency system, but only the inventory command doesn't worked for me, here's the log:
(node:15524) UnhandledPromiseRejectionWarning: Error: Include unexpected. Element has to be either a Model, an Association or an object. at Function._conformInclude ({{path}}\node_modules\sequelize\lib\model.js:390:11) at options.include.options.include.map.include ({{path}}\node_modules\sequelize\lib\model.js:326:59) at Array.map (<anonymous>) at Function._conformOptions ({{path}}\node_modules\sequelize\lib\model.js:326:39) at Function._baseMerge ({{path}}\node_modules\sequelize\lib\model.js:792:10) at Function._defaultsOptions ({{path}}\node_modules\sequelize\lib\model.js:823:31) at Function._injectScope ({{path}}\node_modules\sequelize\lib\model.js:3104:10) at Promise.try ({{path}}\node_modules\sequelize\lib\model.js:1697:12) at tryCatcher ({{path}}\node_modules\bluebird\js\release\util.js:16:23) at Function.Promise.attempt.Promise.try ({{path}}\node_modules\bluebird\js\release\method.js:39:29) at Function.findAll ({{path}}\node_modules\sequelize\lib\model.js:1696:23) at model.Users.getItems ({{path}}\dbObjects.js:31:19) at Client.client.on ({{path}}\app.js:51:28) (node:15524) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:15524) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I've replace actual path with {{path}}

Thanks in advance!

Discord Bot API Incorporation

I'm interested in working on a bot that, for the time being, can read data from a Google Sheets document and also send a message on a specific date every year. The latter will involve sending different messages on different dates.

I was referenced to these APIs to use, but I'm not sure how to incorporate them to the bot code:
https://www.npmjs.com/package/node-schedule
https://www.npmjs.com/package/google-drive-sheets

I'm less concerned about code elegance and more on actually getting it to work.

More specified help command

Hello, in your Command Handler: Additional Features page, you only specified how to list all commands, but can you also explain how to list a category of commands, like utility commands only or fun commands only etc.

Global cooldowns for commands

I'd like to see an alternative for cooldowns to have them be global instead of per user.

Or ideally both, with a way to flag individual commands to be global instead of per user?

Multiples folders for Command Handler

I currently have about 80 commands, so 80 js files in my commands folder, I wonder if there's a way for fs to loop through each folder in the command folder to have categories like "Moderation", "Fun" etc... so it's less a mess in there.

Any ideas ?

Can not run it

if i run

yarn serve

i get this error:

Error: custom keyword definition is invalid: data/errors should be boolean
at Ajv.addKeyword (E:\Desktop\Documentation\guide\node_modules\webpack\node_modules\ajv\lib\keyword.js:65:13)
at module.exports (E:\Desktop\Documentation\guide\node_modules\ajv-errors\index.js:10:7)
at Object. (E:\Desktop\Documentation\guide\node_modules\webpack\node_modules\schema-utils\src\validateOptions.js:22:1)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue With SQLite

I get this error:

(node:1848) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SequelizeDatabaseError: SQLITE_ERROR: no such table: users

Here is what else I get:

sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators ..\..\..\node_modules\sequelize\lib\sequelize.js:242:13
(node:1848) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Sequelize.STRING is now deprecated

sequelize deprecated 
String based operators are now deprecated. Please use Symbol based 
operators for better security, read more at 
http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13

error "no such table: users" when using the currency system (SEQUELIZE)

So I used the example you put in the currency system using sequelize and sqlite3 and this error gets thrown and I'm not sure how to fix it. (Just as a sort piece of mind I put a bit of code in that ensures that it's connected to the sqlite database so that's why it says connection established).

This is the error that gets thrown:
https://i.imgur.com/A6PAGf7.png

And here is the code in the index.js file (The part of the code that pertains to the currency system. The rest of the other files are untouched):

https://pastebin.com/055UEXT1

Thank you! Forgive me if this is just some stupid simple mistake I'm making. I'm kinda just experimenting with this bot stuff and don't have such extensive knowledge in it.

Problem with the random cat and urban dictionary api code you put.

So, I tried one of your tutorial code files so I could implement a feature from here into my bot. The one I tried is located at: guide/code-samples/additional-info/rest-api/index.js. When i tried to execute the code it worked. But when I executed the command it gave me an error: (I renamed the index.js to test.js)
https://i.imgur.com/CMAOqvY.png
https://i.imgur.com/jHaXNGh.png

I tried editing it heavily and body.result_list and body.list were included in the error messages that i got from them:
https://i.imgur.com/nBSDTKm.png
https://i.imgur.com/yuorJyb.png

Webhooks and automatic social media posting/captcha

Hello! I don't believe this section has been suggested (probably because its really easy and I just don't know what I am doing just yet), but one of the things I wanted to do with the discord bot I am coding is have it automatically send a youtube video that I've uploaded to a channel in discord, and the same could be for reddit, twitter etc...but I just don't understand how that would be done. I know it has something to do with RSS feed because after looking around in google, it was kinda hard to pinpoint some kind of template or something to understand what was going on (just joined the server and saw the webhook tutorials there, though I hope that isn't the only way to do something like this). Now Captchas is another thing, to keep a more secure discord server from bot raids, I think that would be a great addition to the guide...Something like, a storage of images put together according to a randomized password.

If a user logs into a game prior to opening Discord, their member.presence.game.name will always return null

If I open a game such as Hearthstone prior to opening Discord, then open Discord, my game status will show as 'playing Hearthstone'.

However if I try to grab this status with member.presence.game (or member.presence.game.name), it will return null (Because I logged into Discord with the game open).

Now, if I were to log into Discord with no game open, then open the game afterward, the status will return an object.

In both instances my status would show "Playing Hearthstone" in Discord, however only one instance returns an object from the API.

This may be a bug, or it may be intentional. I figured I'd bring it to your attention.

return process.dlopen different node js versions crash at startup

Hi i've got an issue with canvas on a bot and i don't know why so if someone can help me it will be very nice thanks :

pi@raspberrypi:~/BOTS/discord-bot-Fiskou-MiMillie $ node bot.js
internal/modules/cjs/loader.js:730
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: The module '/home/pi/BOTS/discord-bot-Fiskou-MiMillie/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/home/pi/BOTS/discord-bot-Fiskou-MiMillie/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)

node.js version v10.15.3
npm version 6.4.1
OS raspbian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.