#development
1 messages · Page 791 of 1
node -v
ty
node .
see im confuzed, cause if npm install worked, why didnt node command?
and if node -v works, why not node file.js
I LOVE YOU
code errors?
ILY ILY ILY!!!!
lmao
full no homo
lol
final offer
ok i take ❤️
gl with your bot dude 🙂
what is that.
pretty much the only refeerence you will need
ohh hell no
it documents all discord js functions and features
yo
how long does it take to code a bot?
idk, ive been programming mine since late december. other members from here ive spoken to are 3+ years
but their bots are live and in production
my bot hasnt even passed approval process yet lol
wdym approval?
ohh
im making a bot that will pm you every 30 mins with alot of stock market stats
i think you should make pm optional though, and have a command to check the info at will 🙂
sure
That's not gonna work, due to rate limits lmao
Unless you do it with just a few ppl
When I am trying to post server count it says 400 error
at IncomingMessage.res.on (/rbd/pnpm-volume/256ccade-fb85-42e6-882f-cd3dd81f765c/node_modules/.registry.npmjs.org/dblapi.js/2.3.1/node_modules/dblapi.js/src/index.js:118:25)2:57 PM
at IncomingMessage.emit (events.js:194:15)2:57 PM
at endReadableNT (_stream_readable.js:1125:12)2:57 PM
at process._tickCallback (internal/process/next_tick.js:63:19)2:57 PM
2:57 PM
(node:1697) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)2:57 PM
(node:1697) [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.
are you using discord.js v12?
@violet nimbus
@violet nimbus how are you using the library? show your code
Anybody know what this means or how to prevent it? I don't have the code for the bot as I am asking for somebody else.
Python is the langauge used
concurrent.futures._base.TimeoutError
Full traceback could help more
?
I don't have the code and that's all the info the bot's owner gave.
You there?
Then ask them for a stacktrace
I'm trying
bots can't access that endpoint
Bots can't fetch that information directly
Which apk gor pc is best to create a bot
so no, not without repeatedly getting messages until the channel creation which is considered api abuse
Alright this got weird in a moment
There's no "apk" for PC to create a bot
A bot is code running under a bot account
I mean’d how ? Where
@earnest phoenix where i have to do !
Make the code?
Yes
Well first of all what programming langauge do you want to use?
Learn something, there are hundreds of programming langs out there which you can easily learn
I recommend python since it's a high level lang
top level? 
high-level
Example visual studio code @earnest phoenix
I don’t have a lot of info i wanna learn
You can learn online for free or get a paid course
What is your opinion
🤷♂️
Thank you a lot
Np
Can anyone figure this out?
https://pastebin.com/XCkEQJwE
that's all the info the bot owner is willing to provide
Where did everybody go?
hard to fix an error with no code 🤷♂️
@earnest phoenix can you explain the situation a bit more? like, who is the bot owner, and who programmed the bot?
and where is the bot running?
hold on
why does that matter 🥺
Because the bot owner only provided that link
tell him to provide more
@frank wyvern Is the owner
i get it that it’s a failed api request?
this is an issue the programmer of the bot should solve, or whoever is responsible for maintaining the bot's code
or ask stack overflow😳
yeah but stackoverflow wont help if he isnt the one who coded it
someone with documentation for:
Your libs docs probably.
@wicked pivot which lib do you use?
discordjs
(master)
use a database
when user created a new request save it to database
mongodb is pretty easy to use
^
i did sorta the same thing with my bot
or enmap
sure
@summer torrent master ?
discord.js v12
sad
v11 has no method about nitro
I am in version 11.5.1 
I mean
is there a way to send a custom emoji from only having the emoji name or id?
w/ discord.js
\:emojiname:```
<:name:id>
the bot must be on the server where there is the custom emoji
message.channel.send(client.emojis.find(a => a.name === "emoji name"))```
or a.id === ""
thank you
@open frost
for(x in array) {
const log = bot.players.get(guildid,array[x])
data.push(log)
}``` I generate Unix timestamps for in the command set past x days. after this i want to retrive logs from the x days from an enmap database. the timestamps i push into an array but for some reason i cant get any data back from the database. (i use the unix timestamp as key)
what is array
an array of the Unix timestamps
var d = new Date();
d.setDate(d.getDate() - i);
d.setHours(0, 0, 0, 0);
day = d/1000
array.push(day)
i++;
};
console.log(array)
let x
for(x in array) {
const log = bot.players.get(guildid,array[x])
data.push(log)
} ```
your 2nd parameter signifies a property to get from the object
Did you put the timestamp as a property
How did you save this data to your enmap
how i set the data in the database?
yes
bot.guilds.forEach(guild => {
date= Math.floor(new Date().setHours(0,0,0,0) / 1000)
var members = guild.memberCount
console.log(members)
bot.players.set(guild.id,members,date)
})
}``` gets called by an timeout every day at a set time
I don't think that works the way you think it does
when i run it manually without the loop for getting data is works
You should try logging bot.players.get(guildid)
and see what it actually looks like
idk enmaps are weird
i dont want to retrive every log in the enmap just the last few.
It's basically just an extended map
You're mapping certain objects to guild id's
In the code up above you're attempting to fetch one of those objects and get it's "timestamp_here" property
I'm questioning if that property exists to begin with
its set as key for the log for the day.
when i run just get(guildid) i get back an array of the timestamps and the log attached to it
Maybe that's the issue
If it's an array of them you probably won't be able to use the actual timestamp the way you did
Because it's likely using that timestamp as an index on the array instead
hello
im losing my sanity please help me
I have a currency bot every command works but leaderboard doesnt work
doesn't give any error
const db = require('quick.db')
module.exports.run = async (bot, message, args) => {
let money = db.startsWith(`money_${message.guild.id}`, { sort: '.data'})
let content = "";
for (let i = 0; i < money.length; i++) {
let user = bot.users.get(money[i].ID.split('_')[2]).username
content += `${i+1}. ${user} ~ ${money[i].data}$\n`
}
const embed = new Discord.RichEmbed()
.setAuthor(`${message.guild.name} - Leaderboard!`, message.guild.iconURL)
.setDescription(content)
.setColor(0x51267)
message.channel.send(embed)
}```
Jw if there is a way to change to emote used to claim kakera. I am color blind and the purple and blue mess me up all the time.
@late hill i use the same way to get my per server config. and this works. the only difference here is that i have a unix timestamp instead of a name
It's also an array?
If you literally just saved an array of timestamps on it, there's pretty much nothing you can get from that
The same thing would happen if you just saved an array of names
you'd need some kind of key-value pair
yea just realized it. but i think im already know a solution
from an object instead of an array
@tight yacht i think you're in the wrong server
Btw, anyone knows why mysql keeps returning error timeout?
inb4 server not running
Whenever I try to make query and/or connect
Server is online always
It works for local databases
But for external databases, one hosted elsewhere, it does not...
Connection credentials wrong? 

@vale python what exactly doesn't work in that code? What does the command do?
And since in the topic of mysql, anyone knows why "new PDO" causes 503 error?
^^php
The one before that is nodejs
since a few days my " setThumbnail "is no longer displayed
you don't provide a proper image url to it then
discord is having a moment rn though
thumbnails arent showing up on embeds at all
you still need to provide a proper url for it if you dont but yes
gotta wait for discord 
discord devs must be like "sigh... not again" every single week lol
their infrastructure is probably so badly designed
and the recent additions for the past few months are... well, shit
non-planned additions are always a pain to add
you gotta hack stuff into your code, and slowly it becomes a big ass mess
half of discord's features were probably never planned
i doubt it's that badly designed when it supports 25bn messages per month from 10m concurrent users
Tfw they disable events but it's still garbage
my head would explode trying to optimize for even a tiny fraction of that workload lol
When padding-bottom in CSS decides to go from right 
css = microsoft word
i doubt it's that badly designed when it supports 25bn messages per month from 10m concurrent users
so does messenger or viber but they don't have issues literally every single week
change one thing and the entire page gets broken
Nah MS Word isn't that fucked in my cases
It's HTML/CSS that always screws me over

Why did it move to the right what
that means you know how to use ms word correctly xD
😂
so many people dont know how to take images out of the text flow
or that you can even do that in ms word

Quick question using Discord.JS I know the fucntion but for some reason it just doesn't want to come to me I am making a welcome message for when a user joins the server so I am using the guildMemberAdd event but I want it to return if the user is a bot I thought if(member.user.bot) return would work but no luck
Also no errors just doesn't work as expected honestly doesn't work at all
it should work
Yeah that's what I thought
can you console.log(member) or console.log(member.user)?
It will console log them but it still sends out the welcome message for some reason
can you show your code?
Of course
One sec
I also use discord.js 11.5.1 don't know if that matters any but 🤷🏻♂️
do you have any other onMemberAdd event? any other instance of the bot?
No just that one and this is the only instance of the bot for now still a pretty fresh bot so
what does console.log(member.user.bot) return?
Someone write on python?
yes
There is lots of people here whobuse python it's a pretty popular language
Someone can help with wait_for in discord.py?
sup
just say "python" and shivaco will pop in
Lol
In docs bad example
https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_for
Waiting for a user to reply:
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
msg = await client.wait_for('message', check=check)
await channel.send('Hello {.author}!'.format(msg))```
Waiting for user to add a reaction
```py
@client.event
async def on_message(message):
if message.content.startswith('$thumb'):
channel = message.channel
await channel.send('Send me that 👍 reaction, mate')
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '👍'
try:
reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
except asyncio.TimeoutError:
await channel.send('👎')
else:
await channel.send('👍')```
sigh
He have only one emoji
Можешь уточнить, в чём конкретно состоит проблема?
От части
Понял
НУ кароче
Мне надо чтобы бот тригерился на пару реакций
И мог выбирать на какую именно нажали
Например 👎 и 👍
@hoary elm if the guildMemberAdd event is firing an empty member object then something is very wrong lol
Yeah that's why I said it makes no sense since to my knowledge member should be defined in that event
Ок, а ты как хочешь реализовать? Когда бот должен ожидать этих реакций?
Например команда хелп
try adding this ```js
client.on("raw", r => {
if(r.t === "GUILD_MEMBER_ADD") { console.log(r); }
})
И бот нашет какую реакцию нужно для какой категории
И пользователь уже выбирает что ему смотреть
Ну мне нужна только помощь в реакциях
Чтобы мог смотреть какую именно нажали
Ok I'll add that and see what happens..
в параметре check для функции wait_for просто уточни message.channel == m.content и возможно ещё добавить message.author == m.author
А, извиняюсь, я немного перепутал сами события
Help it's in elvish
def check(reaction, user):
return user == message.author and reaction.message.channel == message.channel and reaction.emoji in [лист нужных тебе реакций]
reaction, user = await client.wait_for('reaction_add', check = check)
if reaction == реакция_1:
# код1
if reaction == реакция_2:
# код2
no its vodka
Тебе нужно убедиться, что на сообщение реакцию ставит именно тот пользователь, который использовал команду и то, что реакция была произведена в том же канале
и сразу проверяешь мол реакция из нужных
Надеюсь код примерно понятен 
Полностью понятен
@slender thistle, thx SOO much
👍
with what?
How would I create a voice channel??
I tried message.guild.createChannel(....) but it keeps saying createChannel isn't a function
Whats your discord version
Newest one
Packages is set to: github:discordjs/discord.js
message.guild.createChannel(
"Test",
'voice',
{
overwrites: "",
reason: 'New temp channel'
}
);
return message.channel.send("Channel Create!")
This is the current code I'm trying to use
@vague kite
Yeah what's up??
createChannel({type:"voice"})
I still get the same error
Ahh okay thank you ❤️
I hope you will read this page: https://discordjs.guide/additional-info/changes-in-v12.html
Ohh that's actually so helpful idk when V12 came out but I just updated everything in the bot took me so long to find out most of it is using .cache to get stuff now
Thanks that'll help a lot with everything ❤️
technically v12 didnt come out yet
Technically v12 comes out (kinda)
it still an in-development version, althought its been in development for many years now and many people use it even with breaking changes happening often
Every bot dev g'can get it
Okay
How made cored embed for site
Like https://mee6.xyz
This aqua
Meta tags
<meta color>?
For colored embed
I need meat color
Or what
@zenith orchid
LoL
Cайт сервера BerrySpring
Not working
@earnest phoenix
?
I guess this is what you are looking for
Not worked
Not worked
@zenith orchid
my good man
It's definitely better than not being able to open pastebin when someone posted their traceback there
I think there is a 30 minute cache, so after you edit it it can take 30 minutes before you see the change
also for an image you need <meta name="og:image" content="image url here">
you can remove the other image tags
I think if you wait for clear cache, its worked.
Yes?
Okay one last question how would I edit the channels permissions as I create the bot??
as you create the bot? you mean when your bot joins a guild?
Create the bot
I seem to be having trouble installing discord.js
npm install
why would you run node-fetch install wtf
I mean the WARN bits
ignore them
because the first WARN says to use node-fetch
you can mostly ignore the WARNs
the warn is not for you
do I need to deal with the "requires a peer" WARN bit?
no
its discord.js v11 that uses a deprecated library, thats what the warning is for
ok then
peer dependencies are optional
and uws is not recommended
its known to cause a lot of issues
funny I have trouble with this bit but I'll be able to understand the actual coding. 😜
Hello, i have a question about sharding..
Assume i have 2 different bots, both sharded and with the same amount of shards. BUT with completely random servers that invited them. Although its random, some servers will have invited both bots. Will these servers be on the same shard id for both bots?
i am assuming this is the case because of the sharding calculation formula (guild_id >> 22) % num_shards == shard_id, which says to me, that the shardid is only dependend on the actual guild id (and amount of shards), which should be the same for both bots.
I tried to google an answer but couldnt, im interested to know how online games like pubg, minecraft, clash royale, brawl stars etc track where characters are on the map and how do they deliver the information to the client so quickly and smoothly
@viral spade yes i believe so
websockets
@quartz kindle Follow up question: But that also means that, if i am extremely unlucky it could be that of my 10 shards started, only the first will have 1k servers, but the rest none?
well no shit but even websockets have minimal latency
All I know is they're speedy

im not very interested in that, but rather on how they track where characters are on the map
@split hazel https://youtu.be/uh8XaC0Y5MA
In this first part of my C# networking tutorial series, we set up a TCP connection between a dedicated server and a Unity client.
If you get stuck or have questions, ask them on my Discord server: https://tomweiland.net/discord
Kevin Kaymak's channel: https://www.youtube.com/...
@viral spade supposedly yes, although i've never seen a strong deviation in guild ids and shards, idk how i would explain it
This is an entire tutorial
If you're really interested
It's 7 parts
But a lot of it is unity specific (obviously)
i dont know much about game design, but my take is the client using UDP to stream packets to the server
most games, character positions is not synchronized so you often see glitchy movement when lag happens
well yeah, i've also seen the client take over the character movements, mostly in clash royale
and when slight lag happens, the characters get moved back to where the server belives it is
yeah, they use many corrections to resync positions
and predictive movement/pathing
var rethink = require('rethinkdb')
opts = {"host":"localhost", db:"EzDB"}
rethink.connect(opts, function (err, conn) {
if(err) console.log(err)
rethink.connection = conn
})```
How would I create a table
I tried rethink.tableCreate("test")
I did
thats where im getting the code from
It says ```js
db.tableCreate(tableName[, options]) → object
r.tableCreate(tableName[, options]) → object```
I dont know what "db" is
I think db is ur rethink
nvm I just saw js r.db('heroes').tableCreate('dc_universe').run(conn, callback);
im gonna try that
r is rethink
tricking discord.js into not caching things is fun lmao
especially tricking it into working without cached stuff
fetching a message without caches:
await client.channels.add({id:"channelid",type:0},client.guilds.add({id:"guildid"},false),false).messages.fetch("messageid",false);
hey I need help im using a package with discord.js called canvas-constructor how would I use canvas-constructor to get an image from a url not a file?
have you checked their documentation?
Any good databases that are like quick.db, (as easy) and have the performance of something like rethink or mongo db?
@quartz kindle no lemme read
@quartz kindle it doesnt show how.
Ive been seeing an increased amount of HTTPError [AbortError]: The user aborted a request. (Discord.js) now that active server count has gone up.. Any ideas?
Api having problems
Discord API?
Yes
whats the difference between the message attachment proxyURL and the url
which is better?
you'd ideally want to use url
proxy url is for external images being forwarded through discord
and as you can see right now, discord's proxy is down
My bot is having problems, im using canvas-constructor here is my code the bot sends a black background instead of thr image its suppost to be sending.
const { Attachment } = require('discord.js');
const readFile = require('util').promisify(require('fs').readFile);
const { Canvas } = require('canvas-constructor');
const snekfetch = require('snekfetch');
module.exports = {
name: "beautiful",
run: async (bot, msg, args) => {
let user = msg.mentions.users.first() || bot.users.get(args[0]);
if(!user) user = msg.author;
try{
const paintMess = await msg.channel.send('Working on it... ');
const plate = await ('https://cdn.glitch.com/0a96f05c-d7e5-41d5-8422-6adb49bbe599%2Fbeautiful.png?v=1582057361914');
// const png = user.avatarURL.replace(/\.gif.+/g, '.png');
const { body } = await snekfetch.get(user.displayAvatarURL);
const getBeautiful = new Canvas(634, 675)
.setColor('#000000')
.addRect(0, 0, 634, 675)
.addImage(body, 423, 45, 168, 168)
.addImage(body, 426, 382, 168, 168)
.addImage(plate, 0, 0, 634, 675)
.toBuffer();
await paintMess.delete();
return msg.channel.send(new Attachment(getBeautiful, `beautiful-${user}.gif`));
}catch(e){
return msg.channel.send(`ERROR: Please try again later or alert my dev's support server can be found on (removed) Error Message: ${e.message}`);
}
}
}
I want it to send the background image
@unborn steeple you need to download the image to use it with canvas
the official node-canvas library has a loadImage function that does that
if canvas-constructor is updated, it should also have it
i looked at canvas-constructor's source code
you should be able to use js const { loadImage } = Canvas.internalCanvas;
and then you can use this https://github.com/Automattic/node-canvas#loadimage
ok so, i have a question, i coded/made a discord moderation bot, added other commands right? i added a command only I can use, it's called !servers. It detects how much servers, then displays it. So like "There's 5 servers!" But, it doesn't work. I've been testing this, so when I would have the bot join a server, it would still say something like "5 servers!" even though there would be six, then I would restart my bot, then it would finally show "6 servers!"
If you need my code, here.
.
.
const { ownerid } = require("../../loaders/reader"); //get ownerid from botconfig file
module.exports = {
config: {
name: "servers",
aliases: ["servc"]
},
run: async (bot, message, args) => {
if (message.author.id != ownerid) return; //only owner can use
try {
await message.channel.send(`The bot is on ${bot.users.size} servers.`);
} catch (e) {
return message.channel.send(`ERROR: ${e.message}`);
}
}
}
does anyone know how I can get is to actually work so it dosent have to restart every time I want to know how much servers are using my bot?
Are you getting any errors? Btw change != to !==
your checking users size, not servers
The difference between == and === is that: == converts the variable values to the same type before performing comparison. This is called type coercion. === does not do any type conversion (coercion) and returns true only if both values and types are identical for the two variables being compared.
Oh shit didn't realizs
But also change that
await message.channel.send(The bot is on ${bot.guilds.size} servers.);
How does the reset_command line in discord.py work?
I've found kind of how it works, but now it thinks my command is a variable?
discord is dying
any reason why this crashes? I have no errors, it just randomly stops.
my bot has a few configurable settings that have to be set in order to unlock one of the main features (it spawns enemies to battle, needs the spawn channel to be set, and spawns enabled). How would i be best to show the setup guide to new users?
Would you recommend I have the bot send a 'hi im here' type message when he joins a new guild, showing the vital commands to setup things? or is there a better solution?
rip discord
also if i send the same messages its because discord is deciding to die
Any reason why this crashes>
No errors
but it just randomly crashes
Called it
that was 2 mins until it sent
@neat ingot best practice is always to have a help command, you can make it be called by the bot mention as well
im in uk and its running fine for me, must be us server issues or something
oh wait nvm, lagging now 😄
yea, i have the help command, its advertized as my bots status also ('Playing !!help for x users'), you think that is enough though? and the help command doesnt show setup info, it show commands help info. should i add an option for an optional argument like '!!help setup' maybe?
im seriously confused
I researched this, and it said to "poll" the pygame event, and I am
i guess i could easily check if a server has used the help command before, and then send additional setup help info if they havent
in SQL, is there a performance difference between small "autocommits" and large commits every now and then and what's generally the best practice?
Probably a combination
So.. I'm confused.
Why isn't this code working?
if(msg.content.toLowerCase().includes("discord.gg/" || "discordapp.com/invite/")){
I'm logging it, so I can see that it is indeed seeing it.
Nvm
I'm stupid
It was working fine.
Lmao
So I was trying to get the Youtube API in order to create a music bot but I have no idea what scopes to pick
I need help with Embeds
Trying to use Markdown to add hover text over href
[Some Text](Some Link "Some Hover Text") tried this.
ive never heard of doing a conditional as part of a function call like that
Just not the second half, I had to separate it.
So I have includes 1, then includes 2
😛
I realized a check earlier didn't work
That's what my issue actually was
guys don't talk here
the "" || "" would have been like a boolean, either this or this, that then gets checked for included
I had a ! where it shouldn't have been
people that can help me won't see my message 😢
We're discussing code.
😠
can u use markdown to add hover texts?
yes
never heard of that
^
lets text
test*
[Some Text](Some Link "Some Hover Text")```
oh wait it'd only be in an embed?
named links also can used in-line named links with hover
but that makes no sense
yes
I don't get what you're trying to do
sec, i consult dr goog
I know what you mean by hover.. buuut
Trying to make an ability info system for my rpg bot
For instance:
Char: Human
Ability: Taunt
If you hover over taunt will show info regarding the ability
Yeah, but not all of it
😠
Sir I don't need the docs, I need help from people who did it
I saw it over other embeds
Just need help parsing the "Hover text" string
You guys just don't talk here and would help
output using the hover
it will output as a string
nvm you can backslash the 2string
or use template literals
const Discord = require("discord.js");
let embed = new Discord.RichEmbed()
.addField("Test", `[Yeet](https://google.com "Hover Text")`)
message.channel.send(embed);
Yes I saw it
oh, thats pretty neat, i really didnt know markdown could do that 🙂
I guess I could've used link() aswell but I like using Markdown more
As a general issue, what are webhooks and how do I use one?
Webhooks here just any webhooks
They use POST methods and parse info from a json format
A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with th...
Discord has webhooks aswell
But I was wondering how do I make an endpoint using nodejs?
google it
making an endpoint in node is legit one of the easiest things
app.get('/route', function(){});
app.post('/route', function(){});
huggies
debating cutting out the restful api of this project and just doing everything inside the bot process
to speed up dev time
and doing api later
imo you would regret that choice later :p
https://conquestsim.io/upload/dreary-creator-7213.png whats wrong here?
for some reason i think its calling both then and catch
however the function returns when rejected https://conquestsim.io/upload/puzzling-attraction-9490.png
so no reason for both to execute?
if the .then part errors it'll catch that too
hm
whats this
sounded like discord stuff
how to create a new line in json
the enter button
\n
like:
"json": [
"alreadyhere",
"new"
]```
what
ok
"i got this": [
"this was already here, new , gets created >",
"and this comes here"
]```
https://prnt.sc/r4ewqf like this?
oh god
you arent using json to store data, are you?
to be fair mongo uses json 
I used to have sqlite and that kept breaking my bot loll
So I swapped to json, works much better.
Oof.
Can anyone help?
Hey, I can't get my website to show up on the bot page? using object html.. I trade Iframe too but it doesn't seem to work.
It should work if you use it correctly?
well it spaces out as if it did work
but the website doesn't actually show up
it's just big white space
bot ID?
I'll add it back what I was doing
Hmh okay
@flat pelican 678564701499686931
I did
did you actually save it
yes, if I click edit this shows up

there, I added head to it
now it just shows the spacing of the width and height
well it did atleast when I previewed it
and is that code wrong? could you point me to the right direction
defo working for me
I thought this is how iFrame works
<iframe src="https:/somewebsite.com" width="100%" height="1250px">
</iframe>```
I really need to fix the none existant driver error
its the one flaw
with the most devistating concequences
yeah it didn't work
so what's the problem?
I don't see any errors
ohh nvm
Mixed Content: The page at 'https://top.gg/bot/678564701499686931/edit' was loaded over HTTPS, but requested an insecure resource 'http://clank.xyz/commands'. This request has been blocked; the content must be served over HTTPS.
guess I gotta get a certificate lol
ill just make my description with markdown
@earnest phoenix your domain clank.xyz needs to be secure with https
You can get a free ssl cert using https://www.sslforfree.com/ or you can sign up for cloudflare with their own cert
https://nmw03.is-inside.me/sBmGtFc9.png
This is my code. I want to when message author isn't voted send a warning
Result:
if(voted) {
cmd.run(...)
} else {
message,channel.send(...)
}``` assuming you want to block the command if the user did not vote
thanks 👍
letsencrypt also gives free sll
that website uses letsencrypt
I use certbot and cloudflare with full encryption mode
I think certbot uses letsencrypt tho
certbot is a cli tool for letsencrypt
afaik letsencrypt is the only free certificate authority, so every thing out there uses them
If u use cloudflare dont use certbot, just apply ssl in FULL STRICT for cloudflare and this work perfectly 
The Full (strict) SSL option checks for SSL certificate validity at the origin web server. A self-signed certificate cannot be used. A Cloudflare Origin CA certificate or valid certificate purchased from a Certificate Authority is required to avoid 526 errors.
while (coding) brain.offline()
its more efficient to do js while(coding) { if(brain.online) { brain.offline() } }
imagine not having all the code in 1 line
while(coding) brain.online ? brain.offline() : null```
whole(coding) { if(brain) { brain = null } }```
@quartz kindle i prefer to use ()() instead of null
whole
delete your entire brain
while(coding) {
//copy&paste random code
}
jesus that will kill your cpu and ram
@earnest phoenix for a .dev site you need a certificate and just using full strict mode doesn't work.
full strict shouldnt work without a certificate in general
I use only full strict mode and i have (CloudFlare Inc.) In ssl certificat
@earnest phoenix where is ur green role
@tight plinth i have deleted my bot i make a new one later lol
too green, needs to mature a bit more before it can be eaten
omg
nubs
while(coding) brain.online && brain.offline()

jk that reads so badly
$brain.online or die while $coding
in perl except the terminology used is a bit... strong
Do you really have to edit it that much
you also don't have to create a new embed each time
you can simply use the same one but just edit its properties
which in the case of editing a message, kind of makes sense too
pass the eye bleach
For some reason, when i attempt to track key holdings with keyup and keydown events, the keyup event immediately follows after the keydown even when the key has not been let go. Is it a bug or
i figured out it was an issue with a shit keyboard extension i installed, uninstalled and now everything works perfectly
@frozen cedar wHAa
get list of users
use some sort of random choice or random number generator for your language
discord.js has collection.random()
How some servers use 2 second slowmode
so like:js var peopleReacted = msg.reactions.get("🎉").users; const winner = peopleReacted.random()

how can i detect a reaction to an older message in discord.js
use partials, afaik the feature is only available on master https://github.com/discordjs/discord.js/blob/master/docs/topics/partials.md
partials?
or just use raw event
What version of python should i use for discord.py
3.7 probs the best
Ok thx
Use js
Yea
Does that work w/ python?
no
Ok
No, of course
hes just meming
:)
Does node.js work with python or no?
no
Idk
What kind of question is that
Do i do 3.7.6?
what
I need to download python
So yea
Use python 3.8
i think u wanna learn the basics
To use discord.pu
To use the walrus operator 
cuz you seem new
I am new
I have never coded a bot b41
^
Ok
in any way shape or form
So what do i use?
If u want an ez lib d.js is the best
For python
and you wont get anywhere not knowing the basics
D.js? Is that beginner friendly?
NO
No programming languages which use discord will be begginer friiendly
No programming languages which use discord will be begginer friiendly
@modest maple nice wording
thank you
Python+discord isn't beginner friendly
anything + discord isnt beginner friendly
no
Ok
jesus dude
@static trench try https://store.steampowered.com/app/682130/Discord_Bot_Maker/ : u can make ur bot easily and it will create the code for you
Discord Bot Maker is a powerful bot development tool for the #1 text and voice chat service for gamers: Discord. With this tool, you and your teammates can take your social experience to the next level!ExplanationOne of the most prominent features provided by Discord is the of...
$9.99
806
What do i use?
You gotta use lua
do you know what the <file>.xyz means
Ok thx
yh
Nooooo
might aswell use discord bot maker
I know Lua from roblox
Don't tell them to use dbm smh
I will use discord bot maker
or actually learn a programming language properly frist
Yes
isnt there a discord library for lua?
discordie i think
There is a discord library for basically a'y language
ima bounce
discordbotmaker is a system that does the bot for you, kind of a scripting thingy, it runs with javascript and node.js
Yes discordia is the name
Ok! To confirm I should use steam discord bot maker?
you should use whatever you want
Ok
@static trench use whatever u want
Yrs
discord bot maker is for those who dont know programming and dont want to learn programming
And how do i get a green name tag?
everything else requires knowledge of a programming language
@quartz kindle i want to learn but u am not goo
By having a verified bot in the website
Np
var reactionChannel = client.channels.get(event.d.channel_id);
reactionChannel
.fetchMessage(event.d.message_id)
.then(msg => {
var guild = client.guilds.find(uGuilds => uGuilds.id === event.d.guild_id);
var memberRole = guild.roles.find(uRoles => uRoles.name === "NEW MEMBER");
var member = guild.fetchMember(event.d.user_id);
console.log(member);
member.removeRole(memberRole);
})
.catch(err => console.log(err));
It keeps saying member.removeRole is not a function and I don't have a clue why. I've been trying to figure it out for the last hour... anyone have any ideas?
have you tried browsing the docs per sé
fetchMember is a promise iirc
anything that has fetch in it's name implies a request to the api
You gotta do fetchMember().then(member => member.removeRole())
Mdn
@sinful belfry https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
thanks a lot
read up on async await in js instead
it introduces you to the whole scope of asynchronous programming
Kinda
I'm trying to do this:
"if the client is not predefined" is client referring to node or discord.js ?
it shows two examples, one with a "predefined client" the other without
the difference between those two examples is the existence of Discord = require("discord.js") and client = new Discord.Client()
therefore it is referring to discord.js
which file do those lines go into? package.json, package-lock.json index.js or config.json ?
ah, they look like index.js lines
I'm learning 😜
they cannot be json files because they contain javascript code
json files can only contain storage objects, not code
JSON stands for Javascript Object Notation so its quite literally a javascript object written as a string and meant to store simple data
Restarting servers to install updates is a pain
Altho might take this time to check some stuff in bios
if(reaction.emoji.name === "▶️"){
if(a === 0){
collected.first().remove(collected.first().users.filter(user => user !== bot.user).map(data => data.id).join(""))
msg.edit(embed_2)
a = 1
}else if(a === 1){
collected.first().remove(collected.first().users.filter(user => user !== bot.user).map(data => data.id).join(""))
msg.edit(embed_3)
a = 2
}else if(a === 2){
collected.first().remove(collected.first().users.filter(user => user !== bot.user).map(data => data.id).join(""))
msg.edit(embed_4)
a = 0
}
}``` when I click a second time on the reaction it always puts me on the first page (embed_2)
Following up on a conversation yesterday i made a test browser game which connects users with socket io, i set the client to send keyboard keys pressed to server every 100ms and the server sending the state (player positions, health and bullet positions) every 40ms, but the problem is theres sudden huge packets per second drops from like 30/s to 0. Increasing the latency stops this from happening but the game becomes very choppy and slow. Is there any good way i can mitigate this and use something else instead to stop the packet drops and increase the smoothness
is the server and/or client getting bottlenecked somewhere?
@wicked pivot sounds like your a variable is getting redefined/reset
how can I do ?
a and defined above
let a = 0```
help me please it's been more than 2 hours that I'm on it that I'm on 
show full code
look dm @quartz kindle
also switch exists pls
your reaction collector will only work once
you have awaitReactions() with a limit of 1 message, then after the reaction is received, it edits the message and the code finishes and exits
it will not await for more reactions
you need to either restart the function or use a reaction collector
how do you
when you install a package while the program is already running, how do you require it?
cause it keeps throwing the "Cannot find module <module>" error
@wicked pivot send code here
let a = 0
message.channel.send(embed_1).then(async (msg) => {
await msg.react('▶️')
await msg.react('🔄')
restart() // lancé la fonction restart
async function restart() {
msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time']}).then(async(collected) => {
const reaction = collected.first()
if(reaction.emoji.name === "▶️"){
if(a === 0){
collected.first().remove(collected.first().users.filter(user => user !== bot.user).map(data => data.id).join(""))
msg.edit(embed_2)
a = 1
}else if(a === 1){
collected.first().remove(collected.first().users.filter(user => user !== bot.user).map(data => data.id).join(""))
msg.edit(embed_3)
a = 2
}else if(a === 2){
collected.first().remove(collected.first().users.filter(user => user !== bot.user).map(data => data.id).join(""))
msg.edit(embed_4)
a = 0
}
}else if(reaction.emoji.name === "🔄"){
await msg.clearReactions()
msg.edit(embed_5)
}
}).catch(async(err)=> {
await msg.clearReactions()
msg.edit(embed_5)
})
}
})
}```
Ok what's the error, I don't want to scroll all the way up
@grizzled raven check this https://www.npmjs.com/package/live-plugin-manager
@wicked pivot what you want to do is not as easy as you think because it requires that the message is cached, and if your bot restarts, it will no longer react to that message, but basically you have two options: a reactionCollector or a recursive function
so i have to restart my bot to use that
xd
honestly i'll just wait
actually
no nvm
OPTION ONE
// reaction collector
const collector = message.createReactionCollector(filter, { time: 3600000 }); // work for 1 hour
collector.on('collect', r => console.log(`Collected ${r.emoji.name}`)); // the collect event will be fired every time someone reacts, not only once
collector.on('end', collected => console.log(`Collected ${collected.size} items`));
OPTION TWO
// recursive function
function reactions(msg) {
msg.awaitReactions(filter,options).then(result => {
// do the message edit here
reactions(msg) // restart the reaction function to listen to the next reaction
})
}
@wicked pivot
so if i use that, will i have to use the manager.require instead of require?
sorry I took too much head with this code x)
@grizzled raven yes, you can also check its source code to see how they do it
i checked it out of curiosity
basically they do it like this
resolve module path and entry point from package.json
get main file contents with fs.readFileSync
execute/eval file code in a vm sandbox
return result and cache it as a variable
export it back to you
oh ok cool
btw
when you read a file, how do you like
convert it from buffer bytes to readable string?
nevermind#
Okay, I'm using discord.js and I made some new commands. No matter what command I try, I always get the same error.
0|index | at /root/DiscordBotApp/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15
0|index | at /root/DiscordBotApp/node_modules/snekfetch/src/index.js:215:21
0|index | at runMicrotasks (<anonymous>)
0|index | at processTicksAndRejections (internal/process/task_queues.js:97:5)
0|index | (node:656010) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)
``` I've checked, the bot does have permission to send messages in the channel it's trying to (it has admin). I really can not think of anything else to try. Is this possibly a problem on Discord's end or am I doing something wrong? *I've also tried regening my token, didn't fix it.*
Does anyone know a good beginner platform that will help me make a bot? I am on Mac
@wooden lance you'll get more information if you catch the error
ie: message.channel.send(...).catch(console.log)
okay one sec
Hello people. I have a Python discord bot hosted on Heroku. In the last 3 days, sometimes (low frequency) I get this error when sending embedded messages.
Does anyone have any idea what may be causing this?
File "/app/.heroku/python/lib/python3.7/site-packages/discord/ext/commands/core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "Ve7s.py", line 227, in play
await Play.go(ctx=ctx, args=args, client=client, partidas=playing, admin=ve7sadmin, vets=VeTs, db=ve7sdb)
File "/app/Ve7sGame/Play.py", line 141, in go
await game.task
File "/app/Ve7sGame/Play.py", line 114, in match
await gameloop(game, partidas, client)
File "/app/Ve7sGame/Play.py", line 44, in gameloop
await game.canal.send(file=File(data, f'hazzu.{ext}'), embed=embeder)
File "/app/.heroku/python/lib/python3.7/site-packages/discord/abc.py", line 839, in send
content=content, tts=tts, embed=embed, nonce=nonce)
File "/app/.heroku/python/lib/python3.7/site-packages/discord/http.py", line 164, in request
data = await json_or_text(r)
File "/app/.heroku/python/lib/python3.7/site-packages/discord/http.py", line 43, in json_or_text
if response.headers['content-type'] == 'application/json':
KeyError: 'content-type'```
@static trench there is no "platform", aside from maybe discord bot maker or something like botghost (the latter is not allowed here). what most people use is a library to connect to the discord API. those exist for a variety of programming languages and environments, but require basic knowledge of programming and coding
0|client | at /root/DiscordBotApp/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15
0|client | at /root/DiscordBotApp/node_modules/snekfetch/src/index.js:215:21
0|client | at runMicrotasks (<anonymous>)
0|client | at processTicksAndRejections (internal/process/task_queues.js:97:5) {
0|client | name: 'DiscordAPIError',
0|client | message: '401: Unauthorized',
0|client | path: '/api/v7/channels/568991043039526942/messages',
0|client | code: 0,
0|client | method: 'POST'
0|client | }
``` yep doesnt have perms to send messages....but it does
unauthorized doesnt necessarily mean missing permissions
which channel has that id?
is it in a guild where your bot is in?
does the channel have permission overwrites?
is this the right variable names for mongo?
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});
const Model = mongoose.model('Database', { name: String });
const table = new Model({ name: 'Table' });
table.save().then(() => console.log('Saved!'));```
yes but the bot would bypass it anyway, it has administrator
try removing the channel permissions or explicitly adding the bot to them
also check the role position. even if it has admin, role positions still matter
yep i have
401 is wrong token
but it logged in
403 are perm issues
did you create a duplicate client?
issue found and resolved, when i copied over some code, i obviously copied broken stuff. i found client.token = undefined
why would you do that lol
i have no clue
xD
mongodb doesnt come with a dashboard


