#development
1 messages · Page 1249 of 1
because one letter queries can be bad
nope
if(role.role.position > message.author.highest.position) return;??
collection.find only returns one thing
and it would be member.roles.highest
let role = message.guild.roles.cache.find(r => r.name == args[1]) || message.guild.roles.cache.find(r => r.id == args[1]) || message.mentions.roles.first()
@feral aspen OMG STOP USING INLINE CODE BLOCKS MAN USE HASTEBIN OR ACTUAL CODE BLOCKS NOT INLINE
@earnest phoenix why u mad..
welcome to the developer community of madlads
o k a y
its a literal one liner
Yea change the message.author to message.member
@quartz kindle I usually recommend Sanic because it's for the basic parts similar to Flask
a l s o i d o n t h a v e a 2 k l i n e i n d e x . j s
o k
few lines changed at best to run an async server, which is nice
i h a v e a 2 k l i n e b o t - c o d e . j s
😂
Be prepareted
still gets me
Be prepareres
@quaint hornet i wasn't prepared for a r/BoneAppleTea congrats you're now a meme
import brain
print(brain.iq)
> -34
congrats you just linked a subreddit outside of reddit
lol
funy
anyway lets go back to cODing
lets go back to code913ing
it's a pseudonymous name idot
HOW DARE YOU CALL ME AN IDOT
Ok how do I handle HTTP exceptions to stop being ratelimited by discord?
@earnest phoenix anyone?
Which version of node.js should I install for Discord.js v12?
10+
I installed 10 but gave this error
hey @earnest phoenix so that finally happends the other day 
12+
That's for better-sqlite 3
Hmm, how can ı fix that
Install node.js 12+
Node.js 12.0.0 or newer is required. https://discord.js.org/#/docs/main/stable/general/welcome
Did they change d.js to require 12+? Last I remember it was 10+
v12 has always required node.js 12+
Interesting
can anyone help me to fix could not find player config
???
Still
I don't think that's related to discord.js
This is glitch?
@vernal rivet you use server lunix or win
yes, i added it to glitch via github to test v12 @vernal rivet
you can help me to fix could not find player config @vernal rivet
@cinder patio I know the problem is from better sqlite but how can I solve it
@torpid tiger are you using pnpm or nom?
@fluid widget idk what you mean by player config. Can you elaborate on that please
@vernal rivet pnpm ı think
Ok try doing npm enabled
a l s o i d o n t h a v e a 2 k l i n e i n d e x . j s
@earnest phoenix i do jkjk 305 lines
Please tell me how the living fuck 0.7 * Abs(Tan(Sqr(Log(y * x)))) can raise a type mismatch error
if everything is a Double
I created a new music bot and it worked well, but there is a problem. There is some adult-only music on YouTube that he cannot play and see the picture
@vernal rivet
I have fixed it over and over but the same problem there is a problem with packages ytdl-core
yes
look
Ummmm I honestly never encountered that before. I use ytdl-core + simple-youtube-api.
I downloaded the new update but nothing happened
You've probably been 429'd from youtube
429 means too many requests
But the problem is not in 429 that the problem is in ytdl-core
Have you check the docs, or git repo for ytdl-core for the player config?
You have to pass a json object through. Check lib/info.js of ytdl-core in the git repo. Line 83, that will explain everything
I did not understand you
@vernal rivet
Check line 83
I know that it is a page for adults, but it requires a login and how to log in to get it @vernal rivet
@vernal rivet ok how to login to use +18
Did you not read the method. It requires a json string. Which is passed through the options parameter of the class I would assume
I understand you but I don’t know how to do it in order to fix it. Can you help me do it? @vernal rivet
https://alex.is-bad.com/9yPT1cL.png
https://alex.is-bad.com/3ky5s34.png
https://alex.is-bad.com/J6w21mo.png
Can somone explain me wtf am I doing wrong here? yes, i know I shouldn't use php file_get_contents to make http requests
i mean, at the second if, it doesn't redirect me at the correct page
it doesn't redirect me to /login?redirectUrl....., but to /login
nvm
anyone can help me to fix this
can anybody just help walk me through the process of creating a bot
See the bottom of #502193464054644737
oof heck. my computer doesnt let me open the thing that lets me code. Like visual studio isnt supported
I can't do this. I really needed this bot for mah discord. I just dont have the tools to do it. Heck. Sorry guys ;-;
Watch an up to date ytb tutorial
use atom
@thin turret what OS are you using (and/or what version of it). Have you heard of Visual Studio Code as well (not the same as Visual Studio)?
@earnest phoenix *
I'm on a chromebook. It doesnt let me open downloads at all
and because I am poor as heck I can't get anything else really.
So you can't download software
nope
An online code editor may be what you're looking for. I used a chromebook for a lot of my time, but it's no where as good as downloading the software.
School Chromebook
I dont even know how to set the bot up. I just woke up and was like "Yeah Ill try to make a bot."
i would need some serious hepl to just get the one command I need
Well, what's the command
especially the last two lines
Basically somebody types one thing, the bot waits approximetely 7-10 seconds then responds
I know java. And from school CoffeScript(dumb dumb Javascript)
so you should just be able to use the lib's docs to get started
where's the problem
I just needed something that can just comment a couple seconds later. I don't know how to write that in java and I dont know how to get that into a bot either. I know how to write it in a simplisctic version of javascript but I mean Im just lost
😦
you see. I dont understand what that is
I can't download files on my chromebook
and I dont know how to do it online, nor how to make the command I need compatable with discord, nor how to make the command cooldown before the response. nor how to make the code work with a discord bot
I'm just not ready for this, but I want to be, but I'm not
and I dont know what to do now
the top 2 results returned from the lmgtfy are thoroughly documented libs
you need a machine to dev on
if you don't know what a lib is or how to use one, you don't have enough knowledge
i'm assuming you learnt it in CS
um... I speak java, (albeit not well) And I dont have enough knowledge.
But I need this bot so I have to learn
where can I start learning?
pretty much any library requires you to have extensive knowledge of the language you're going to work with
I dont have extensive of java and I hardly think anybody even knows what coffescript is
so............. I cant. I just cant.
ok
All I need is it to literally respond to somebody saying ;p
heck
are you trying to get pity or what
but again it has to say it 7 seconds after somebody types ;p
no lol.
Well there's 2 options then. Learn java, by looking at the links cry has given you, or second option is don't do it.
i'm confused as to what you want to do
do you want someone to make it for you?
I know basic java. I dont know how to code the specific command
if you had just clicked any of the links i sent you (which are just lmgtfy, you could've googled it and gotten your answer)
no. Nobody has to make anything for me. No I dont want pity. I just... I dunno.. I guess I just need help because I obviously can't make this on my own. But nobody has to do anything.
but I just think I'm going to give up. I cant do this and thats ok
this channel isn't for teaching basics per se, it's more of "i have an x problem, looking for a y solution"
for basics there are a plethora of resources online which are just a google away
I've tried searching my problem specifically but I havn't found anynthing
Javascript epic for bots
I know how to make the command to respond
I dont know how to delay the response
i literally sent you two links that answered over half of your questions
Javascript epic for bots
@thin turret well uh no, but whatever floats your boat
I dont understand them. Which is why I am just going to give up. I dont know how to understand this yet. I'm very grateful for your help. I'm sorry for wasting your time.
My opinion wasnt requesting input
are you implying anyone was asking for your opinion in the first place
@earnest phoenix take your time and learn
You wont get the hang of it overnight
Its a slow process which needs dedication
I have been having a hard time finding a software to actually code it. From there I'm pretty sure I can figure out how to make a command
but I cant download stuff. I have to use it from a website.
that's the problem here
well the first problem
you need a machine which you have control over
The ide you use wont define your success in learning the language
You could even use notepad
Ofcourse it will be a bit harder to troubleshoot
I only need one command
and I dont know what notepad is ;-;
I'm sorry. I'm trying to learn the best I can but I'm still really new at this. I've never made a bot
I can barely make a functional line of code in the course I'm taking
but I mean I know how to send a message
Start by learning a supported language, then later on try making a bot
um..
Alot of people jump into making a bot when they have 0 programming experience, and every 10 seconds they need help with something basic
^
well I wanted to try javascript, as I already know coffescript really well. and I assume coffescript isnt supported
how can i fix else if error
I used to be one of those people before i decided to go through the proper route
that's java right?
@unreal tapir you learn js
hello can anyone help me to fix it
discord.js
ok. I know some java. Just the general basics. Like making different files and stuff
I just need something that I can code in that doesn't require a download
um.. I'm not quite sure what those are. Can you send a link to one?
like do I just search "online ide's"?
Ide's are the coding software you are asking about
Yeah
Like for java: "online java ide"
does online IDE have any perk?
I mean... dnst look comfy to work with your files using online stuff
They're on a chromebook and say they cant download anything
@unreal tapir you messed up your syntax somewhere
Epic
so I need one more thing and I can get started
else if (command === 'args-info') { if (!args.length) { return message.channel.send(You didn't provide any arguments, ${message.author}!); } else if (args[0] === 'foo') { return message.channel.send('bar'); };
@unreal tapir you cant start and else if if theres no if statement before
the one before is a try catch
so?
how do you get it to work in discord. Like how will the bot be able to read and respond to comments. How do you get the input and write the output
@unreal tapir google this: javascript syntax
@unreal tapir
rolan
Theres discord.js documentation online, tutorials on youtube ect

Just have to research
docs are better
I dislike reading, so I watch videos at times Lol
I do all, read, videos, github, guide...
so like. Can sombody walk me through this. If I want to run my code when somebody types a command, what would I write in the code itself
everything is good
if it helps you it is fine
@earnest phoenix look for a command handler
when someone sends a message an event is triggered
if (message.content === ';p;{}
you can read the message and see if theres a "prefix" in it
Start small tho, you still need to create and setup your bot
like that?
start with the basic ping pong command
if(message.content === 'p' )?
message.content is the message itself
yes
do I need to define client, or message? or channel? or does the djs do that?
Yes
So I just want to know what variables I have to define
and client is a new Discord.Client()
and basically what to define them
yeah you have to define the clinet like that const client = new Discord.Client
@earnest phoenix https://discordjs.guide/
and log it in
and you also want to add some stuff on the message event, like disabling everyone, disabling bot messages, etc..
ok So I'm going to need to get some help there but thank you SO MUCH
Really you are awesome
a whitename willing to learn how nice
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
This series is outdated!! We have a new series playlist here!
https://www.youtube.com/playlist?list=PLdnyVeMcpY7_IiC977keSLBXXJG_I3vUo
Thank ...
wait. I dont know how to se this ip tho
you’re literally one of the nicest people here
wait. I dont know how to se this ip tho
@earnest phoenix what do you mean
I need to learn more
by IP
Just make sure the tutorials you follow match your djs version
thats what I mean. I dont know how to make this compatable with discord
that's why i linked you the guide
thank you 🙂
that video is a bit of a problem. I cant download and run files from my chromebook?
so would the online JS I'm using still work with that tutorial?
I like how I'm trying to do this to make one command. Then I might never use it again. I hope people in the server like this lol
que?
there are some sites that let you code & host in side but they arent made for discord bots
and they are usually as learning tools rather than a proper final solution
but if you have no other option, it's something you might wanna look into
I just don't know if it's even worth it at this point. It's only one command. I can't make this the intended way and have to go off random sites. That alone is a struggle but I don't know how to make the code either. Plus I can't get somebody else to make it for me because I don't have a job yet. So.... I'm just done. My brain is mush and I havn't even started the precalc homework. Sorry guys, IK it's frustrating to deal with people like me who don't know how to use stuff like this and thank you all for your time. ❤️
anyone help me to fix it pls
@earnest phoenix its okay, people have to start from somewhere ❤️
the thing is tho. I don't need this skill. I mean I don't need to make discord bots other than this one, and this one only needs one text command either way. I don't know if its worth it to learn this for one command.
You might make one command and wanna keep going, that's what happened to me 😛
;-; I'm trying to balance online learning, learning java, and now js too, plus trying to learn how to do get it compatiable with discord. I can't lol. Like I dont think I can do it, and if I do, I'd put all of this effort into this thing for one command.
fair
hope you can get all your stuff done 
I mean I won't be able to. No dinero lol. So I dunno how I can get somebody to make it for me. But thats just what happens. It was my choice.
create a message collector?
is there a way to prevent my bot from sending an everyone or here ping from a repeat command in node.js
allowedmentions
where do i put it
@white vapor you can use this https://discord.js.org/#/docs/main/stable/class/Util?scrollTo=s-removeMentions
I am getting an error TypeError: Cannot read property 'SPEAK' of undefined while trying to overwrite a roles permissions
show code
permission part
await channel.overwritePermissions({
deny: ['ADD_REACTIONS'] ['SEND_MESSAGES'] ['SPEAK']
})```
thats not how overwritePermissions() work. Check example: https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=overwritePermissions
await channel.overwritePermissions(muterole, [
{
id: muterole.id,
deny: ['SEND_MESSAGES'],
}
])
}
) ```
```TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites```
The first argument is not the right type: https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=overwritePermissions
You can remove the first arg to see.
can any one help me to fix this
did it at least query the arguments?
i'd assume it either:
Did not grab your arguments
Didnt find the video somehow(URL encoding or poorly usage of returned query value)
Stream buffer problem
@fluid widget
you arent providing much info
{
id: muterole.id,
deny: ['SEND_MESSAGES'],
}
])
doesn't deny the permission


why do that when you can just make a role without SEND_MESSAGES perm and assign it to a user? @rancid bramble
why change all channel overrides rather than just use a role without that perm?
¯_(ツ)_/¯

message.channel.awaitMessages(msg => msg.author.id === message.author.id,
{max: 1, time: 15000}).then(collected => {
//poll Text Collector
pollText = collected.first().contents;
message.channel.send(pollText);
}).catch(() => {
message.channel.send('No answer for 15 seconds. Set up has been cancelled. ');
});
the logs say it cant send an empty message
console log pollText
ok
cuz its likely undefined
also contents?
it returns a MessageType
Discord.Collection<string, DiscordMessage>
iirc
so Message doesnt have contents
its content iirc
it is undefined
try content
rather than contents

Yes, but how do I solve this error
either use a debugger attached to your node or check the documents for ytdl
@fluid widget https://code.visualstudio.com/docs/editor/debugging
@opal plank and
Did you mean to download the program and use it to fix the error? @opal plank
notepad++

you should likely use something better for coding than that
VSC or ATOM are my recommendations
if you really dont want to
your other option is exposing a debugger on chrome
but vsc handles all that for you
¯_(ツ)_/¯
It tells me the error is in ytdl-cord-discord
at exports.getBasicInfo (/home/ubuntu/m1/node_modules/ytdl-core- discord/node_modules/ytdl-core/lib/info.js:59:13)
did you read the guide/docs for that package?
also VSC is for debugging, its not realated to the error, its a tool to make your life easier spotting WHAT is erroring
WHAT and WHY
When I work on the bot in the free server in repil.it it works fine and there is no error, but when I transfer the file to a private server lunix, this problem occurs when I play music for adults only.
@opal plank
then you likely missing a dependency
I did not understand you
I downloaded all the private files in my music file but still this error
That error was in ytdl-core-discord
you for some reason didnt move your package.json and node_modules did you?
how to check if a user has permission to type in a channel? in discord.js
hmm okay thanks ill check
I downloaded everything, and the bot music works, but your music for adults is not only played on YouTube@opal plank
then im not sure, check the documentation for ytdl-core-discord
You have entered the file info.js in which the logs error is
info is likely only the handler that sends the error on your console
hence why i told you to use a debugger
I opened the debugger and there was no error
I don't know how to use a correction session
collection.update_one({"_id": member_id}, {"$set":{"purse":str(purse + coinstogive)}}, upsert=True)
discord.js
py
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can only concatenate str (not "int") to str
destinationChannel = collected.first().content;
let permCheck = destinationChannel.permissionsFor(message.member).has("SEND_MESSAGES");
console.log(permCheck);
nothing shows up in console. no errors, but no permcheck thing
@opal plank My friend, I worked on the file that I said about on the personal computer, and it worked and you did not have any problem, and when I transferred it to the private server lunix , I encountered the problem again
does permissionsIn return true or false?
if (message.content.includes("@lost barn") {
message.reply('Hello, I am disco bot. You may help d!help to view a list of my commands. If you\'d like to invite me to your server you may do so by saying "d!invite".')
}```
This does not work.
it returns permissions @silver lintel
@quick dune how doesnt it work? does anything show up in the logs?
or the bot isnt responding?
Hold on.
Alright.
or use message.mentions.has(client.user.id)
let permCheck = destinationChannel.permissionsFor(message.member);
//let permCheck = message.member.permissionsIn(destinationChannel)//.has("SEND_MESSAGES");
console.log(permCheck);
its not console.logging anything
If there's a condition that could prevent that code from being executed, that's probably why it wouldn't log anything.
If it did reach that code and permCheck was undefined, it would log undefined
destinationChannel = collected.first().content;
//let permCheck = destinationChannel.permissionsFor(message.member);
//let permCheck = message.member.permissionsIn(destinationChannel)//.has("SEND_MESSAGES");
//console.log(permCheck);
message.channel.send(destinationChannel);
i did this and its sending the destinationchannel alright
in discord.js whenever I write to a JSON file it adds an extra curly bracket } at the end
made a bot but dont know a single line of code
then how did you make it? took code from github?
Discord Dev stuff idk if it works
v11 tutorials
Bet
agressively Copy pasting
welp
Yes
he's a lost cause
100%
Do it like i did a couple minutes ago. Cant solve an issue? Submit a request to the platform to increase your ratelimits 
no joke,i 100% just did that
just hack the main frame
If i knew how to code yes i just know control c + v
nah, i mean it,unironically i just sent an email to staff requesting increased rate limits


Ill try to make coffee tomorrow and find out how to awaken my boy
are you talking about the bot or the man downstairs
Both
Have you tried js? its pretty good to wake up screaming UNHANDLED PROMISE REJECTION early in the morning
I love the smell of TYPE ERRORS in the morning.
hey you have a unhandled promise rejected this will soon be deprecated hey hey hey update your code hey do it now
If only i had a laptop
Js deprecated, start using Ts 
Im on a tablet with a keyboard addon
yea that would probably increase your development progress from 0% to 100%
js and ts are dumb, use jsfuck
jquery is the solution for every question in the universe
ill just figure out how to awaken my creation
have you tried turning it off and back on? 
if you have a advanced command handler, and where should i put my functions???
It doesnt even have an on switch yet
huh?
Im using the API
lol what
wdym advanced command handler?
on the index.js file or the

i dont really know what you mean, but you could have a core file with functions which you can get when you need
what about it?
the command is in
like client.commands = new Collection(); ??
no
if you want functions, put them inside the file that function needs to be
function (){}
function purgeCommand() ?
if you need to pass a function as a callback to your handler, pass it as an argument
im actually lost wtf lmao
commands.get(something).run/execute(params, FUNCTION HERE)
So I will have a lot of duplicated functions???
ok i shut i leave pro to do it
Welp i gotta figure out how imma use java online without getting viruses
then export your functions
bro i dont understand what he means doe
I could use my Obama phone but it’s laggy af
im so confused
in discord.js whenever I write to a JSON file it adds an extra curly bracket } at the end
send the code then
//functions.js
function a() {};
function b(){};
export {a,b};
//index
import a from 'functions.js';
a();
//comand ping
import {a,b} from '../functions.js'
a();
b();
@carmine summit
Found java app time to figure out how to make something
whats the site to learn how directories work
i use function.js like
blahblah (stuff, stuff) {
//code....
}
and when i need it
const functions = require("../functions.js");
then you can use functions.blahblah() {}
thats not correct syntax tho so
._.

;-;
require better for noobs liek me
B}
whats the defference of absolute and relative
relative is relative to the folder you are currently in
absoulte is like your system path
c:/users/downloads/somefile
thats asbolute
so relative is more confusing
would rather absolute
bad
teach me how to absolute
ill read it
if you switch your bot folder you fucked
move your folder and enjoy all the errors
or move your bot to a vpn
more errors
¯_(ツ)_/¯
relative path is the way to go
how to i go up a folder using absolute?
you dont
aw
get current path then remove last /{thing}
thats bad
whats a good image generation thing for node? im considering canvas
get current path then remove last /{thing}
what?
path C:\Users\DELL\Desktop\NotABotBeta
dir above C:\Users\DELL\Desktop
aka, remove \{thing}
is that absolute?
yes
though you are being a sturborn mule if you do it that way
stop being lazy and learn relative path
how do i go up a folder using relative?
,,/
is that a comma or a period
period
ok
lazy devs who are afraid of beter and newer tools
@opal plank bc i quit coding for like 2 years so i use outdated stuff ;-;
./ - same folder, ../ - last folder, / - ???
4h ago i just did a commit with 2300 removals and 1700 additions
like bruh,stop being lazy
@carmine summit you'd get if you read the docs i sentyou

reading the docs is too complicated for me
/ - ??
if you dont want put effort into it,why shall i?

Where am i going to put
a();
b();```
in ```module.exports = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
message.channel.send('Pong.');
},
};```
at the top
const filter = (reaction, user) => {
return reaction.emoji.name === '👍' && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 4, time: 60000, errors: ['time'] })
.then(collected => console.log(collected.size))
.catch(collected => {
console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
});
i took this code from discord.js guide, but how do i make it so the user reacts to the message and the bot registers the reacted emoji?
Just found out I need a laptop to actually do anything with this bot
So it’s just there
Waiting for a code that’s never coming
no u dont
vps? rasp pi? cellphone? old unused device? smart fridge? You can use any of those to host a bot @wanton aurora
what u on about?

you dont need a laptop to either code or run a bot
cellphone?
@opal plank are you talking about me? :3
@faint prism god have mercy on those souls that do that
i hosted mine on an old Wii i had

I’m trying to figure out how to even activate this thing
I mean
As long as the cpu isn't bottle necking
You have redundant internet and a UPS (battery)
i ran fine,though much more stress and it wouldve likely throttled
More resilient than my rpi 4 tbh
I saw this thing on how to activate your bot and how to ping it, but then I saw GitHub and I stopped
Why

GitHub is just repos of other code
oh shit my nitro expiring tomorrow

hopefully i should get back from the twitch staff tomorrow too, hopefully it counters out the emotions
sad
Also the keyboard stopped working so I have to wait another week for it to do something
whats a permission should be for mute command? KICK_MEMBERS?
my preference is MANAGE_MESSAGES
if you can delete chat message you likely a moderator at least
thats my smallest perm
ohh yes
God my brain is full ooga booga right now I don’t have a clue what these people are saying
then dont listen to them
well learn to code

@faint prism guess what i did a couple hours ago
@opal plank hmm?
not there yet
So, i was getting rate limited on twitch
rather than doing the obvious and working around it
i went and harrassed twitch staff into taking my request to increase rate limit rather than properly handling it

ahah
im legit trying to pull this off on twitch staff
is it possible to read a variable but is declared on a different file???
people here hate me lol
Lmao nice
I need help with api
holy cow
here is what response.data give me
{"data":[{"targetId":3,"state":"Completed","imageUrl":"https://t2.rbxcdn.com/a4a3317a6b6509b5de81786bb7d5e959%22%7D]%7D
but doing this
response1.data.data.imageUrl
isnt anything
but it should be?
data[i].imageUrl
What did you type
Because it's an array of objects
You I hope you didn't actually type data[i]. The i is the index of the array
const filter = (reaction, user) => { return reaction.emoji.name === '👍' && user.id === message.author.id; }; message.awaitReactions(filter, { max: 4, time: 60000, errors: ['time'] }) .then(collected => console.log(collected.size)) .catch(collected => { console.log(`After a minute, only ${collected.size} out of 4 reacted.`); });i took this code from discord.js guide, but how do i make it so the user reacts to the message and the bot registers the reacted emoji?
@faint prism i didnt
I firgured it out
but when trying to put it into a thumbnail it doesnt show
if (message.member.roles.cache.has('713367575769383006')){
message.channel.send(embed1)
}else{
message.channel.send(embed2)
message.member.roles.add('713367575769383006')
let verificationresult = new Discord.MessageEmbed()
.setAuthor(message.member.user.tag, 'Verification Result')
.setDescription(`*Member:** ${message.member.user.tag} **[${message.member.id}]**\n**Creation:** ${moment.utc(message.member.user.createdAt).format("dddd, MMMM Do YYYY")}\n**Suspicious:** No\n\n**More Information:**\n**Verification Passed?** Yes`)
.setTimestamp()
.setFooter('Your local automation')
const logchannel = client.channels.cache.get('713365213151494221')
logchannel.send(verificationresult)
}```
(node:20812) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
logchannel is undefined
@earnest phoenix I think it may be because logchannel is of type cache whic does not have a function .send()
logchannel is a variable
what
if they attach the log channel to a channel,it does
you should
i would assume they wouldnt be stupid to call a variable logchannel and not referencing a channel
channels/guilds should all be cached iirc
yes but it is running the get function on a cache, im assuming that returns a cache not a channel
Then dont suggest if you dont know
you'll get in the way more than you're helping with false information
@earnest phoenix define log channel first 😅 or set there only to send it in a channel by id or name 😁
i did do that though
ive got an empty json file
{}
and i want to check if it has a muteRole, like settings[message.guild.id].muteRole. that doesnt work because muteRole doesnt exist. how would i do it?
{
"muterole": "id-here"
}
He wants to check in code @earnest phoenix
are you using a JSON “database” 
A permission so that only users and not administrators can use a command? Someone help me please
is for the antifloob
has anyone used this and would prefer this over storing prefix in json file?
check does he has admin role, if not return; else continue ur code @earnest phoenix
admin perms*
@ionic shard u better save it in .env file
@silver lintel you want to check if muteRole is defined?
any reason for saving it in a env file?
yes, how to define it?
??
im not doing static prefix
why?
im doing custom prefix
env is only for secret stuff like tokens
settings[message.guild.id].muteRole = ...?
@ionic shard then u better save it in database
quick mongo or sqlite?
eh i just need guild it and prefix
Mongo is more performant than SQLite, as far as I'm aware
how to check if it doesnt have muteRole? because if they redo the command, it will reset the muteROle
settings[message.guild.id].muteRole !== undefined
@ionic shard ok go google and search fo mongo docs
ohh yes thank you pooled
Currently almost 11 and not a single line of code has been writen
Mostly because the code doesn’t know what discord.js is
So I’ve been sitting here looking at the error for about an hour with no solution and I feel like a bitch asking for help
Mongo is more performant than SQLite, as far as I'm aware
@slender thistle it also depends on what data you are saving
yeah if you aren't saving/accessing much it doesn't matter what database you use
is there a way for the user to react to the bots message and the bot registers the emoji in discord.js?
if (!member.hasPermission("MANAGE_MESSAGES")) member.hasPermission('MANAGE_MESSAGES') = 'yes';
let test = member.hasPermission('MANAGE_MESSAGES')
message.channel.send(test)
i dont think you can do that, but just try changing 'yes' to true
no
that wont do anything
im trying to make it
so
if they have the perm
when you use test
it will say
yes
or no
but now
I need to put no in
and idk how to
ohh, okay you cant do it that way, you gotta do it this way
.overwritePermissions(guild.member {
'VIEW_CHANNEL': true
'SEND_MESSAGES': true
'READ_MESSAGE_HISTORY': true
})
``` something like that iirc
no lmao
im not overiding
I need to see if the user has the perms
and if they dont
it says
no
and if they do
it says
yes
then just do
if (!member.hasPermission("MANAGE_MESSAGES")) message.channel.send("no");
if (member.hasPermission("MANAGE_MESSAGES")) message.channel.send("yes");
that wouldn't work
invalid left hand in asignment means the = sign is wrong
it needs something to change to if the user dosen't have the perm
then just make a variable like let YorN = true (starts off true but doesnt really matter)
then run the if statements and let YorN = false or true
can you write out a example as i'm quite confused
me too, can you elaborate on your question? from what youve said i think you said that you needed something to change if the user can manage messages or not
message.member.roles.remove("717575259338833930") is it correct? bot didnt remove my role
so for a more in depth userinfo I'm going to check for the members perms, and have it display like this
Manage Messages No
Kick Members No
like that
or yes or no
okk
var manageMessagesYesOrNo;
if (!member.hasPermission("MANAGE_MESSAGES")) manageMessagesYesOrNo = "No";
if (member.hasPermission("MANAGE_MESSAGES")) manageMessagesYesOrNo = "Yes";
message.channel.send("**Manage Messages** " + manageMessagesYesOrNo);
holy shit
thankyou so much
lmao saved like 2 hours of my time just thinking
lmao
lol
Yo I'm having really big trouble github actions and trying to deploy pm2, for some reason everytime the action is finished, the pm2 daemon shuts down the process or itself (not sure)
name: Node.js CI
on: [push]
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: echo "DISCORD_TOKEN=$DISCORD_TOKEN" > .env
env:
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
- run: pm2 kill
start:
runs-on: self-hosted
strategy:
matrix:
node-version: [12.x]
needs: build
steps:
- run: pm2 start . -n "glenn"```
i did, there's nothing
** - run: pm2 kill**
@earnest phoenix whenever i dont do this, it literally just doesn't start at all
I don't know this but try logging it
just said there's nothing in logs at all
console.log
sorry it does until the job is finished
and im sure of it because the bot comes online, and everything console.log's yes
!p marron
How to make Dank Memer Bot
that is such a general question. which part of it?
I was jk sorry lol
anyone have a document of all valid checkable permissions eg MANAGE_MESSAGES
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
how do i add embeds to my bot commands?
you mean discord.js version?
hey @earnest phoenix so that finally happends the other day
@ionic dawn
um
it gives me a eroor
error
nice
Idk why it copyed the previsos message lol
you sent the previous messages too
hello
Is rate limit is per ip or token?
My website has an Authorize thingy
And got rate limited
per ip
in bots it's per server
Ah ok
So buying lots of hosts will help?
when my bot a person discconect it not join voice again how i can fix
note: music bot
X)
@main chasm please explain better
your English seems bad
can you speak something else?
discconect my bot
@main chasm Bot is removed from voice channel?
no
wut
do u know what discconect ?
i don't get it
when i discconect bot in voice channel bot working all commands but can’t join voice channel again
i want fix
it
@green kestrel ask em
your english isn't making sense to me
Can you speak another language?
bro i speak english not arabic
but i can't understand
u can’t understand your problem bro i speak english proper bur idk why u can’t understand me
i said when i discconected my bot in voice channel bot can’t join voice channel again when i used !play
because that file is extensionless
wtf
let muteRole = message.guild.roles.cache.find(role => role.name === args[1]);
```ive got this code to find a muted role, but it doesnt work with role mentions and is case sensative. how can i make it so it works for: muted, Muted, @muted, @Muted and stuff like that
check if there are role mentions before searching the cache, use toLowerCase() to make the names lowercase
ok i did the lowercase thing but how to check the mentions?
message.mentions.roles is a collection of all the mentioned roles in the message, get the first mentioned role with the first method, if there are no mentions, fall back to finding the role from the cache
so message.mentions.roles.first()? then if mutedrole is undefined do the guild role find thing?
yup, or you can do let muteRole = message.mentions.roles.first() || (find from cache...)
You are sending a message which is empty
yes
Check all your send calls to see if the string you are passing is empty, or you are attempting to send something that isn't a string
i got it working by doing ```js
message.channel.send(<@&${muteRole.id}>);
thank you for the message.mentions.roles.first()
Do a OR check
Check for both embeds or string lemgth
Not OR, AND
!payload.content.length && !payload.embed return
let muteRole = message.mentions.roles.first() || message.guild.roles.cache.find(role => role.name.toLowerCase() === args[1].toLowerCase()); how do i make it say something when it couldnt find a role
Typing on mobile is a hassle ffs
If!muteRole return 'no role found'

ok im on pc now
jesus fucking christ that as annoying to type
im usng this cat api https://api.thecatapi.com/v1/images/search, and it results a json in form of [{...}]
how do i remove the square brackets
substring()
substring (1, thing.length-1)?
yup
let {body} = await superagent.get(`https://api.thecatapi.com/v1/images/search`);
``` i did this to get the link, but what format and how do i change it so i can edit the json, and how to turn it back
Typing on mobile is a hassle ffs
@opal plankGuess who does that always
Bruv
I literally coded my entire bot, website and npm package on mobile
Man how did you not notice
Im afraid to ask how many sins you commited to be doing that much cleansing
let {body} = await superagent.get(`https://api.thecatapi.com/v1/images/search`);
``` i did this to get the link, but what format and how do i change it so i can edit the json, and how to turn it back
@silver lintel You mean of getting the json, editing it then doing a post request to return it back
yes
Or what I'm confused
Well
let { body } = await superagent.get(<URL>);
// Edit the body deconstructed from the promise object that was resolved
superagent.post(<URL>, {
body: {
// The body you edited here
}
});```
But remember that the url that awaits or receives the post requests might be different than the base url
what i want to do is substring it
so take the first character and the last character of the json out
What do you mean by slicing off the first char and the last char from the json?
Show an example?
.substring(1, body.length - 1) (obviously body.length dont work i think, so that why i want to convert it into editing format)
But, using substring on what?
on the whole json
Property values?
:O
[{"breeds":[],"id":"c26","url":"https://cdn2.thecatapi.com/images/c26.jpg","width":852,"height":569}] i want to remove the [] from both sides
thats the json
Array is an object type
Wait lemme do a test
yes
So this?
yes
In superagent as it returns the body as an array in the response of that API,
You can do
body[0].url```
.setImage(body[0].url);
``` this?
Yes
Np
is there a way to await reactions where the user reacts to the bots message and the bot finds out what emoji the reaction was? or should i just use a simpler system?
Reaction collectors can do that
all reaction collectors i could find are like reaction role sorts
and dont read the reaction
well
They have a collect event which is emitted when a reaction is received
Returns 2 parameters of reaction and user who reacted
i can do messgae collectors easily
hmm
wait
bot: react to this message with the emoji you want
user reacts with an emoji
bot: the emoji is :emoji:
bruh how many things you doing
every 2 minutes i look in chat u asking something completely different
this is last

every 2 minutes i look in chat u asking something completely different
@opal plank bc im noob and dont know how to code
w3schools
For example
let someFilter = (reaction, user) => user.id === <message>.author.id;
let someCollector = <message>.createReactionCollector(someFilter, {
time: 35000
});
someCollector.on("collect", (reaction, user) => {
// 'reaction' is the reaction that the user reacted with
// 'user' is the user who reacted
});```
unexpected token ':' for time: 35000

wait nvm
how long do you think it'll take












Guess who does that always
