#development
1 messages ยท Page 996 of 1
to get the owner of this server you have to fetch the owner's id (example)
because it's uncached
so i figured out how to get a guilds id in eris but how do i get the name
on message
@honest perch you need to fetch the guild
could you provide me with the section of the docs
or simply message.channel.guild.name lol
Oh you can do that?
eris seems pretty nice
bruh eris seems easy

Idek
why if i copy paste  into my code it not show that emoji
this search is rigged
There is no embed constructor
You have to use .createMessage({embed:{title, description etc.})
@misty sigil is your bot in the same server as the emoji is from?
no
But you can get external packages for it
then thats why
:p
msg.channel gives you the full channel object
which in turn channel.guild gives you the full guild object
so yes, you can access all guild properties from it
thanks tim
TypeError: discord.client is not a constructor what dose this mean
that its not a constructor
^
Visual studio code
Coding your own Discord bot isn't hard at all! with a couple of simple lines you can get a bot up and running on your server. Stay tuned for the next upcoming videos. Make sure to comment below any suggestions you may have about the next tutorial.
How to make custom commands:...
OMG
i followed this but i got stuck right at the end
u are not very help full
IM OUT TOO
how much should ppl wait for the bot to get accepted
:0 so someone here gonna try my bot b4 it get accepted?
y'all, don't be rude to beginners
we all have to start somewhere
at least try to direct them to somewhere that will help
:0 so someone here gonna try my bot b4 it get accepted?
Yeah
@hollow void please learn the basics of js
Visual studio code is not a language.
lol.
y'all, don't be rude to beginners
its not a matter of being rude to begginers, im simply leaving this to someone. The least you should expect for a bot is learning a programming language, you are trying an intermediate level difficulty project without even knowing what a programming language is. I left my sarcastic comments for myself, i simply left /shrug
@idle mountain
anyway.
@opal plank, after learning promises.
now the error says translate.getText isn't a constructor.
@pure lion how to get bot dev role?
Get verified
where
@earnest phoenix you'll get it automatically when your bot is accepted
^
:0
*inhales loudly*
top.gg is its own website
also, #general for general talk
this is for programming help
#support/ #general / #memes-and-media basically anywhere else
whats ur bots name?
lmao.
okay
are you passing translate?
@vitalets/google-translate-api
also getText is a method, it requires params
lmao.
const translatedMessage = new translate.getText(textToTranslate,{to: langToTranslation});
const myMessage = function() {
translatedMessage
.then(function(text) {
console.log(text)
})
.catch(function(error) {
console.log(error)
})
}
oh well, that's the code.
ok hold your tits right there
where is textToTranslate and langToTranslation?
well eitherway
the only problem on ur snippet is new
const translatedMessage = translate.getText(textToTranslate,{to: langToTranslation});
const myMessage = function() {
translatedMessage
.then(function(text) {
console.log(text)
})
.catch(function(error) {
console.log(error)
})
}
problem is, its still spaguetti
trying to rearrenge it
@steep garnet js async function myMessage(textToTranslate, langToTranslation) { await translate .getText(textToTranslate, { to: langToTranslation }) .catch((err) => console.log(err)); } myMessage(/* your params here */)
major problems on your code.
new is requiring a constructor.
function inside functions
unecessary constants
functions just to log console, just do console.log(this)
.then calls the promise right away, i told you yesterday to learn promises before doing calls like that
:(
ah yes, "BAD_REQUEST".
anywayyy, i think i'll learn more stuff before jumping into real stuff.
Does anyone know how to create a webhook and then make it send a message?
i think i actually didn't applied something i always say "don't try to fly when you don't know how to walk".
(from the bot)
https://hastebin.com/wagexamumu.js
(node:7964) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a constructor
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:21)
Have you checked the docs Dice?
pls help
@steep garnet you flew, but you'll get higher every time
Have you checked the docs Dice?
@warm marsh the docs are hard to read
๐ค
@steep garnet you flew, but you'll get higher every time
@pure lion ah well, i just need to learn more stuff.
https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=createWebhook
https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=fetchWebhooks
But thats fetch, i wanna create too
to put it simply @steep garnet , translate does a call, though you are running it sequentially. Imagine this , on the example you gave above, even with new fixed, what would end up happening is that it would call translate.getText (this is a promise) and would immediately try to run .then without waiting for the promise. Basically it returns {promise:pending} not the actual result of the promise. then it would try to console.log({promise:pending} and error. Thats why you await promises to make sure they are fullfilled before the code continues
we all start somewhere, dont worry, but please check mozilla or a js tutorial on promises,callbacks and sync/async stuff, its some of the most important fundamentals of js
ok, ty.
https://hastebin.com/wagexamumu.js
(node:7964) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a constructor
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:21)
what's the easiest way to distribute something to 10% of guilds similar to how discord does it? ik they use some sort of equation on the guild id but what is it?
wait what?
not sure i get your question, but if you want 10% of something, just do 2 functions. One returns guilds.cache.size and divide by 10, you'll now get the number of guilds you need to randomly generate to get 10% of total population. Next one runs a random picker on the guilds you are in picking the n number of guilds you got from before @slim heart
ยฏ_(ใ)_/ยฏ
not sure i get what you are trying to do, can only get that much from the little info you gave
i'm not talking about id arithmetic not like dividing it and doing it through stored guilds
then?
you could do something like id % 10 === 0 lol
lmao
mm okay i'll see how that works and if not i might just distribute on one cluster
if (math.random() > 0.10) 300iq
guild.channels.create('test')
what do i do to send a message in it
im using discord.js
hey, what is the permission for read messages ? (in djs v12, i tried READ_MESSAGES but doesnt look working :/)
guild.channels.create('test')
what do i do to send a message in itim using discord.js
@clever garnet you can use an await
@hasty lotus i have exactly no idea how to use await xd
i just do not understand this use id for grabbing user id
like
let channel = await guild.channel.create("name")
channel.send("message")```
but to do this you have to be in an async function
at the begging
when you put your options
you must set async juste befor the options
there we go
how do i grab user object from id (or just the avatarurl)
from cache or?
๐คทโโ๏ธ
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")
}```
idk, probably not cached
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")
}```
@opal plank also works ๐
so fetch
it wouldn't be cached
@opal plank how
await client.users.fetch(id)
we basically spoonfed you the code my dude
READ_MESSAGES
@opal plank i tried it didn't set the permission
setting permissions?
@quartz kindle I've tried that but
(node:32244) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'avatarURL' of undefined
did you await it first?
what version ?
show code
of djs ?
const Discord = require("discord.js")
exports.run = async(client, message, args) =>{
let member = message.mentions.members.first() || await client.users.fetch(args[0]) || message.member,
user;
if (member) user = member.user;
console.log(user)
var randomColor = Math.floor(Math.random()*16777215).toString(16); //randomizes colour, use this for every embed.
const HelpEmbed = new Discord.MessageEmbed() //creates the embed
.setColor('#' + randomColor) //various settings (including using the randColour)
.setImage(user.avatarURL())
.setFooter(`Requested by ${message.author.tag}`, message.author.avatarURL()); //footer
return message.channel.send(HelpEmbed)
}``` v12
you're doing mentions.members
you are passing a collection onto the channel nini?
thats a member object, not a user object
ohgod
and then you do users.fetch(), thats a user object not a member object
you are passing a collection onto the channel nini?
@opal plank ๐คจ
then you do member.user
what do you mean by that ?
which turns a member into a user, but a user into nothing
you are setting one at a time or are you bulk changing it?
@opal plank didnt work
https://hastebin.com/kukibujopi.js
(node:15304) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
pls help
you'd usually wanna use this @hasty lotus https://discord.js.org/#/docs/main/stable/typedef/PermissionOverwriteOptions
that is what i used
@hardy vector show models/ReactionRole.js
c.updateOverwrite(guild.id, {
READ_MESSAGES: false,
SEND_MESSAGES: false
})
c.updateOverwrite(staff, {
READ_MESSAGES: true,
SEND_MESSAGES: true
})```
c being a channel
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
and staff is a valid role
@opal plankit didnt work
overwrite is fine
what do i do
what didnt work
my code
explain how it didnt work
what was it supposed to do and what did it do
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")
}
was the code
@hasty lotus use permission VIEW_CHANNEL
ok
and you copy and pasted that code literally without understanding it
nah
that code creates a function. functions need to be executed, they do not execute themselves
i dont see a READ_MESSAGES permission on the portal docs, only VIEW_CHANNEL
ok
i don't want members to be able to read at all
they cant access channel if they cant view it
so how do i do that
it's for tickets so if anyone can see the channel :/
// this is how you create a function
function bla() {
// do something
}
// this is how you run a function
bla()
i dont understand
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
๐
@clever garnet functions are a basic component of all programming languages, its like the basics of the basics
^^
@hardy vector show models/ReactionRole.js
ok
module.exports.run = async () => {
const mongoose = require("mongoose");
const schema = new mongoose.Schema({
Guild: String,
MessageID: String,
Reaction: String,
Role: String,
})
const model = mongoose.model("ReactionRole", schema)
module.exports = model
}```
tim
would highly recommend reading that
// create a function called myFunctionName that does 10 + 10 and returns the result
function myFunctionName() {
return 10 + 10;
}
// run the function you created
myFunctionName() // returns 20
console.log(myFunctionName()) // logs 20 in your terminal/console
var test = myFunctionName()
console.log(test) // logs 20 in your terminal/console
``` @clever garnet
@hardy vector wait so you export a run function
and the run function exports the model
wat
anyone good in vanilla JS ?
define vanilla JS
i rarely use HTML, so no
Is there an easy way for me to get rid of npm packages that go unused?
i would like to make something to show the exact current number of server that my bot has
i've already made an express server in my bot file
Then?
thats it, uninstall it
But
why bother keeping unused packages
Uh
do you have a website or a webpage hosted elsewhere?
or is the website itself run by the express server?
i gave up on that, my isp makes my life a living nightmare with not being able to port foward my shit
so your bot express is just an api to export those values
so your bot express is just an api to export those values
@quartz kindle yep
in json
then your website server needs to make a request to the bot server
either from server side or client side, doesnt really matter, but from server side is safer
*--+jhiopjhgkl[iuh
stroke
*--+jhiopjhgkl[iuh
@clever garnet ๐คจ
having a stroke
nohno
use an http lib such as http, node-fetch, axios, got, etc @hasty lotus
how ?
axios is my goto out of thsoe
by reading docs
sry i accually never use web js ๐ฆ
node-fetch gnag
axios squad
that comes later
mmh ok
you can get the json before sending anything to the webpage
is request fine ?
uh why ?
things get deprecated
they discontinued development lol
it just happens
so
in the server.js file
well first explain why you have a run function that redefines module.exports
what do i need to put ?
bc i have this in my main file
require("./Models/ReactionRole").run()```
so i export run function?
but like. why export run in the first place? why not export model directly?
so can i just do module.exports without the run and have it not throw me a damn error and actually work?
const mongoose = require("mongoose");
const schema = new mongoose.Schema({
Guild: String,
MessageID: String,
Reaction: String,
Role: String,
const model = mongoose.model("ReactionRole", schema)
module.exports = model
ty, i was getting tired of scrolling back up
then ```js
Role = require("./model.js");
data = new Role({bla}) // or whatever
it seems you also forgot the new keyword
i dont use mongoose, but this is what they docs show
@hasty lotus show your server.js
sure
const express = require("express")
const path = require("path")
const app = express()
app.use(express.static(path.join(__dirname, 'website')))
app.listen(5000, () => console.log(`Started on :5000 !`))```
that's all...
and then i've got the website folder
in which i've got the css + js + html file
at least for the json file
something like this
\Frosty Rewrite\src\index.js:5
require("./Models/ReactionRole").run()
^
TypeError: require(...).run is not a function
why is this happening now
\Frosty Rewrite\src\index.js:5
require("./Models/ReactionRole").run()
^TypeError: require(...).run is not a function
@hardy vector you must defined a run module
module.exports.run = //function```
well remove the .run at the end then

require("./Models/ReactionRole")
without .run at the end
๐
try something like this js app.get("/json", async (req,res) => { let data = await fetch("bot's express server ip address and port").then(res => res.json()) res.send(`var data = ${JSON.stringify(data)}`); })
example using node-fetch
then go to yourwebsite.com/json
and you should see the data
then in your static html files, you do <script src="mywebsite.com/json"></script>
and you should get that var loaded
do you have an html file?
<script src="/json"></script>
Tim do be teaching doe
x)
first confirm that the data is available
ok
hi, does anyone know why im getting this?
yep yep sure
in the console
i have: js app.post('/save', (req, res) => { console.log('save'); });
and in my html i have: html <form action="save" method="POST"> <button class="button is-success is-light save-btn">Save Changes</button> </form>
and type the variable name
@quartz kindle which name ?
oh
ok
hm, now it just loads and doesn't do anything..
doesnt log to console?
i've got an error in the console
that console is not dev tool, its server console
"SyntaxError: unexpected token: ':'"
@hasty lotus show code
@digital ibex if you go to yourwebsite.com/save
does it log in the server console?
well i mean its post, not get
use reqbin or similar
kk
and try a post to yourwebsite.com/save
just to see if it logs
@hasty lotus where did you get the unexpected token?
on which console?
HTML require the json :
<script src="http://skypvp.fr:3001"></script>```
Website express server :
```js
const express = require("express")
const path = require("path")
const app = express()
app.use(express.static(path.join(__dirname, 'website')))
app.listen(5000, () => console.log(`Started on :5000 !`))```
3001 Port website (bot data in the bot index.js) :
```js
client.on('ready', () => {
serverCount = {
"servercount": client.guilds.cache.size,
"memberCount": client.users.cache.size,
"channelCount": client.channels.cache.size
}
setInterval(function() {
serverCount = {
"servercount": client.guilds.cache.size,
"memberCount": client.users.cache.size,
"channelCount": client.channels.cache.size
}
}, 5000)
})
app.get("/", async function(req, res) {
console.log(serverCount)
res.setHeader("Access-Control-Allow-Origin","*")
res.send(serverCount);
});
var server = app.listen(3001, function () {
console.log("Listening on port %s...", server.address().port);
});```
i've got the unexpted token in the firefox console
while watching the website
on :5000
whats that fast ws lib again?
i cant recall its name
the thing that replaces express and socket io
uws?
yusss, ty tim โค๏ธ
@hasty lotus so you're loading the bot data from client side, not server side
which means your bot server is public
and if you go to skypvp.fr/3001 you see the json data?
thoses numbers will be public anyway on the website so it sdoesn't change anything :/
and if you go to skypvp.fr/3001 you see the json data?
@quartz kindle yep
ok
so the problem is
that browser js cannot load json directly
it can only load js
so the json data has to come through js
here i am with another probably stupid question
How do i fetch a guild member from ID?
so you have to change your json output to a js-compatible output, like this res.send("var data = " + JSON.stringify(serverCount))
then your <script> tag should be able to load it
hmok
and it should be globally accessible in the client side through the data variable
"undefined"
show your html
<script src="http://skypvp.fr:3001"></script>```
thats all?
Is it possible for you to use fetch?
how do i fetch guild member from id?
await <Guild>.members.fetch(id) on d.js
Some that uses mongodb?
Could be cache then
if your using chrome, you can disable cache while dev tools is open
@limber swan what do you need
๐ฆ
or that
idk how its in firefox
yep
<script src="http://skypvp.fr:3001"></script>
<script>
document.querySelector("#someid").innerText = data.servercount
</script>
hm ok i'll try this
@digital ibex did you test with reqbin?
not even an ip address?
lemme try with my ip
just if you know, would you have any simple way to make the number count up ?
something ++
oh ty
if you wanna do it manually, look into requestAnimationFrame()
ok
but you'd need to code your own easing function for the slowdown at the end
does setInterval works in web js ?
yes
oh nice
the only one that doesnt work is setImmediate
nope tim
i tried doing the things u told me to do before, but i got confused and just gave up
ah if its a home pc it needs port forwarding
yeah, i tried doing that but no luck :/
im looking at the way i done it with my url shortner but it looks the exact same to me
just
if i do this
<script src="http://skypvp.fr:3001"></script>
<script>
setInterval(function() {
document.querySelector("#channelsCount").innerText = data.channelCount
document.querySelector("#serverCount").innerText = data.userCount
document.querySelector("#userCount").innerText = data.serverCount
}, 10000)
</script>```
will this really update every 10s ?
bcs the request for the data is only made once
so idk
nope, that wont update
if you want it dynamic, then you need to change everything again lmao
๐ญ
switch back to pure json in your 3001
and dont load anything on html
not directly
and use ajax instead
or fetch
for example, with browser fetch
<script>
setInterval(() => {
fetch('url here')
.then(response => response.json())
.then(data => {
document.querySelector("...").innerText = data.channelCount
});
},10000)
</script>```
tim, is this is what im gonna have to do?```js
app.post('/:guildId/custom-commands/save', (req, res) => {
console.log('save');
});
@digital ibex idk
oh
you're using a router middleware arent you?
yeah
whats your middleware again
app.use('/login', require('file'));
app.use('/dashboard', require('file'));
app.use('/guilds/:guildId', require('file'));```
i read that the discord api won't let bots set custom status' so how are devs doing it?
like
thats not a custom status
they said they plan to, but it was pretty low in their priority list
they said that like 6 months ago
ah ok ty
any ideas or
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")
}```
how do i use this function
im using discord.js
wut
just do newChannel() ?
and create channels
i did
๐คจ
@digital ibex add a simple res.send("bla") on /save
async function newChannel() {
let channel = await guild.channel.create("name")
channel.send("message")
}
})``` this my code
kk
see if it shows up
what do i do
<script>
setInterval(() => {
fetch('url here')
.then(response => response.json())
.then(data => {
document.querySelector("...").innerText = data.channelCount
});
},10000)
</script>```
@quartz kindle i've done this but the counter is still on 000 (default number)
any errors in dev tools console?
what do i do
try console.log(data)
also check the network tab to see if the requests are actually being made
nope tim
can someone help
@clever garnet i already showed you how to run functions
how
also check the network tab to see if the requests are actually being made
@quartz kindle there is
there is only one
๐คจ
console.log something before the interval
test the code without the interval
do some debugging
@clever garnet ```js
// create a function called myFunctionName that does 10 + 10 and returns the result
function myFunctionName() {
return 10 + 10;
}
// run the function you created
myFunctionName() // returns 20
console.log(myFunctionName()) // logs 20 in your terminal/console
var test = myFunctionName()
console.log(test) // logs 20 in your terminal/console
this is my code rn: ```js
app.post('/guilds/:guildId/custom-commands/save', (req, res) => {
console.log('save');
res.status(200).send('hi saved');
});
whats your form url?
<form action="save" method="POST">
<button class="button is-success is-light save-btn">Save Changes</button>
</form>```
@hasty lotus 304 is not modified, you still have caching turned on
you have to disable caching
do i need to update that too?
how?
@digital ibex and whats the current url of the page before you click the button?
okey
@hasty lotus
the pb is on the fetch
i've set a console.log juste before the fetch line
and when you click the button what happens?
it sends me to the cannot post page
let channel = await guild.channel.create("name")
is my code
my error is
(node:25060) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'create' of undefined
what do i do
"SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"
uh
yes
the data is still in js
@digital ibex its trying to post to /guilds/:id/save but your route is /guilds/:id/custom-commands/save?
oh
what do i do
ok now the error is gone
im gonna make it be the website.com/save
@clever garnet learn javascript and stop trying to blindly guess things, sorry
bruh
plus, its channels, not channel
ko
why star? 
guild has multiple channels, so guild.channels makes sense. guild.channel doesnt make sense because there isnt any specific single channel in a guild
i feel like an actual coder person now, them memes of the backend is shit but the frontend is nice, i can finally relate
but both backend and frontend r shit tho
@hasty lotus response.json() needs to be returned
response => response.json()
or
response => { return response.json() }
it's already done
okay, so i have this endpoint: ```js
app.post('/save', (req, res) => {
});``` how would i start to ratelimit users?
you added console.logs but you didnt return it
fetch('http://skypvp.fr:3001')
.then(response => {
console.log(response)
})
.then(data => {
console.log("fetched")
console.log(data)
document.querySelector("#channelsCount").innerText = data.channelCount
document.querySelector("#serverCount").innerText = data.userCount
document.querySelector("#userCount").innerText = data.servercount
});```
i've got this
bruh
you need to return the .json() promise
fetch('http://skypvp.fr:3001')
.then(response => {
console.log(response)
return response.json()
})
.then(data => {
console.log("fetched")
console.log(data)
document.querySelector("#channelsCount").innerText = data.channelCount
document.querySelector("#serverCount").innerText = data.userCount
document.querySelector("#userCount").innerText = data.servercount
});```
like this ?
yes
hm so
with this endpoint
how can i get the guilds id? 
req.params and req.body is an empty object and undefined
wym?
hm, lemme try it
To get the body you need to pass body in the post request.
this is my form: js <form action="/save/:guildId" method="POST"> and this is the js: ```js
app.post('/save/:guildId', async (req, res) => {
then it errors
But that should return a body with form data.
saying cannot post /save
in the form or the post?
both
Yeah, I had to check.
I'm unsure but I think you require a middleman in-order to access form data on server.
dude no
@digital ibex if your .post is /save/:guildId then you need to post to /save/id, like /save/264445053596991498
then afaik its req.params.guildId
Oh I was right.
my post isnt that
He's posting form data.
Do you have something like body-parser installed?
Is it possible to code a functioning discord bot in pure html?
@earnest phoenix no
what does html lacks that makes it unable to code a discord bot?
You can run a bot in the browser.
app.use(express.urlencoded({ extended: true ));```
that'll let you use `req.body` which is all the form params @digital ibex
if you have js you can
html on its own won't
are you posting the form
my form is just action="/save" method="POST"
this is all thats in the form: html <form action="/save" method="POST"> <button class="button is-success is-light save-btn">Save Changes</button> </form>
o
how would i uh change that?
put all your inputs inside the form?
?
im confused..
it'll only post data in the <form></form>
so put all your inputs you want saved in there
oh for fucks sake
you already had it
/save/:guildId on the back end
make the form post to /save/guild id
okay
Can we simulate a (successful) vote?
using the test button
so, form: <form action="/save/:guildId" method="POST">
post method: app.post('/save/:guildId', async (req, res) => { like so?
Uhm where?
bot page -> edit
and no, you replace :guildId with the guild id on the form @digital ibex
oh
so action="/save/264445053596991498" for eg
Ah thanks I found it bud
how would i uhh, do that
are you using ejs
yeah
action="/save/<%= guildID %>"
then pass the guildID in to ejs as an option or such
ie res.render('whateverpage.ejs', { guildID: xxx })
<%= guildID %>
will get replaced
action="/save/<%= guildID %>"
so that will post an actual ID
i literally just showed you how
Hi
/save/:guildId?
yes
so posting to /save/264445053596991498 for eg would then pass the guild id on
then you have req.params.guildId
.... :guildId isnt an id
im trying to get the id
i have been in this for 3 days and i cant solve the problem: https://sourceb.in/32b8360ebb
and my code is this:https://sourceb.in/d5399fbad8
i told you how, if you're not smart enough to understand then learn express before making a complex project
@quick copper show the contents of whatever this code is requiring
const reqEvent = (event) => require(`../events/${event}`);```
wait nvm
your code is wrong
reqEvent('disconnect')(client)
that won't work
use reqEvent('disconnect', client)
ok
then just parse the args through
i change all to that
const reqEvent = (event, client = null) => require(`../events/${event}`)(client);
then each event can receive client
each event needs to export a function
because you aren't parsing a msg
@earnest phoenix why are you asking heere
the hell i do that?
then they won't watch
its your channel.
who cares
ThatTony how i parse a msg?
@quick copper client.on('message', reqEvent('message'), client, message);
then modify your reqEvent:
```const reqEvent = (event, client = null, message = null) => require(../events/${event})(client, message);
should pass the msg through optionally
i was working on typing i can't type fast
ok
thattonybo, i fixed it and now i get this error:
its not an error, it's telling you to change your code because that function will be removed
and it's quite literally telling you what to use
no not that
the cannot set headers bit
don't send content after you already ran send once
@quick copper you're fucking discord.js internally somewhere, look through your code
can't help you there
ok
i can just eval()
How do I bounce my webhook to the external ip? in Node-JS
top.gg DBL: Webhook running at http://0.0.0.0:5000/dblwebhook is what it says now.
It's a windows server.
It doesn't works btw that's why I ask.
The server at IP is taking too long to respond.
go through your firewall and then your router (if you're locally hosting) to port forward
make sure external connections on that ip/port are forwarded to 0.0.0.0:5000
Lemme see
i don't have experience with win server past 2003 so i can't help
netsh interface portproxy add v4tov4 listenport=5000 listenaddress=0.0.0.0 connectport=5000 connectaddress=EXTERNAL_IP
Is that possible?
All of what?
what do you need?
I need help with this top gg thing
plz
Anyone who knows a fair amount of HTML Coding, DM me.
|| Ty ||
HTML?
html isnt used in embeds
Whatever this is?
i can help tho
@quaint hound DM?
ok
There are lots of libraries for the discord API.
"top gg thing"
And HTML isn't a scripting language.
i love white names
lmao
and the fun questions you get
Why not those last two if's on the same line?
you write ugly lol
Here are my elifs
Why blank lines
Blank lines are useless
You don't need blank lines
You need patterns
That's not easier
Just makes me scroll more
๐
I despise whitespaces and blank lines.
if you dont write code that others find readable ~ your doing it wrong. period.
https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
help pls
i cant seem to fix this problem
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.<anonymous> (/home/runner/infernotest/index.js:1146:20)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
exit status 1
๎บง ```
code
config.json?
ok
module.exports = {
TOKEN: '',
YT_API_KEY: '',
devs: ['397451673842352130']}```
thats my config.json
the whole text is black
aaaah
{
"TOKEN": '',
"YT_API_KEY": '',
"devs": ['397451673842352130']}
}```
i think
idk
works for me, but i don't use exports
why does this throw about eight errors
return (permission || (_: any) => false)(message.member || message.author);
@earnest phoenix .json files aren't .js or .enf files
you need to use actual json
{
"token": "..."
}```
ok
@opaque hawk show errors 
ok...
https://hastebin.com/dadayozina.js
(node:12008) UnhandledPromiseRejectionWarning: TypeError: ReactionModel is not a function
at module.exports.run (C:\Users\kenra\Desktop\Frosty Rewrite\src\commands\Utilities\rradd.js:41:22)
help pls
internal/modules/cjs/loader.js:1170
throw err;
^
SyntaxError: /home/runner/infernotest/config.json: Unexpected token ' in JSON at position 11
at parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1167:22)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/home/runner/infernotest/index.js:21:37)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
exit status 1```
im getting this error when i try to launch
I mean, there is about three "; expected"s, two ") expected"s, one "Unreachable code detected"
hi um, does anyone know why this logs a as the prefix when the prefix is actually hi ? my code: js app.post('/save/:guildId', async (req, res) => { const guild = await guildModel.findOne({ id: req.params.guildId }); console.log(guild.prefix); await guild.updateOne({ prefix: 'a' }); console.log(guild.prefix);
and then i do aping nothing responds, i do hiping response
@digital ibex prefix: 'a'
There is a line that literally defines "a" as the prefix
It says something is wrong in your config json file @opaque hawk can you paste it in chat just dont put ur token.
ok
for(let i=1;i==test.length;i++){
if(test[i]=="+"){
testsliceAddition.push(test[i-1,i+1])
console.log(testsliceAddition)
}
}
[ '3' ]
[ '3', '4' ]
[ '3', '4', '2' ]
[ '3', '4', '2', '3' ]
[ '3', '4', '2', '3', '9' ]
[ '3', '4', '2', '3', '9' ]
So this is the result. Can someone explain to me, why the first number is not pushed?
Here is the string, which I transformed into this(I filter the strings by + and join them to an array)
original array:
[
'2', '+', '3', '+',
'4', '+', '2', '+',
'3', '+', '9'
]
TOKEN=
PREFIX=r!
ANTI_DUPE=https://embed-8k2rfnof0bo3.runkit.sh/
This is a .env, not a json
what does the file that holds it say like what s the name
oh wait I was looking at the wrong thing lol. Above where you said your error there was some guy who had the json problem.
archigan, whats ur issue
My issues is mainly "Unreachable code detected
free code pls
@tiny venture uuuuh no.
wdym?
The line

which line?
wait nvm
return (permission || ((_: any) => false))(message.member ? message.member : message.author);```
You have to put a ; after return
u wot
thats what sets that error off
I have a fellow dev who is redoing the line in another way
im still a bit confused what ur trying to do lol
the code is unreachable?
show the code above it
I have another dev who is redoing the line
so its fixed?
Pretty much
noice
can someone help me with my problem?
Using Windows Server 2016 I have added a TCP forward in my Windows Firewall for port 5000, when trying to visit it says that the server took too long to respond.
Any ideas?
Is there a function in discord.js similar to if(message.author.bot) return; but for reactions?
no i meant like
a function similar if (message.author.bot) return; but it tells the bot to return if the reaction was added by the bot
Read what I said
alright thx
