#development
1 messages Β· Page 932 of 1
bye
unless your js file is named task_queues, which is in a process folder which is in an internal folder, no that's not where the error is coming from
My script
if(usedCommandRecently.has(message.author.id)){
message.channel.send('This command is still in cooldown, please be pleasant :D').then(msg => msg.delete({ timeout: 2500 }));
}
Error:
(node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
at Object.run (/app/commands/info/stats.js:13:47)
the code: ```js
message.channel.guild.members.filter(member => member.roles.some(role => guild.mod.roles.includes(role)))
ahhh, i'm so late
mod.roles is an array of ids right?
yeah
so is it working?
it returned an empty array?
How i'm i supposed to connect my bot to a database
wdym?
like you would without your bot
your bot has nothing to do with how you interact with your db lol
you have google.
@earnest phoenix remember the link you gave me? regarding the emojis
Like store data in a database for example servers list and message points
the emoji map?
Like mee6
yeah
I have trouble getting emojiDefinitions as defined. I see it creates an [] but it returns as undefined every time π€ (using axios to retrieve the data from that link).
@slender wagon just pick the db you want to use and look up how to use it?
is it possible to make bot reply in embed ?.
So I get response, then response.data returns successfully, but response.data.emojiDefinitions is undefined.
Oh okay
yes zac
Do u have any suggestion?
you might want to download the file locally so you don't have to make a request to the file on the web all the time
you could use quick.db thats a pretty good db for starting
Are those things free?
eww
Or should i pay
use postgresql
cries in quick.db
you should pay
bruh time to learn how to use embed i guess.
quick db is paid?
it won't be hard
Oh okay
nani
@earnest phoenix yeah i did like 5mins ago, but I googled if theres a way to retrieve a local file with axios
why do you need axios
idk i'm stuck with it
bruh
I'm really new to this database thing and it seems confusing
after i tried it on api I just made a whole code for it
just require the file
I don't feel like clearing it out ;c
or import it
yeah ik
it's already in json
but wait, what if the emoji map updates
might need a handler for that in case of any missed updates i guess.
discord doesn't update the emojis they use very often, it took them 4 years to update to the latest twemoji lol
and even now they're on an outdated ver
oh, good then
the latest mod-log
how to make neko but its not nsfw
i want to add it :v
neko is always nsfw
neko is cat
and mostly filled with nsfw nekos, make your own api and filter out the nsfw ones
neko is cat and people use cat(neko) as nsfw
what are they doing to neko command ;-;
because weebs
wait is your bot the one that got denied because of the nekos.life api?
you shouldn't use the nekos.life api at all
nvm your bot wasn't denied yet
but still, dont use nekos.life, the best thing to do is to make your own api to have full control of its content
still, if you want a nsfw-free neko command, its best to make one yourself

neko is cat but because there's so many fantasy animes with nekos character, people made nekos anime nsfw with nekos character and i hate that ;;--;;
thats how weebs work
^ that's when peverts act
fr tho, i'm really confident that theres no non-nsfw neko apis 
just donβt look at it 

why my kick command ended up banning lol
check your code
check your code
oh right my kick code had a little code from ban function.
"little code" meaning the one would that actually matters?
not really i forget how to make kick commands so i copy a little bit of ban function and expand it a little bit and it still banning people xd.
Anyone here uses or used Lavalink before and knows how to get rid of this issue?
hmmmm go to the erela.js server and ask...best idea ever
i dont understand why I have trouble requiring a json file
i even tried fs readfilesync and json.parse
just import it like a regular module
check the file path maybe?
Console returns MODULE_NOT_FOUND
Uh file path should be correct
I also tried path-ing directly to it.
are you trying to read the file?
requiring it.
also reading doesn't work, it says the file can't be found
Even though im 100% sure the path is correct
are you doing it like this?

pepeHands
verified developer
Ceritified
discord developer 
.
@oak cliff
how tf did i waste 10 hours on this
in 10h i did so much things to my bot
like yesterday
that you definitely dont think about because they're so obvious
yea dont worry i spent 2 hours to find that i was missing a semi colon...
i spent my career coding bad shit
I'm probably too used to only test things with my vps.
so i didnt realize i dont have THE JSON FILE in both locations
;c
I said i'm too bored to fix the mysql issues on localhost so i decided to use vps for like my whole life
just use something called a SFTP Network Drive
and you could code like you would have these things on your Drive
host from a usb
host from a samsung smart fridge 
host from a smart oven
even better
smart thermostate
toaster
https://sourceb.in/9d8a30f3da
right now if i try to battle someone they can only accept if they are the firt person to respond
so if use the command and a random person sends any message before the before the person i challenged accepts or declines it doesnt work
how to make bot activity as a elapsed time like this :
Watching Discord Bot list
Elapsed time : XX:XX.
i mean watching how much server the bot were in.
@queen needle
what?
ugh i tried to search cat picture using reddit and this show up :
(node:4) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
@quartz kindle is there a problem with that
===
yea thats what u use
thank you
@fickle arch the elapsed time is from rich presence
when i swithced to that it doesnt work at a;;
but the wathing servers can be done with
client.user.setActivity(`text`, {type: WATCHING});
like no errors and now it doesnt work at all
@sterile mesa does it even return mp4s?
@earnest phoenix where i could get the rich presence for it ?.
i have some problem with this plz help js if (message.guild.me.voice.channel.id != message.member.voice.channel.id) return message.reply("You must be in the same channel as me").catch(console.error);
are you trying to check if the bot and user are in the same voice channel?
yep
const voiceChannel = message.member.voice.channel;
if (!voiceChannel || voiceChannel.id !== message.guild.me.voice.ChannelID) {
return message.channel.send(`You need to be in the same voice channel as ${config.clientName} to use this command.`);
}
this should owrk
fix ur function
yep u dint have to tell me the exact code but thx 
which function?
filter
now they're gonna say 'bUt fIlTeEr iS nOt A fUnCtIoN, iTs A vArIaBle'

why when i'm trying to make invite link for bots after i pressed authorize it always end with big X in the middle.
I have this function for checking permissions: ```py
def is_author_authorised(ctx) -> bool:
"""Checks if message author is in an editor role"""
if (
ctx.message.author.server_permissions.administrator
): # allow dev or admin
return True
return False
But it's returningnone
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'server_permissions'```
Has it been removed in rewrite?
anything server -> anything guild
I am so bad with lists. This question is so trivial, that u can not find anything good on stackflow and even in a javascript documentation, they didnt show this case.
i have this json file: "list": [{"abc":"zks","bcd":"jdiw", ... }
how should I know store "abc" and "zks" in two different variables?
My first idea:
let a = list.key[0]
let b = list.value[0]
console.log(a+b)
abczks
what should I change?
Imma bad about that REEEE
@midnight blaze what are you even trying to do?
do you want to display them
or what
if so then you could do
abczks is what you get or what you want to get
please be more descriptive
because I don't get anything from that
list[0].key
thanks
gets the value
yeah, but I need both seperated
to get the value of abc
doesnt that show all the keys/values?
its an array of the keys and values
so like
const keys = Object.keys(list)
keys[0]
how do i update my repository after i'm updating the code that i used while the bot is on hosting.
Question I got
If I have this
bot.on("guildMemberAdd", (member) => { let welcome = bot.db.get(`welcome_${member.guild.id}`) if(welcome === null) { return; } bot.channels.get(welcome).send(`We have a new member arriving! It was ${member}! Have fun!`) })
why when someone joins, it sends the message twice
fixed!
good
anyone know how to convert my code into embedded for welcome message ?, or just help me figured out how to do it, here is my code
const channel = member.guild.channels.cache.find(channel => channel.name === "yourchannelhere");
if(!channel) return;
channel.send(`your message here ${member}`)```
i'm not really good at embed.
i've tried with this
.setColor('#0099ff')
.setTitle('Welcome')
.addField('', member.nickname)
.setImage(member.user.avatarURL)
member.guild.channels.get('701391792020389930').send(exampleEmbed);
});```
are you on v12?
yeh.
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Welcome')
.addField(member.nickname)
.setImage(member.user.avatarURL)
member.guild.channels.get('701391792020389930').send(exampleEmbed);
});


dont you need cache before get?
--- if its not the k
can embed fields have empty spaces now?
did they add an auto blank space to it
when you don't provide anything
bruh why everytime music come end the bot auto disconnected from voice chat.
show your code
really quick question
is the way it works
[the name](the website)
for embed
or the other way around
yes you can
what
you can hyperlink in embeds
i had this trouble on my play function
^
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined```
whatever you passed isnt a string
Maybe he passed a kidney stone π€·ββοΈ

what is the reason for this error?
it had no content
I don't understand, are you telling me?
yes he is
Whatever field you had doesnβt have anything in it
bruh it sometimes show error because the string thingies and it sometimes don't.
how are you passing it?
typing video url
i mean show the code where you pass it
wdym on pass ?.
@lofty grove you could check to see if it was a partial first
@lofty grove you could check to see if it was a partial first
@steel drum How is it going to be?
@fickle arch where do you send the link?
just like this !play linkhere
Do I add this?
some implementation of this, probably
I understood thank you.
np!
can i see your code....
wow tf it happened again the music sometimes load and being played or sometimes the bot won't played it and shown error.
are you using ytdl-core?
how would i make a bot that assigns roles with reactions
yeah ytdl-core.
show me the code where you pass the link
what do you mean on pass the link ?.
do you mean like this ?.
.play(ytdl(song.url))
.on("finish", () => {
serverQueue.songs.shift();
this.play(message, serverQueue.songs[0]);
})```
where do you tell ytdl to use the link the user provded
because i'm not using youtubeapi for word search.

if using that you could search for example !play despacito without putting the link.
just use lavalink...
but the problem you are having is however you are getting the link
its not a string
either its undefined
or something else
yeah it sometimes work and sometimes don't
you replace entire code for lavalink or just replace ytdl core ?.
oh god.
it could use for discord.js to right, cause i'm not used to other than djs.
i mean the lavalink.
yea
if you want a good tutorial, go to Anson the Developer or Menu Docs
they both have good videos on setting it up
oh yeah, i watched Menu Docs to.
are you on a vps?
yeah.
if you do end up switching to lavalink
hit me up
you need to do some extra steps if you plan on using it on a vps
How can I get the ping in Discord.js v12?
ocrap thanks
vps is the hosting right ?.
is it just me or that pic is moving xd.
you
just you
my eyes tired watching screen for alittle bit long.
oof what you used it for.
what bot id
/bot/youtube
oh.
is it for your bot page?
yes
#bot-details-page .bot-img {
box-shadow: none!important;
}```
oh you need #bot-details-page

cool thanks

lol
haha ik someone named danny that is japanese irl too
still japanese 
and i assume 99% communist?
oops
this isn't the support server for any bot
how can I make it so the message.content.startsWith function ignores capitalization?
message.content.toLowerCase().startsWith()
you convert the content .toLowerCase()

Im wondering how to read DMs to my bot and if it is possible, Like if my bot receives a DM then it sends it into a channel i specify. Do you guys know if it is possible? (js)
you just do a check to see if the channel is a DM
ok, I am unsure how to do that, I will experiment a bit and if i cant figure it out i will ask for assistance again. Thank you
let me get a link for you
Check the channel type
Check the channel type
@earnest phoenix I legit just told him to and he doesn't know how
@uneven monolith that link is for you
Ok, Thanks
if(<message>.channel.type == 'DM')
no spoonfeeding...they won't learn
its not
I was not asking for the answer i was asking if it was possible
ok, good sign. I wrote what i think could work and when i typed a message to the bot in a DM it had an error so im on the right path.
It works, This is what i got
Im gonna add some things like who sent it and things like that
Thank you guys
@uneven monolith 

any idea how to use this timestamp : 2020-05-18 00:00:00 in a mysql query? tryed to set is as a string but for some reason it only gets the time in the string WHERE timestamp = "${date}"
tryed to set it as '${date}' but the error persists
Don't we need cache.get in v12?
you need
you are definied date? (var date =)
okay so in mongodb i have the following document structure {id: 1234, nodes: [{from: 1, to: 2}, {from: 2, to: 1}]} how could i query the node objects based on only the to or from value?
do you expect to get an answer here
never used mongo but can't you filter it or something
yes i am expecting an answer thats why im posting, and i could filter but that requires grabbing all values and then filtering through them with code, and im wondering if it can be done with just 1 query
How can I Get my bot verifyed
?
How can I Get my bot verifyed
||Ping me if you know how||
are you sure you can't filter in the query? @mossy vine
thats what im asking (β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
try reading the docs smh
i did that
@green kestrel can you run -verifybot for @earnest phoenix
what?
brain have a high ping
lol sure i'll get right on it
1000000000000ms
fact of the day, ping times for probes on mars are measured in minutes.
didnt even run the command
let target = message.mentions.users.first();
const kembed = new Discord.MessageEmbed()
.setAuthor(`${message.author.username} kiss ${target.username}`, message.guild.iconURL)
error
Cannot read property 'username' of undefined
no one mentioned
looks fine to me
probably isnt an issue with what you are showing us
Β―_(γ)_/Β―
is mongodb good for start?
I'd say it depends for what you'd wish to have a database for, there are many advantages and disadvantages for many databases.
I solved that but idk how but now i did a
if(target) return message.channel.send("mention someone");
but this doesn't send anything if i don't mention someone
any idea?
oh well actually i just need a good track for the servers that my bot is in
cuz the log console is annoying
!target
@torn nebula even with ! is same thing
oh well actually i just need a good track for the servers that my bot is in cuz the log console is annoying
@slender wagon I'd just make it so in a channel you can log, using a guild added event, rather than having to use a database, and paying for upkeep depending on what you use.
@mossy vine Doesn't findOne accept filter JSON
oh yeah i thinked about that
but then i might add some other stuff that will for sure need a db
like points tracking for a specific game or something similar to that
Yeah that'd be a good use for a DB however you don't wanna waste storage to track guilds unless your saving data for the guilds, ie prefix.
@slender thistle yes but how do i filter for that
search for {node: [{from: 1}]}
i guess filtering in my code rather than in the query would be better
How to check a given user id is fake or real?
you can try to fetch the user from the api
^^^^^^^^
SyntaxError: Unexpected identifier
I got this error in my console. [discord.js] Can someone help me to fix?
syntax error
recheck your syntax
you can try to fetch the user from the api
@smoky spire wdym?
Aka https://www.w3schools.com/js/js_functions.asp will help.
@thorny meteor if the user id isn't valid, the api won't return a user if you try to fetch it
https://discord.com/developers/docs/resources/user#get-user i guess @thorny meteor
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
so i use a catch?
Bonjour, je voudrais savoir comment mettre en status "regarde (...) messages" en fonction du nombre de messages sur les serveurs ou mon bot est ?
So
i just d oclient.users.cache.get(id).catch()?
getting from cache isn't fetching from the api
How to check a given user id is fake or real?
let real = false;
if (client.users.cache.get(id)) real = true;```
that
idk
that seems correct
ok
ah fetch
Can someone help me with this error please?
serverinfo doesnt work but only in this server
the user is not cached
just use fetch
you cant... just copypaste code from the sample and expect it's going to work
read the text above shiny colorful code blocks
maybe guild is actually undefined
wait, this only works on v12 right
because it seems like the page doesnt exist in v11
what are the embeds in v12
what was even the point of changing them wtf
i mean alteast it turned on
MessageEmbed iirc but check the v11 to v12 upgrade guide.
replace feature one by one
yeah because you can specify dimensions and format
^
and i am still not
eris is cool tho
music sucks but ye
Any doc's . How to add emoji like this
Ok
ok ty
manually?
that's how wrong your code is if it has no error and it's still not working
but before doing that
do dbl.on('posted', () => console.log('stats posted'));
that'll tell you if its actually posting or not
Ahhhh

const DBL = require("dblapi.js"); const dbl = new DBL('Your top.gg token', client); // Optional events dbl.on('posted', () => { console.log('Server count posted!'); })
This is all i need right?
^
Ok i'll paste this in ready event and try again
but how much time does it take to show the count?
nononononononnonon
Or no time?

and it's instant
the fact it's not showing up means that either:
- the library is screwed
- your token is wrong
i'm not even sure how you got the token if you're not owner of the bot
u sure the token works tho
why doesnt your friend add you to the bot
that would literally make everyone's life easier
^
it shouldnt be
except the log line
how do you chekck the token
@tight plinth post to it i guess?
idfk
with it*
anyway why can't you show me the bot page for this bot
it's public so i don't see a problem
then do it manually with a http lib
Btw dbl.postStats is necessary?
Cuz i dont see it on api docs
Oh its down
But is it necessary?
My whole code is correct still it doesnt work
Idk why
Who made that package
Pls recheck it dude
guys who can help me to program a bot in js?
you don't have to use postStats, but there isnt a reason to not to if you are using the library anyway
Why is say a parameter
btw ur code is fucking old a shit
currently upgrading to v12 and im getting this error fn.bind is not a function
@modest maple can you tell me how to give it the βparamβ?
use snipping tool lol
And i just started today so i bet it is old as fuck because i have not got much knowledgr
I am having this error... v Error: Could not locate the bindings file. Tried:
What is the problem?
I did not have this error before i went to bed last night.
or just straight up remove say
I don't understand why I have an error
not like youre using it
So i just keep client?
no
there is no ffmpeg module
fucking get rid of the old shitty code
Remove say from function parameters
and dont copy paste next time
@turbid bough I don't want it..
then remove it
how
No need to be toxic
remove it on BasePlayer.js
Bruh what?
???
you don't want to have ffmpeg you said
yeah I don't
Error: Could not locate the bindings file.
???
i have error : TypeError: Cannot read property 'setActivity' of null
you are trying to set the activity before the client has logged in
@turbid bough yeah I don't want it at all.
put that code in the ready event
nice i go try this thanks
you see this stacktrace? https://img.thaun.dev/miers.png
try removing the one that has that require
how do i publish my bot
-faq 1
@turbid bough i'm very confused...

Your code is trying to load ffmpeg
I have a discord.js question, How would I display the first argument of a message, Would it be ("my text here") + (args[1])
you are trying to require(ffmpeg) which you don't have
though, you seem to need it though according to your script names
soo, pip install ffmpeg
I don't want the ffmpeg tho..
oh wait thats python
what does fn.bind is not a function mean
any reason?
I just don't want ffmpeg..
your bot seems to depend on it though
So i'm gonna need to re download it...
you will need ffmeg
whats wrong with ffmpeg lol
I don't like it and idk the purpose of it...
voice
Well i'm just going to re install ffmpeg
run npm i
A complete, cross-platform solution to record, convert and stream audio and video.
then do npm i ffmpeg
ffmpeg is a media transcoder, it is required for voice functions in discord.js in order to convert audio into something discord understands
Anyone know why this happens?
you slap
my code is: client.on("message", (message) => {
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case "slap":
message.channel.send("You slap");
+args[1] + "!";
break;
}
});
i dont know, ask your self
"i dont want discord.js cause i think it might be bad"
"btw how do i make discord bot"
thaun do you use djs?
thats what you're sending
no
fair enough
no
is DAPI being slow for anyone?
no you didnt
api is fine for me
.send(everything inside here will be sent)
everything here has nothing to do with sending
im more talking about when he tried to remove ffmpeg when his scripts has "voice" in his scripts and folders.
tim do you use djs by anychance lmao
yes
@turbid bough so i need to re download it now?
yes?
Ok
idk just npm install ffmpeg
aha, im upgrading to v12 and im getting this error on my mute cmd fn.bind is not a function
I did that, do i need to do that again...
v12 requires node.js v12 or higher
Don't i need to download it from the website.?
if you already have done it you don't need to do it again when you already have it
already has node v12
do console.log(process.version)
Yeah but i just need to download it from the website now..
when you install it with npm it already is installed on your workspace
uh, idk
do you need to install it on the whole os too to make it work when you have the library?
show the full error
I use praw to fetch an image from a subreddit but i dont get it. Im beginner python because i was ready for a new challenge so please dont be toxic
Idk, i just copied a tutorial on how to download ffmpeg and i had to download it from the website first
whats mute.js line 40?
you are missing an argument in say()
that way of using .find() was removed
oh so what is it now lmao
@earnest phoenix Show me your command function
Why do you have a say argument there if you're not using it
also, please do not take a picture with your phone to show code
This is a photo before i added the print function @slender thistle sorry for that
i barely see how that relates to the error
what about the computer you use now?
i get this error message:Please enter at least 300 characters excluding special characters in your detailed description. Add your commands. Spaces or empty spaces are not counted.
am i missing something?
anybody knows of a discord bot that would ping role X when a role Y is manually set to a player?
the github?
300 characters for github link?
no
Please enter at least 300 characters excluding special characters in your detailed description.
i dont want to make the bot script released
the detailed description / long description is the black bar
@earnest phoenix Show me the function
write information about your bot in the black text area
that has an argument say
ok
What is that loop there for anyway
where is line 500
Where's the rest of your code
Anyway, you only need ctx
for that command you don't need a say argument
for loop is probably to loop trough an array of submissions
limit=1 could probably just access the first element if it's a list
if (!message.member.hasPermission("MUTE_MEMBERS")) return message.channel.send("You need the MUTE_MEMBERS permission!"); would this still work in v12?
oh okay well now it prints the url to the console obv but how do i make the image post to the channel i did the command in
i think his issue is on an another side that he thinks it is
I don't know, check Misly.
just await ctx.send(submission.url)?
the docs exists for a reason
that sounds about right
if submission will have a url property, yeah
But something is telling me you are most likely getting a dictionary, but... 
use the debugger to view what the info you are getting
or just print it
printing is for normies, debugging is for chads
Banned for wrong opinion
My bot powers on perfectly and when I type my <rip command (sends a rip image) my bot goes offline and my terminal says ReferenceError: MessageAttachment is not defined
when I checked the discordjs docks after that works and it has MessageAttachment in it
two possibilities:
either you're defining the messageattachment the wrong way OR the image does not exist/have wrong path
s
-dotpost
Nah that's -spost
--spostpost
Hey. I've got a promise inside a promise. If that inner promise gets rejected, I want the outer promise to complete, so my code can continue. How?
show code
limit=1could probably just access the first element if it's a list
@slender thistle yeah i noticed that but i cant figure out how to limit it to only send 1 but not only the top from the list if you know what i mean
for example
non-async
const a = () => {
return new Promise((resolve, reject) => {
if(1+1 === 2) resolve(2)
else reject('Wrong')
})
}
a().then((n) => {
console.log(n) //returns 2
}).catch((e) => {
console.log(e) //returns 'Wrong'
})
or async
const a = async () => {
if(1+1 === 2) return 2
}
const b = await a().catch(console.log)
wtf is Discord doing
nothing
I can't send a message
i see it
well I can with this one, but not my code
idk your bot is broken i guess
ffs
idk your bot is broken i guess
@turbid bough because my bot is broken I can't send a code block here? lol
async log(guild, message, logType, messageAddition) {
return await new Promise((resolve) => {
con.query(`SELECT * FROM logpreferences WHERE guild_id = ${guild.id}`).then((logPreferences) => {
con.query(`SELECT * FROM serdverdata WHERE guild_id = ${guild.id}`).then((serverData) => {
if (!serverData[0] || serverData[0].logchannel == 'off' || serverData[0].logchannel == 'custom' && [0, undefined].includes(logPreferences[0][logType[0]]) && [0, undefined].includes(logPreferences[0][logType[1]]) && [0, undefined].includes(logPreferences[0][logType[2]])) return resolve();
const logChannel = guild.channels.cache.get(serverData[0].logchannel_id);
if (!logChannel) {
this.adminLoop(guild, messageAddition, 'Log channel deleted', 'My log channel was deleted', 'I deleted it from my database and turned logs off.', message);
insertData('serverdata', 'logchannel', guild, 'off', undefined, 'logchannel_id', null);
return resolve();
}
if (!logChannel.permissionsFor(guild.me).has(['SEND_MESSAGES', 'VIEW_CHANNEL', 'EMBED_LINKS'])) {
this.adminLoop(guild, '', 'Cannot send message in log channel', `I am not able to send my log in ${logChannel}`, 'I turned logs off for now. Make sure I have \'Send Messages\', \'Read Messages\' and \'Embed Links\' permissions in that channel. Then, reactivate logs.', message);
consoleLog('off automatically', guild, 'setlogs', 'not enough perms, updaterolecounter function');
insertData('serverdata', 'logchannel', guild, 'off');
return resolve();
}
logChannel.send(message);
resolve();
});
});
});
},```
The con.query is the other promise
oh i thought you meant your code in your bot was broken
Tim blocked me π€
wut
oh no
I wanted to mention Tim
@quartz kindle
oh now I can
does someone know how to limit praw from sending 500 messages but still keeping the messages random
what
okay so do you know praw?
what's praw?
python reddit api wrapper
why does it send 500 messages?
bruh
then it only shows the top post of the list
so no randomization
have you tried... not for looping to send every single entry
bruh
it's a logical flow, it isn't language related lol
every submission
send message
I think that was taken from somewhere
oh,idk
i dont know how to set looping to not send every message @earnest phoenix
sort of
you should definetly not make a bot as your very first project
I will say this. Discord Bots are not beginner friendly
guys i know but i need this for my small server
do i really need to explain this? i only asked for help for this one small command
and you asking very simple questions
which beginners should know
I made a reddit command with praw
Made it get top 20 hot
randomized
cool now i would like to know how i would do that
@nocturne grove it would be much easier to convert your code to async/await syntax
store data in a list
i thought he wanted to get the top?
can anyone tell me what the hell this is?
(node:3343) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/gateway/bot failed, reason: getaddrinfo EAI_AGAIN discordapp.com
at RequestHandler.execute (/home/dc/chinochan/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3343) 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: 2)
(node:3343) [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.
which is shown in docs
isnt that a little bit of a detour?
what is a detour
to first store everything and then randomize?
yeah you need to learn beginner python
Do you want to know how much lines my Reddit Command alone has
no
async log(...) {
let result1 = await con.query(...).catch(error => null)
let result2 = await con.query(...).catch(error => null)
if(result1 && result2) {
// do code here
}
}
``` @nocturne grove
i only asked for help not to be roasted
@quartz kindle I did that but it didn't wait for it to fully complete
I am telling you to learn
will try again tho. Thanks @quartz kindle
whoa, you saying that you need to learn python is a roast?
We all start from somewhere
exactly
My first python script was a calculator
I learnt how to use if else inputs print math
and other nonsense
including errors
okay okay
im saying if you don't know how to store a variable, then obviously you are trying to do something you clearly dont understand.
^
bro i only need this for my server and then i wont bother to do python ever again. i do not have the time to take a long course and make calculators to practice
we could give you the fish
yeah, you kinda shouldve gone to fiverr instead
but it's better if we show you how to fish
or invite an already made reddit bot
and that would mean you won't ever need to host it
like i said and i will say once again, i need this for my server and will never bother to use python again. please stop telling me i need to learn because i only asked for help. i got every other basic in this bot already done
just this small command
yeah i don't wanna spoonfeed much
We won't spoonfeed
Coding takes time to learn
holy shit
Its learning, learning and learning
do you even understand what i told you
@quartz kindle wait lol now it does work to use await instead of a whole promise. Thanks!

obviously he don't appreciate our help
Are you understand US
yeah then you don't know lol
We ain't giving you code
you are looping through 500 reddit posts and sending them all
@vivid crescent Don't spoonfeed
why are you surprised its sending 500 messages
I didn't tell them how to fix it or send any code
ye
i am not surprised it is sending 500 posts im just asking how to limit that but still keeping it randomized
you choose limit=500
google how to exit a loop or something
store the result in a variable.
yes
then get a random integer
from the length of that result
then send that result from that index
what about Math.random()?
that would work
no
it would be ..limit(...)[a random number between the first index and the final index]
i dont want a random amount
isnt it you want to choose a random post within that 500?
yes
so you gotta store the 500 subreddits in an array and get a random index for that
not inside a for
yeah thats what i already said
Yes
I done mine in a for loop to get a range to then get the url
ez
well I can't describe well
meh
I made this ages ago
and I also forced to get comments
all the comments
which takes more loops
π
omfg
Its a mess I need to fix
i do not want to store subreddits just want it to send a random image from a subreddit @lyric mountain
Yeah so why waste more time looping unnecessarily π
@earnest phoenix omg store it in a variable lol
@earnest phoenix we have told you how
MAKE A VARIABLE
i do not want to store subreddits just want it to send a random image from a subreddit @lyric mountain
store π in π a π variable (array)
idfk how to do that because if i would i wouldnt be here anymore
okok
bruh
can you tell me how to make a variable?
Yes tell us
imagine googling
<name> = <something>
okok
yes
hmm if you explain it like that
peter please stop being toxic because it really doesnt help me learn anything
please help me ```js
(node:3654) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/gateway/bot failed, reason: getaddrinfo EAI_AGAIN discordapp.com
at RequestHandler.execute (/home/dc/chinochan/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3654) 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: 2)
(node:3654) [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.
so put that reddit.subreddit("dankmemes+memes").hot(limit=500) in a var






