#development
1 messages ยท Page 1081 of 1
not webdev i think
then require('node-fetch')('(website)/api')
how do I get it to print the response body?
const bob = await require('node-fetch')('website/api').then((e) => e.json()).then((e) => { return e; });
console.log(bob);
``` you may need headers and body, but thats the basic template kinda thing
It works now, but how do I turn this into a message and sort it
if you know how to use express, then you know how to do it
its simple
then learn a bit about express, follow some tutorials
message.reply(`Hey! Calm down! You've got ${timeLeft.toFixed(1)} more second(s) before you can use \`${command.name}\`.`);
.then(msg => {
msg.delete({timeout: 5000 })
})
at the .then "decleration or statement expected"
its probably very obvious why, but im not thinking rn, am I doing this wrong?
do you use discord.js
yes
got it
@earnest phoenix?
going to yoursite.com would send the index file
so change homepage.html to stats.html
then it'll send you to it
that's where your files are located
if you go to site.glitch.me, it'd send the html file
do you even get how express works
https://www.tutorialspoint.com/expressjs/index.htm
go read a tutorial or smtn
ExpressJS Tutorial - Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. It is an open source
Read docs
const yt = require('simple-youtube-api');
bot.youtubeAPI = new yt(key);
If I call bot.youtubeAPI, is that creating new instances?
Has anyone else had issues with lavalink not working with text search
So links work
But normal search does not
my friend have a bot and he's bot have a lock command, but for bot can change the channel permissions it need a admin permission, without that permission discord says dont have permission to do that, but why if the bot already have permission to change channel permissions?
It doesn't need admin perms
without that permission it says: HTTP 403 Forbidden, {"message": "Missing Permissions", "code": 50013}
Then give it the correct permissions
might want to hide your token @crystal socket
oh crap
You're probably missing the colon after the function closing )
oh yeah forgot it thanks
It's hard to explain Discord's role hierarchy flow which may be the issue here, so (if it is), please look at this article: https://support.discord.com/hc/en-us/articles/214836687-Role-Management-101.
It could also be based around "what" you're exactly trying to change. For example, trying to change a text channel's permissions when you can't yourself (or just a plain logical error).
its trying to change a user permission to send message
the hierarchy is correct
the bot is on top of the users who will lost that permision
not sure if this is something to do with my code
Internal issue, update your discord.py
oh okay
@dark vapor you should also reset your client's token, The first few lines of stack trace reveal it
we discorver the problem, apperently the category have to have the change channel permission too
For requesting track info from Spotify, are you able to extract artist name and name of track without needing an auth code or do you actually need to go through an Oauth flow just to be able to get track info
if its ur token
@dark vapor i'd regen it since theres most likely logs which log when messages are deleted with the content of the message and like 20 people have access to it, even if they are mods they're still normal people
@lament rock use an api
that's what I'm trying to do. Why do you think I'm asking this info about Spotify's API
iirc I had to use OAuth flow for that
Don't take my word for granted as I don't remember exactly what I did last time I used Spotify's API
After the initial grant, would the system be able to fully automate itself or would someone constantly have to re-grant the auth code
@digital ibex I regened it thanks!
After the initial grant, would the system be able to fully automate itself or would someone constantly have to re-grant the auth code
I'd suggest reading the docs on how long your token will be valid
Or maybe a way set it to never expire
@earnest phoenix in your bot description, you have text as white, which is invisible, you should change that as it adds a character count to your bot description without showing anything
hi
how can I check if i get this error code? { message: 'Unknown User', code: 10013 } "10013" ?
how can i start create my own bot
@earnest phoenix https://anidiots.guide/first-bot/your-first-bot
const talkedRecently = new Set();
if (talkedRecently.has(msg.author.id)) {
msg.channel.send("You can give reputation once every hour. - " + msg.author);
} else {
talkedRecently.add(msg.author.id);
setTimeout(() => {
talkedRecently.delete(msg.author.id);
}, 7200000);
}
it doesn't send "You can give reputation...."
What was The command to check the queue
what queue
The bot queue
huh
Like to be verified
There is no command.
@swift void try a comma instead of plus
so
msg.channel.send("You can give reputation once every hour. - " , msg.author);
if that doesnt work make it a var
message = "You can give reputation once every hour. - " + msg.author"
msg.channel.send(message);
and make it a comma again
alright thanks
How can I get that when my bot does multiple reactions it is a message, it does it fast ?, Because it currently takes 2 seconds per reaction
Hi i use cubes hosting , and after 10h
My bot is down
Idk why
I see in console some big shit error
debug your code
Not error in the code
@digital ibex i dont say do it
@distant plank discord rate limiting , you probs cant change the speed
its nothing we can do unless theres someone here who works or maintains for ur provider
have u contacted them?
Yes
@low shard send the error
yh ok
I go to my pc
have you done any debugging at all?
help my bot not here
your bot must be approved first
-busy mods
I need help with this rq
I'm making economy
But as I do this
setVar[money;$sum[$getVar[money;$mentioned[1]];$noMentionMessage];$mentioned[1]]
There's a money var
Oops wrong server
Anyone remember what the max amount of time my bot has to wait before updating it's presence without it being considered API abuse?
There are no clear api abuse limits, you should consider yourself if what you are doing would be "api abuse" or not
@sonic copper
Bottom of the page
Alrighty. Was wanting to set up an interval that updated the server count. just wanted to make sure I didn't break any rules by making it too quick
nah it wouldnt matter , better antispam has over 96k servers atm, it updates usually every 12 hours i think
Alrighty. Thanks for the help, yall!
yep
@crystal socket what?
@low shard use galaxy gate
Link ?
its designed for discord
In dms
hi
hey
by which command can my bot
show name of guilds
it is in
something like this
all guild objects have the name property
Quick question.. using discord.py what is the best way to get any of the standard emojis as an object to have the bot add as a reaction?
For example 1๏ธโฃ
@frank jackal i know only on js
@stiff stream what's the js way? I will seei f it helps anyway :)
ok so you want the bot to react to your message? or that the bot send something and you want him to react to him self?
@frank jackal
??????
Send something and react to itself. I can do it already but currently I have the emoji in the code.. I would rather use an id or something than actually pasting the emoji in the code
btw to paste the emoji you need \emoji
\๐
message.react("โ
")
message.react("โ")
})
@frank jackal
Ok so just having the emoji directly in there is the best way then?
yeah
unfortunately you cannot have it dynamically lookup without a baked in map
to paste him you need to do \ before him
What do you mean by \emoji?
luckily, this exists, https://static.emzi0767.com/misc/discordEmojiMap.json
@frank jackal
:one:
@earnest phoenix thanks for the link :)
:one:
number emojis are consisted of two different characters
number + keycap
that's why escaping doesn't work
:weary:
\๐ฉ
escaping on mobile doesn't work either
I don't understand why I need to exacpe it?
so you can get the unicode counterpart
^^
anyways you can use the map i sent you
Ok and I use the unicode to do?
I will look at the map

discord requires unicode to be sent at the create reaction endpoint
you cannot use colon emojis
exception are custom emojis
ron can you stop spamming emojis
it's annoying
lol sorry
Ok thanks. So I can escape the emoji then copy the result and paste it isn't my code to use?
Also appreciate the assit
(With Discord js) how/can I take a post from r/ShowerThoughts?
like post a post from r/showerthoughts
when someone says a command
api
in short: use a thing like "node-fetch" and fetch memes from reddit and yeah.
reddit has a api. you can accessing it by adding .json at the end of the url
https://www.reddit.com/r/memes.json?sort=hot this as example access r/memes and sort for hot
when you paste this in your Browser you get a large Json file with posts. then just sort out the path in your code to display the postst
hi
is there way to show boosts level in server ?
like Boosts: 0/30 (Tier 0)
ok thx everyone
i think there is a way
@lusty quest, You can ask you in dm about verification?
@crystal stream why?
Or here
Hey,
I Need A Bot That Can Automatically Purge Messages After Some Time, For Free
r/choosenbeggars
If the servers on which the bot is installed are empty, will the discord count them?
For verification
if you artifical do it you get flagged and need 250 Guilds. not sure what happens after this
how to show boosts level in embed ?
If the servers on which the bot is installed are empty, will the discord count them?
@lusty quest
I mean to get the bot verified
its possible but idk if they check the owner of the guilds. if they do you will get rejected
Okey, thz :ะท
if you artifical do it you get flagged and need 250 Guilds. not sure what happens after this
@lusty quest no. Let's say we're after October 7th,and your bot reaches 75 servers. Normally, your bot is capped at 100 servers, but if it's an anormal growth you get capped at 250
It affects all bots right?
Yes, but not for now
umm when can my bot be added to https://top.gg/
Wait 3+ weeks
https://top.gg/newbot
@tight plinth I done but I will wait 3+ week :(
Yep
Does anyone know a way to send data from backed to frontend?
does anyone know?
Remove a .
My bot already on 24/7
Trivia are you py?
yes
Me host using script
but i have other bots in js
yeah
Thanks
@pure lion r u telling me?
Quick question: did you write this code
yes i did
U sure?
110%
i'm pretty sure i've seen it before
If you did you'd be able to solve this error
Lol
110%
@lime pumice nice
Can someone who has used lavalink help me, whenever I query using text it returns not found
But links work
Wdym
What lib do u use
Djs and erela.js
I get this issue sometimes when using a different library but using shoukaku never had this issue for me for some reason
Thanks, I'll try to use that lib then
Np
How do I send from the frontend to the backend?
expose an API endpoint on your backend server and hit it from frontend
you should obviously make it secure
CSRF tokens, authorization etc
i have two values, {transferred: 2785264, total: 4853128}, how do i try turn that into a % value like 50%
% 100 would work
wdym
i have two values,
{transferred: 2785264, total: 4853128}, how do i try turn that into a % value like 50%
@sick cloud
that's... basic mathsamount/total * 100
do you not know how to calculate percentages 
i don't have a use to do it much
How can I use the oauth2 scope ID thingy to get info?
what
Idk either
... well i'm sorry but we didn't do percentages in grade 3
in fact i did barely any math in early school
you should consider brushing up on maths
a few days ago you didn't know how to turn a number into a negative
:o
anyways, dice, are you aware of how oauth works
what
i never implied that
i suggested you should brush up on maths since it's an essential part of being a developer in the first place
you're going to constantly use it
We never went through percentages in school either kek
Still have to Google it to this day 
i didn't end up covering fractions until a repeater course in grade 5
i spent like <50% of my primary school time in the classroom
Cry, not at all
Ew school
aight im going to give you a crash course then a few resources
ok sure
Teaching fractions outside of school 
@sick cloud if you want to learn maths go to YouTube and search what you need
I did this for my entire school year, it worked
anyways dice, you need to have a backend server. oauth is controlled by user decisions, the user can choose to either authorize your app or not authorize your app. there's two ways to do this, authorization code grant and implicit grant. i would personally suggest authorization code grant since it is MUCH more secure and you reduce the risks of hijacking.
tldr your user goes through the authorization screen, if they accept they get redirected to the redirect URI you set with a ?code= url parameter, you can then take that code out of the URL and exchange it for an access token (https://discord.com/developers/docs/topics/oauth2#authorization-code-grant)
the access token that gets returned is a bearer token for the user which you can use to, for example, get info about them (https://discord.com/developers/docs/resources/user#get-current-user)
I already have a backend server with my website, using ejs
for extra security during oauth auth read this: https://auth0.com/docs/protocols/oauth2/oauth-state
And I have redirected to oauth2 and can see my ?code=
perfect, now you need to take that code of the url and exchange it for an access token: https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example
with that token you'll be able to get the data yes
re-read my message i explained how to
don't know i don't use node as my backend
Oh alright
my forte is usually an asp.net core backend server (c#) + react frontend (ts which is compiled down to js)
How do you do it in your context tho?
@pure lion once you've sent content you can't update it again unless you re-render the page, aka reload
So I do 1st page that shows up, then a login button that redirects the oauth2, then second page with extra info?
see, i don't send any content, my frontend is react so it's statically served, content on the frontend changes based on API requests to my backend
Ah got it
so it's different than using templating languages
:sad:
also a big tip
if you're planning to launch it to the public, don't forget to implement the state parameter
How would state be generated and how exactly does one utilize it on the backend?
Yeah that's a good question, what does the state Param do?
tldr it allows you to verify that the login is actually coming from your website and not from a foreign one (a hijacking attempt)
not using state exposes you to a CSRF attack
auth0 explained this better than i did https://auth0.com/docs/protocols/oauth2/oauth-state
Makes sense
reeeeeeee
discordjs.guide explains it well @pure lion
Hello, can someone help me ? My bot have to send an embed message but it takes a long time and i don't understand why
var message_embed = new Discord.MessageEmbed().setColor(0x8dd4ff).setDescription(description).attachFiles([im]).setImage('attachment://'+im_name);
channel.send(message_embed);
I have to eat, please send me a pm i'll read it later
This place is better than school and stackoverflow
ok
i suggest you check the docs https://discord.js.org/#/docs/main/stable/class/Message
Can someone help me with running my nodejs discord bot on docker?
@stiff stream why not just use .setTimestamp
Just made a prefix for my bot
didn't take me that much time
But node index.js was not working
but fixed it
@stiff stream add user id
Can someone help me with running my nodejs discord bot on docker?
@wary flame never used docker so idk
@wary flame docker has a whale logo right?
Yes
@violet nimbus i already add the id... look
Use code prompt
@silver dust say: cd desktop
Then say
cd (your folder)
then say node file.js
file is your file's name
I asked about running on docker, my bot isnt magically on docker AND docker will terminate when it has nothing to do
If you dont know docker (wich you said) please let someone else who does know docker help me
can you send the code?
hmm i give up
Code?
Im getting error
show me the code
@earnest phoenix full code
We cant help you without the code
use haste bin and paste the lin here
@earnest phoenix make sure to not show us your token
@wary flame what did you want to do with docker?
@earnest phoenix not the error. the code
Host my discord bot
ok
@lusty quest
@earnest phoenix and not that ur code that u run the bot on
its pretty easy
Can you help me
sure
okkayy my messages are super delayed
@earnest phoenix and not that ur code that u run the bot on
@distant bramble already told him
I couldnt figure it out :(
did you know how to make a dockerfile?
Im can't see error code because my modules error
Kinda
ok
FROM node:12
RUN mkdir -p /usr/src/bot
WORKDIR /usr/src/bot
COPY package.json /usr/src/bot
RUN npm install
COPY . /usr/src/bot
CMD [ "node", "index.js" ]
@stiff stream i know i also told at the same time but my connection is bad so it posted delayed
this is a dockerfile i use
@stiff stream i know i also told at the same time but my connection is bad so it posted delayed
@distant bramble k
pack it in the root directory of your bot and use docker compose to build the image
how do I edit and remove a attachment (image) from a message?
I did that, but I want it to connect to my local files so i dont have to rebuild every update
how do I edit and remove a attachment (image) from a message?
@rocky hearth wdym?
hmm should i use the vote webhook thing?
then add a shared volume to it
my bot has send a message with a image as a attachment file
@rocky hearth show me the command
how do I later remove the image from the message
@rocky hearth show me the command
then add a shared volume to it
@lusty quest how do I do that? Can that be done trough docker files?
maybe u should have used hastebin
@rocky hearth dm me your command, i will help you
Ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages.
here
just make sure you edit your dockerfile to copy your bot also in there
https://ideone.com/C7j4vA here my code
Ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages.
here
pls help me
hmm can any 1 check his code its stuck in loading for me
Will
VOLUME mybotpath /home/bot
Connect my local bot folder to the docker container /home/bot ?
And will it then update when docker container changes something and update when local files change ?
Im using glitch
@lusty quest
Im will send you invite link in dm?
Heyyyy
@wary flame i think (never used Volumes in a dockerfile)
someone is didnt helps me :(
@earnest phoenix install better sqlite 3
Can someone help me with oauth2
I need a bot for self promotion
@pure lion you mean autorisation headers?
grant_type query param for OAuth
Yes that
A website you use OAuth of should have a documentation mentioning all supported types
grant_type: 'authorization_code', https://discordjs.guide/oauth2/#oauth2-flows
The djs guide for oauth2 too I'm guessing but I'm not sure where to loo-
I'm on that page
I don't know what authorisation_code is
i never worked with oauth but there is it
your code for authentificating with the API i guess
*head explodes*
Yes that is exactly where I am
I don't know what or how to replace
Oh
It's literally auth code
hurr durr
How can I make my bot do this
@lusty quest how?
if you dont know how to install node modules did you know the basics?
its request erwin
or was it request?
request
ah ty
How to get DBL Token?
@solid falcon get your bot approved
How to log user info from oauth2?
ยฏ_(ใ)_/ยฏ
@solid falcon get your bot approved
@lusty quest oh, okay
How do I search for multiple scopes through the oauth?
You guys know what was the default property for the $os in
<client>.options.ws.properties?
wdym, @pure lion ?
scope is an array
a
scope: ['guilds', 'identify']
wdym?
Wait lemme log on to pc discord
so
i have the oauth2 scope set up, but i want to be able to actually access the info from the user
have u clicked authorise?
yeah
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: Gunzip {
_writeState: [Uint32Array],
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: true,
_transformState: [Object],
_hadError: false,
bytesWritten: 0,
_handle: [Zlib],
_outBuffer: <Buffer 7b 22 69 64 22 3a 20 22 35 32 38 32 32 39 37 35 33 32 35 38 32 34 36 31 34 35 22 2c 20 22 75 73 65 72 6e 61 6d 65 22 3a 20 22 44 69 63 65 28 64 69 73 ...
16334 more bytes>,
_outOffset: 0,
_chunkSize: 16384,
_defaultFlushFlag: 2,
_finishFlushFlag: 2,
_defaultFullFlushFlag: 3,
_info: undefined,
_level: -1,
_strategy: 0,
[Symbol(kCapture)]: false
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'https://discordapp.com/api/users/@me',
status: 200,
statusText: 'OK',
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}
thats a chonky buffer init

seriously tho what do i do x(
about?
to get user/guild info
cant u just slap authorization header and GET it?
slap token in that chonky Auth header, send GET to /guilds/guildid
i havent done manual requests to discord's api, otherwise i'd be able to give moe help
@wary flame does it work?
though, you might be better off asking in #381887113391505410
actually, you arent there
im back
lmao
i just checked his shared server
i assumed most people here already be in Dapi
@pure lion log the user, not the api response
send ur code
aight
const express = require('express')
const app = express()
const port = 3000
const fs = require('fs')
const url = require('url')
const fetch = require('node-fetch')
let content = String(fs.readFileSync('./alebot website/index2.html'))
app.get('/', (req, res) => {
const urlObj = url.parse(req.url, true)
if (urlObj.query.code) {
const accessCode = urlObj.query.code;
console.log(`The access code is: ${accessCode}`);
const data = {
client_id: 'eh its kinda sensative',
client_secret: 'nononononononononononono',
grant_type: 'authorization_code',
redirect_uri: 'http://localhost:3000/?',
code: accessCode,
scope: ['identify', 'guilds'],
};
fetch('https://discordapp.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then(res => res.json())
.then(info => fetch('https://discordapp.com/api/users/@me/guilds', {
headers: {
authorization: `${info.token_type} ${info.access_token}`,
},
}))
.then(console.log)
.then(console.log('aaaaaa')) //this was the retard test
}
if (urlObj.pathname === '/') {
responseCode = 200;
content = String(fs.readFileSync('./alebot website/index2.html'));
}
console.log(urlObj)
res.send(content)})
app.listen(port, () => console.log(`app listening at http://localhost:${port}`))
fetch('https://discordapp.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then(res => res.json())
.then(info => fetch('https://discordapp.com/api/users/@me/guilds', {
headers: {
authorization: `${info.token_type} ${info.access_token}`,
},
})).then((e) => console.log(e));
}``` what does it log?
same things as before
:l
i say just do this
what are they for tho
never again will you need console.log()
makes the code easier and more readable imo
lemme grab an example
the little red dots in vsc?
breakpoints? never heard of it
const userData = fetch('https://discordapp.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
console.log(userData);
// .then(res => res.json())
// .then(info => fetch('https://discordapp.com/api/users/@me/guilds', {
// headers: {
// authorization: `${info.token_type} ${info.access_token}`,
// },
// }));```
Dose anyone have discord.js 11.5 code for the top.gg votes that a message is displayed after they vote saying โthanks for voting ...โ
i dont use breakpoints cuz i dont use VSC :p
one sec @pure lion
Guys, please tell me how to check if the channel is NSFW?
(js)
discord.js has nothing to do with ur question
msg.channel.nsfw
channel has property NSFW in it
if (<channel>.nsfw)
what does it log, dice?
@pure lion
wait
Okey, thz u ^^
OHHHHHH THATS SICK
thats called step debugging
never again will you use console.log
unless you do
but still, you get the point
it pauses the code execution on that line you added a breakpoint so you can see values when debugging
just remember it only works with a debugger attached
dice u there?
what?
@wary flame does it work?
@lusty quest It's building
@digital ibex how to unpend promise?
just add a .then((e) => { return e; }); on the end
okkk
const userData = fetch('https://discordapp.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then((e) => { return e; });
console.log(userDate);
?
lost guess what
it logs the s aaaaaaaaaaaaaaaaaaaa me thing
@earnest phoenix send it already goddamit
you don't need .then((e) => { return e; });, just continue your code in that .then or await it

its a fetch
await it
await your promise
let a = await promise
console.log(a)
though like i told you, no need for that with breakpoints
scope: 'identify guilds',
um
?
isnt it supposed to be an array?
no
okay
{
access_token: 'accessy boi',
expires_in: 604800,
refresh_token: 'second accessy boi',
scope: 'identify guilds',
token_type: 'Bearer'
}
i gotta eat brb
i cloned a bot, i can get help with it, can i get help configuring it here?
its not like commands to set up ur server or anything
to log messages on a website
async function a() {
const b = await fetch('https://discordapp.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
console.log(b)
}
await the promise mah dude
or async () =>
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
also seems like an array, but i dont see it either
also like i said before, those questions you should foward to https://discord.gg/discord-api in #381887113391505410 @pure lion
e
@jagged pebble you did read the rules about flashing/rainbow stuff in description pages yes, before you spend time making a rainbow text anim on your bot desc page?
@green kestrel edited
internal/modules/cjs/loader.js:1237
throw err;
^
SyntaxError: E:\gen\alphastar.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1234:22)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (E:\gen\index.js:4:24)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
whats this
Error: Cannot find module '../build/Release/canvas.node'
Require stack:
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bindings.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\canvas.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\index.js
- C:\Users\athir\Desktop\New folder (3)\app\server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\athir\Desktop\New folder (3)\app\node_module
s\canvas\lib\bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\
bindings.js',
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\
canvas.js',
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\index
.js',
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\server.js'
]
}
``` what does this error mean?
Anyone?
@lusty quest It is working now on Docker, thanks a lot ๐
@weak rain your json file is broken
@scenic grotto you need to rebuild the canvas module npm rebuild canvas
Need help why its not in the Center and why is the Animation not Playing...
.bot-name{
text-align: center!important;
color: #92f3fa;
font-family: 'Homenaje', sans-serif!important;
animation: botname 10s linear!important;
animation-iteration-count: infinite!important;
}
@scenic grotto you need to rebuild the canvas module
@quartz kindle i delete the node modules and do them again?
try npm rebuild canvas
@opal plank no i use my skretch build in a iframe
iframe ruined it
i did the rebuild then i did node and got this
$ node server
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module '../build/Release/canvas.node'
Require stack:
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bindings.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\canvas.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\index.js
- C:\Users\athir\Desktop\New folder (3)\app\server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bin
dings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\bindings.js',
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\canvas.js',
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\index.js',
'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\server.js'
]
}
@golden condor that lib didnt fix it but it worked fine after installing the jar from https://github.com/Cog-Creators/Lavalink-Jars/releases
@scenic grotto show the full logs of the rebuild command
Did you have the latest one?
i did the rebuild then i did node and got this
$ node server internal/modules/cjs/loader.js:969 throw err; ^ Error: Cannot find module '../build/Release/canvas.node' Require stack: - C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bindings.js - C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\canvas.js - C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\index.js - C:\Users\athir\Desktop\New folder (3)\app\server.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15) at Function.Module._load (internal/modules/cjs/loader.js:842:27) at Module.require (internal/modules/cjs/loader.js:1026:19) at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bin dings.js:3:18) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32) at Function.Module._load (internal/modules/cjs/loader.js:879:14) at Module.require (internal/modules/cjs/loader.js:1026:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\bindings.js', 'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\canvas.js', 'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\index.js', 'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\server.js' ] }
@scenic grotto what are you trying to do rn?
Beforehand
Lemme see if I can help
Did you have the latest one?
no lmao
@silver dust running the bot
Btw uh I have made a repo which I update with the latest lavalink
paste it in hastebin or any other bin
Dude is it java script?
java script, yes
jabba script
you dont have build tools installed
you need to install windows build tools
npm install -g windows-build-tools
athir@fury MINGW64 ~/Desktop/New folder (3)/app (master)
$ npm install -g windows-build-tools
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
then i do rebuild then node server.js?
@jagged pebble wdym?
@weak rain your json file is broken
@quartz kindle what should i do
size problem
Hm
Compress it
@quartz kindle what should i do
@weak rain copy your code then make a new one and paste it there with the same name
Same a s the replace
@jagged pebble resmi compress et
รok ลey farketmez
tamamdฤฑr
birde
sitenin รถlรงรผsรผ
nedir tam รถlรงรผ bir fotoฤraf yerleลtiriyim
@weak rain copy your code then make a new one and paste it there with the same name
@silver dust {
"Alphastar": [""]
}
its just this
peki botun logosunu daire nasฤฑl yapabilirim
if (message.member.hasPermission("KICK_MEMBERS")) message.channel.send("you cannot"); return
can any1 help ?
what is the issue?
even if i have permission it says u cant
try permission.has()
for what?
1min
how to bot logo to circle
btw did you use d.js-light?
Cannot read property 'has' of undefined
guys how i react like this ๐ and then the commands will deleted?
is it possible to merge 2 bots in a single team?
@earnest phoenix
message.react
@viral iris sorry permissions.has
isn't that the same as hasPermission()? iirc
and if the member will press ๐ then the command will be deleted?
still i can't
also add a ! infront of the check otherwise its true
OOF
yep
what is that for?
hasPermission() uses permmisions.has()
i had some wired stuff with hasPermission() permissions.has() fixed it
peki botun logosunu daire nasฤฑl yapabilirim
@jagged pebble hm bilemedim
if (member.hasPermission('KICK_MEMBERS')) {
message.channel.send("u cant"); return
is it right ?
if (!member.hasPermission('KICK_MEMBERS')) {
@pale vessel wtf your profile man hentai in "seconds" ???
otherwise it will send the message if you have the permission -> ! infront
@silver dust hallettim
Tamam
@earnest phoenix you can react with the bot to the reaction. you can use the MessageReactionAdd event or a Collector for looking for the reaction
umm...
npm install -g windows-build-tools
@quartz kindle
i did the rebuild canvis and i got this error
https://hasteb.in/enefuvuq.lua
what is the command
@scenic grotto delete the node_modules folder and install again. helped me a few times
I got the guild IDs but:
- How do I filter it so it doesn't display the guilds the client is not in
- How do I then display this info on the webpage?
How do bots choose in which channel send the bot presentation when the bot gets added to a server?
@pure lion check the guilds the User is in and only display them
@opaque seal you could use the SystemChannel
How'd I pass in client to my app.js?
what's that @lusty quest
but this will error out if there is no system channel set
what's the right way to stream audio with ytdl-core? I'm currently using ytdl(url, { filter: 'audioonly', quality: 'lowest' }) but this doesn't work on some videos
what's a sytem channel
its a channel the Guild can use for system messages
usually the Join and Boost Messages are send in there from Discord
there was a Wellcome Channel variable a year ago but this got removed
I stuck
you get the Client from the OAuth
Oh makes sense
\๐
What's the most convinient way to edit a message every 3 seconds and stop at the 5th time for example?
\๐
@opaque seal a for loop
and how do you wait 3 seconds?
would not recommend every 3 seconds
^
use a timeout
dont come back here and cry your bot got ratelimited
umm does anyone know what can be the error
@lusty quest how'd I send any info from the backend to the frontend after getting it from oauth2?
@lime pumice show code
@pure lion index?
learn how tyo use js and fs
nodejs and fs
@scenic grotto the canvas module has special requirements to work on windows
as you can see in the logs, its missing all these files
that is because GTK is a requirement for it to work on windows
Can someone help me with express, not sure how to send da shit to res after I get it from the oauth2 scope thingy
they have an installation guide on their github that explains this
so you need to follow these instructions before installing canvas
.
it already does it
it will respond
message events come from all channels
saying hi
be it type text or dm
i'll bonk you if you ask for APi questions
@pure lion what do u need?
@opal plank its not an api question
they are there for THAT specific reason
idk how to put the stuff i got from the api onto the webpage
u can ask api questions here too 
you got the api payload right?
msg.channel.type == "dm"
you can ask it in here, but its unlikely that many would know
just like
res.status(200).json({ response from the api });
then send to author
check type first
@pure lion do u mean that?
@gleaming glen
i do not know the doc shit
check type first
@opal plank
if(
msg.channel.type == "dm"){
msg.author.send("Poop")
}```
h o w
depends what u using
i cant do res.send
HTML? vue? js? jquery?
ejs
@delicate shore cancer indentation, but yeah
ok
@pure lion res.render('ejs file', { responseFromAPI: the response u got from the api });
and in the ejs file
okay se- why do i need a .ejs file?
u can just do <p><%- JSON.stringify(responseFromAPI) %></p> to see if it works
u can just like
app.set('bob', path.join(__dirname, 'bob'));
``` and make a folder called `bob`, in that folder, make a file with the ejs file extension, and copy `<%- JSON.stringify(responseFromAPI) %>`
if thats what u mean?
if you want to send a json response you can simply res.send(response from the api)
app.get('/test', (req, res) => {
res.render('<file>', { responseFromAPI: the response u got });
});```
res.send is deprecated, use res.sendStatus(code, message)
you only need ejs if you want to put the response in an html file, in a page in your website for example
(node:6304) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:526:11)
at ServerResponse.header (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:771:10)
at ServerResponse.send (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:170:12)
at ServerResponse.json (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:267:15)
at ServerResponse.send (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:158:21)
at C:\Users\james\Desktop\h\app.js:41:22
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:6304) 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: 1)
(node:6304) [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.
yeah tim that was the idea, sorry for not clarifying
code?
jesus
(node:6304) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
this much was enough
lost, its just res.send
fetch('https://discord.com/api/oauth2/token', {
method: 'POST',
body: new URLSearchParams(data),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then((e) => e.json())
.then(info => fetch('https://discord.com/api/users/@me/guilds', {
headers: {
authorization: `${info.token_type} ${info.access_token}`,
},
}))
.then(e => e.json())
.then((e) => res.send(e))
i know your real name now @pure lion
whoa really?! cool!!!
James Charles
im going to murder you
My real Name -> ||Never gonna give you up||
Why was I excepting that
i have spoilers on auto
thats not all the code is it?
idk why thats happening, not for my dashboard, is just put it in functions and it works, i also dont have loads of .thens. not sure why
you have another res.something before or after the code
you cannot set headers after a response has been sent
so somewhere you're trying to modify the response when the response is already on its way
Can I have some help please, Whenever I use my userinfo command on my server my friend comes out with having bot founder role when he has the moderator role
The code I'm using is js .addField("Highest role", member.roles.highest)
what is member defined as
first mentioned user
is Bot Founder their highest role
No
isnt highest a method?
there highest role is "server moderator" and its mentionable
this is not mine btw
PG you can get yourself a tim plushie
nvm its a proprety
@delicate shore i dont see how this is related to bot development
ok

