#development
1 messages · Page 1506 of 1
you might want to use a more unique identifier for your bot, like its id
then what's the if statement for?
which one
it checks if the username is the bot's username, doesn't it?
if
how to make a mass-role command?
i have this code
let members = message.guild.members.cache.filter(m => !m.user.bot)
members.roles.add('763358178049261658')
i obv know it's incorrect but i don't know other way :(
use a for loop
no
oh ok thanks
dont use forEach
why not
it creates an anon function internally
of course you can
and forEach doesnt return a collection
correct
i put the bots nickname in the input on my website, it checks if it is the nickname in a discord server is what i put in the input
and after that you run a for loop
you cant iterate over a collection with a vanilla for loop, because they are key-value pairs
unless i'm missing something
of course you can
u r
im not gonna give the full code, but here
so do u know why? or
for(let [k,v] of new Map().entries())
that should give out a rough idea of what i mean without spoonfeeding it too much
@slender hamlet ?
you can either use entries or deconstruct it
deconstruction might be better, or use values()
since you dont care about the key either way
collections arent native to js
its implemented by discord.js, its an extension of maps
@slender hamlet take a look at these
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values
The entries() method returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order.
The keys() method returns a new Iterator object that contains the keys for each element in the Map object in insertion order.
The values() method returns a new Iterator object that contains the values for each element in the Map object in insertion order.
I'm really sorry, I just can't grasp what you did
hopefully someone else can help
i worded it bad
yeah i know, I was being an idiot and forgot you can literally do .values
or pair them up in the for of
theres 5 ways you can do it , from the back of my head, all of them will accomplish the same goal
what that if statement is basically doing, is if (my bots current nickname === the text the user put in the text input) { do whatever }
if that makes more sense idk
for(let e of new Map().values())
for(let [k, v] of new Map().entries())
for(let e of new Map().keys()) Map.get(e) //do stuff
for(let [k,v] of [...new Map()])
for(let v of [...new Map().values()])
@slender hamlet and all of those without using unoptimzied forEach
ok, and do you think you could explain your problem again
for(let e of new Map().keys()) Map[e] //do stuff what is this
(sorry for making you repeat)
the embed gets sent twice as seperate messages
it isnt in a loop or anything
iirc you can, let me check rq
its cuz of #development message
i checked
alright let me think about this for a sec
does anyone know how to fix my issue?
so when you execute that, does it run twice or just the message gets sent twice?
it runs twice
ok
so i added a if (client.nick !== nickname) { to stop it but it didnt work
it might have to do with your network request, not 100% sure
if its getting called twice
what's client
the bot client i assume
it gets called twice because the input's text didnt go
yeah
wait no
its just the member object of my bot
the member yes ah
mb
ok
my english is 100 today
wait, so on the site it doesn't clear on submit?
you can manually clear it
How can i fix it?
make sure you require fs as a module
like if u enter text in this input, on discord and go to another channel / server, and u come back here to this channel, the text stays if u've not sent it
its not the exact same but similar
if im making any sense
:(
i see what you mean, but how does that cause it to send a request twice? man I'm sorry for all the questions
by defining fs
use the methods that erwin mentioned
and press save
yeah
yes
oh ok\
so i change the prefix, and press save
and because theres text in the nickname input
it sends that to my backend
so it sends, nickname and prefix in req.body
could it have to do with the fact that you're using === and !== as opposed to == and !=?
a shot in the dark, but a shot
doesnt do anything
ok
Ok so I wanna make my bot leave a server each time it reaches the max of discord. I'll base this on member count, and I'm thinking how can i do that the best? I use discord.js
(My bot got capped on 250 servers, and will be stuck soon)
"max of discord" ?
what is 250
whats a server
lmao
ok man i blocked you
whats discord.js
guild.memberCount will give you the amount of members on that guild object
oh no!
My bot only sends this but it should also have pics? (1s sending code)
unfortunately that doesn't give you the number of bots so you can't really check for shitty bot farms
client.on('guildMemberAdd', async member => {
let a = client.channels.cache.get("765885272092180483");
let embed = new Discord.MessageEmbed()
.setTitle("Welcome")
.setAuthor(`${member.user.tag} Has Joined.`, member.user.displayAvatarURL,)
.setThumbnail(member.user.displayAvatarURL)
.addField('Date Joined', member.user.createdAt, true)
.addField('Total Members', member.guild.memberCount, true);
a.send(embed);
displayAvatarURL is a function i think
displayAvatarURL is a function
and remove the comma at the end of setAuthor, in the parenthesis
hey tim, you think you have any idea what might be wrong with this? https://hastebin.com/uqomuzisev.less
the indentation
some context
LOL other than that there's something causing it to run more than once
there r other stuff around it thats y its so indented lol
this 1?
the main thing is he's trying to make it so that the createmessage thing only gets called if the member's username is not already equal to the provided 'nickname' value
its not a property, its a method
so call the method
a function is like bob(), bob is not a function, bob() is
which part runs twice?
the whole thing
the createMessage() part
client.on('guildCreate', async(guild) => {
if(client.guilds.cache.size > 240){
client.guilds.cache.forEach(guild => {
if(guild.memberCount < 10) {
guild.owner.send(`I'm sorry, but your server is smaller than 10 members, and this bot is maxed on 250 servers. I'll have to leave! You can invite me later, if I'm verified`)
await guild.leave()
}
});
}
})```
will this work?
then i'd need to see more code
like, createMessage, and it logs twice
That should work fine, yes.
its not in a loop or anything tim, its cuz of #development message @quartz kindle
though guild.owner might be undefined actually
so just like
a.send(functionhere) right?
It's a member, so it's not automatically cached.
the () is the function
no, the message embed is not the method
not the stuff inside the parenthesis
yeah probably
displayAvatarURL is a method
bruh
still, need more code
https://hastebin.com/axufomabab.less thats apart from the app.post
thing.property
thing.method()
@harsh blade
and just checking if the server's id actually exist
uuhhh oki
what is lost.changeNick?
a method changing a users nickname
so in this case, it changes my bots nickname in my discord server
@quartz kindle
always change it
well, still not enough code
theres nothing in there that suggests it being executed multiple times
it’s cuz it gets sent back
if I change the nickname, and press save. It works fine, if I then change the prefix, bc the text is still in the input, it sends the same thing again, and it gets sent twice
I’m using ajax so it doesn’t clear and I’m not manually clearing the input thing
ok so you have 2 input fields, and when you press save, both input fields are sent
is that right?
so option 1: make a separate save button for each field
option 2: clear all fields after pressing save
isn’t there another way?
orrrr switch to something like react and then you'll have proper state management
what kind of other way are you expecting?
i still suck with React but its really nice and relatively easy to use
idk
check if the values are the same, and dont do anything if they are
@crude mantle
and? is it working?
nope
submission = reddit.subreddit("memes").random()
is working
submission = reddit.subreddit("memes").hot()
but this not working ??
i get r/memes/hot
did you use some sort of api client?
name of the client? or just use direct api calls
pls help stop music bot command not working
but saying in chat Leaving..
case 'stop':
var server = servers[message.guild.id];
if(message.guild.voice.connection){
for(var i = server.queue.length -1; i >=0; i--){
server.queue.splice(i, 1);
}
if(server.dispatcher) server.dispatcher.end();
message.channel.send("Leaving...")
console.log('Leaved Succes')
}
if(message.guild.connection) message.guild.voice.connection.disconnect();
break;
and DO NOT SAY ABOUT server.dispatcher
STOP SHOUTING AT ME 😭
who shouted at u
i dont use py and dont really know it well, but the docs say its valid
oh..thx for trying
can anyone help me pls
i stay as far away from Music bots as possible
they are a pain in the ass to maintain
i would just make a direct call to the Reddit API tbh https://www.reddit.com/r/memes.json?sort=hot this one will give you the first 100 posts iirc
i hv it for python
Is this for a bot?
yea
praw is sync, blocking
reddit meme
nope the memes from the hot section is not comming
random meme is geting generated
Doesn't change the fact it's blocking
I'd just do this with aiohttp though
a
ya
xD
I'm getting something from an api and it replaces all 's with '. How can I parse these back to punctuation?
yes but
https://stackoverflow.com/questions/40263803/native-javascript-or-es6-way-to-encode-and-decode-html-entities this maybe helps
then 2nd answer looks promising
just gonna install he
oh also, in JSON all field names need to be encased in quotes too @earnest phoenix
so it would be "obje": true

How i use jsdoc to put a default value?
have you tried to search on google?
I already found it
Hello
Basically I have a messageDelete event with a MongoDB database
const Server = require("../../models/guilds/server.js");
module.exports = async (bot, message, guild) => {
Server.findOne({
serverID: guild.id
},
// some other code.....
what did you want to do?
(node:14656) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined at serverID: guild.id
messageDelete doesn't have a guild argument
just get the guild id from the message?
Hey uhh, how do i set a author avatar in a embed? V12
I will try.
let member = message.guild.members.cache.filter(m => m.user.roles.cache.some(role));```
why it no work :(
bcs you try to get a role from a user
how do I make a bot commands banlist?
TypeError: Cannot read property "cache" of undefined
i suggest caching responses
if you're gonna be fetching that often
By?
i don't quite understand
like when a specific user runs a command, it doesn't work
likely because you didnt implement it
no thats what I want to happen
im not sure if d.js already released an update for slash commands support
.setAuthor(`${member.user.tag} Has Joined the server!`, member.user.displayAvatarURL("png"))
How do i set the author avatar to be the BOTS avatar?
I don't know how to get a uID from it
what you got rn?
client.ws.on('INTERACTION_CREATE', async interaction => {
const command = interaction.data.name.toLowerCase();
const args = interaction.data.options;
if(command == "start") {
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: "Test"
}
}
})
}````
at first glance i dont see anything particularly jumping out
though at the same time i havent played with slash commands
well, that explains it
you copied from here didnt you?
haha yup
it's a bot for my personal use
it's all temporary right now but I need to limit a specific person from using it
did you set a command first?
yes the commands work
I just don't want them to work for a specific user
who's been messing with it
I was thinking of a banlist.json and then checking if the uIDs math any of them, but I have no idea how to grab the uIDs from this
and I can't find anything explaining how to

on member @gritty bolt
@gritty bolt read this https://discord.com/developers/docs/interactions/slash-commands#interaction
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
im not sure if dj.s resolves that to user
but regardless it gets an id
hey guys
so ummm
my bot hit around 100 servers today
i got the verification DM from discord
but it says suspecisions growth like wtf? i mean yeah players did flood in like 30 mins
i was at 15 servers around 6om and around 6:30pm 7pm my bot went viral
now i have like 200 players and 100 servers
i verified my drivers liscense ID
but discord says sus growth like lmao
what do i do
suspicous growth is just very fast growth. you should wait a few weeks before submitting your bot again
i got it
it can also mean that a lot of your bots guilds come from the same user
thats inorganic no?
inorganic growth #697236247739105340 message
suspicious growth #697236247739105340 message
You don't have access to this link moment
you have to join the support server.
I know, cba
yeah i did
btw discordjs returns the first user if they have the same username
is there a workaround for this?
this is a major issue
you mean using fetch?
is there a reason your using usernames not ids to fetch?
for example if there's another guy with "hoax" if i type in something like "hoax" my bot will detect the first guy
because i wanted it to work even with username/nicnnames
not mentioning them
like "battle username"
not "battle @mention"
its a pain if he has to mention everytime
well, discord cant know specific context like that. your best bet is filtering to make sure the user is in the same guild, but even that it cant be 100%
since nicknames and usernames are not unique its really hard to tell who you mean
yo guys is it real that discord ain't giving verified bot dev badge no more?
yes
yep
yeah, too many people made bots to get the badge
lol thanks
shitty bots*
and then everyone told me to wait with verifying my bot, while i where doing it relatively early
F
nah got the badge bcs i dont give a fuck about other peoples think about it.
i got the verification message today from discord
im not gonna lie, my code needs some SERIOUS optimization
but applications are opening on 11
2gb for 400 guilds
i think about recoding my entire Bot. but im not sure if i should Learn Rust or C# and then recode in it
thats seem way too much
what panel is that?
looks like Grafana
had the plan to make a Grafana Dashboard for my bot, looked into Time Series Databases and then decided its not worth for the moment
with a lot of coding
grafana is literally just a display, everything backend you need to code
you need to feed grafana all this data, which isnt easy at all
oh ok
it actually is super confusing then its all super simple.
I dont know why someone hasnt made a simple explanation of how it works.
cuz there isnt a simple explanation
grafana ISNT easy to fuck with
for simple stuff? sure
for this sort of stuff? absolutely not
Set Channel Command: https://srcb.in/TdywOoeXjn
Suggest Somehing: https://sourceb.in/tu09nvR2Yd
Schema: https://sourceb.in/l1Qu2YUMpX
help. no work. i will set the channel then it will be undefined
each panel for the SQL queries is about 41 lines long
wow, i didnt have to do that at all 
document.getElementById("status").innerHTML = "Error - Ratelimited"; its saying, can not set to null
wat
not only do you need to know grafana, you need to know how macros, SQL, elk, Postgres, Prom and some other stuff
the pre-made ones will simply use a node-exporter
it'll tell you ram usage and traffic, thats about it
i've seen em'
then you just add your own queries on top.
you making it too simple dude
grafana is easy for some stuff, for this kind? not really
Bruh idk wtf I'm doing lol
const express = require('express')
const fetch = require('node-fetch')
const app = express()
const port = 3000
app.get('/:site', (req, res) => {
fetch(req.params.site)
.then(res => res.text())
.then(body => {
res.send(body);
});
});
app.listen(port, () => {
console.log(`app listening at http://localhost:${port}`)
})
is it api spam to give 30-50 people a role? Or would it be okay if I give someone a role every second
generally you shouldnt mass give roles.
^^
or mass do anything.
okay well the max it would is 50 members not like entire guild
most of the time it would be around 20-30
its not about the number of people, its the fact its done in mass
That's still a lot of actions in a tiny amount of time
woo, this btw
those 2
one panel
{
"fieldConfig": {
"defaults": {
"custom": {},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "dark-green",
"value": 10
},
{
"color": "super-light-yellow",
"value": 20
},
{
"color": "semi-dark-yellow",
"value": 40
},
{
"color": "light-orange",
"value": 60
},
{
"color": "dark-orange",
"value": 80
},
{
"color": "light-red",
"value": 100
},
{
"color": "dark-red",
"value": 140
}
]
},
"mappings": []
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 4,
"x": 20,
"y": 3
},
"id": 10,
"options": {
"reduceOptions": {
"values": false,
"calcs": [
"mean"
],
"fields": ""
},
"orientation": "auto",
"textMode": "auto",
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto"
},
"pluginVersion": "7.1.4",
"targets": [
{
"expr": "rate(genshin_discord_ws_guild_member_add[1h]) * 60 * 60",
"interval": "",
"legendFormat": "Members Join/h",
"refId": "B"
},
{
"expr": "rate(genshin_discord_ws_guild_member_remove[1h]) * 60 * 60",
"interval": "",
"legendFormat": "Members Left/h",
"refId": "C"
}
],
"timeFrom": null,
"timeShift": null,
"title": "",
"transparent": true,
"type": "stat",
"datasource": null
}```
logs for the server? or bot stats?
everything
wdym?
that whole thing is for that single panel
isnt that just a tsdb with basic math at each point 🤔
like the server staff, gets the graph?
yo guys would there be a problem if i use 2 command handlers
graphana has something built in for those things
ignore the grid and the post, those are autogenerated
oh and also, how do you display like text, and logs in grafana?
i use it for graphs, but i wanna have like join/leave logs etc
not dynamic
yo guys would there be a problem if i use 2 command handlers?
SQL raw requeries, grafana isnt meant to be a log, you'd use an elk stack for that
i do it cuz i dont want to use another panel
ye, how do u get the like guid logs and the other types of graphs?
oh
so super complicated?
basically, yeah
i can list all you need to know, but its one hell of a curve to learn
oke
np
document.getElementById("status").innerHTML = "Error - Ratelimited"; its saying, can not set to null
did you put it on the bottom of the page
or in the body.onload event
yes
@opal plank is it because you use sql and i used Prometheus queries our experience was so different?
i also use prom
so do you use their graphing queries?
prom cant query strings or display it
why are you querying strings for join and leave rates
but that was the hard one 
yes, prom you need to setup on your bot, set the tresholds and set the rates with the proper value measurements
did you not use the prom lib?
my rates where one line
ohhh he wants logs
and tables
how do you disable bot's invite link?
the queries for my sql are 40 lines long
like people are flooding lol
grafana is very good
i thought you where saying grafana is hard for basic rates and stuff.
and thats PRECISELY why you need rates and setup stuff like that
otherwise it looks that fonky
its not that
cuz half of the time when you use the query helper it wont do what you need
its too basic
the helper is fine for simple stuff, but past a point it cant help you and you need to use raw SQL to parse it
u guys think this looks wonky?
like i mentioned, you are NOT suppose to use grafana for logs, you'd use kibana
alr
What is this????

grafana
hey
graphing tool for graphing any metric
is there a function called: if (message.member.hasPermission("OWNER"))
As i only want owners to use a command
couldn't find it in the docs
what if there are multiple
there are multiple servers i mean
...get the guild from the message?
People can join a server...
add the bot to their own
and use the !server command as owner
idk what their server ids are.
what in the literal fuck are you trying to do
what i said, does that work?
nevermind
are you saying you want anyone who owns any discord server should be able to do this command?
No
Only the owners of their servers.
then compare ids?
Huh
all of their servers?
yeah
Oh
i cannot compare ids as i don't know their ids yet.
IS IT FINE IF I HAVE 2 COMMAND HANDLER NO 9NE ANSWERED MY QUESTION
sure
no
(woo help him cuz idk js)
is there a function called: if (message.member.hasPermission("OWNER")) would this work?
no
To me?
yeah
no to both of you
literally what are you trying to do
because this is an https://xyproblem.info
Asking about your attempted solution rather than your actual problem
@earnest phoenix why can’t I have 2 command handlers?
0
Okay i am just going to check on administrators than.
you can have two command handlers, its a terrible idea, but you can have two.
@solemn latch all good thanks
best practice is to keep everything contained to a single event, otherwise you're just wasting cpu power
cache.get returned undefined
find out why
look into the caching behavior of Discord just as a tip
im so confused what is going on in this 🤔
he trys to get a uncached channel
channels should be cached at all times
it's probably the value they're passing into get
that's why i said find out why
possible, but you dont know if he runs normal d.js or something else
d.js-light as example dont cache channels by default
hey guys another question. How would i get the server id of the server a message was sent in>
this actually looks like api abuse, looks like he is trying to mass send messages to many guilds right?
Who
the snippet above
yo thanks
the one who is mass sending messages to many guilds lol
yeah this is a channel spammer.
well he will end up here crying that his bot got Locked for atleast 24 Hours by the API
A user is deleting another user's message in messageDelete event, how can I get that user who deleted the other user?
message.author.username will just show who sent the message, but not who deleted it.
How can I get the user who deleted it?
Aww, that is unfortunate.
Alright.
Is there another thing I could do to get the user?
i think you could get it over the Audit logs
i thought audit logs only log bulk deletes
Well, not gonna put my self in situations, just gonna remove it and make it slide for now.
True.
So you could do it, but not every messsge would be logged
I believe dyno does this as well
I'll make it slide for now.
client.on('guildMemberAdd', member => {
let embed = new Discord.MessageEmbed()
.setColor('#ff00e0')
.setAuthor("Just before we get started..."), client.user.displayAvatarURL()
.setThumbnail("ddmegadoodoo.png")
.addField('Please read the #〔💌〕rules!')
.addField('By being in this discord, you automatically agree to these rules.')
.addField('**Leaving this discord at any point will get your services with us suspended!**');
member.send(embed);
});
i cant figure this out
?
no worries
You can do , just you closed the parentheses.
https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setAuthor
Just to help if anyone would need it, this regex can be used if you want your bot to check if an argument is an image URL: ```js
var regex =
message.content.match(new RegExp(https?:\/\/.*(?:png|jpg), 'i'));
if(!regex){
console.log('Invalid URL')
There are a million ways to match URLs. I'm surprised JS doesn't feature a class to parse a URL and see if it's valid.
maybe the url node module works
I find using a rational expression easier
And only posted it cuz this regex is acc quite useful
Oh it does, I didn't know that: ```js
// A TypeError will be thrown if the input or base are not valid URLs. Note that an effort will be made to coerce the given values into strings. For instance:
const myURL = new URL({ toString: () => 'https://example.org/' });
// https://example.org/
poggers
Thats an exact url tho
you might also want to check the url extension
You're matching an exact URL though
Nope
The regex checks to see if the url is of an image
like if you type youtube.com
it will say invalid
But I can write https://.png and it'll work
since it isnt an image url
nope
it doesnt just check for png maybe if you added something else to it then again, it will check
It does
In general I prefer an implementation in the standard library of a language/library/framework over regex matching when what to match can be complicated, like URLs. Like in another language, I can just do URL(string: "https://google.com/") and it'll return an URL? so it tells me if the URL is correct. There's no need for action from there unless I want to look at the contents, like the host, scheme, endpoint, etc.
and urlregex.com is useful
right, but again, in this case you dont wanna check for an exact url you wanna check the TYPE of url. And this is when you mostly need to use a regex
Yea, and i already got it, i just put it here in case anyone else would need it
well
sorry to break it to you
but you have to make a request to the url and check the content mime type
it's not 1995 anymore, images can be served from any path, with or without the extension
even checking the mime type is not enough in some cases, for example, discord
discord sets the mime type to whatever the extension is
but someone can rename an .mp4 file to a .png
and it'll get served as a png, when it in fact isn't
Oh truee
which leaves you with the final option: download the first few bytes of the file and check the file header (magic number)
right
its so magical
smh ghost ping?
hey
wanna send a text message to a channel if sending embed messages are disabled like this
message.channel.send(helpEmbed);
} catch(err){
console.log("catch");
msg.channel.send("Can not send an embed message, make sure that I have permission to send embed messages");
}```
but it doesnt fire the catch somehow
because you aren't awaiting send - why not just check for permissions before sending the message?
that way you don't waste a request
what does it mean when a shard closes without a reason nor a code?
has_permission is only about role(general) permissions or permissios for the channel which message was sent to
if its latter its ok
but if bot has no role and channel's send embed is disabled, checking permission makes no sense
i need help my brain frozed i need make: A code is a code that can close a vulnerability called anti-raid what it does if a bot or someone tries to create or delete channels between 1 and 5 seconds, the code will re-create/ delete channels and alert the server constructor with dm
who can help me
@ornate otter
I honestly dont know cus im kinda tired and im not the best dev when im not tired either
😭
im sure someone will be willing to help just rn im frazalled cus @languid dragon be playing good music and it making me tired
oh
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix=["#","# ","goji ","Goji "], description='gojiraaaa!!!',intents=intents)
bot.add_cog(Music(bot))
how to add more cogs
i hv two more cogs but if i add those commands in that cog are not working
@earnest phoenix
?
??
some know why my bot don't show my information when i write the command on pc but when i write the command on mobilphone its showing?
give context with your question
it's as if you asked me "why does my washing machine work but my grandma's doesn't?"
xd
ok sorry
i should said better my question xd
my bot doesn't work when i write from computer, but he works when i write from mobilphone
yeah it's fine, just gotta give more context
yo how to add multiple cogs?
you make them a list
and you load them like that
initial_extensions = []
for extension in initial_extensions:
bot.load_extension(extension)```
so inside those brackets i put my cog names?
yes
initial_extensions = [music,genral,fun]
for extension in initial_extensions:
bot.load_extension(extension)
?
no
lik this
some has any idea about my problem? 😦
and they must represent your file path
lol i put all cogs in same file "
so now i hv to distribute those classes and
get those in this
example, if one of your cogs were cogs/music.py, you would do
initial_extensions = ['cogs.music']```
ok thx bro
donno what it is but u can run it from repl.it then
okey
Explain what you need help with
if i call my bot on private msg he works
but he doesnt work in general channel
in computer
You need to provide more details. What isn't working when you call your bot in a server? What's the code being run that's failing? Are you getting any errors?
Why collector.on('collect'); dont work?
const collector = new Eris.MessageCollector(message.channel, { filter: () => true, timeout: 10000, count: 5 })
collector.on('collect', res => {
console.log(res);
});```
The message collector constructor doesn't take an option called filter
It takes 3 parameters
channel, filter, options
So the filter should be there
🗿 Wait you using eris?
Yes

Lmao i didn't realize
@earnest phoenix bruh https://gyazo.com/5a6d7d4eab3aa316d6d38bea2008b5db

Damn, that's kinda a bruh moment
is json bad?
JSON is good for only read purposes, it's bad for read and write purposes since it can be corrupted
json is fantastic for what it is intended to be used for.
aight imma head out
json is great to transfer data between things
backend & frontend intensifies
and a db /s
jason db voorhees will hunt you down
can I get help with mobile exports
exporting data from one file to another
do you mean module exports?
use module.exports
yeah that
hey quick question
you know how some bots create small disposable bot accounts?
those are probably just webhooks
oh webhooks?
webhooks don't have notes, roles and some other stuff
how do I export soemthing?
I want to export 2 strings
ooh, guess i need to look into webhoooks then
How can I use data outside .then() or an await function while resolving a promise?
maybe I am being dumb, but everything I tried failed
you mean awaiting it?
yeah
just use await on the promise
use async/await
alright thanks for the help 👍
but i would have to put await in an async function
and that's where i am having bit of trouble, i can't use the data freely outside of that function
i am not
o
what are you actually trying to do
hold on let me show code
let player1 = drawCards('id', 1)
console.log(player1)
async function drawCards(deckid, countNum){
player1 = await fetch(`https://deckofcardsapi.com/api/deck/${deckid}/draw/?count=${countNum}`)
})```
and this console logs promise pending
...await drawCards?
am I not supposed to do this?
await drawCards('id', 1)
or then pattern
im kind of confused why you need an api for a deck of cards
that pattern seems super weird overall
isnt that like one of the first things you learn to program
but then i would need that in an async function
yep
this pattern makes no sense whatsoever
well i didn't
and it's very convenient especially because it also has images
there are tons of royalty free decks online
making decks is like day one programming.
exports = {
value: () => {
return value;
},
value: () => {
return value;
}
}
const value = require("./file.js")
Cosnole.log(value)
@solemn latch ?
const player1 = await drawCards(...);
//or
drawCards().then((result) => {
//do whatever
});
function drawCards(...) {
return fetch(....);
}
this is the pattern you should use
why are you attacking me for not being a good programmer, I do not wish to spend my time creating it
okay cry ty
and this is more about the learning process of promises 
okay
if you want the response (presuming it's in json) you should turn drawCards into
async function drawCards(...) {
const response = await fetch(...);
return await response.json();
}
cry
did you read the article i posted
then whats the issue
show your code what you get so far :3
basicly it
exports = {
value: () => {
return value;
},
value: () => {
return value;
}
}
const { value, value } = require("./file.js")
console.log(value)
um what
i am having a hard time to get my bot to react to its own message
...okay? what have you done so far
i am back at square 1.
ok
you are also spoonfeeding bad practices
I was trying to help but sorry
guide them to the solution instead of feeding them the code
what
did I do it right?
what?
the export
use module.exports
if you mean this, nope
okay
-at least if that's exactly what you have
ReferenceError: module is not defined
you running your file as a commonjs module?
?
how are you running your file
um
i am just as confused as i was when i started. no i am more confused
javascript in the browser doesn't use modules
so I cant export?
\
pretty sure the article i linked goes over that
and optionally babel it
and you can define your script tag with type="module" and use import/export
but those are weird when used with browsers so i dont use them
i'm pretty sure very few browsers are compatible with import/export
One message removed from a suspended account.
👁️ 👄 👁️
better use pm2 with it, just in case it goes down.
One message removed from a suspended account.
import + tree shaking
i guess most people who use const Discord = require('discord.js') are just following tutorials
how hard is it to use const { Client } = require('discord.js')
Both do the same thing ¯\_(ツ)_/¯
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
wait really
One message removed from a suspended account.
🤢
One message removed from a suspended account.
C#?
One message removed from a suspended account.
One message removed from a suspended account.
dnet is an absolute shitshow
One message removed from a suspended account.
How would I sent values to my main handler
the difference between dsp and dnet is like heaven and hell
One message removed from a suspended account.
they work similarly but dsp exposes the type as a property instead of using polymorphism
kind of like djs
One message removed from a suspended account.
Is there any real reason to not do const Discord = require(‘discord.js’)
What do you mean by bundle your app into something?
you might also save some time by not doing that but we're talking like 800ns to a few ms
webpack (for electron, just node, browser) or a standalone executable
Oh
because by not doing that you reduce the amount of modules that need to be in the actual code
so logically, you wouldn't do it if your goal is to reduce your bundle size
yeah with require there's little to no difference
i think it matters with import/export tho, doesn't it?
How can I check if a user have a specific role in a specific guild?
cant I make: <Guild>.members.cache.get(message.author.id) and the x.roles.cache.has("roleid")?
That's precisely correct.
just did members.fetch instead
and roles does contain ids
Well that's the first part, and you can use the second as you have it
Safer to fetch, for members, you're right.
Roles do contain ids, but roles aren't ids
just blocking some commands from my bot so only people with a role in the support guild can use them
"Bot admins" etc
@lyric mountain check the x.
Caches are collections which extend Map and they're keyed to their IDs.
Nvm then
smh people talking out of their ass with such confidence. Great example of Dunning Kruger.
im not talking with confidence
im just saying it, it does have them 
if Im askin questions here its because im no expert
No I meant KuuHaKu. Lol.

Well, sorry for thinking it returned a List evie, didn't think I'd trigger your inflated af intelligence
"List"? That's not even a thing in JavaScript...
Array, whatever it's called in js
well, just try to actually know the answer when you help someone instead of just randomly throwing bad information out there. ¯\_(ツ)_/¯
whoa people really out there calling someone out for calling an array "list"
Well then, I'll make sure to call your highness next time then
I'm not saying I'm right, I did make a mistake there, the issue is how you addressed my answer
"people talking out of their ass with such confidence"
Yeah, fuck it
uh does innerhtml work with ``? with multiline code?
exe do you know what this means?
script.js:1 Uncaught SyntaxError: Unexpected token '<'
const socket = io('/')
document.getElementById("status").innerHTML = `<div class="alert alert-success alert-dismissible fade show" role="alert" style="float: right; background-color: #f15050; border-color: #f15050;">
<span class=""><b id="status" style="font-size: 17px;">Error - Ratelimited</b></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true" style="margin-top: 2px; font-size: 30px;">×</span>
</button>
</div>`;```
this is my code and it no worky
document.getElementById("status").innerHTML = '<div class="alert alert-success alert-dismissible fade show" role="alert" style="float: right; background-color: #f15050; border-color: #f15050;"><span class=""><b id="status" style="font-size: 17px;">Error - Unauthorized</b></span><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true" style="margin-top: 2px; font-size: 30px;">×</span></button></div>';``` imma try this
<script type="text/javascript" src="public/script.js" charset="utf-8" defer></script>
<script src="https://domain.com/static/controlpanelFunctions.js"></script>
this is my current
what should i do to it?
it doesnt need to declare type
fr?
-The resource from “http://localhost:3000/public/script.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
http://localhost:3000/public/script.js not found
did I do this wrong?
app.use(express.static('public'))
what you did serves the files on the index route
so the script's route should just be /script.js
# kick
@commands.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, self, member: discord.Member, *, reason=None):
try:
embed = discord.Embed(title=f"User Kicked!",
colour=discord.Colour.green())
embed.set_thumbnail(url=str(member.avatar_url))
embed.add_field(name="**user Kicked**",
value=f"**{member}**", inline=False)
embed.add_field(name="**Kicked by**",
value=f"**{ctx.author}**", inline=False)
embed.add_field(name="**Reason:**",
value=f"**{reason}**", inline=False)
await ctx.send(embed=embed)
await member.send(embed=embed)
except:
pass
await member.kick(reason=reason)```
please hlp
help
anyone
hey guysss
umm
the web socket ping is too high TwT 200
my server is in asia
and ig discord is US?
Help how
I don't see anything wrong with that
Apart from the function possibly missing self if it's a method of a class
yeah new york us




