#development

1 messages · Page 611 of 1

solemn kayak
#

thank you

grizzled spruce
#

Herm

earnest phoenix
#

i advertise my bot

#

what.. Promoting?

unique nimbus
#

You are not allowed to advertise your bot

grizzled spruce
#

Really? I thought the rule was no server invites? Lemmecheck

slender thistle
#

Rule 4 says 'no self-promotion'

grizzled spruce
#

WELL THEN

#

My bad

floral bloom
#

I created a bot, added it to my server, and I have the code setup like my other bot that is perfectly fine.
It isn't online in my server though. Why? The token is correct.

Ping me with response please

earnest phoenix
#

No idea

#

Sry

floral bloom
#

😦

mossy vine
#

@floral bloom any errors in the console?

#

Make sure you copied the bot token, and not the client secret

floral bloom
#

@mossy vine I copied the token, even regenerated it multiple times.
As for errors... let me reload and check.

#

(node:6140) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
at timeout.client.setTimeout(/rbd/pnpm-volume/8a466edf-34ca-4883-82c6-36d85ce7283d/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/ClientManager.js:40:57)

lament meteor
#

try to do client.login('token').catch(e => console.error(e))

floral bloom
#

@lament meteor Well, I made a new program...... it works now. Maybe it was a bug on the programs side...

earnest phoenix
#

Error on the module

#

Maybe

pallid zinc
#
const YouTubeWatch = require('youtube-watch')
const client = new Discord.Client()

const yw = new YouTubeWatch({
    secretKey: 
    hubCallback: 'http://your-ip-or-domain/',
    hubPort: 9001,
});
 
yw.on('start', () => {
    let channels = ['https://www.youtube.com/user/ROCKSTARvvk',
                    'UCGY2w6hIZWwyxasBUN7wbaQ'];
 
    yw.watch(channels);
});
 
yw.on('notified', video => {
    console.log(`${video.author} just uploaded a new video titled: ${video.title}`);
  client.channel.get(547065494507749396).send(`${video.author} Just uploaded a video ${video.title}`)
});
#

Is it ok?

sturdy flame
#

missing the private auth tokens uwu

lament meteor
#

fyi when i tested youtube-watch it didn't work for me

#

soo...

#

idk

pallid zinc
#

Hmm

#

For checking this I need to upload a video?

earnest phoenix
#

Why in a message that a bot sends, its puts rhombuses with a question mark instead of a letter with an accent:/

drowsy lily
#

Discord does not support baguette language

quartz kindle
#

no? áéúíóôêâàè?

opaque eagle
#

Your device might not support some Unicode characters

#

I’d check if a) you can send those characters somewhere else like notepad and b) if there are issues on either Chromium or Electron’s github repo about this

quartz kindle
#

or whatever library he's using does not support unicode strings?

#

or his code editor is not in unicode mode

ruby dust
#
CREATE TABLE IF NOT EXISTS RandomQuotes (QuoteID INTEGER PRIMARY KEY, Author INTEGER, Category TEXT, Quote TEXT, Approved INTEGER)
#
sqlite3.OperationalError: table RandomQuotes has no column named Author
#

this messes with my head

#

ok nvm, apparently there's a column that's called AuthorID, which is weird because I never ran the program when it was like that thonkku

earnest phoenix
amber fractal
#

You're requiring something you dont have

#

Or you're going to the wrong path

earnest phoenix
#

what will i do?

#

shoıld*

lament meteor
#

does the file exist?

earnest phoenix
#

i have quick.db

#

but im not sure it exists

quartz kindle
#

rebuild it

earnest phoenix
#

If a person makes an order, how do I make the bot change nickname in the server once the command is made?

#

I do not know if it works:

message.delete();
          message.guild.members.map(async (member, id) =>{
            member.setNickname("NICKNAME");```
stable elk
#

change whos nickname?

mossy vine
#

are you trying to change all member nicknames?

earnest phoenix
#

Ah I got it wrong, I just want to change the nickname of the BOT

stable elk
#

message.guild.me.setNickname(nick)

earnest phoenix
#

thx

unique nimbus
#

vps

hushed berry
#

dont turn it off

earnest phoenix
#

But

hushed berry
#

lmao

earnest phoenix
#

When I make the command set prefix, it changes the prefix but here is the error in the console:

(node:8302) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
    at item.request.gen.end (/storage/emulated/0/Bot Discord/bot/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)
    at then (/storage/emulated/0/Bot Discord/bot/node_modules/snekfetch/src/index.js:215:21)
    at processTicksAndRejections (internal/process/task_queues.js:86:5```
hushed berry
#

have you tried reading the error 👀

earnest phoenix
#

Yes but it has all the permissions

#

I don't understand too much

hushed berry
#

what are you trying to do after setting the prefix

#

send a message or smth?

earnest phoenix
#

Change the nickname of the BOT

heavy spade
#

What’s your prefix command

earnest phoenix
#

t/

heavy spade
#

The code?

earnest phoenix
#

You want me to give it here?

heavy spade
#

Sure

earnest phoenix
#
const Discord = require("discord.js");
const fs = require("fs");

exports.run = async (bot, message, args) => {

  if(!message.member.hasPermission("MANAGE_SERVER")) return message.channel.send("Vous ne pouvez pas effectuer cette commande car vous n'avez pas la permission de gérer le serveur.");
  if(!args[0] || args[0 == "help"]) return message.reply("Utilisation : t/setprefix <Prefix voulu>");

  let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"));
  let newprefix = args.join(" ")

  prefixes[message.guild.id] = {
    prefixes: args[0]
  };

  fs.writeFile("./prefixes.json", JSON.stringify(prefixes), (err) => {
    if (err) console.log(err)
  });

  let sEmbed = new Discord.RichEmbed()
  .setColor("RANDOM")
  .setTitle("Prefix changé avec succès")
  .setDescription(`Nouveau prefix : ${args[0]}`);

  message.channel.send(sEmbed);
  message.guild.me.setNickname(`[args.join(" ")] TheKıng`);
}

exports.help = {
  name: "setprefix"
}```
hushed berry
#

does the send the message

heavy spade
#

You can make the prefix a const

earnest phoenix
#

@heavy spadeI have a handler

#

I'll try something wait

heavy spade
#

Awwwww

earnest phoenix
#

@earnest phoenix t'as une erreur ?

#

I put args join, I'll try args

#

oe @earnest phoenix

hushed berry
#

Does it work if you give the bot admin

earnest phoenix
#

Le bot à juste pas les perms

#

À ce que je voix des erreurs

heavy spade
#

Um

#

I can’t speak French

earnest phoenix
#

@earnest phoenix j'ai lui est mis les perms admin pourtant

#

Yes, me, i don't speak good english

#

🤔

heavy spade
#

😔

earnest phoenix
#

I've solved the problem. I had put args. join while the args I had already defined by args [0]. All right. Thank you all.

#

👌

glass spruce
#

on parle français ici ? :p

earnest phoenix
#

ouep @glass spruce

#

Certains ouaip

#

j'ai une question

#

C'est triste, ils prennent plus de temps qu'avant pour vérif les bots

#

Pourquoi quand le bot répond à un message, à la place des accents il met un losange qui a un point d'interrogation à l'intérieur ?

glass spruce
#

encoding

earnest phoenix
#

Je règle sa comment ?

#

Je suis en UTF-8

#

Oof

glass spruce
#

je sais pas ce que tu utilises, je viens d'arriver ici mdr

earnest phoenix
#

ah ok x')

#

Passe en Passe en UTF-GENERAL-CI

#

P'tet ça marchera

#

ok je look sa

glass spruce
#

des fois il semble que les français se souvient pas les mots et ils utilisent les mots anglaises (je look ça)

earnest phoenix
#

X)

#

@earnest phoenix Merci ça a fonctionné

#

He finds an error but I don't know which

  .setDescription(`Nouveau prefix : ${args[0]} || Je me suis rename en `[${args[0]}] TheKıng` pour vous aider si un jour vous avez oublié mon prefix.`);```
glass spruce
#

peux-tu utiliser ` en place de ' ou " ? quelle langue est ça ?

earnest phoenix
#

En js mais j'ai mis ` car il y a [{$args[0]}]

#

sinon sa affiche pas correctement et sa affiche pas le args

#

soucis réglé enft xD

glass spruce
#

mais c'est pas .setDescription('Nouveau prefix : blah blah `[blah blah]` blah ');

#

'' pour le paramètre de setDescription, et les ` pour le message

late hill
#

If you're trying to put that bit as an inline code block

#

Just escape the ` characters

#

using a \

glass spruce
#

with backslash?

#

yea didn't work lol

lost swallow
#
\` \`
glass spruce
#

``` test

#

see

late hill
#

In the code it'll work

glass spruce
#

in the block yea, not in the inline code block

#

you can't escape it there apparently

late hill
#

gamer

glass spruce
#

wait ah you're talking about the javascript code

lost swallow
#

can someone help me with something ive never seen in any other bot and im having difficulties trying to add it

glass spruce
#

sorry sorry

late hill
#

yes

glass spruce
#

but i'm not sure if you can use ` in javascript at all rather than '

quartz kindle
#

you can

glass spruce
#

fair enough

quartz kindle
#

` are template literals, not string literals, but they work the same way

late hill
#

Genesis what something 👀

lost swallow
#

ok im doing a module loader, mainly to bind guidebot's stuff like functions and Logger to the client so its exportable on any command or anything else. basically i accomplished it, works just fine with guidebot's Logger module. but with functions.js not so much

#

i always get a client.modules["functions"].loadCommand is not a function

#
// module loader
// Loading modules
    const mdlFiles = await readdir("./modules/");
    client.modules = {};
    const mdlOpsStarted = process.hrtime();
    console.log(`[Client] : Loading ${mdlFiles.length} modules...`);
    mdlFiles.forEach(mdl => {
        const mdlName = mdl.split(".")[0];
        console.log(`[Client] : Loading module: ${mdlName}`);
        const mod = require (`./modules/${mdl}`);
        client.modules[mdlName] = mod;
    });
    let mdlOpsEnded = process.hrtime(mdlOpsStarted);
    console.log(`[Client] : Loaded ${mdlFiles.length} modules in ${mdlOpsEnded}ms`);```
#
//where im trying to use functions.js
const res = client.modules["functions"].loadCommand(command);
        if (res) console.log(command);```
#

error

quartz kindle
#

you have an error inside an async function

#

if you're using .then() add a .catch() to it, if you're using async await, put it inside try/catch blocks

lost swallow
#

i asked in the idiotsguide server, got kicked because evie refuses to help and i said now i know why i dont use this server for questions

#

asked in d.js, got bullied by every js script kiddo

#

im not using .then()

#

the full command loader is

#
// Loading commands
    const cmdFiles = await readdir("./commands/");
    let cmdOpsStarted = process.hrtime();
    console.log(`[Client] : Loading ${cmdFiles.length} commands...`);
    cmdFiles.forEach(command => {
        if (!command.endsWith(".js")) return;
        const res = client.modules["functions"].loadCommand(command);
        if (res) console.log(command);
    });
    let cmdOpsEnded = process.hrtime(cmdOpsStarted);
    console.log(`[Client] : Loaded ${cmdFiles.length} commands in ${cmdOpsEnded}ms`);```
quartz kindle
#

post the contents of functions.js module

lost swallow
#

let me put in a pastebin

#

want logger.js to compare the structure of both?

#

oh wait nvm, you can check guidebot's repo since the only thing im using from it are those 2 unedited modules

quartz kindle
#

also, try putting the require(module) inside try/catch blocks

lost swallow
#

ok let me try

#

im not that familiar with try/catch

earnest phoenix
#

try catch clauses are very basic and fundamental

quartz kindle
#
try {
    const mod = require(...)
} catch(e) {
    console.log(e)
}```
earnest phoenix
#

if you don't know how to use them, take a step back and learn what you're missing out on

lost swallow
#

i added the catch/try and ran the bot again still same error

spring ember
#

why are you always on development only to tell beginners to go learn something

earnest phoenix
#

"i don't know how to X"
"to do X you need to know how to do Y first"
"oh"
for a comparison it's like trying to learn how to use the pythagorean theorem without knowing what a triangle is

lost swallow
#

if anyone has vsc and vslive-share and is willing to help let me know

#

i just want to fix this

quartz kindle
#

you can try basic debugging, like console.log(client.modules,client.modules["functions"])

lost swallow
quartz kindle
#

so you can actually see whats going on

lost swallow
#

is it because Logger.js uses switch cases?

#

maybe i should adapt functions.js to be the same?

#

since also every function inside functions.js has client.functionName

quartz kindle
#

looks like your functions.js is outputting an empty object

#

you still didnt post the contents of functions.js

lost swallow
#

top is functions, bottom is Logger

quartz kindle
#

quick google search: ```bar.js

exports = { "a": 1 }
foo.js

var bar = require("./bar")
console.log(bar)
then

node foo.js
will log an empty object, {}

In CJS the module wrapper passing in module.exports as exports.
So reassigning exports =... severs the association with module.exports.```

#

replace exports with module.exports

lost swallow
#

no more empty objects BUT still doesnt work

#

instead of {} like before, i get [Function]

quartz kindle
#

modules[mdlName] = mod()

lost swallow
#

ok that kind of fixed it

#

cannot set property permLevel of undefined

quartz kindle
#

remove client from the function, and replace all client. by this.

lost swallow
#

ok

#

its almost working thats good progress

#

now in the file i just need to use the client module importer for a couple of things that need the Logger module

#

ok i removed the all the client from the functions.js, replaced the module's handler logger with a simple console.log and now it says mod() isnt a function

#

but if i remove it i get the error i had when i first asked my question

#

im probably just gonna re-write functions.js

earnest phoenix
#

How do I make a picture appear in a channel send message?

lost swallow
#

message.channel.send("image link") or an embed with .setImage()

earnest phoenix
#

And the image comes out in an embed but the worries is that I do not want the link this see

lost swallow
#

well in an embed it wont show the link

earnest phoenix
#

Yes, but the embed does not mention a user, and I want his for the welcome command

lost swallow
#

well then its not possible because sending images in messages will show the links

inner jewel
#

you can upload it as an attachment

lost swallow
#

oh true

inner jewel
#

or send it in an embed + regular message content

earnest phoenix
#

@inner jewelI want to Yes

lost swallow
#

oh yes also works

earnest phoenix
#

Attaches a file, but how do we do xD?

lost swallow
#

a message with the mention and embed with the image

#

but why are you going to be annoying and mention the user when he joins

#

like, there's already mee6 for that

inner jewel
earnest phoenix
#

Its not going to be automatic

quartz kindle
#

@lost swallow to initialize it that way, you need to use new mod()

earnest phoenix
#

@inner jewel Yes like her, I do how?

inner jewel
#

depends on your library

lost swallow
#

mod is not a constructor tim

#

:/

earnest phoenix
#

Javascript @inner jewel

lost swallow
#

this is getting on my nerves its only this one file that screws the execution

mossy vine
#

javascript is not a library

lost swallow
#

d.js is

inner jewel
#
  1. no need to ping on every message
  2. js isn't a library
earnest phoenix
#

discord js

quartz kindle
#

then rewrite it into something simpler, like an object of functions

lost swallow
#

im gonna do like logger

#

kind of

earnest phoenix
#

Discord js Natan

inner jewel
earnest phoenix
#

thx

lost swallow
#

natan, that .build() is something that you coded yourself or already a function/property of d.js/js?

inner jewel
#

that's not d.js

#

it's not even js

lost swallow
#

oh

#

mb

idle basalt
#

lul

quartz kindle
#

@lost swallow module.exports = function() instead of () =>

lost swallow
#

mod is not a function omg

#

ill just rewrite it with fricken switch cases ig and see if that works

idle basalt
#

this is straight from guidebot and that thing works

#

how are you having problems

lost swallow
#

what is straight from guidebot

#

are you blind

#

guidebot doesnt have a module handler

idle basalt
#

oh i read up a bit more

#

i see

lost swallow
#

basically loads modules

#

binds them to client

#

and voila

#

works with guidebot's Logger

#

but not functions.js

quartz kindle
#

this is one way to do it

idle basalt
#

they should already be bound because theyre named client.someFunctionName

lost swallow
#

yes but

#

you have to do require("functions.js")(client)

#

so im having a rough time trying to load it and use its functions with my module loader

#

i just want to do this so i dont have to require everything, which tbh, is kinda lame since it isnt that hard to do

#

its just finicky with the module.exports and all that

quartz kindle
#

this is another way to do it, much simpler

lost swallow
#

how is your module.exports?

#

i really do have to work harder on this to make it compatible with basically everything

quartz kindle
#

there's a gazilion ways to use module.exports

#
module.exports = function() {}

module.exports = { a() {} }

function a() {}
module.exports = { a }```
lost swallow
#

oh

#

damn

#
function permlevel (message)  {
      let permlvl = 0;
  
      const permOrder = this.config.permLevels.slice(0).sort((p, c) => p.level < c.level ? 1 : -1);
  
      while (permOrder.length) {
        const currentLevel = permOrder.shift();
        if (message.guild && currentLevel.guildOnly) continue;
        if (currentLevel.check(message)) {
          permlvl = currentLevel.level;
          break;
        }
      }
      return permlvl;
    };```
#

so like this, and at the end module.exports = { permlevel }; ?

quartz kindle
#

yes

#

you can do multiple functions like = { f1, f2, f3 }

lost swallow
#

so with one module.exports i could export all the functions instead of exporting them line by line

#

ill adapt the whole code and see if this works

quartz kindle
#

you can also only import the ones you need using let { permLevel } = require(functions.js)

lost swallow
#

thats the thing the module loader SHOULD import the modules and let me use them within the code by using the client.modules.x.x

earnest phoenix
#

Code:

const Discord = require("discord.js");
const fs = require("fs");
let mod = JSON.parse(fs.readFileSync("./mod.json", "utf8"));
let modd = [560511965177446407, 186895347409354752]

module.exports.run = async (bot, message, args) => {

    let user = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);

    if (message.content.startsWith("-addmod")) {
    if(message.author.id.modd) {
  if (!mod[user]) mod[user] = {
    id: user.id,
  };
//let userData = pre[message.author.id];
    message.channel.send(`${user} Was added as \`Globan\` mod!`);
  }
  fs.writeFile("./mod.json", JSON.stringify(mod), (err) => {
  
    message.channel.send(`Sorry but you are not owner of the bot!`);
});
}
}
#

Need help its says Sorry but you are not owner of the bot! but i am mark as owner

slim heart
#

Ok with nginx is there a way to use the basic authentication yeah but then store like some sort of token or SOMETHING the information of the user idk, but store it somewhere so I can authenticate requests from unlocked websites as well

earnest phoenix
#

I coded a system that when a member joins a server, he MP the Member by wishing him welcome. But the console tells me that Member is not defined:

bot.on('guildMemberAdd', guild => {
        var joinEmbed = new Discord.RichEmbed()
            .setColor('00FF00')
            .setDescription(`💼 • Bienvenue dans le serveur ${member.guild.name} - Respectez le règlement et le staff - Bonne continuation.`)  
            .setTimestamp()
        guild.member.send(joinEmbed).catch((err) => message.reply("Mon système n’est pas en mesure d’autoriser la demande car l'utilisateur venant de rejoindre le serveur n'a pas ouvert ses mp"))
    });```
lost swallow
#

if someone reports your bot for dm abuse it can get banned. you know that right?

#

why dont you like do something basic without mentions or dm's when the user joins

earnest phoenix
#

Why would he postpone me? It's OK, right?

lost swallow
#

wut

#

bruh speak proper english please

earnest phoenix
#

He's going to send him the welcome message once. Do we have the right to do that?

lost swallow
#

i mean you can. but people can report it for mass dm's

#

and for the purpose of mass pinging we have the lord mee6

flint trellis
#

@earnest phoenix guildMemberAdd passes through a member.

lost swallow
#

OwO fyko

earnest phoenix
#

How do I do it?

flint trellis
#
<client>.on('guildMemberAdd', (member) => {})
#

but do not do that part with dmming every member.

lost swallow
#

yea its not guild its member lol

earnest phoenix
#

Mass? @lost swallow, it's just a message. I don't see why someone complains about my bot to discord!

#

thx

lost swallow
#

lol there's always that group of whiny kids

#

that love to report stuff

flint trellis
#

It is against the rules in this server

earnest phoenix
#

Discord does not refuse to send a message privately to welcome privately. Discord will punish me?

flint trellis
#

so take your dm-ever-member-message bullshit elsewhere if you plan on doing it

#

just not in this server smyl

earnest phoenix
#

@flint trellis How do I do it so he doesn't just put it in this server?

flint trellis
#

HappyThonk database

lost swallow
#

dont mention people if they are active in the chat its annoying

mossy vine
#

why would you need a database for that

#

its literally 1 line

earnest phoenix
#

OWH

#

Which c but Longer ?

flint trellis
#

well you can filter

#

bots don't work in this channel HappyThonk

mossy vine
#

you can check if the guild id is dbls, and just return

flint trellis
#

what I do is check my settings to see if the guild has welcome_toggle turned on

#

it's all up to you

scarlet phoenix
#

Using a database would allow you to dynamically enable and disable it on any server

earnest phoenix
#
if guild.id = "ID" return;
#

?

mossy vine
#

something like that, yes

flint trellis
#
lost swallow
#

i also have a welcome toggle switch

earnest phoenix
#

So it's not totally its, though?

mossy vine
#

i just dont even have welcome messages because theyre annoying to users

#

ez

flint trellis
#

please learn javascript before you try to make a bot.

lost swallow
#

and learn proper english

flint trellis
#

*proper. how ironic

lost swallow
#

SORRY

#

at least people can understand me

quartz kindle
#

please make a bot before learning javascript

lost swallow
#

xD

quartz kindle
#

so i can see you suffer

#

@earnest phoenix thats not how you check for server owner, .id.modd doesnt exist, unless you're doing something weird

earnest phoenix
#

@quartz kindle no i want to define owner of bot id

lost swallow
#

uh

earnest phoenix
#

that bot owner is just allowe to use that command

lost swallow
#

add a ownerID line to your config file followed by your id?

quartz kindle
#

to check for bot owner, just get the owner user ID

#

and compare it

#

if(message.author.id === "YOURIDHERE")

lost swallow
#
if (x.ownerID === message.author.id) {}```
quartz kindle
#

why would you ever need to make ownerID a customizable value?

#

are you gonna sell your bot? lmao

earnest phoenix
#

nah 😄

#

i need to define 2 owners

quartz kindle
#

then put them into an array and use .includes or .indexOf

earnest phoenix
#

k

quartz kindle
#

if(["OWNERID1","OWNERID2"].includes(message.author.id))

earnest phoenix
#

i add if(message.author.id === "560511965177446407") should i add else to include error?

lost swallow
#

oh wait

#

i did it wrong

#

didnt i

quartz kindle
#

yup

lost swallow
#

i tried

#

r/therewasanattempt

quartz kindle
#

and yes, you can add an else to define what happens if the ID is not an owner

earnest phoenix
#

k thx

#

urgh

if guild.id = "264445053596991498" return;
       

SyntaxError: Unexpected identifier guild.id ```
lost swallow
#

kids these days smh

quartz kindle
#

thats not how you use if in javascript

lost swallow
#

youre also missing ()

earnest phoenix
#

No, it is so that the bot does not MP in this server (welcome message)

quartz kindle
#

still, thats not how you use if in javascript

lost swallow
#

both things i said are correct for what you wanna do

quartz kindle
#

if you're using javascript, the correct way is if(condition) {action}

earnest phoenix
#

Well I put what instead!?

lost swallow
#

do us all a favor, and check something like guidebot

earnest phoenix
#

OK

lost swallow
#

and stop asking so many questions like

#

its actually dumb when someone with barely any js knowledge just asks for help

earnest phoenix
#

Code:

    if (message.content.startsWith("-addmod")) {
    if(["560511965177446407","186895347409354752"].includes(message.author.id))
  if (!mod[user]) mod[user] = {
    id: user.id,
  };
//let userData = pre[message.author.id];
    message.channel.send(`${user} Was added as \`Globan\` mod!`);
  }
  fs.writeFile("./mod.json", JSON.stringify(mod), (err) => {
  } else {
    message.channel.send(`Sorry but you are not owner of the bot!`);
});
}

Error:

} else {
  ^

SyntaxError: missing ) after argument list
#

His:

bot.on('guildMemberAdd', member => {
    	
    if guild.id = "264445053596991498" return;
    ```
 ?
#

What do I replace?

lost swallow
#

just go check friccing guidebot oml

quartz kindle
#

guildMemberAdd doesnt give you a message

#

@lost swallow dont answer if you dont know the answer lmao

earnest phoenix
#

Integer coding ^^

bot.on('guildMemberAdd', member => {
    	
    if guild.id = "264445053596991498" return;
    
        var joinEmbed = new Discord.RichEmbed()
            .setColor('00FF00')
            .setDescription(`💼 • Bienvenue dans le serveur ${member.guild.name} - Respectez le règlement et le staff - Bonne continuation.`)  
            .setTimestamp()
        guild.member.send(joinEmbed).catch((err) => message.reply("Mon système n’est pas en mesure d’autoriser la demande car l'utilisateur venant de rejoindre le serveur n'a pas ouvert ses mp"))
    });```
lost swallow
quartz kindle
#

no, because guildMemberAdd doesnt give you a message

earnest phoenix
#

Why message?

#

@quartz kindle i add else and i go this

  } else {
  ^

SyntaxError: missing ) after argument list
lost swallow
earnest phoenix
#

what should i do?

#

Why message Guild ID?

lost swallow
earnest phoenix
#

Ok

quartz kindle
#

@earnest phoenix you forgot an opening {

earnest phoenix
#

where?

#

it:s good :

if member.guild.id = "264445053596991498" return;```
quartz kindle
#

at the end of your if(ids)

#

@earnest phoenix which part of if(condition){action} didnt you understand?

#

the brackets/parenthesis are important

earnest phoenix
#

ok wait

#

@quartz kindle i added and still desame error :/

quartz kindle
#

where did you add it? show code

earnest phoenix
#
module.exports.run = async (bot, message, args) => {

    let user = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);

    if (message.content.startsWith("-addmod")) {
    if(["560511965177446407","186895347409354752"].includes(message.author.id)){
  if (!mod[user]) mod[user] = {
    id: user.id,
  };
//let userData = pre[message.author.id];
    message.channel.send(`${user} Was added as \`Globan\` mod!`);
  }
  fs.writeFile("./mod.json", JSON.stringify(mod), (err) => {
  } else {
    message.channel.send(`Sorry but you are not owner of the bot!`);
});
}
#

if (member.guild.id = "264445053596991498") {return} ;

quartz kindle
#

@earnest phoenix == or === not =

earnest phoenix
#

thx

#

any clues?

quartz kindle
#

@earnest phoenix your code is very weird... lets see what happens if you at least format it correctly js if (message.content.startsWith("-addmod")) { if(["560511965177446407","186895347409354752"].includes(message.author.id)){ if (!mod[user]) mod[user] = { id: user.id, }; //let userData = pre[message.author.id]; message.channel.send(`${user} Was added as \`Globan\` mod!`); } fs.writeFile("./mod.json", JSON.stringify(mod), (err) => { } else { message.channel.send(`Sorry but you are not owner of the bot!`); });

#

you can already spot a few problems

earnest phoenix
#

hmm no i think

#

Does it work or not?

bot.on('guildMemberAdd', member, guild => {```
lost swallow
#

No it fricking doesnt

#

omg can you read the docs

earnest phoenix
#

i know some things are not define but i did define them

lost swallow
#

i could spoonfeed you but like, just learn js pls

earnest phoenix
#
const Discord = require("discord.js");
const fs = require("fs");
let mod = JSON.parse(fs.readFileSync("./mod.json", "utf8"));

module.exports.run = async (bot, message, args) => {

    let user = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);

    if (message.content.startsWith("-addmod")) {
    if(["560511965177446407","186895347409354752"].includes(message.author.id)){
  if (!mod[user]) mod[user] = {
    id: user.id,
  };
//let userData = pre[message.author.id];
    message.channel.send(`${user} Was added as \`Globan\` mod!`);
  }
  fs.writeFile("./mod.json", JSON.stringify(mod), (err) => {
      
  } else {

    message.channel.send(`Sorry but you are not owner of the bot!`);
});
}
#

But in the console it puts me "Guild" is not defined, it is you who told me to put Member in place of Guild @lost swallow

flint trellis
#

@earnest phoenix Go learn javascript.

#

Go read the Discord.js docs.

lost swallow
#

bruh go learn f'ing js

#

holy f

quartz kindle
#

for example: you need to use an if with {} if you're going to do something in multiple lines, so if (!mod[user]) mod[user] = { is wrong, you cant add a comma to the last value of an object, so id: user.id, is wrong. you dont have an opening parenthesis anywhere, so }); is wrong, your else is in the first if not the second one, so the message about you not being the owner only appears if the message does not start with -addmod @earnest phoenix

lost swallow
earnest phoenix
#

but when i add else the is 4 errors

flint trellis
#

json database shoo

earnest phoenix
#

In the doc I get lost so..

quartz kindle
#

json database is the least of anyone's problems here

#

lmao

earnest phoenix
#

i use json because i just add 6 mods and that all

quartz kindle
#

anyway, fix the problems i told you about

earnest phoenix
#

Any last help?

lost swallow
#

bruh just stop being such a help vampire

#

omg

earnest phoenix
#

here: it tells me "Member is not defined"

bot.on('guildMemberAdd', guild => {
   
    if (member.guild.id === "264445053596991498") {return} ;
    
        var joinEmbed = new Discord.RichEmbed()
            .setColor('00FF00')
            .setDescription(`💼 • Bienvenue dans le serveur ${member.guild.name} - Respectez le règlement et le staff - Bonne continuation.`)  
            .setTimestamp()
        guild.member.send(joinEmbed).catch((err) => message.reply("Mon système n’est pas en mesure d’autoriser la demande car l'utilisateur venant de rejoindre le serveur n'a pas ouvert ses mp"))
    });```

For the record, I just looked in the doc, but I got lost ^^
neat falcon
#

bruh momento

lost swallow
#

omg are you a retard

flint trellis
earnest phoenix
#

I just want this info!!

lost swallow
#
bot.on("guildMemberAdd", member => {``` 
not guild
unique nimbus
#

Vinx I told you yestrday to read the docs

#

We won't babyfeed you

earnest phoenix
#

But when I put Guild it tell me, Guild is not defined

unique nimbus
#

I literally googled your answer and I don't even do js

loud salmon
#

@lost swallow hey, no need to call people retarded

unique nimbus
#

THEN READ DOCS

lost swallow
#

OMFG GO READ THE DAMN DOCS

#

please

loud salmon
quartz kindle
#

lmfao

loud salmon
#

good lord

flint trellis
#

I gave you an example earlier and you still mange to be ignorant enough to ignore that, ignore what other people say, and repeat.

loud salmon
#

if someone is a help vampire then tell them nicely dont shit on them just because of their ignorance

unique nimbus
#

Vinx, we all start from somewhere
Documents are here for a reason
They are not a scary monster they just want to help

loud salmon
#

calling people retarded or telling them to learn js helps no one

earnest phoenix
#

STOP YELLING AT ME, I JUST TOLD YOU THAT I READ THE DOCUMENTATION AND THAT I GOT LOST. I WAS JUST ASKING IF SOMEONE COULD HELP ME A BIT BUT AS EVERYONE TOLD ME TO GO READ THE DOCS, THAT'S WHAT I DO BUT I GOT A LITTLE LOST!!!

neat falcon
#

learning js first is a brilliant idea however

flint trellis
#

a little lost

lost swallow
#

so we are gonna ignore the fact that he is a help vampire, and that is ignoring every f'ing suggestion?

#

nice

quartz kindle
#

jesus christ people, chill

unique nimbus
#

Chillax people

#

no fighting

lost swallow
#

lets keep spoonfeeding the baby so he grows up still needing to be spoonfed

unique nimbus
#

no

#

spoonfeeding

earnest phoenix
#

lol

earnest phoenix
#

smh

surreal peak
#

Cheers loves, the cavalry's here to ban

quartz kindle
#

@earnest phoenix guildMemberAdd gives you a member, so bot.on("guildMemberAdd", anything_you_write_here_is_a_member => { to see what a member does, check here https://discord.js.org/#/docs/main/stable/class/GuildMember

surreal peak
#

Don't bother, giving them a little timeout

neat falcon
#

good mod

quartz kindle
#

so to get the guild: whatever_you_wrote_up_there.guild

surreal peak
#

Also @lost swallow it's 24 hours, but if you keep being a dick, I'd be more than happy to smash you with a hammer.

loud salmon
earnest phoenix
#

@quartz kindle i think i did what you said but by this meaning i meant what i understand to do

const Discord = require("discord.js");
const fs = require("fs");
let mod = JSON.parse(fs.readFileSync("./mod.json", "utf8"));

module.exports.run = async (bot, message, args) => {

    let user = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);

    if(["560511965177446407","186895347409354752"].includes(message.author.id)){
    if (message.content.startsWith("-addmod")) {
  if (!mod[user]) mod[user] = {
    id: user.id
  }
//let userData = pre[message.author.id];
    message.channel.send(`${user} Was added as \`Globan\` mod!`);
  }
  fs.writeFile("./mod.json", JSON.stringify(mod), (err) => {
      
  } else {

    message.channel.send(`Sorry but you are not owner of the bot!`);
});
}
}

But now is just 3 errors by else

quartz kindle
#

you didnt do the multiline if thing

#

and all your problems can be easily seen if you indent your code correctly

flint trellis
#

ps: instead of doing message.guild.member()... you can do message.mentions.members.first() and keep that second option in the operator

earnest phoenix
#

i use 3 if and i mean i need it what can i use insterd if?

quartz kindle
#

and you reversed the order of the ifs, thats not what i told you to do lmao

#

why dont you start by indenting your code? do you know what indentation is?

earnest phoenix
#

yes

#

i know

quartz kindle
#

you can even get a website to do it for you, just copy and paste your code there

earnest phoenix
#

i got this

quartz kindle
earnest phoenix
#

tim thx its working i just need to fix this Cannot read property 'id' of undefined

quartz kindle
#

you should put the ifs back in the order you had before, startswith first, and owner check later

#

also, as Fyko said, instead of getting the user twice, you can get it only once

#

because mentions.users.first() is already a user, you dont need to member(...users.first())

earnest phoenix
#

k

quartz kindle
#

just change it to member if you want an actual member

#

mentions.members.first()

#

so just do user = ...members.first() || ....members.get(args)

earnest phoenix
#

k

#

@quartz kindle can you help me with last thing?

quartz kindle
#

what is it?

earnest phoenix
#

because all is working expt saveing to json file

#

    if(["560511965177446407","186895347409354752"].includes(message.author.id)){
    if (message.content.startsWith("-addmod")) {
  if (!mod[user]) mod[user] = {
    id: user.id
  }
//let userData = pre[message.author.id];
    message.channel.send(`${user} Was added as \`Globan\` mod!`);
  }
      
  } else {

    message.channel.send(`Sorry but you are not owner of the bot!`);
};
}
#

@quartz kindle sry for ping

fiery stream
#

Uhh oh

quartz kindle
#

did you remove the writeFile line?

#

also, your code is still a mess lmao

#

and you didnt fix the order, and you didnt fix the if(!mod[user])

earnest phoenix
#

@quartz kindle all works when i delete writeFile line

quartz kindle
#

because you're messing your code up lol

livid adder
#

How to create a bot

west spoke
earnest phoenix
#

Uh, I have a problem, when a person joins This server, my bot does not send a private message saying welcome, but when it does not send, it catch the error:

member.send(joinEmbed).catch((err) => console.log (`DM de bvn = bloqué`))

but here is the error:

(node:16521) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

So it puts nothing in the console. log but it puts the error just above.

amber fractal
#

If you dm welcome messages to people in this server, your bot will be kicked

earnest phoenix
#

No, there's this line:

if(member.guild.id === "264445053596991498") return;

the bet ID is that of this server.

late hill
#

Getting Missing Permissions after trying to send a DM to a user most likely means that your bot misses the permissions to be able to DM said user as in that user has DM's disabled, blocked your bot, ..?

grizzled spruce
#

Anyone?

modern sable
#

You don't need the webhook for the server count

grizzled spruce
#

@modern sable I have set up the part for the server count. How do I get it too show up on the bot page

modern sable
grizzled spruce
#

Ah found it thx

vagrant bison
#
(node:6324) UnhandledPromiseRejectionWarning: Error: Client network socket disconnected before secure TLS connection was established
    at TLSSocket.onConnectEnd (_tls_wrap.js:1084:19)
    at Object.onceWrapper (events.js:273:13)
    at TLSSocket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:6324) 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: 2)
(node:6324) [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.


>
#

help me

hybrid oasis
#

handle your promises

rancid quartz
#

I've got a really dumb question - I'm unable to test this at the moment so I can always do it later but figured it couldn't hurt to ask here.
Does it look like this code would successfully have a bot send a DM to a user that joins a server?


    bot.sendMessage({
        to: userID,
        message: 'Welcome!'
            })

})```
vagrant bison
#

what? xD

hybrid oasis
#

it tells you right there, handle your promises

spring ember
#

@rancid quartz you forgot to await

river trellis
#

!help

buoyant wagon
#

-_-

#

¯_(ツ)_/¯

west raptor
#

@rancid quartz what library are you using

idle basalt
#

looks like eris

buoyant wagon
#

whoop

idle basalt
#

exactly

#

which is why his lib is eris

earnest phoenix
#
bot.on('guildMemberadd', function (member){
    member.send("Welcome!")
})```
#

@buoyant wagon how you do that coours?

idle basalt
#

```js
// code
```

buoyant wagon
#

ok i think its aris

#

eris

rancid quartz
#

@spring ember Sorry I’m really new, what is “await”?

frozen inlet
#

so how does one add a bot to DiscordBot?

earnest phoenix
#

How?

idle basalt
#

i just told you how

#

```js
// code
```
becomes

// code
spring ember
idle basalt
#

why does he need await there?

buoyant wagon
#

not there

rancid quartz
#

Check in out.

spring ember
#

@idle basalt bot.sendMessage

#

Is a promise

idle basalt
#

.. and?

frozen inlet
#

so if I wanted to get my bot on Discord Bot List how would I go about it?

idle basalt
#

check the faq

buoyant wagon
earnest phoenix
idle basalt
#

the promise resolves to something, the message will be sent without resolving it

rancid quartz
#

@west raptor not sure- I’m using JS and it looks like it belongs to one of two libraries but I don’t know how to tell.

idle basalt
#

you dont need to put await everywhere just becasue its a promise

#

@rancid quartz what?

rancid quartz
#

He asked me what library I’m using.

idle basalt
#

its eris

rancid quartz
#

Sorry just super new.

spring ember
#

@rancid quartz it seems like you added to the function parameters that weren't there

idle basalt
#

how can you not know which lib youre using

#

yea your params are way out of whack

#

why do you have 5 params for something that takes 2 params thonk

spring ember
#

The event guildMemberAdd has one parameter which is the member

rancid quartz
#

Gotcha

#

Oh

idle basalt
#

guildMemberAdd takes guild and member

rancid quartz
#

Kk I’m on mobile lemme try fix in a minute.

rancid quartz
#

And yeah I just straight up don’t know what a library is sorry.

idle basalt
#

its basically a fancy wrapper

#

it "wraps" the api endpoints so you can call simple methods instead of dealing with pesky http requests

frozen inlet
#

completely different question: If I wanted to keep my bot online 24/7, how would I do THAT?

idle basalt
#

host it

#

on a vps

frozen inlet
#

vps?

idle basalt
#

virtual private server

frozen inlet
#

Sorry I'm really new

#

ok cool

idle basalt
#

its basically a server that runs 24/7 in the cloud

#

there are a lot of companies that offer the service

#

just google vps and youll find a ton

frozen inlet
#

thanks man

idle basalt
#

most people use cheaper and lower-powered servers because discord bots arent exactly massive applications

frozen inlet
#

do you know of any in particular you'd reccomend?

rancid quartz
#

@spring ember Does this look better?


    bot.sendMessage({
        to: member,
        message: 'Welcome!'
            })

})```
amber fractal
#

bro

#

sendMessage has been deprecated

#

for like

#

ever

#

have you read the docs?

scarlet phoenix
#

@frozen inlet OVH is super cheap but their support is meh at best
Skysilk is good and even has a discord support server, but does not support docker if you use that.
Scaleway is good if you want to host in Europe

frozen inlet
#

k thanks

#

I'll take a look at them

rancid quartz
#

@amber fractal Oh I didn't know that. If it's deprecated where can I check to see commands that can replace it?

idle basalt
#

wait hes using d.js

amber fractal
#

the docs

idle basalt
#

i thought that syntax was an eris thing

#

my bad, sorry

rancid quartz
#

@amber fractal Do I just search for other commands that send a DM? What I've searched up so far keeps bringing me back to sendMessage.

amber fractal
#

I sent the link tho

#

?

rancid quartz
#

I could just be missing something obvious.

amber fractal
#

I believe so

#

Ill repost it

rancid quartz
#

No I just read it wrong.

#

For whatever reason I didn't think .send would work for DMs.

buoyant wagon
#
bot.on('guildMemberadd', function (member){
        member.send("Welcome!");
});
rancid quartz
#

Thanks! I'm gonna give this a shot later today.

bright spear
#

and yeah, use send, not sendMessage

#

sendMessage was removed in 12

rancid quartz
#

Yeah sorry I was confused by the deprecated meaning and didn't realize send was an equivalent.

earnest phoenix
#

uh

#

you're mixing eris with d.js

#

lmfao

fiery stream
#

Okay...

forest needle
fiery stream
#

I never seen that error but i think u are forwarding two things to same ip

forest needle
#

What do you mean?

#

It's giving an ERROR: CONNECT ETIMEDOUT.
I don't recognize the ip, but I assume it was chosen by Discord.js

#

I haven't changed any code, this was working a couple hours ago, then my router got changed to a different account and it suddenly gives me this.

fiery stream
#

I meant same port

#

#brain-fart

#

@forest needle got it?

forest needle
#

No

fiery stream
#

So something else is already bing forwarded to 443

#

Being*

forest needle
#

It's not my ip if that's what you're thinking

fiery stream
#

Umm

#

Nope i dont think u get what i am sayin

#

Do u mind if i can see the code

forest needle
#

What part?

fiery stream
#

Probably main.js

forest needle
#

It gives the error right after the console log

#

that's the bottom of the code too

fiery stream
#

Are u using app.listen somewhere

forest needle
#

no

fiery stream
#

Send that

forest needle
#

What?

#

send what?

fiery stream
#

Nvm

west spoke
#

The code

fiery stream
#

I think u are pretty new to coding cuz u should code discord bot in one file

#

Shouldn’t

#

I always have alot of typos cuz i am typing without lokin

forest needle
#

This bot has worked 24/7 for two years straight and is only have this issue now.

P.S. there are several files, this is only the main one.

fiery stream
#

Why do u have 800 lines of code in one file

forest needle
#

Because I can

fiery stream
#

Okay...

forest needle
#

Most of the code is just objects of basic commands, not to mention I wrote most of it like 3 years ago.

fiery stream
#

Are u local hosting the bot?

forest needle
#

Yes

fiery stream
#

I think port 443 is usually taken by network service and u are reusing same port

forest needle
#

Nowhere in my code is port 443 referenced. That's all done within Discord.js' Discord.client.login() function

fiery stream
#

Whats discord defined as?

forest needle
fiery stream
#

I am getting confused now

forest needle
#

Is there something I can clear up?

#

It might be worth noting that I'm using Discord.js version 11.2.1 (it looks like the current build is 11.4.2 so I'm a couple years out dated)

#

Here's the code:

const Discord = require('discord.js');
const client = new Discord.Client();
 
client.on('ready', () => {
  console.log('I am ready!');
});
 
client.on('message', message => {
  if (message.content === 'ping') {
    message.reply('pong');
  }
});
 
client.login('your token');
fiery stream
#

That is a weird issue u are getting

forest needle
#

If it wasn't weird I wouldn't need help. ¯_(ツ)_/¯

fiery stream
#

Uep

#

I only get that issue when i make web apps or something

earnest phoenix
#

After adding the bot to discordbots.org, it doesn't react to messages anymore. The stack trace links to files in Discord.js lib and says that something took too long to do.

bright spear
#

probably discord api issue

#

or ip ban

earnest phoenix
#

What host? @earnest phoenix

#

Glitch

#

So your glitch IP is banned @earnest phoenix

#

Contact support and tell your IP is donw

#

Down

#

And they will move the project

#

Oh

earnest phoenix
#

Is there a way to prevent JSON corruption?

stable elk
#

whats the corruption?

slender thistle
#

Don't open your files constantly

earnest phoenix
#

will opening and writing to a JSON corrupt it?

#

@stable elk turning the entire file into nothing

stable elk
#

by doing what?

#

writing to it or just opening it?

spring ember
#

@earnest phoenix locking the file and making sure no two process ever read it at the same time

#

I don't recommend using json as a database

earnest phoenix
#

then what should i use?

#

i know there’s mongodb but i dont know how to use it on a hosting website

spring ember
#

NoSQL - Mongo, Rethink
SQL - MariaDB, PostgreSQL

#

on a hosting website?

earnest phoenix
#

glitch

spring ember
#

oh

#

you can't

earnest phoenix
#

then can i use sqlite?

stable elk
#

you can but it sucks

#

bc its locked

spring ember
#

sqlite is better than json

#

because it locks itself and doesn't corrupt

earnest phoenix
#

Can someone suggest a database that is familiar with JSON and is free?

soft eagle
#

mongoosedb ?

lost swallow
#

:0 i got my module loader to work

sinful lotus
#

sqlite is better than json

#

but it can cause you problems in future

ruby dust
#

database like json?

#

how does that even work

sinful lotus
#

fs.readFile

#

fs.writeFile

#

Json.stringify and json.parse

earnest phoenix
#

so, how should i connect to a mongodb database using mongoose in glitch?

sinful lotus
#

you cant

#

you need a real server

#

your only option is sqlite but that would cause you problems in future when your bot somehow scales

earnest phoenix
#

ok

earnest phoenix
#

Database on glitch wont work

sinful lotus
#

unless its a sqlite

lost swallow
#

databases work on glitch lol

#

i got multiple apps running on mongosql

#

oh nvm thats sql

#

ok so i finished the module loader and now it works perfectly but its a lil finicky. anyways, while starting the bot, it is saying that client is not defined in the ping command (only command i have on it rn).

// command handler
    // Loading commands
    const cmdFiles = await readdir("./commands/");
    let cmdOpsStarted = process.hrtime();
    console.log(`[Client] : Loading ${cmdFiles.length} commands...`);
    cmdFiles.forEach(command => {
        if (!command.endsWith(".js")) return;
        const res = client.modules["functions-rw"].loadCommand(command);
        if (res) console.log(command);
    });
    let cmdOpsEnded = process.hrtime(cmdOpsStarted);
    console.log(`[Client] : Loaded ${cmdFiles.length} commands in ${cmdOpsEnded}ms`);```

```js
// loadCommand from functions-rw
case "loadCommand":
            {
                try {
                    console.log(`[Client] : Loading command: ${commandName}...`);
                    const props = require(`../commands/${commandName}`);
                    if (props.init) {
                        props.init(client);
                    }
                    client.commands.set(props.help.name, props);
                    props.conf.aliases.forEach(alias => {
                        client.aliases.set(alias, props.help.name);
                    });
                    return false
                } catch (e) {
                    return console.log(`Unable to load command ${commandName}. Reason: ${e}`)
                }
            }```
#
[Client] : Loading 1 commands...
[Client] : Loading command: ping.js...
Unable to load command ping.js. Reason: ReferenceError: client is not defined
ping.js```
#

any ideas mention me

#

i wanna fix this issue

opaque eagle
#

You’re doing client.commands.set which isn’t possible since you haven’t defined client yet

#

If you can’t fix this issue, I’d suggest going the easy route which is to load client from your main file

lost swallow
#

how?

opaque eagle
lost swallow
#

but you dont get it tho

#

functions-rw is one file

#

the first codeblock is on my MAIN file, which has the client.commands collection

#

lol arrow functions are just => not =>>

#

and also im pretty sure events should be written in english? cus im sure that whatever is written in the first dbl.on wont work

earnest phoenix
#

low iq hours again

lost swallow
#

what are you talking about

earnest phoenix
#

messages got deleted

#

message*

peak quail
#

help

#

help

#

python files dont run

lost swallow
#

because he knows that he f'd up that code

#

and is ashamed of himself

peak quail
#

no

#

its a normal code in the documentation

#

a test code

earnest phoenix
#

?

peak quail
#

that the bot python file doesnt run

earnest phoenix
#

theyre not talking to you lol

peak quail
#

oh

#

:(

#

hey if nobodys going to help me

mossy vine
#

just wait until someone who knows python looks at your message

slender thistle
#

@peak quail What is your code

peak quail
#

sorry already fixed

#

i should haven used termux instead of qpython3

opaque eagle
#

Why do u need the second codeblock if you’ve got the first one @lost swallow

lost swallow
#

what

#

because the issue involves 2 files perhaps? or atleast it did involve 2 files i fixed it

opaque eagle
#

Gr8

pallid zinc
#

Is there any way to check youtube watch code without uploading video?

ruby dust
#

regarding sqlite, how would you use the vote system to give the entry an improved chance to be randomized? I'm not talking about getting the one with the most upvotes by ordering all entries properly, I need an actual "chance improver" or something among those lines

scarlet phoenix
#

Store a users total votes in the db, then when calculating the winners, take each users votes into account.

ruby dust
#

the thing is, I don't want to fetch a lot of entries and do all the calculations manually, as I thought that there's a more proper way to do that with sqlite commands alone

pallid zinc
#

I know trivia voting command

earnest phoenix
#

In this line:

.setDescription(`Bienvenue dans la commande `about`.\nCette commande vous donne quelques informations sur moi :\n\n▶ Je suis codé sous le langage JS (Javascript).\n▶ J'ai été codé en partie sur téléphone.\n▶ Mon créateur est VinxVinx (Youtubeur de 1.6k abonnés).\n\n▶ Vous avez à disposition des commandes d\'administration, de modération, d\'amusement, de random et de la configuration.\n▶ Mon créateur travaille un peu sur le système de musique.\n\n▶ Je fais partie de la liste des bots francophone.\n▶ Je suis sur le site de discordbots.org.\n▶ Lien discordbots.org : [Clique ici pour accéder à la page](https:\//discordbots.org/bot/550367400521105409)\n\n▶ Je remercie Blizzard de m'avoir fait apprendre le Javascript et avoir commencé me coder.`)

The console tells me missing one ) but I do not find
Who can help me?

ruby dust
#

you can't find it because it's missing, duh

#

can you show the error

earnest phoenix
#

Yes, but I see PS where it lacks

#

SyntaxError: missing ) after argument list at Module._compile (internal/modules/cjs/loader.js:760:23)

pallid zinc
#

I know this type of voting

ruby dust
#

are you addressing to me with this?

pallid zinc
#

Yup

#

You ask for voting I think

ruby dust
#

well I'm not really talking about this type of voting

pallid zinc
#

Hmm

#

I know

#

It's trivia voting

ruby dust
#

not trivia either

pallid zinc
#

I don't know about normal one

scarlet phoenix
#

SQL Selects are fast and if you do many frequently you could cache them in memory. Either way you do it you do have to persist something about the user regarding their voting status

ruby dust
#

basically I have a database file, in one table I have user submitted quotes, and in another table I store which user voted for which quote

earnest phoenix
#

So who can help me find the ) missing?

scarlet phoenix
#

You do that in one table?

ruby dust
#

not sure about that

scarlet phoenix
#

my bad

#

totally misread that

earnest phoenix
#

In this line:
.setDescription(`Bienvenue dans la commande `about`.\nCette commande vous donne quelques informations sur moi :\n\n▶ Je suis codé sous le langage JS (Javascript).\n▶ J'ai été codé en partie sur téléphone.\n▶ Mon créateur est VinxVinx (Youtubeur de 1.6k abonnés).\n\n▶ Vous avez à disposition des commandes d\'administration, de modération, d\'amusement, de random et de la configuration.\n▶ Mon créateur travaille un peu sur le système de musique.\n\n▶ Je fais partie de la liste des bots francophone.\n▶ Je suis sur le site de discordbots.org.\n▶ Lien discordbots.org : [Clique ici pour accéder à la page](https:\//discordbots.org/bot/550367400521105409)\n\n▶ Je remercie Blizzard de m'avoir fait apprendre le Javascript et avoir commencé me coder.`)

The console tells me missing one ) but I do not find
Who can help me?

scarlet phoenix
#

Do you have a db you use? Like Postgres or mysql, Im confused what you mean by file.

pallid zinc
#

Replace `` with ''

ruby dust
#

@earnest phoenix you started your string with ` and then ended it with the same character in the about word

pallid zinc
#

Yup

ruby dust
#

I use SQLite3

earnest phoenix
#

ok

#

thx

pallid zinc
#

I think bot starts from bienvenue and end at about

ruby dust
#

I don't even know js but even I found an error 🤦

pallid zinc
#

Lol

#

Any one know youtube-watch.js

#

?

scarlet phoenix
#

SQLite is probably even better in this case because it not remote, but running in memory with your program. IMO you would be fine querying all of the users you need with voting info. Especially if you do it asynchronously you shouldn't see performance degradation.

ruby dust
#

hm

#

I assume so, thanks for trying to help

scarlet phoenix
#

np

slim heart
#

Ok I just added this because I’m moving my authentication into a header instead, and it’s specifically this part that causes Error: spawn openssl ENOENT

require("pass").validate(pass, admins[user], function(err, res) {
        if(err || !res) return res.send("0")
        res.send("1");
    })```
earnest phoenix
#

Uh,

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'find' of undefined```
#

How do I define it?

amber fractal
#

Can't help really without code. That means that whatever comes before .find is undefined

earnest phoenix
#
const Discord = require ("discord.js")

module.exports.run = async (bot, message, args) => {
	
	let salon = message.guild.channel.find(`name`, "#🚧-vérification");
	
	if(!salon){
    try{
      salon = await message.guild.createChannel({
        type: "text",
        name: "#🚧-vérification",
      })
    }catch(e){
      console.log("Salon verif non créé")
    }
  }
      message.channel.send("Salon `#🚧-vérification` créé avec succès.")
}

module.exports.help = {
	name:"verifychanneladd"
}
amber fractal
#

It's just message.channel

earnest phoenix
#

ok

amber fractal
#

message.guild.channel doesn't mean anything

slender thistle
#

(It also makes no sense)

mossy vine
#

i suggest you read the docs and do proper indentation

amber fractal
#

Wait

#

You want to find the channel mb

earnest phoenix
#

And so the role is message.roles

mossy vine
#

what no

#

please

amber fractal
#

message.guild.channels

mossy vine
#
#

read the docs

earnest phoenix
#

I read the doc do not worry. I just wanted to make sure.

slender thistle
#

Don't know where it mentions Message.roles at this point Thonk

smoky spire
#

message.roles isn't a thing

grave pilot
#

How can I disable Error: 429 Too Many Requests that logging

slender thistle
#

Are you sending http requests manually

grave pilot
#

Nope

slender thistle
#

lib?

grave pilot
#

nodejs

mossy vine
#

thats

#

not a lib

grave pilot
#

Libary

#

Node

slender thistle
#

That's your programming language

mossy vine
#

no

grave pilot
#

I am using dbl libary

slender thistle
#

Doesn't dblapi.js handle ratelimits thonkku

quartz kindle
#

Inb4 hes creating a dbl task on message

slender thistle
#

while True:
dbl.post(...)

amber fractal
#

Yes

quartz kindle
#

Tht would probably make it crash before even sending anything

inner jewel
#

just throw it on a separate thread

#

ez

opaque eagle
#

Node is single threaded

earnest phoenix
#

Codage :

let role = message.guild.roles.find(role => role.name === '👤 | Membre') return message.channel.send("Rôle `👤 | Membre` inexistant.");

Worries :

Unexpected token return

#

Yet I looked at the doc and it's like his

harsh dagger
#

so um im having problem making the bot respond when pinging

#

me and the other owner cant make it

#

work

earnest phoenix
#

What are you throwing your bot at?

#

@harsh dagger

harsh dagger
#

discord.js

#

if thats what you mean

earnest phoenix
#

computer? phone?

harsh dagger
#

ohh

#

computer

earnest phoenix
#

Okay, with a server like PM2 or directly with node command prompt?

harsh dagger
#

node

earnest phoenix
#

Okay, you're launching it on Windows 10?

harsh dagger
#

no

#

macbook

#

its pretty fast ngl

earnest phoenix
#

Okay, you did the update of nodejs via the site or via the command npm i nodejs ?

harsh dagger
#

uhhh

#

i didnt do any of that

earnest phoenix
#

The command npm i nodejs allows a complete reinstall of nodejs (module)

harsh dagger
#

it doesnt need to reinstall

#

we just cant make the command work

earnest phoenix
#

Okay, reinstall the latest version of nodejs via their website and try to restart your bot after the update and if the problem persists, tell me.

harsh dagger
#

i got the latest version already

slender thistle
#

Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem.

harsh dagger
#

i explained my problem

late hill
#

VinxVinx you can't just put return after any statement

slender thistle
#

What is your code currently though, omer?

earnest phoenix
#

Explain your problem in detail Omer please

harsh dagger
#

node.js

#

wiat

#

wait

earnest phoenix
#

@late hill I do how then if I want the bot to say something if it does not find the rank?

late hill
#

if (!role)

earnest phoenix
#

thx

#

@harsh dagger Does your bot take time to respond to an order?

harsh dagger
#

no

#

its fast

earnest phoenix
#

What's the problem then?

harsh dagger
#

that the code is wrong and me and him cant make it work

#

the co owner of the bot is offline rn and has the code

earnest phoenix
#

I'll give it to you, you're in handler? @harsh dagger

harsh dagger
#

as i couldnt code it

#

wdym

earnest phoenix
#

wdym ?

harsh dagger
#

what do you mean by handler

#

though

slender thistle
#

Do I see spoonfeeding

earnest phoenix
#

Are your commands in or outside the index. js file?

harsh dagger
#

in

earnest phoenix
#

All right, wait.

harsh dagger
#

but

#

dont send the whole code

earnest phoenix
#

yes ?

harsh dagger
#

bc

#

thats spoonfeeding

#

i want to learn

slender thistle
#

The rare type of humans we can observe nowadays

earnest phoenix
#

All right Okay, did you put if (message.content.startsWith === prefix + "ping") => {

harsh dagger
#

No..

#

ill try to get the co owner of the bot online

#

brb

ruby dust
#

Vinx, can you actually help someone knowing their issue

late hill
#

I'm pretty sure he meant pinging as in @ bot

harsh dagger
#

yea

#

i meant

#

that

ruby dust
#

You have been misleading them the entire time

earnest phoenix
#

First, start with
bot.on('message', message => {

ruby dust
#

Oh boy...

harsh dagger
#

vinx

#

im talking about something else

#

as in

#

@static pumiceon help

#

istg

quartz kindle
#

vinx doesnt even know js lol

#

@harsh dagger can you post your code so we can see whats wrong with it?

harsh dagger
#

@earnest phoenix

#

here

grim aspen
#

why do you keep pinging random people

#

we're asking for the code that you used

ruby dust
#

They invited the bot owner, since they are a co owner

harsh dagger
#
Bot.on("message", async message => {
  if(message.isMentioned(Bot.users.get("561968604334260244"))){
    message.channel.send("Yes, what do you want?");
  }
})
#

last time we tested

#

it didnt work

slender thistle
#

Is that your bot's ID?

harsh dagger
#

yes

slender thistle
#

You could do Bot.user thonkku

harsh dagger
#

oh ok

#

lemme try

slender thistle
#

@quartz kindle Does isMentioned accept ClientUser?

amber fractal
#

Is that d.js?

harsh dagger
#

yes

grim aspen
#

yes

harsh dagger
#

its discord.js

#

wait shivaco

#

ill try with the bot.users

#

and see if it works

#

this time

ruby dust
#

It will return a list of users that it can see

harsh dagger
#

it works for the co owner of the bot but doesnt work for me

#

omg

#

its spamming rn

#

bc

#

of

#

my mistake

#

never ever doing that again

#

we clearly did a mistake

#

@slender thistle

ruby dust
#

Show your current code

harsh dagger
#

i just deleted it but ill show

slender thistle
#

I'm not quite sure how you can fuck that up

harsh dagger
#
Bot.on("message", async message => {
  if(Bot.users.get("!561968604334260244"))){
    message.channel.send("Yes, what do you want?");
  }
})
ruby dust
#

So you didn't change anything?

harsh dagger
#

no

#

when i changed

#

it didnt reply

#

so i went back to the old code

#

but now it fucked up

#

and started spamming in the support server to i restarted the bot

west spoke
#

What would happen if you made it instead of message.isMentioned and make it the bot ID in tags.

#

Like

#

@west spoke

harsh dagger
#

so you mean like

west spoke
#

That's my Id use the bots id instead.

harsh dagger
#
Bot.on("message", async message => {
  if(Bot.users.get("!561968604334260244"))){
    message.channel.send("Yes, what do you want?");
  }
})
slender thistle
#

Either a guild channel, user or a role object, or a string representing the ID of any of these

quartz kindle
#

why are you using an exclamation mark before the ID?

harsh dagger
#

oh wait

#

wrong thing

west spoke
#

It will do it for both a nickname and normal name

#

@west spoke with !
@west spoke without!

#

I have no nickname so it allows both

harsh dagger
#

wait ill try something

#

how can i fuck this up omg

#

now it doesnt work

west spoke
#

odd

harsh dagger
#

i think my bot is a little retarded

quartz kindle
#

your bot is nothing more than a reflection of you

#

:^)

harsh dagger
#

cries

west spoke
winged mango
#

someone knows stuff about sqlite ?

ruby dust
#

sup

winged mango
#

i have some issues

inner jewel
#

someone does

harsh dagger
#

ok you know what i give up on a pinging prefix

ruby dust
#

I think I like sqlite more than python itself

#

is it weird that I'm addicted to data management?

winged mango
#

then, what is wrong with this command : DELETE FROM anniv WHERE date =" + date

#

not at all

inner jewel
#

use prepared statements