#development
1 messages · Page 608 of 1
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
hErEs A gReAt GuId-
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
client.on('message', message => {
if (!message.guild) return;
if (message.content.startsWith('y?latency')) {
message.channel.send(`${client.ping}ms`)
}
This would be right @sage bobcat
i see a missing part
One message removed from a suspended account.
One message removed from a suspended account.
if (!message.guild) return;
if (message.content.startsWith('y?latency')) {
message.channel.send(`${client.ping}ms`)
}
});```
One message removed from a suspended account.
You have to close a if statement
One message removed from a suspended account.
No
One message removed from a suspended account.
not only that @dull bobcat
One message removed from a suspended account.
The difference from Creeper, mine and yours is that we close the if statement and event, but you dont close it
you have to put }); at the end
@grim aspen why did you mention me?
i pressed enter too quickly
you were also forgetting that }); needs to be in there to match with client.on line
One message removed from a suspended account.
@sage bobcat You don't need semicolons in JavaScript so no that was not your problem, your problem was that you didnt close a if statement and the event
One message removed from a suspended account.
One message removed from a suspended account.
No you dont
You don't need semicolons in javascript
actually
Just in few very rare cases where semicolons might be needed
for(let i = 0; i <=3; i++){
//doshit
}```
Yeah cases like that ^
One message removed from a suspended account.
One message removed from a suspended account.
they're also required for stuff like minification where linebreaks are removed
let hw = "hello world"
console.log(hw)
This works @sage bobcat without any semicolon
You dont need semicolons to end a line on javascript
One message removed from a suspended account.
Yeah thats something good to get used to
What I am saying is that you dont need semicolons in JavaScript
And apparently you don't agree with that
One message removed from a suspended account.
One message removed from a suspended account.
Well then you have learned something new, google it up if you want a better explination
in python you don't need semicolons
how to welcomer enebal
Same with JavaScript @unique nimbus
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
how to enable welcomer
One message removed from a suspended account.
hindi
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat U probably should read the link I sent you before actually helping someone 😉
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
hes probably trying to use the Welcomer bot 😑
One message removed from a suspended account.
One message removed from a suspended account.
@hushed berry Yeah...
One message removed from a suspended account.
lol
he left 
How come he cant even manage typing the help command lmfao?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
christ guys
Oh ok ur busy, but you help people with their development?
One message removed from a suspended account.
One message removed from a suspended account.
@dull bobcat what do u need bro
One message removed from a suspended account.
You need help?
No dude wtf can you read anything? Scroll up lmfao im helping people not asking for help
Cool
DV5 thought you need semicolons to end a line in JavaScript and he kept argumenting with me about it, so I sent him a link where they explain that you dont need semicolons and now he doesn't open it
That's whats going on if you are too lazy to read
Wow
Just stay cool, dont attack people i'm just asking a question
Semicolons best
Yeah they are
It's very good to get used to ending lines with semicolons, especially in js since they dont do any harm or anything
But what I were trying to say is that you don't need semicolons in js but nooo no one believed me xDDD
And make code more readable
jeeeeeeeeeeeeeeeeeeeeeeez guys
Hi nik
hewo
hi
@frail anchor As
That's what i've been saying lmao
stupid argument
He's the one being a ignorant lmao
Footers don't support markdown
ok
In the setDescription its works?
yes
thx
title doesnt support links but supports markdown
^Doesn't even support markdown on mobile afaik
I do how if I do not want to put a description to an .addField ?
what ?
It's a character which doesn't show
As its: ""
yes
Field titles don't fully support markdown either if that's what you're about to do^^
Hello, I’m coding in C# and I’m using discord.net, and I need some help. When I ban someone with my bot, I get their account through the server members. If they’re not in the server I can’t get it. How can I ban someone that’s not in the server?
It's good:
.addField("TEXT", "")
?
you might be able to ban via their user id
I can’t ban with id’s, I have to ban with an account
if the lib does not support that, then you may just be out of luck
Yeah I’ve asked all my friends and they don’t know
You can't just put nothing @earnest phoenix
you may wanna try and ask in discord.net's server
.addField("TITLE_HERE", "\u200B")
discord.js even has an addBlankField afaik
Which probably does the same
Or maybe that one is fully blank idk
i dunno
you could also try their discord api channel
which semes like its their home
addBlankField is just blank
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
its bad
One message removed from a suspended account.
One message removed from a suspended account.
You shouldnt have a listener for every command
One message removed from a suspended account.
you have the prefix hardcoded
no lol
One message removed from a suspended account.
put everything into one message event
the way events work is they fire when something happens
so when the bot "sees" a message, the code in your message event runs
One message removed from a suspended account.
having 1000 message events is pointless
it just leaks memory
to change something being "hardcoded" you make it variable
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
it can be whatever you want
and now that its in a variable, you can easily change it by just changing the variable instead of changing every single command
One message removed from a suspended account.
One message removed from a suspended account.
A guide made by the community of discord.js for its users.
One message removed from a suspended account.
no
also you do other unnecessary things like requiring discord multiple times
read the guide
One message removed from a suspended account.
Who knows about music commands?
me!
One message removed from a suspended account.
Who else knows how to music commands ?
what do you mean
I explain the worries:
I just have a problem, when I make the play command with the YouTube link of my music wanted, the bot joins the vocal and leaves the vocal 2 seconds after.
And I have the coding part where it bugs, you want it?
sure, send it
In private message or here ?
here
so if i cant help, someone else can
ok
const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
.on('end', reason => {
message.channel.send('``The music is over .``');
if (reason === 'Stream is not generating quickly enough.') console.log('End of music .');
else console.log(reason);
serverQueue.songs.shift();
play(guild, serverQueue.songs[0]);
})
.on('error', error => console.error(error));
dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
serverQueue.textChannel.send(`?? Start of the music: : **${song.title}**`);
}
});
One message removed from a suspended account.
where?
One message removed from a suspended account.
One message removed from a suspended account.
There is still coding at the top of what I sent. about 1000 lines
One message removed from a suspended account.
My bot has suddenly start giving this error:
Error: Cannot find module './src/config.json'
The error is directed to this line of code:
const config = require('./src/config.json');
One message removed from a suspended account.
One message removed from a suspended account.
no
Show project tree?
k
One message removed from a suspended account.
oof
Error: Cannot find module './src/config.json'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/src/alexi5.js:8:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
🤣 😦
Yea.
ok
One message removed from a suspended account.
Thanks for the help @late hill My bot is up and running now.
One message removed from a suspended account.
One message removed from a suspended account.
how do i call a function defined inside a function from outside all of those functions
Show the full line of code @sage bobcat
client.shard.fetchClientValues('guilds.size')
.then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.size)
})
.size gives error
I am trying to get the number of all servers located in shard.
One message removed from a suspended account.
One message removed from a suspended account.
Well yes, you didn't have an initializer when you destructured it...
One message removed from a suspended account.
One message removed from a suspended account.
const { Client, Attachment } = SOMETHING
you need to put some value there
they won't be magically set to the right thing
One message removed from a suspended account.
One message removed from a suspended account.
Where do Client and Attachment come from?
async function postToDBL() {
client.shard.fetchClientValues('guilds.size')
.then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.size)
})
client.logger.info(`Anlık bilgiler başarıyla discordbots.org'a gönderildi.`)
}
});
One message removed from a suspended account.
1|shard | Uncaught Promise Error:
1|shard | TypeError: Cannot read property 'size' of undefined
help pls
One message removed from a suspended account.
Where
One message removed from a suspended account.
Where
One message removed from a suspended account.
One message removed from a suspended account.
Well if you're destructuring it from somewhere, it means you're pulling it in from somewhere else
One message removed from a suspended account.
That's not defining the class
One message removed from a suspended account.
I suppose you wanted to do js const { Client, Attachment } = require("discord.js");
Yes, you are...
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Why?
One message removed from a suspended account.
Then destructure it from the first import
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
If you did it the way we said, then yes.
One message removed from a suspended account.
One message removed from a suspended account.
Cool
One message removed from a suspended account.
One message removed from a suspended account.
I don't seem to see a help command there, but ok...
One message removed from a suspended account.
One message removed from a suspended account.
Same way you did it earlier: https://discordapp.com/channels/264445053596991498/272764566411149314/570342807064150026
if (message.content === `${prefix}help`) {
// handle it however u wish
}```
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I really suggest that you look into some basic JavaScript and/or discord.js
Bestest tutorial for JS: https://javascript.info
Bestest tutorial for Discord.js: https://discordjs.guide
A guide made by the community of discord.js for its users.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
It wouldn't hurt to brush up on it, would it?
And yes, the Discord.js part is understandable.
A lot of things have changed since "a few years" ago, and D.js (non-DOM/node) tutorials in-general tend to follow the latest ECMAScript standards like template literals, object destructuring, arrow functions, etc...
client.shard.fetchClientValues('guilds.size')
.then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.size)
})
.size gives error
I am trying to get the number of all servers located in shard.
Is the error "Cannot read property size of undefined"
Well Ill just outright say it. There is no client.shards
.
No dots please
What is a good bot status?
Online?
I mean playing status
I use my bots main prefix
k
@modern sable
,
Ban!
!ban
Give Me Bot Developer
if(arg[i].length == 1 && arg[i+1].length == 1) {
for(q=0;q<3;q++) {
if(arg[i+q]) {
if(arg[i+q].length == 1) {
result += arg[i+q];
arg[i+q] = "";
ki = q;
} else break;
} else break;
}
}
if(ki) { arg[i+ki] = result};``` why is this causing a memory heap?
How do I set that my bot can use emojis are especially to servers?
@earnest phoenix what lib
discord.js
@upper hemlock #502193464054644737
do client.emojis.get("emojiid")
There is a situation that someone sends me the commands of welcome
then you can send it along as a string
no
or "tickYes"
Ty dude
yup
Or 

Is IDEA ide program?
Lol yeah ^
Yeah, it's the best for Java or kotlin development in my experience. There are a lot of plugins that add support for more languages that work well too.
Mhmm
so here's a question since Kotlin was brought up. I've seen a friends java bot (a while back, no longer friends) use java and kotlin together. Whats the point of that? is there a steep advantage to using both? or is it just preference?
Just preference
When I do + play on my music bot, he joins the vocal but leaves right after.
How do I do that?
Music is ez
@earnest phoenix well can you show the code for the play command?
Please in a paste service
Like hastebin
I have a question, in the console it tell me Unexpected token
at :
let embed = new Discord.RichEmbed()
.setAuthor(`${message.author.tag}`, message.author.displayAvatarURL);
.setDescription(`${message.author}, you are worked. You earn ${amount}$`)
.setColor("RANDOM")
message.channel.send(embed)
You have an unneeded semicolob after displayAvatarURL)
OK thx
Other worries, I can't install the module quick. DB, who can install it and give it to me please?
Where must I set message client.emojis.get("emojiid") ? To the bot.js?
What do you want to do? @earnest phoenix
Using special emojis
Especially to the servers
ok
Oh, and what can I write to the detailed description? I wrote information about bot.
Are you on PC?
No, mobile
Ah, it's not going to be possible because we can do that on PC. at least make the command \:you emoji:
Oh ok
I'm saved this message
Ask someone who is on PC to help you. I personally am on mobile here
Okay
I asked "where can I write clients.emojis.get command?".
You must have friends on computer, ask them and then you will have to put at the beginning of a line a .setDescription or other
Oh ok
But I'm working on glitch.com 😂
example:
.setDescription("<a563806746964131840> Title or other
Okay
Ty dude
What's glitch?
It runs nodejs over Linux
How to host on glitch
My bot go off after some time
https://anidiots.guide/other-guides/hosting-on-glitch if u want to host on glitch. Just for your information glitch is meant for websites not discord bots
Matrix can you help?
Okay and after create hello-express
If you keep online glitch.com, it never goes offline
@pallid zinc u need to use uptimerobot and ping the project thru the project
Ok thanks
@pallid zinc and code as nodejs dude :)
Is it safe to host on glitch
I code node.js only
Ok try
You are sure?
Yes
Anyway I already have a free host and H24 online
Many people use and share glitch
Im using uptimerobot for keep bot online always
you speak French?
No
ok
Not even a little?
No, Im just know bonjour 😆
And I can errors on English, if I did, sorry
Because English isn't my mother tongue
All right. If you say Bonjour, je suis très gentil et très sociable.
That means in English Hello, I am very kind and very sociable.
Wow
yes
And the word
anti-constantitually is said anticonstantitutionnellement in French. The longest word in the world ^^
Oh :D
Let's talk about it in general channel
I can't
why ?
Because Im afk for codding
ok
Supercalifragilisticexpialidocious is longest word
No
¯_(ツ)_/¯
In your country.
And in mine, no
I did not even know the existence of this word xD
i know it just the only time that word can be used outside of the movie lol i'm know its not
yes my bad, didnt see the channel name
Are there any computer users?
@earnest phoenix showing Error: An invalid token was provided.
Ss
ss mean
screenshot
Hmm
Maybe I cant help you
Because Im using Turkish words
Example: settings.json is ayarlar.json (bot's token, ID and owner info page)
solved my problem no. one
Hm
how to prevent bot go off
Use node.js app
how to use it
i have node.js
i use it to code
@earnest phoenix whats that website you are talking about
Uptimerobot.com i think
regarding sqlite, if I'll assign a primary key to more than 1 column (for example 2), does that mean that unique values can't be a combination of the same value of both columns?
well for example, if in 1 column I have a value of 25 and in the second column a value of 1, can I still assign the value 25 in the first one if at least the second column has a different value?
console log Cannot read property 'avatarURL' of undefined
var member = message.mentions.members.firt
message.channel.send(embed
.setImage(message.user.avatarURL)
.setColor('#275BF0')
)
}
command
reread your code very carefully
sorry
given worng code
if (message.content === `${prefix}avatar`) { message.reply(message.author.avatarURL); } }); Cannot read property 'avatarURL' of undefined console log
this is right one

discord.py whats the problem?
Can someone recommend me a image manipulation api that can let me insert images into a large image (Node.JS)?
@next wedge it looks like a youtube-dl bug... Have a look at this https://github.com/ytdl-org/youtube-dl/issues/20758 and ig it's fixed update your youtube-dl lib and try again
"token" parameter not in video info for unknown reason; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to updat...
Anyone else getting a crap ton of socket hang up errors on sharded bots?
Yea
@slim heart dude where I can type client.emojis.get("emojiid")?
const hastebin = require('hastebin-gen');
module.exports.run = async (bot, message, args) => {
let users = bot.users;
let searchTerm = args[0];
if(!searchTerm) return message.channel.send("Please provide a search term.");
let matches = users.filter(u => u.tag.toLowerCase().includes(searchTerm.toLowerCase()));
let bestMatch = matches.map(u => u.tag).join("\n");
if(bestMatch.length > 1000){
hastebin(bestMatch, "txt").then(r => {
message.channel.send(`Output was too large. Data was exported to hastebin! ${r}`)
}).catch(console.error);
}else{
const embed = new Discord.RichEmbed()
.setTitle("All the users found.")
.setColor(0x26a98b)
.setDescription(bestMatch);
message.channel.send(embed);
}
}
module.exports.help = {
name: "find"
}``` it finds all members in guilds i want it to be in only 1 guild when you search for members.
@earnest phoenix save it as a variable and then when sending a message / putting it in a string just do (`${variable u store the emoji in} etc. etc`)
k
unless you want to supply a server id, you can use your arguments
msg isnt denified
Bruh

module.exports.run = async (bot, message, args) => {
you pass it as message
FIX IT THEN, you were told what to do like by 3 people
on what.
i mean
Is there a reason this is still collecting all reactions? I have the max as 1 and if someone that isnt user reacts it still goes through const filter = (reaction, user1) => reaction.emoji.name == '✅' || reaction.emoji.name == '❌' && user1.id === user.id that is how you set up the filter right?
ea
No output after sc!find uwu is now given.
(reaction.emoji.name == '✅' || reaction.emoji.name == '❌' ) && ..
the or operator (||) will rely on the first supplied paramater that is true
@winged river Because you are now filtering trough a Collection of Members
Ye, I always forgot how js handles it like that
true || false //true
false || true //true
false || false //false
imagine fyko answering something like this 👀
imagine fyko 👀
How come JS don't convert the code to a machine language? How tf does our computer understand the code?
its called an interpreter 
it can be compiled to say an executable, or interpreted as it goes
I asked a question
Could you answer me question?
If not dont bother giving suggestions about reading how something works
Because I didn't ask my question to learn something big, I simply wanted to know if JS has a compiler or something because on the tutorials it says JS dont
But then how does the machine understand the code?
JS, like python is interpreted
@amber fractal That's just how boolean logic works afaik
Thanks for the late ping
It's like that for most coding languages basically
It was fixed already
it's read line by line and converted to machine code, while it's completed in a session @dull bobcat
I know but you said "I forgot js did that"
I just forgot I needed parentheses on those
@cold harness Well apparently it isn't?
what isn't
(edited)
So what?
You can't be insulting someone then make a mistake yourself, it just doesn't work
it is not a compiled language, it's a interpreted language. a compiler is separate, the code is put through that compiler and it's translated to bytecode, to which the machine can understand. I would also like you to not be rude to the developers. i don't fucking care about what you try to correct me with, i am trying to help people with coding, and this type of attitude is not appreciated for the developers who try to help
I've been thinking, what's the best way to commit changes to db? I've been doing that on possibly every insert/update since it was a small bot anyway, but do big companies commit on an interval or something?
google "eventual consistency"
the most difficult part is how should a non english native should be able to understand what is explained like that? any example you can give?
basically, eventual consistency runs on one or multiple caches
data exchange is made with caches, and caches write to database on an interval
that way you can have for example 10 caches receiving requests, and those 10 caches then merge with the database on an interval
this is often used for things like view count, likes, etc
likes are stored to caches, and only merged to the main database every once in a while, hence why views and likes tend to be inconsistent when accessed
this model cannot be used when you need your data to be consistent and accurate everywhere though
hm, alright thanks
@ruby dust For individual writes for a small 1db instance application goes, I would use any sort of transactional logic your db engine allows to make sure that the writes complete. As far as distributed db clusters go, at my workplace we use both eventual and strong consistency depending on the use case.
understood
Will the a bot notify me when my bot has been reviewed im guessing yes but i would like to know for sure
yes
Ok ty
@abstract quarry text works like this <p align="right">This is some text in a paragraph.</p>
so i assume you can do the same
let me try
like <p align="right"><a href="LINK"></p>
it works
thank you
no first you do <a href="LINK"> <p style="text-align: center> test </p> </a>
np
Does someone know how to align a picture in HTML?
thats not inline css, thats a class
classes can only be used in <style> tags or in a css file
<!-- embedded css -->
<style>
.position {
position: absolute;
}
</style>
<img class="position">
<!-- inline css -->
<img style="position: absolute">
then you're doing something wrong
remove the style="" if you're not using it
also, you dont need a container, you can apply the class directly to the img
<img class="right"
Ok I didn't knew that. Thank you.
also, if you want to center it, you wont be able to do it with float
you can try display: block and margin: 0 auto
Ok, but at the moment I don't need to center images.
how can you check whether the type of a channel is nsfw or not
.nsfw doesn't seem to work
message.channel.nsfw returns a bool value in d.js
I'm using discord.js.
can anyone help me set 2 prefixes?
"^" and "slave."
this is what I have right now
I already tried js let prefix = "^" || "slave." but it doesn't work
Use an array of prefixes
And then check if the message includes a prefix from the array
yayeet^brokeyourcommand
let prefix = "^" || "slave." makes no actual sense
that makes even less sense
thank you for the positivity
| is bitwise or
^ i would recommend that
because you then also could easily add mention prefix with it and not have any problems with cutting away the prefix
getting closer
thats correct (i would name it prefixes since its multiple) but now you need a different check for that
you can try
let prefix = ["^", "slave."];
let sw = false;
prefix.forEach(function (pr) {
if (message.content.startsWith(pr)) sw = true;
});
if (!sw) return;``` @potent verge
json lang?
lmao
what is so funny?
i don´t programm with it. i just ask 😂
^
In computing, JavaScript Object Notation or JSON is an open-standard file format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types.
if (message.content.startsWith("something") || message.content.startsWith("something2"))
No no no, Im sure he mean Jason Lange, the journalist
hahaha and html works only when a profi write this (its a joke who don´t check it)
Jay's son
🙄
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Like make sure that people of a specific id can't run a command?
One message removed from a suspended account.
One message removed from a suspended account.
Show me the code for the command that you want to restrict
One message removed from a suspended account.
One message removed from a suspended account.
where?
One message removed from a suspended account.
which library are you using again?
One message removed from a suspended account.
That's... not a command... it runs when the client starts.
One message removed from a suspended account.
One message removed from a suspended account.
Put it in your message event...
One message removed from a suspended account.
Ya know, I still highly recommend you follow a tutorial...
A guide made by the community of discord.js for its users.
One message removed from a suspended account.
Yes, it is...
One message removed from a suspended account.
You probably skipped around instead of reading it page by page
One message removed from a suspended account.
This is the most basic that command handling can look like:
https://discordjs.guide/creating-your-bot/adding-more-commands.html#simple-command-structure
A guide made by the community of discord.js for its users.
You should really start from the very beginning and go on from there
It helps you with best practices, etc...
it's not a programming language
it's a data format
which may be considered a language
just not a programming one
oh, i always just associated it with js
JSON = JavaScript Object Notation
THATS what it stands for??!
i also associated it with json + javascript = minecraft
Weird considering minecraft is java
same thing potato tomato
potato tomato
i confuse myself a lot by all the crap and incorrect things i say
where do i get server name
i tried to find it on discord.js
i cant remember how to do it
?
the dude doesnt have a mutal server with the bot
Hi...
How can a "reload" of the command handler be done if one has shards?
(pls help)
global.EnmapGuildsDb = new Enmap({
name: "Guilds"
});
global.Enmap = require("enmap");```
where do i define enmap
and how
im new at enmap so...
i tried to define enmap but this pops up
Cannot find module 'better-sqlite-pool'
@raw wharf You can try bot.destroy(); .then(bot.login(token));
@earnest phoenix u need to run npm i better-sqlite-pool
Cannot read property 'hasPermission' of undefined
@earnest phoenix show code
If anyone's interested, my organization made a https://www.speedrun.com API wrapper, and it's available at https://npmjs.com/package/node-speedrun
i was legit thinking of making one a few days ago lol
we thought of that abt 3 days, because of an issue in our github
and we thought "why don't we make a wrapper, since it's easier to make, and won't take up much space in code"
and boom
ok so just gonna ask , my bot shows server count (discord.py) in the status , but it says 209 , but on dbl it says 76 ... so ... im kinda lost where the problem is ...
you havent updated it on dbl
That's not how you give dbl your server count
ik
i have the api stuff too ...
that should post the server count
but I asked before in #topgg-api bc it didnt work , but after a few hours it actually started posting the server count even when my console said "failed to post server count"
Update the lib and try again please
0.2?
u mean discord.py right ?
dblpy
mmm how do I update that one ?
yes
pip install -U dblpy
Ig I'll have to change the way it waits until everything's ready
Sucks not to have my laptop on me
well i can show u the code I have to post the servercount ...
Please do
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'TOKEN'
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
``` ofc I have TOKEN replaced with the dbl bot token from the site
Slap the new example in
did they update it ?
It's updated
ok bc last time it wasnt so I already asked a mod when it would be updated ... ok ill check it out and try it again after it
so this is the updated one right ?
Don't look at that
ow then where ...
Hold up
ok
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
Scroll down on either
Could you please open an issue on GitHub
I suspect that I should rewrite the way it waits for the bot to be fully ready
oww
welp i can open one on github but not now , wont be on pc for the next few hours .. just wanted to have my servercount fixed and working correctly
Dw, it's fine
i will send u the link then when i opened on ok ?
No need, but it's up to you
ow welp ill see (:
👌
Hi ! I am creating a bot in node.js but I can not connect my database. Could someone help me solve this error? 😕 ```C:\Users\eveno\OneDrive\Bureau\Bot discord\Bot habbix test\testbot.js:20
if (err) throw err;
^
Error: Cannot enqueue Handshake after already enqueuing a Handshake.
at Protocol._validateEnqueue (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\protocol\Protocol.js:221:16)
at Protocol._enqueue (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\protocol\Protocol.js:138:13)
at Protocol.handshake (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\eveno\OneDrive\Bureau\Bot discord\node_modules\mysql\lib\Connection.js:119:18)
at Object.<anonymous> (C:\Users\eveno\OneDrive\Bureau\Bot discord\Bot habbix test\testbot.js:19:7)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)```
eey can somone help with a problem a have with my bot
@versed briar we cant help if we don't have any code.
@west spoke @unique nimbus You can't help me ? 😢
post the relevant code
pi@raspberrypi:~/Documents/bots/dndbot $ npm start
dndbot@1.0.0 start /home/pi/Documents/bots/dndbot
nodemon
[nodemon] 1.18.11
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node index.js
/home/pi/Documents/bots/dndbot/index.js:10
bot.on("ready", async() => {
^
SyntaxError: Unexpected token (
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3
[nodemon] app crashed - waiting for file changes before starting...
an error without code doesnt say much
Pi(s) normally don't work as well as a laptop/android
@quartz kindle ```var con = mysql.createConnection({
host: "localhost",
user: "ruth",
password: "123456"
});
con.connect(function(err) {
console.log("Connected!");
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "INSERT INTO users (ID, PetType, PetName, PetLevel) VALUES ('1234', '10','test','6')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
});```
@quartz ridge why are you connecting twice?
@versed briar you have to post your code. the error doesnt say much
I did not see 😄
also please use code blocks
oke
Guys, how do I specify the auth for a request? I use request(url, (error, response, body)) for a discordbots.org request but it say { error: 'Unauthorized' }
which lib are you using for request? look at its documentation and look for how to set headers
`const discord = require("discord.js");
const botConfig = require("./botconfig.json");
const racefile = require("./races.js");
const classfile = require("./classes.js");
const bgfile = require("./bg.js");
const bot = new discord.Client();
bot.on("ready", async () => {
console.log(${bot.user.username}: Main index is docked.);
bot.user.setActivity("D&D", {type:"playing" });
});
bot.on("message", async message => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;
var prefix1 = botConfig.prefix1;
var prefix2 = botConfig.prefix2;
var messageArray = message.content.split(" ");
var command = messageArray[0];
var arguments = messageArray.slice(1);
var cmds = [">bot",">help","D&Dinfo","D&Dclasses","D&Draces","D&Dbackgrounds","D&D(Racename)"];
if (command === `${prefix1}Bot`) {
`
Javascript, sorry
request is not a native function, it requires a library. which library is it?
how do you do a code block
three `
three times `
Yea, it's a package
so look into the package's documentation on github or npm, and search how to define headers
There
const botConfig = require("./botconfig.json");
const racefile = require("./races.js");
const classfile = require("./classes.js");
const bgfile = require("./bg.js");
const bot = new discord.Client();
bot.on("ready", async () => {
console.log(`${bot.user.username}: Main index is docked.`);
bot.user.setActivity("D&D", {type:"playing" });
});
bot.on("message", async message => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;
var prefix1 = botConfig.prefix1;
var prefix2 = botConfig.prefix2;
var messageArray = message.content.split(" ");
var command = messageArray[0];
var arguments = messageArray.slice(1);
var cmds = [">bot",">help","D&Dinfo","D&Dclasses","D&Draces","D&Dbackgrounds","D&D(Racename)"];
thats the full code?
```if (command === ${prefix1}Bot) {
let BotPic = bot.user.displayAvatarURL;
let botembed = new discord.RichEmbed()
.setColor("#ffffff")
.setThumbnail(BotPic)
.addField("Bot name: ", bot.user.username)
.addField("Created on: ", bot.user.createdAt)
.addField("Server related prefix: ",prefix1)
.addField("D&D related prefix: ",prefix2);
return message.channel.send(botembed);
}
//commando's for the bot not d&d related
if (command === `${prefix1}Help`) {
let cmdos = new discord.RichEmbed()
.setColor("#ffffff")
.addField("These commands available: ", cmds)
return message.channel.send(cmdos);
}
//commando's for the bot d&d related
if (command === `${prefix2}Info`) {
let info = new discord.RichEmbed()
.setColor("#DC143C")
.setDescription("These are your options:")
.addField("Classes")
.addField("Races")
.addField("Background")
.addField("Weapons")
.addField("Armor")
.addField("Equipment")
.addField("Spells")
.addField("Others");
return message.channel.send(info);
}
if (command === `${prefix1}Sup`) {
let SUP = new discord.RichEmbed()
.setColor("#ffffff")
.setDescription("Sup");
var i = 0;
while (i < 10) {
i++;
return message.channel.send(SUP);
}
}
});
bot.login(botConfig.token);```
ok but why are you defining the variables on every message
can we go in a voice chat
Also, is here a way to get the votes count in real time? tried dbl.getVotes() but isn't updated =/
Creating a loop most likely
@unkempt juniper the best way to get votes in real time is to use webhooks
I mean, not in real time, but not values from the previous day
How often does it update?
no idea
I got it 👏
how can you make a bot have multiple commands, do you have to have multiple .js files for each command?
you can do that, or have all one file
last time i did that it was a MESS
How far developed is fully developed for the mods to accept a bot?
i'm trying to make a database system with sequelize / sqlite and im doing it exactly as this (https://discordjs.guide/sequelize/currency.html#initialize-database) tutorial says but i keep getting this error:
(node:452) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: SQLITE_ERROR: no such table: users
A guide made by the community of discord.js for its users.
Well appearently a table called users is missing
Thats really all i can give because you have not shown us any code
^
@dusky bear functioning commands, rest of the requirements are in #502193464054644737s. start there
So all you need are functioning comands. No minimums.
essentially a help command, and other stuff. I'd reccomend trying with file storage/profiles, idk.
What image manipulation library do you recommend
what lang do you use
Node/discordjs
Isnt their a canvas thing built in?
I know for python you can use pillow
But idk about js
thanks.
Attention my dear friends👀
Here comes a serious request:
Hack-Save
Last week, on a pretty crowded server 2k+ members an admin account got hacked and all of the normal members got kicked + nearly all channels were deleted. Sad thing, so an interesting idea came to my mind.
Creating a bot that prevents those cases.
Basic idea behind this: when an admin kicks serveral members in a short time (lets say 10 members in 1 minute) the bot immediately takes away all admin-roles. Second feature: when an admin deletes two channels in under 10 mins, all admin roles are removed.
Not only at the admin that is acting, at all available admins. Therefore the bot-role has to be the highest role on the server. The owner has to reset the bot, if he does not, the bot will keep taking the roles away. Several features can be added like bot being kicked -->warning to other admins by dm, admin-roles taken away by owner (in case the owner-account got hacked).
Just wrote this down, I know its technically not that hard to realize, so here is my question:
What do you think of this feature?
Does anyone know why this part of the code doesn't work, without an error message?
@wild comet #502193464054644737 , no ads.
Its just an idea that came to my mind, just want some opinions on it😊
ElуterYesterday at 11:50 PM
Does anyone know why this part of the code doesn't work, without an error message?```
because that event doesn't exist
that event doesnt exist
thats not how you use find
addrole doesnt exist either
camelCase my guy
@wild comet the problem is, being hacked by bots is way more common than being hacked by user accounts afaik
bots who have admin permissions and get their tokens leaked are single handedly responsible for nuking hundreds of servers
it could still work, but you need to check who's the one deleting things, and leave the server if he himself is the one doing it
also if a raid happens, you will need to disable the bot before you can mass ban people
same if you want to modify the server structure
@idle basalt what is the good method ?
k
but you can still update your bot right
Try discord.host for a forever free host
vpsd
OFC you can
k
99.9% uptime gaurenteed
@willow sparrow that's not a trustworthy site
I use it and love it
i use skysilk
scaleway uses atom cpus
yeet
hey tim
do you trust discord.host?
@quartz kindle
i wouldn't think it would be trustworthy
idk, they claim they are run by MCS Hosting Ltd, you can check their website mcshosting co uk
looks sketch idk
@earnest phoenix the event is called guildMemberAdd and the method is addRole
its all in the docs. i recommend you search there first
🤷
there's a couple ways:
github link is public and the token is included publicly
bot is hosted on a bad site like free hosting
and last but not least, if you were to eval client.token without having regex, it will show your bot token in chat
@strange trout @west yarrow this should answer your question
well glitch is actually trustworthy if you put your token in a .env file where it is private and no one can see it if they were to access your bot's page
Yeah it's safe if used correctly. That's where I do my testing
but use regex or a counter reply for eval because it can catch your token whether or not it is in a .env file
honeslty i dont really see a need for that
how often are you going to eval your bots own token 
rare but it could still happen
seems like a bit of a stretch
@grim aspen while it is a good idea to put token in .env, you could always just make the project private
yeh. s3 or something.
Yeah, cloud config is pretty common, used mostly for managing tokens/properties/keys for many services in one central location.
Ye
YawN need to update my bot info command, and my bot's page with the correct webpage
We use it at work for a boatload of microservices, pretty slick
Seems cool.
every time i type in a command my bot is executing it twice and i dont know why
ive looked thru all my code, there is nothing that seems like it could be causing it
Restart it and check if there are any extra ones open.
its doing it with literally all of my commands, and no i only have the one open
Ah
this is literally the worst bug i have ever encountered, i think my program might be haunted
do both stop if you turn off the bot @mystic shell
you might have two instances running
^
or two message events
ive checked both of those, they arent the issue
nik, the reason you regex your token is because shit happens and its only a few characters of code to fix
@mystic shell if it isnt the code there is some background process running I assume
are you using node?
yeah
semis are great

