#development
1 messages · Page 622 of 1
make a
well
check if guild got prefix by if
and if not then make
Ah yes!
^
Hmm
let prefixes = JSON.parse(fs.readFileSync("./prefix.json"))
if (!prefixes[message.guild.id]){
prefixes[message.guild.id] = {
prefixes: botsettings.prefix
};
}
let prefix = prefixes[message.guild.id].prefixes;
this works
and when i print prefix it works
oh yeah like that but you might wanna save to the json?
well yeah thatw orks
@celest spindle you need fs.writeRile
File
yeet
fs.writeFile("./prefixes.json", JSON.stringify(prefixes), (err) => {
if(err) console.log(err)
});```
idk how your file are named
u forgot .json
hehe
Ah yeah
my laptop just chose to do windows update cuz it failed earlier XD
why do I have this error in my console? "DeprecationWarning: Collection # find: pass a function instead"
is it discord.js?
Yes
Okay thanks
np
hello guys, I need some help
trying a github clone in cmd not working
is there a plugin or something I need?
dm me please, it s urgent
Ever heard of docs
Like, google "how to use git"
Search on google before asking here, and if you dont found ask here
alright, thanks
@zealous veldt can i have my bot un muted, i fixed everything
this is why it was muted
@modern sable ^
sure
]]helpcom
You will not be the first, and you will not be the last to do the following:
- Decide to run a common prefixed help command.
- Immediately regret your decision.
- Post about it in #general , warning people about it.
Times this message has been reposted: 25
Break the cycle. If you fuck up, then keep it to yourself.
Bad choice
For your bot?
yee
Something easy to click
mine is ">"
Something unique
many people put the first letter of their bot's name before or after a character like !, ?, etc.
kk
Like b!help
ik
ok
My prefix is +
I made a bot in android tell me way how to host it
Lol glitch
heroku better than glitch
mainly cause its designed to host apps
rather than running as a hobby service like glitch
:v
M h m
ikr
uhh does discord.py-rewrite have a way of checking if the channel the command is used in is a dm channel or not
i know i talked about googling a problem in five seconds earlier but i don't think i found anything when i did and i'm too lazy to do it once again
async has that. Idk about rewrite. Rewrite wont work for me qwq
you are not w o r t h y
I know .bot() exists so I thought there might be something similar for dm channels
Kek
I run my levels through .json despite like everyone telling me to use something else and I've no clue how to prevent people from just spamming a message to gain exp
I feel like there's a function that should help me here
maybe something with god damn datetime and comparing the current datetime to the datetime i can log but I've no clue how to compare datetimes and it sounds like more work than it's worth tbh
Python timers exist. Make it set a date and store it in a file ig
all I can think of doing is adding a 'time' key and putting the time
then a function that compares the current datetime to that
That would work
I'm going to work out the logic of that tomorrow because it's nearly 11pm and I'm tired
Agreeable
#inv
@jolly sentinel if a command is used in DM, message.guild is None
Also, command cooldowns exist if you are using commands extension
I was talking about the on_message
You get x exp for every message sent, yada yada, basic basic
Ah, well
You will need a dictionary where the key is message author id and the value is datetime.datetime.now().timestamp()
already got the key with the message.author.id so that should be easy
I just want to know how to compare the datetimes
dt > some other dt object
so something like uhh
I doubt timedelta works when comparing
say I want to make it not allow it if they've sent a message in the past minute
I've only ever used datetime for logging purposes so I've no clue how to check these things
You will need datetime.datetime.now() as a value of dict
Then, when a message is sent, substract another dt.dt.now() from the previous one
And see if .total_seconds() will be > 60
so
dict = dt.dt.now()
x = dt.dt.now() - dict
if x.total_seconds() > 60:
because
I've no c l ue
Well certainly that won't work for each member so you need a dictionary :p
But you are close
Would that work if the dict was instead the dictionary
so instead it would be
a = lvl[str(guild.id)][str(user.id)]['timestamp']
x = datetime.datetime.now() - a
if x.total_seconds() > 60:
# stuff
else:
pass```
That looks correct

if this also completely wipes my json script
i will cry
this is why I have a backup
lets go boiiisssss
I almost fucking panicked thinking that my on_ready statement was taking user ids instead of guild ids when checking

someone deleted a message in corgobot's dms
they just made me realize it gave an error
phuck
good news; it didn't throw an error
bad news; it still gives exp
bad bad news; json doesn't like dumping datetime.datetime.now()
good news; fixed it still giving exp
Store .timestamp()
Well unless json doesn't like floats, it will work:p
Substraction? Well use two timestamps for that then
Since .timestamp() is float
What


I'm gonna set it to like 60 for now
and just add a way to customize it another time

though
bad news
Luckily I have to do this now and not later
I have to reset everyones levels in my dict
because otherwise
Welp
key errors
anyhow
thanks for the help
also, messages in the dms return as NoneType
You can use .get('key') on a dict instead of ['key'] so thaf it will return None instead of KeyError
Messages in DMs? Well that's weird
that only happens if someone tries to use something like -!level in dms tho so no one would try taht
r i gh t t t
well
unless there's some unseen danger of letting keyerrors run rampant
is there a reason for me to make it neater in my console
So that you could look at it without having your eyes bleed? 
I have accepted that I shall suffer
Good luck
eh
my console doesn't log anything anyways
it just logs this
Bot is ready!
corgobot
2019/05/26
12:14:00 AM
<--->```
What is it supposed to output?
Ah, I thought you were getting some other issues with outputting something
Good
Search some random bots on the website for ideas /shrug
Or dedicate your bot to just levels
It's not just levels
It's levels, logging (message, admin actions (using the bots commands), warns), and other stuff
I don't care to list it off rn
Well then ig search for some ideas 
I shall
My bot was originally just a three day project to see how much I could do for a friends server that evolved into this
it will be a bad idea?🤔
Hello , how i get bot developer or certified developer ?
and how i can know if my bot declined or not ?
]]faq 1
Click the link to get more information on the question:
]]faq 2
Click the link to get more information on the question:
2) How long is approval?
both apply
Bot Developer role is given to you when your bot is accepted on the website
Certified Developer role is for developers of certified bots
Ah well
yes that too
]]faq1
why i cant invite @covert turtle
ooh
how do i get the data of a list
{
"test" : {
"test1" : {
"id" : "tt",
"return" : "success 1"
},
"test2" : {
"id" : "tz",
"return" : "success 2"
}
}
}
how to return test 1 and test 2 at the same time
just get test?
does it return all?
it should
py or js?
py
like playing?
some bots have status "streaming"
please, just go to docs
but playing yes
i know its configurable
hmm
@proud wadi looked at the documentation, here's an example
await client.change_presence(activity=discord.Game(name='my game'))
# or, for watching:
activity = discord.Activity(name='my activity', type=discord.ActivityType.watching)
await client.change_presence(activity=activity)
streaming?
you could probably do discord.ActivityType.streaming
for streaming to work you also need to provide a url
discord.Streaming
oof :/
not you
okay
ik, but i wouldn't be able to help anyway because i'm on the old version, not rewrite lol
okayokayokay
because you didnt set a url for streaming
whats that
a streamer my friend likes
oh yes what a good choice
?
oh
music bot.
24/7?
um
have a dedicated server?
all these noobs hosting their bot 24/7, why not just do 24/24
gotta get those 24 days a week you know
?
what im making
what
bot.on('message', msg=>{
if(msg.content == "HELLO"){
msg.reply('HELLO CHIPS!');
}
if statement isnt closed
give me say something
neither is the event listener
i did js syntax colouring but i have no idea what language that is
its javascript
pls
bot.on('message' => {
if(msg.content === 'HELLO') {
msg.reply('HELLO CHIPS')
}
})```
oh yeh
my very simple system for bot
mhm
..and?
i just set up a category with permissions, and it became a drag and drop instead of a bot command
people nowadays rely on bots too much
xd
i have no problem with bots doing simple things a dumb user could do
i just dont use them
plus the best thing about being a bot develpoer is that you can just build your own systems for whatever you want instead of having 900 bots in the server
I have no problem with shit bots existing, but what's the point of them when manual actions are far more efficient?
again, dumb users
youd be surprised how many people have no idea how permissions work
._.
im not calling out anyone, just talking from my own experience
I've been in more than enough servers where in channels like announcements and rules you can't read message histories
there was a youtuber who is now inactive, and i was given the muted role in his server for uh reasons and i was able to send messages in the rules channel
i have no idea how you fuck up that badly, but eh
._.
what's more triggering to me is when they want to hide the channel, they disable LITERALLY EVERY permission for that channel
Nvm
anyways, please teach me some custom commands```
that's not how it works
a giant prerequisite to making a bot is knowing the programming language you're going to make it in (ignoring the fact that 80% of people here do the exact opposite)
once that has been done, you progress onto learning what discord's api offers you and what you're capable of doing
is there a way in python to, instead of running through individual items in a list with a for loop, it just does every item at once?
I have a Google search command, when I run home, its works, but on my vps, its not working. And there is no API to create for the command. Do you know what this is about?
Do you speak french?
@solid pike oui
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return ("**❌ Vous n'avez pas la permission d'effectuer cette commande. Permission requise : `Gérer les rôles`**");
let role = args.join(" ");
if (!role) return message.channel.send("**❌ Veuillez spécifier un rôle.**");
let gRole = message.guild.roles.find((r) => r.name === role);
if(!gRole) return message.channel.send("**❌ Je ne trouve pas ce rôle.**");
message.channel.send(`<@&gRole.id>`)
}
module.exports.help = {
name:"mentionrole"
}
I wonder why he doesn't answer when he finds the role..

You miss something
Is there a way to deploy to netlify without using github?
I really don't wanna make a github repo for a trivial project I'm working on
let mention = message.server.roles.get('name', role);
roles at role.get is undefined.
How can i do ?
Read the docs
server isn’t a property of the Message class
And Map.get() only takes one param
is someone able to show me how to embed messages from a discord bot?
@vital nest can ur bot send any messages yet?
what language is it
its in javascript, and yes I can send messages with it
Can i get helpjs if (message.isMentioned('366026189166346242')) { message.reply("Are you really pinging him when they told you not to... Great When he gets back you're Banned. Have fun!"); if (!message.channel.includes('408885161724215296', '366026189166346242')) return; } if (message.isMentioned('408885161724215296')) { message.reply("Are you really pinging him when they told you not to... Great When he gets back you're Banned. Have fun!"); if (!message.channel.includes('408885161724215296', '366026189166346242')) return; } i am trying to make it with me being the owner and the other owner can ping each other without the message going off when other people ping let the message go off the message goes off when anyone pings him even him self.
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return ("**❌ Vous n'avez pas la permission d'effectuer cette commande. Permission requise : `Gérer les rôles`**");
let role = args.join(" ");
if (!role) return message.channel.send("**❌ Veuillez spécifier un rôle.**");
let mention = message.server.roles.get('name', role);
role.setMentionnable(true)
message.channel.send(`${mention}`);
await role.setMentionnable(false)
}
module.exports.help = {
name:"mentionrole"
}
why is not fonctionnaly ?
What error do u get? @earnest phoenix
When I do the command with a role name that exists, it finds it but it does not mention
So I'm guessing the console says Can't find "roles" of undefined?
What does it say then
Hmm
Do you suppress your errors somehow?
Like do u do a client.on("error") or process.on() somewhere?
wdym by "handler"
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return ("**❌ Vous n'avez pas la permission d'effectuer cette commande. Permission requise : `Gérer les rôles`**");
let role = args.join(" ");
if (!role) return message.channel.send("**❌ Veuillez spécifier un rôle.**");
let mention = message.guild.roles.find(`name`, role);
role.setMentionnable(true)
message.channel.send(`${mention}`);
await role.setMentionnable(false)
}
module.exports.help = {
name:"mentionrole"
}
What does ur main file look like
But, it's not from the..
The concern is that when he finds the required role, he does not answer of the latter
Can you pls send the main file or not
Ik what's wrong with ur code, but what's concerning that you're saying you don't get any errors in the console... that's more important to fix
ok
You have to get errors in the console...
But you're saying you don't.
That's more important to fix first
No, just for this command it does not send error, for others, its the e
for others, its send them
huum
just says me :
(node:21006) DeprecationWarning: Collection#find: pass a function instead
Well you said you didn't get any error
How did that magically show up
Were you lying to me earlier
I didn't think it was a mistake me..
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return ("**❌ Vous n'avez pas la permission d'effectuer cette commande. Permission requise : `Gérer les rôles`**");
let role = args.join(" ");
if (!role) return message.channel.send("**❌ Veuillez spécifier un rôle.**");
let mention = message.guild.roles.find(`name`, role);
role.setMentionnable(true)
message.channel.send(`${mention}`);
await role.setMentionnable(false)
}
module.exports.help = {
name:"mentionrole"
}
Please, fix it directly if it doesn't bother you, I'm a little lost
Dude... pass in a function
I put find
Just replacing .get() with .find() won't do anything
You have to pass in a function
I don't know sorry.
Collection.find(role => role.name === "I'm gonna copy-paste this code cuz i want to make a bot without knowing js")```
but I want the command to be available in all the servers where is the BOT!
@earnest phoenix what was the question
mention.setMentionable
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return ("**❌ Vous n'avez pas la permission d'effectuer cette commande. Permission requise : `Gérer les rôles`**");
let role = args.join(" ");
if (!role) return message.channel.send("**❌ Veuillez spécifier un rôle.**");
let mention = message.guild.roles.find(`name`, role);
role.setMentionnable(true)
message.channel.send(`${mention}`);
await role.setMentionnable(false)
}
module.exports.help = {
name:"mentionrole"
}
The command does not work and I do not know why!
@spring ember
@buoyant wagon what ?
mention.setMentionable because role is a string
what does work
mention.setmentionable is not a function
M caps
Lmao again I'm surprised by how terrible some people are at copy-pasting spoonfeed code...
i have this :
let role = args.join(" ");
if (!role) return message.channel.send("**❌ Veuillez spécifier un rôle.**");
let mention = message.guild.roles.find(`name`, role);
mention.setMentionnable(true)
message.channel.send(`${mention}`);
await mention.setMentionnable(false)
@opaque eagle I made it..
Role.setMentionable() with one n
hum
await message.channel.send(`${mention}`);```
Lmao yeah that too
Do you use an ide
But I want to know why it doesn't work
Read the console
STOP SAY ME !
The error should tell everything you know
It doesn't work because you typed it wrong
I understand that you're not English but that doesn't mean you aren't capable of getting an ide
Which would point out these issues
And actually be very helpful for someone like you
(and free)
Its works but its not mention knowing that I have the role notification
ROFL
what ?
That's a rip
Anyway
It's not working because you aren't waiting for the role to be mentionable
It doesn't immediately happen
You should await setting the role mentionable and then await sending the message
After that you can set it back
ayy how can i get user by id
in discord.js its client.users.get(id)
lol
he asked about discord.js before iirc
oh
ohh so that
@mossy vine A!eval client.users.get("542877354125557760").message.send("Hi")
cant i send msg wit that function
because a User doesnt have a message property
just do .send directly
also read the docs
ohh thx
i swear 90% of the problems in this channel could be solved by reading the docs
DMs are probably closed in that user's settings
ohh
hmm
profilepicraw = await self.bot.session.get(f"https://www.reddit.com/user/{memepak['author']}/about.json")
profilepicpak = await profilepicraw.json()
profilepic = profilepicpak["data"]["icon_img"].split("?")[0]``` look at my coding gore
Does anyone have the code for virtual currencies ?? Pollux type rubies. 
This is not a place to be spoon-fed. There are plenty of examples online and you should first try to create what you can and ask questions relating to that rather than steal someone else's entirely @earnest phoenix
ive been away from discord.py for a while and i cant seem to find the rewrite docs. is there even rewrite anymore? lol
I can add a bot in the discordbots.org and "private" he?
ohhhhhh
https://discordpy.readthedocs.io/en/latest/ @Honor#2406
@naive laurel why would it be private if you were to add it
How i can get my bot votes? in dblapi
A!eval client.guilds.get("506041422626029578").channels.find("name", "general").send(Pong)?
why doesnt that work
What does the error saay
well that find is deprecated and ^
TypeError: Cannot read property 'send' of null
thats what she said
@opaque eagle umm?
latest
master or stable
Np lol

ayy anyone ever used mongoose cdn before if u did pls help me out
missing library 
reinstall android
microwave iphone
I just installed Windows Me on my iPad +
And I install ios on Windows
@earnest phoenix ytb dude
best way to learn
Wait
https://youtu.be/XH1Fp77D-js @earnest phoenix
This series contains some errors. A new series is on the way to right these wrongs. T 2019 Discord.js Series: https://www.youtube.com/playlist?list=PLdnyVeMc...
(:
I'm not at home
Sry
wew
I'm struggling to be able to get my bot to go online, I've started using a software called node but when I continued on visual studio code it keeps saying node is not recognised. Does anyone know how to help
Is node.js installed properly?
If it doesnt recognize node you likely didnt add it to PATH while installing
How do I add it to the path
I'm sorry but I'm just confused
Do I need to uninstall and reinstall??
I prefer reading docs as I understand what to do and not by copying what someone has doe
Done
I still prefer reading docs
Again i prefer reading docs
YoU cAn LeArN fRoM dOcS LoL
No but i prefer docs yes
But i started coding with a simple tutorial.
And from then, i tried to learn it myself
wOw oK
cAnt i give my own opinion
Nah joking
guys any help on slowmode wwith python?
@slender thistle
its the last ver
look at the error
what you mean?
You are using channel property of ctx
channel is instance of TextChannel, which has function edit
Also, time: int in command function arguments
done thanks
yeahi
i already did that
btw
can i send my code and see if i can like wrap it a little bit?
cause its too long lol
Sure
dm
if(message.mentions.members.size == 1) {
let member = message.mentions.members.first()
message.channel.send(`${message.author} gave ${member} a hug!`, { file: "https://media.giphy.com/media/CZpro4AZHs436/giphy.gif" }); }
break;```
No err
Pretty sure it has to be js { files: ["url"] }
=== instead of ==?
how do you even manage to do that
im actually curious
what fucking tutorial do you follow to manage that happen
magic
Ok
Im not following a Tut ma dude 😛
a simple ```JS
if (message.guild == null) {
await message.channel.send("No no, not here")
return;
fixed it
Just forgot to add it in xD
please give me that tutorial lmao
What tutorial ?
😛
Not working even with ===
Could just use the channel type
And if you wanted that !message.guild would probably be better
How to shard a bot using discord bot maker
Go into the code
Anyway to remove [ws] [connection] Heartbeat acknowledged, etc from showing in the console ?
it is annoying as fuck
how are you creating your client?
Internal via VS ( for testing ) Linux for the main bot. it shows on both clients
Like I created my bot as sh*t
he sad client
👍
i dont know why its sending those then
😦
only had that when i was testing a commando-based bot i was contributing tho
KMS = Kiss My Self ?
Kill My Self?
no shit sherlock, how about just typing it, since that violates community guidelines
fun fact if you kill yourself you die
wrong channel
when you try installing new modules but pips like "nah i dont exist anymore"
Are you trying to edit a message?
Guys what do you need visual studio for?
visual studio is an ide
Oh
it helps you write code more effectively
Like pycharm?
Lol i use pycharm
Who needs visual studio when u got notepad
Yeah lol
im in the vim gang
fuck if i know, never used pycharm and only used visual studio for an hour
They're for different langs
i use vim and vscode
I use vim and webstorm
visual studio has python support
pretty much all the jetbrains editors
Wym storing channels
a database is for storing literally anything
fetching from a database can be faster afaik
Like if a user wants to set which channel they want mod logs in, etc
yeah but even then storing the id is enough
Yeah
If a user want to set logs chqnnel
He can just type a commad
To create that channel
Amd assign logs to it
I mean its already created in thr server
Why making database and it wont help
what should I write in the red area
I dont know shiz about java
Py
isnt that js
that's js
yes @mossy vine i just said that xD
yes ok
Whatever from the preview it looks like java..
im proud of you
Leave me alone cri
what is the error if you're recieving one?
When it edits the message one of them comes up with a Node error
let me see if i can re create the error and send it
1 sec
can we put nohello.com in the channel topic or pin it
{ DiscordAPIError: Unknown Message
at item.request.gen.end (C:\Users\Jake\Desktop\GIT HUB\Discord-Test-Bot\discordbot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
at then (C:\Users\Jake\Desktop\GIT HUB\Discord-Test-Bot\discordbot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'DiscordAPIError',
message: 'Unknown Message',
path:
'/api/v7/channels/574658802268241962/messages/582575541434056717',
code: 10008,
method: 'DELETE' }
Yes u now know my name now
what line are you getting that on
🤷
We don't care about your name, no need to say that again and again
@slender thistle I am kindly going to say Shh
ily2
❤
wait what
you are getting it on index.js
wait this is index.js
a part of it
so we have no idea what line youre actually getting it on
Correct
so we cant help you
oof 😦
because we dont know where the error is coming from
can you open up your index.js file and tell us which line youre getting the error on on the paste
i will do that 😃
line 215
(err) => cb ? cb(err, err.status ? err : null) : Promise.reject(err)
thats the discord.js code
not the code you wrote
and is also not in the index.js file
That is the Index.js
correct
theres nothing like that in the code you sent
he did
me
visual studio is mostly used for HUGE libraries
like Unreal library
or Unity
or BDL
but NOT for discordbots made within like 4 hrs of coding
or even a little larger
those things should stay within the visual studio code environment
due to a) simplicity, no need to worry about file mismatch or adress location failure
b) speed, alot faster to start up the program and get into the IDE
there’s not rules on what ide to use
i personally think npp is futile and shouldn’t be used for anything but people still use it
bad idea
I only sent him _main.js
if you were to send the full code i could find it in the config.json since it's automatically not hidden
i did not send him config.json or settings,json so he cant get my token
and i sent it in a pastbin so he has the code only
he only posted the main.js file in a pastebin so i have no idea about the json files
there are a lot on github
@pale mango you wont be able to add it here
I know.
im ok with that i was gonna keep mine closed source lol
You just can't use someone else's code without modifying it
i don't use other people's code anyway lol
there's no problem adding an open source bot here if it's yours
^
ah alright
Just not someone else's
what you can't do is download the code and add an unmodified copy
^^^
i use the klasa framework but that's not really copying someone elses code
since its made to be used by other people
adds guidebot to server @inner jewel
ree
hey can someone help me, pips decided its not gonna work any more, tried a complete reinstall
no i got that, just wanna get Flake8
got all the required things to run the bot and connect it
ah no ok nvm im stupid
what would i do if i want some like
const admins = ["ID HERE", "ID HERE ETC"]```
And it work with all commands with it being in index. and by updating it with eval like :
`;eval admins.push('ID HERE');`
it will work... until your bot restarts
or to decide if they're an admin or not, check if they have an admin role in ur bot's support server or smth
so u can easily add and remove admins
Can you help me make help command? Discord.js
Depends.
:D
You can do it yourself
Help ?!?
^
Hm
All I did was make my bot send a formatted embed with commands when you ask for help
It shouldn’t be any different from other commands as paradox said
^ what they said. Not worth doing otherwise unless you want like a Dynamic one.
if you use external files
just make an addition like help = {}
if you use Js module.exports.run = async() => {}
Wow
Ok.
or make it read dynamically
That would be dynamically.
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return message.channel.send("**❌ Tu n'a pas la permission de gérer les rôles pour effectuer cette commande.**");
if(!message.guild.me.hasPermission("MANAGE_ROLES")) return message.channel.send("**❌ Je n'ai pas la permission de gérer les rôles pour effectuer cette commande.**");
let demande = args.join(" ");
if(!demande) return ("**❌ Veuillez m'indiquer un rôle à donner à tout le serveur.**");
let role = message.guild.roles.find(`name`, demande);
await message.channel.send("**✅ L'envoi du rôle à tout le serveur en cours. Cela peut prendre quelques minutes..**");
message.guild.members.forEach(e => {
(e.addRole(role))
});
}
module.exports.help = {
name:"roleall"
}
Error :
(node:4845) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.
How can i do dude please ?
console.log(true);
So works there....
@earnest phoenix
let role = message.guild.roles.find(role => role.name == demande);```
thx
I did the update and that's the worry
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return message.channel.send("**❌ Tu n'a pas la permission de gérer les rôles pour effectuer cette commande.**");
if(!message.guild.me.hasPermission("MANAGE_ROLES")) return message.channel.send("**❌ Je n'ai pas la permission de gérer les rôles pour effectuer cette commande.**");
let demande = args.join(" ");
if(!demande) return message.channel.send("**❌ Veuillez m'indiquer un rôle à donner à tout le serveur.**");
let role = message.guild.roles.find(`name`, demande);
await message.channel.send("**✅ L'envoi du rôle à tout le serveur en cours. Cela peut prendre quelques minutes..**");
message.guild.members.map(member => {
member.addRole(role)
})
}
module.exports.help = {
name:"roleall"
}
Error :
(node:5558) UnhandledPromiseRejectionWarning: TypeError: Supplied parameter was neither a Role nor a Snowflake.```
where ?
o h b o y
^
They will both be strings
=== is just == but type checking as well
So you should
if we know we are dealing with the same data type why the ===?
A developer who knows the difference should use them accordingly.
Because
When another person reads your code and sees only 2 of them
They will assume there was a reason why you used 2 instead of 3
okay see now thats a valid answer
=== should also be faster than ==
does anyone know how to do sqlite stuff in c#?
I took your advice, the command works, but in the console there are time errors (its going too fast). How do I settle this?
you dont abuse the api by giving everyone a role
how about you actually respect discords rate limits and wait a bit between each call
So?
oml my head
does anyone know how to do sqlite stuff in c#?```
just like you'd do regular sql, or if you don't want a headache use ef core
I set an interval?
thats not what i mean. i already did that, but my database won't enter a new entry.
In an interval function, for two seconds I put what? 2000 ?
🤷 i don't do sql because hand writing it is a nightmare
i use ef core instead
create models and ef core binds them and writes sql commands
In an interval function, for two seconds I put what? 2000 ?
all timings are based on milliseconds, so yes, 2000 ms = 2s
thx
@quartz kindle
So the interval is good?
const Discord = require ("discord.js");
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission("MANAGE_ROLES")) return message.channel.send("**❌ Tu n'a pas la permission de gérer les rôles pour effectuer cette commande.**");
if(!message.guild.me.hasPermission("MANAGE_ROLES")) return message.channel.send("**❌ Je n'ai pas la permission de gérer les rôles pour effectuer cette commande.**");
let role = message.mentions.roles.first();
if(!role) return message.channel.send("**❌ Veuillez m'indiquer un rôle à donner à tout le serveur.**")
message.channel.send("**✅ L'envoi du rôle à tout le serveur en cours. Cela peut prendre quelques minutes..**");
message.guild.members.map(member => {
setInterval(member, 3000);
function member() {
member.addRole(role)
setTimeout(function() {
})
})
}
module.exports.help = {
name:"roleall"
}
did you test it
The name of the Member interval is false? If so, I don't know what to put
i can see disaster happening with that code lmao
Seriously, it's not with her that I'm going to move on..
if you have 500 members, you will create 500 setIntervals
NO
thats what the code is doing
Oh okay, I fix that how?
learning how setInterval works maybe by reading documentation would be a good start
ok
here's a hacky way to do it
for(i = 0; i < 5; i++) {
result = await new Promise(r => { setTimeout(t => { r(i) },3000) })
console.log(result)
}```
basically, executing a loop with an interval between each iteration is not so simple. one way is to await promises, the other way is a recursive function
so good luck figuring it out
@earnest phoenix do u speak spanish?
no, french
<a id="sign-in-or-dashboard-button" class="text-white btn button" role="button" style="margin-left: 25px">
</a>```
if i have img like outside a tag the id works if i do it inside a it crashes help
<img id="pfp" width="50" height="50" style="border-radius: 25px; margin-left: 911px">
</a>```
like that not really crash but img does not show up
and its jquery
if (user) {
$("#user-name").html(user.w3.ig);
$("#sign-in-or-dashboard-button").html(user.w3.ig).attr("href", "/Dashboard.html");
$("#pfp").attr("src", user.w3.Paa.replace("s96-c", "s512-c"));
console.log(user);
} ```
thats js



