#development
1 messages · Page 1001 of 1
i still dont get why quick.db didn't save my stuff
anyway, your problem is that you're resetting your own database every time your bot restarts
that would be one way of doing it yes
and i should probably add .gitignore i dont want user IDs to be in my backup repo
and no one uses glitch
also can you tell me how i can detect if a user's ID is in "userBalance" and if it isn't then it does db.set("userBalance", { <userid> : 300 //starter money});. And i don't wanna overwrite everyone elses balances
@quartz kindle p i n g
How do you make it look like this?
I tried removing the value but it just show undefined
{ name: "All Commands", value: "All Commands" },
oof
also tim can you help me with another problem
i just wanna check if a user's ID is in "userBalance.<id here>" and if it isn't then i add another variable (or whatever you call it) with the starter muny 500
@quartz kindle p i n g
sorry man
either add the user id to the key, or add it as a field
how do i check if its there
most people do something like db.set("balance_USERIDHERE",value)
try getting it
also i believe there is a .has method
if (command === 'profile') {
var user = message.mentions.users.first() || message.author
var output = await dl.Fetch(user.id)
if (msg.content === "profile") {
const profileEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle(`Welcome ${user.tag} |:bell:|`)
.setAuthor('LevelHouse™️ |👨|')
.setDescription('Welcome to LevelHouse™️! Here you are able to check your LVL and XP! Have fun :)')
.addFields(
{ name: 'Level |:black_joker:|', value: `Your level is ${output.level}`},
{ name: '\u200B', value: '\u200B' },
{ name: 'XP |:black_joker:|', value: `Your XP is ${output.xp}`},
)
.addField('News |:newspaper:|', 'Soon b2.0.0.0 :)', true)
.setTimestamp()
.setFooter('Next |↪️|: 𝗰𝟮?𝗱𝗮𝗶𝗹𝘆');
message.channel.send(profileEmbed);
}
}
Error is: "msg is not defined". What can I do?
you're using message, not msg
oh wait that's wrong code
`if (msg.content === "profile") {`
mobipe
still same
Shouldn't be doing support on mobile
after changing to msg
Shits hard to type
How's Possible to like slice off the elements of an array by the amount you want so all of them are seperated by the amount you want... For example
i have an array that has 150 elements and i want them to be seperated by 50 elements each..
How can i do that?
Is it possible to like run a loop on it?
mobile bad desktop good
i didnt tell you to change to msg
i said you're using message
so you have to use message everywhere
how to use try{} catch{}
or define msg
oh
unless you change everything to msg
let msg = message
No reason
Thats just plain as lazy
Bad code but saves typing time dependung on how long ur code is
I'm just stupid 😂
@earnest phoenix you mean create 3 arrays of 50 elements each?
i believe discord.js collections have a method for that
@earnest phoenix https://www.w3schools.com/js/js_errors.asp
why is it telling me catch {} <= unexpected token {
oh
catch {} is valid in node.js 13+
Fun fact catch { } works in C# but in js you have to specify an exception
(message.content === "profile")
Error was bcoz of me, I forgot to add "c2?" before "profile" XD
Now everything working, but thanks for help :)
(code is looking like that:
(message.content === "c2?profile")
)
is it actually?
i know try works with that syntax, but i was always told yo do catch() {}
i did try{} and the try works but after that catch() guves error
How do you make it look like this?
I tried removing the value but it just show undefined
{ name: "All Commands", value: "All Commands" },
@earnest phoenix I fixed it by setting the name to “ “
No i mean like for example
let someArray = [<150> elements here];
I want to like join 50 elements and then get the other 50 elements and join them one by one...
Example
let someArray = [
'f', 's', 'j', 'f', 's', 'i', 'g', 'i', 't', 's', 'k', 'g',
's', 'k', 'g', 'd', 'k', 'h', 'x', 'k', 'g', 'z', 'i', 'g',
'd', 'i', 'g', 'x', 'o', 'g', 'x', 'o', 'g', 'z', 'l', 'g',
'x', 'l', 'g', 'd', 'l', 'h', 'd', 'o', 'y', 'd', 'p', 'h',
'd', 'p', 'h', 'd', 'p', 'h', 'd', 'p', 'h', 'd', 'p', 'h',
'd', 'p', 'y', 'd', 'l', 'y', 'd', 'k', 'y', 'd', 'k', 'y',
'd', 'l', 'y', 'x', 'p', 'u', 'd', 'p', 'u', 'f', 'p', 'y',
'd', 'l', 'j', 'c', 'i', 't', 'd', 'l', 'y', 's', ' ', 'i',
's', ' ', 'o', 'y',
... 43 more items
];
someArray.slice(0, 50) + "\n" + someArray.slice(50) + "\n" + someArray.slice(100);``` @quartz kindle
Run a loop on that kind of a thing to seperate all of them by 50 elements and like join Something between them
what's worser than not being able to fix catch{} which is supposed to fix errors
and botht he brackets dont work
would be much better to tell you whats wrong if you provided the code
try {
message.channel.send("You have "+db.get("userBalance_${message.author.id}.balance"));
} catch {
db.set("userBalance_${message.author.id}",{balance : 500});
}
what error is it outputting?
Also use ` insteas of "
in both catch() and catch{} it is giving an error unexpected identifier ( or {
by ( or { i meant in both cases it gives different error
You're literally providing options on setting something on a db object
@earnest phoenix if the length is known, you can do what you did there lol. but if the length is unknown, you can use a loop with array.splice(0,50)
so that on each loop, the first 50 items will be removed from the main array
so you dont need to constantly update the indexes
@opal plank
Oh i thought of splice to work
Lemme try
@opal plank it is giving unexpected identifier ( in catch() and unexpected identifier {} in catch{}
@earnest phoenix
<db>.set(<object>, <Something to set>)
bro its not about db
Not <db>.set(<object>, { <Something to set> })
It's because of it
what
@earnest phoenix as i said, try {} catch {} is only available in node 13+. you're using node 8
@earnest phoenix theres no syntax error in that snippet , try ```js
try {
message.channel.send("You have "+db.get("userBalance_${message.author.id}.balance"));
} catch(() => db.set("userBalance_${message.author.id}",{balance : 500});)
```
in older node versions you have to use try {} catch() {}
try {
bla
} catch() {
bla
}
oh
Wanted to ask is this host good for hosting a bot aiming to reach over 1000 servers. Or should I go for more reputable hosts. If for more reputable paid hosts may I gain suggestions
you can get better
Any suggestions 👀
@quartz kindle still giving errors in try{} catch() {}
fixed it
@vernal vapor check out Google cloud
needed to put err in catch()
the service that doesnt jhave captcha
but goddamn credit card verifictaion
O aight I'll give that a look
google and amazon both offer free for 1 year trials
^
google has a permanent free tier as well, but they charge for bandwidth usage
im using galaxygate at the moment, which has roughly the same specs as you showed above, but for 3 USD a month
for european hosting, i heard good things about hetzner and contabo
Contabo is pretty good.
Tim you decent with discord.py[voice] by chance?
nope
F
what are you trying todo @earnest phoenix
for Europe Hetzner and Digitalocean is really good. Amazon AWS and Google also works
if(command === "patreon"){
const pat = new Discord.MessageEmbed
.setColor("#7289DA")
.setAuthor(bot.user.tag, bot.user.displayAvatarURL())
.setDescription("Become a Patreon To Unlock Exclusie perks")
.addFied("Before Becoming Patreon Join Here" , "Link")
.addField("Become A Patreon" , "Link")
.setFooter("Pls Support lol")
msg.channel.send(pat);
};```
What is error here?
like
it's not working
You are not calling the constructor
yes
🧠
How do I get guild owner name
@quartz kindle so i tried but i don't know how to actually run a correct loop on that... How can i do it?
i'm trying to get my bot to work and play music in different servers at once, using SQL, but it's not Renaming the Song what it needs too and i keep getting an Error saying ```py
Song#672743264675168257(Testing Grounds).mp3: No such file or directory
then i changed it a bit and now it's giving me a this error:
```py
Song#672743264675168257(Testing Grounds).mp3: No such file or directory
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/player.py", line 611, in _call_after
self.after(error)
File "OwO.py", line 2236, in <lambda>
voice.play(discord.FFmpegPCMAudio(f"{name_song[0]}({name_server[0]}).mp3"), after=lambda e: check_queue())
File "OwO.py", line 2157, in check_queue
length = len(os.listdir(Queue_Main))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/con/Desktop/Yandere copy/Queues/Queue#672743264675168257'
@modest maple
@misty sigil guild has a property that can be accessed for that
docs?
@misty sigil Guild.Owner
@earnest phoenix No such file in that directory
it's putting it into the Main Directory, but not into the Queue folder, and i cant seem to understand why.
ok so
@misty sigil if it's cached
<Guild>.owner.username if not
<Guild>.members.fetch(<Guild>.ownerID).then(o => o.user.username)```
@earnest phoenix example
Oh i see...
Lemme try
someone help
what is spawns.json
a file
what are its contents
@quartz kindle trying that loop instantly crashes the bot lol, the bot runs out of memory
@long yew client.channels.cache.get()
@modest maple 
why is message.author.displayAvatarURL not working?
like
if(command === "MemberCount") {}
@delicate shore firstly, delete your code and start over with a handler
@deft condor version?
@deft condor code
12.x
That's not a handler
if (message.content === ${prefix}avatar) {
const avatarEmbed = new Discord.MessageEmbed()
.setColor("#000000")
.setTitle("Avatar")
.setAuthor(
${message.author.tag},
${message.author.displayAvatarURL()}
)
.setImage(${message.author.displayAvatarURL()});
message.channel.send(avatarEmbed);
}
Just advice for the future
@deft condor you don't need to have template literals for one single thing like that
^^^^^
you can just do message.author.tag or the others without template literals if you aren't gonna use those inside an actual string
Channel is not cached or id is invalid
so what would need changing?
you could fetch the channel instead of getting it from the cache
and console.log pConfig.spawnChannel to make sure it's an ID
\https://discord.js.org/#/docs/main/stable/class/ChannelManager?scrollTo=fetch
@long yew please.. but channelCache#send
how do i get the total guild count from all shards and set it as the status
It's in the example
yeah but how do i set it as the presence
@restive furnace wdym
i know how to set a presence, i just don't know how to combine them
In the broadcastEval example, results is an array of the returned values of every shard, using reduce with the parameters in the same example will give you the total count. Then do client.user.setPresence({ activity: { name: THE REDUCED VALUE HERE })
is there any way i can take the value from .then() and add it to an external value to put in the presence
can i assume that if bot.get_user(id) returns None then that account is deleted. or is it just not viewable by the bot
Some JS here
/**
* Create custom fields map
* @type {Map<string, () => string }
*/
this.customFields = new Map();
I am trying to JSDOC the typing of a map for VSCode
This works but I basically want the function in the type there to be asynchronous
Make it async lol
try adding @async?
I don;t see how to do that on an @type though
Just return Promise<string>
guys any suggestions for postgresql database hosting? i need one with more concurrent connections
@dense patio put the code that sets the status inside the then
Buy a vps to put your database on
can u suggest me any guide fos r vps
i tried and it didn't work
@subtle holly You are missing a >
Check the pins
anyone know what i need to change?
It should work so you did something wrong
Ah yeah
idk what to do though
if pointing to a method you could use to resolve the issue is not enough then I don't know what is
how do i cache channel?
by fetching it
im here i need help
and?
my image isnt going in embed
let embed = new Discord.MessageEmbed()
.attachFiles(canvas.toBuffer(), 'profile_card_${name}.png')
.setImage(`attachment://profile_card_${name}.png`);
message.channel.send(embed)
``` my code
Guys, how can i get the badges links?
Is there a way ?
you find them
Look closely
' '
i have same issue with derku
guys i still dont know how to make embed messages on c#
i need help with making embed messages doe
thx
is there a way (python) to grab the custom status of a user? i have tried to do so but failed... and the documentation doesn't say anything about it
and the documentation doesn't say anything about it
you sure about that
about python when i try to get my bot online on python i get errors that arent even on my code and i dont understand
why i use c#
https://discordpy.readthedocs.io/en/latest/api.html?highlight=member#discord.Member.activities
https://discordpy.readthedocs.io/en/latest/api.html?highlight=member#discord.BaseActivity
https://discordpy.readthedocs.io/en/latest/api.html?highlight=member#discord.CustomActivity
https://discordpy.readthedocs.io/en/latest/api.html?highlight=member#discord.CustomActivity.name
is it only for me or why when i try to get my bot online on python a bunch of errors pop up that arent even on my code
just you probably
I have the problem of MaxListenersExceededWarning I fixed the think but my bot wont answer to my cmd
Code
who knows, on message event for every command?
my code is good there is no error
show us the code.
yea for me the code on python is fine but there are other errors i dont understand
maybe my interpreter or something i dont know
who knows, on message event for every command?
@pale vessel JAJAJAJAJAJAJAJAJAJJAJAJAJAJJA
@lofty lagoon bro you have a get command files script why aren't you using it
?
To the fullest
@lofty lagoon bro you have a get command files script why aren't you using it
@pure lion I already use the script for the cmd
I have 3 file I use with the get command file
To the fullest
@pure lion the fullest?
hmmm
idk how and why but my bot work again
and I didnt change anything in the code
:/
looking to implement sharding using discord.py, need i jsut change my Bot instance to AutoShardedBot?
i feel like im missing something
So i made a function that makes an string to turn into a chunked string by the provided amount and what to join between the strings... Is this good?
if(!joinWith){
return "There was nothing provided to join between the strings";
}
if(!JoinSpot){
return "There was no join position between the strings provided";
}
if(isNaN(JoinSpot)){
return "Join position is not a number";
}
let arrayOfElements = [];
for(e of this.split("")){
arrayOfElements.push(e);
}
let arrayOfSpliced = [];
while(arrayOfElements.length > parseInt(JoinSpot)){
arrayOfSpliced.push(arrayOfElements.splice(0, parseInt(JoinSpot)));
}
let arrayOfJoined = [];
let CounterOfIndex = 0;
for(a of arrayOfSpliced){
arrayOfJoined.push(arrayOfSpliced[CounterOfIndex++].join(""));
}
return arrayOfJoined.join(joinWith.toString()) + this.slice(arrayOfJoined.join("").length);
}```
I think it can be simplified
whats the worst a team member can do to the bot? they can only change tokens right?
steal your rented hardware and ghost you
or add stuff to the bot that is against the TOS to get you banned and in certain cases even fined
@cinder patio how tho
can he steal the code?
@earnest phoenix so what does it actually do like an input output example
if he get access
Lemme show you
async function chunk(arr, len) {
let chunks = [],
i = 0,
x = arr.length;
while (i < x) {
chunks.push(arr.slice(i, i += len));
}
return chunks;
}
// Optionally, you can do the following to avoid cluttering the global namespace:
Array.chunk = chunk;
```i use this for chunking down large arrays into groups of 10
you just pass the array and the wanted chunksize to it
@lusty quest
"77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777".JoinBy("\n", 15)
=>
777777777777777
777777777777777
777777777777777
777777777777777
777777777777777
777777777777777
777777777777777
77777777777777777777777777777```
split it into indidual numbers and push them as a single number into an array. then just chunk it into the wanted size
Hmm not a bad thing to do Actually
there is probably a more efficent way but idk rn
function joinBy(string, separateAt, joinChar) {
let result = "";
const length = string.length;
for (let i=0; i < length; i++) {
if (i % separateAt === 0) result += joinChar;
result += string[i];
}
return result;
}
Here's how I would do it
i guess i use my function bcs i call an API that returns sometimes 2k keys in a array
so i can have it in handy smaller chunks to display them in Embeds
@earnest phoenix
That looks good actually
It's probably the fastest too
i get fancy arrays with arrays inside so i can access something like array[10][5]. better than trying to limit it to 10 arrays per page with a counter
yea but his function is probably faster
Can you change the bot discriminator?
no
How can i learn to a user join position?
sort members by join date
fetch all members, sort by join timestamp
Yapabilsem neden sorayım
then find member's index
How can I have rainbow text for my bot's name? (Like this bot: https://top.gg/bot/720621632346915205)
It's not rainbow though?
Looks like that to me?
Maybe not rainbow but constantly changing color
what is a good thing to add to a bot?
@solemn latch yea because those can cause seizures
hey, i have code for a music bot but it kiiiiiiiiiiiiiiiiinnnnnnnnnnnnda sucks ass
can i have help building one from scratch?
I'll link a hastebin
youtube exists 👍
:P
looking to implement sharding using discord.py, need i jsut change my
Botinstance toAutoShardedBot?
@restive willow
.setAuthor("Some text", client.user.avatarURL())
Cannot read property 'avatarURL' of null
idk what's wrong
null is nothing, you are trying to get an avatar url on a user that does not exist
@viral iris try displayAvatarURL ()
@viral iris try displayAvatarURL ()
@earnest phoenix the same
:/
I have no idea why your user is null though
message.client.user
try message.client.user.displayAvatarURL()
hey, i have code for a music bot but it kiiiiiiiiiiiiiiiiinnnnnnnnnnnnda sucks ass
Pspsppspsps
or whatever your message is called
*loud crying*
@solemn latch yea worked thx
Client doesn't exist if you don't pass it on, messages always have .client tho
@pure lion writing a music bot is a good exercise, we can answer questions. but you still need to write it somehow 🙂
do the big 🤔
I'm using ytdl-core
are u using glitch?
Nope
good
what's glitch? js library or something?
Also using @discordjs/opus
a type of code running service
a type of code running service
ah alright, i understand
I mean opusscript is when discordjs/opus doesnt work
ive been trying not to ask this discord will this ping command work?
@spare mirage try it and see
wait what
E
from when was that a rule in js
Idk I've never used it without
curlies are optional, itll use the next statement for the if block
if (your code is bad) {
return ('ujajaajajja')
} else if (code is good) {
return ('good')
}
curlies are optional, itll use the next statement for the if block
The more you know...
I find it more readable with, but you dont need em
yes
Uhh why is this not working
but it should work
you need some scoping lessons ma boi
Error: Cannot find module '../util/UserFlags' can someone explain ......
Read the error
@spare mirage read the error
@spare mirage that isn’t how elseifs work
It is apparently
@spare mirage the code will work
Hmm
the code above the code would not
wait what!??!
Either it doesn’t work like that or it is bad formatting
the code u sent is correct
@spare mirage you see the word message in bot.on. that creates the message that you use. but it only exists inbetween the { }
but u see
who uses var anymore
It’s outdated as of ES5
I use const and let
who uses var anymore
@opaque hawk a beginner who doesnt know better?
^ ||me||
...fair point
const is a var u cant change right?
I think that const amd let are better, var isn’t as good in ES5 and 6
you can only assign (const val = 12) once
how do I fix my stuffs xD
the = is assignment
remove var ping = ... above bot.on( bla bla
== is checking if it equals that, after type juggling
ok
and pls learn the basics
im just dumb lmao
everybody thinks that in the beginning, if you keep at it you'll get there eventually 🙂
still not fixed :/
same error? did you save?
yes
show the new error pls
everybody thinks that in the beginning, if you keep at it you'll get there eventually 🙂
@toxic forum I mean I can understand the code but I cant come up with it
¯_(ツ)_/¯
well you need to understand what you have before you can think about how to use it
the "how to use it" part is a bit harder though
why did you define the ping and decide to not use it
I mean that's not the problem tho
YEP still
how to download this module or so '../util/UserFlags'
i see
double the allocation means the program runs faster :sunglassesvery3dcool:
X to doubt

it wouldnt make it run faster

bad habit
wait ill put it into an hastebin thats easier to see
more allocation is never faster
people always try to cut down on the amount they allocate
yea
thats why i said depends
thats why i said depends
very much depends, think about how slow a bot would be if it wouldn't cache users. it would have to fetch them from the API. which is very slow compared to reading them from memory when working with them
all of that caching design is probably going to get abandoned with huge api changes in october
stateless design and all
spam
FINALLY
gj
probably to cut down on resource usage
@earnest phoenix pls go to general
stateless design and all
you are talking about intents or changes in discord.js?
intents
might not have to change much for library users then
they'll change the payloads so the data you get is what you can work with without doing any extra requests
iirc
you were probably sending everyone in a panic there XD
i love how people here are afraid of design changes in libs
because they have little to no experience with the language and they only know how to do x in a certain way
https://hastebin.com/eluzavarij.js
I think I know whats wrong
sendMessage isnt a function right?
what error do you get?
message.channel.sendMessage("Your ping is " + ${Date.now() - message.createdTimestamp} + " ms");
TypeError: message.channel.sendMessage is not a function
that's your code, not the error message. but nevermind
@earnest phoenix how much do you know about programming in javascript? or any other language?
mostly js because thats what youd be coding in
@toxic forum thank you for your cooperation
i will now take the actions needed to meet those requirements
thank you
mostly js because thats what youd be coding in
@pure lion just asking if he has any experience anywhere
Works! Thanks for the help!
sendMessage is no longer a function in 12v i think
ye its not
because message.channel is useful
docs
:/
thank you
@earnest phoenix if you haven't done any programming in javascript, then you probably need to setup an editor aswell. Visual Studio Code is a good recommendation due to the help it gives when writing javascript.
How does a man not forget the docs lmaoo
please read docs otherwise you're never learning
I red it twice today
My whole browser history is full of that
ok listen, order of importance:
docs > stack > discord > youtube
@toxic forum i know about visual studio code, but i use sublime text because to me its just very simple
stackoverflow
I only get py stuff there
@toxic forum i know about visual studio code, but i use sublime text because to me its just very simple
that's fine, everyone has a preference 🙂
ayy i use notepad++
ay i use simple notepad
why do you torture yourselves
npp just works for me
and it makes my code colourful
i use google docs
uses word
why do you torture yourselves
@pure lion ever heard of vim?
i also use discord code block
@pure lion ever heard of vim?
@toxic forum nope :D
what feature do you even need in vsc that isn't in npp
the new github
yes
what feature do you even need in vsc that isn't in npp
sexy ui
dark mode
damn i don't need any of those, lucky me
dont forget darkmode
bruh
@toxic forum nope :D
@pure lion its an editor that you use via the terminal. you can lock yourself in it. the most popular question about vim is how to get out 🤣 https://stackoverflow.com/questions/11828270/how-do-i-exit-the-vim-editor/11828573
raise your hand and you will be spared
nano gang
@pure lion its an editor that you use via the terminal. you can lock yourself in it. the most popular question about vim is how to get out 🤣 https://stackoverflow.com/questions/11828270/how-do-i-exit-the-vim-editor/11828573
@toxic forum LMAOOO
yeah that's a lot easier to use than vim
it has very quick shortcuts, so if you know how it works then you can get around very fast
any useful npm packages i can use for music (other than ff/opus/ytdl)
oh cool everyone went
nice
still here
can you recommend me stuff
I'm finally starting on my command handler, but I need help. How do I have my bot look for a certain line of text within the commands folder? Like a text file with footer info?
...buut im not a javascript developer, i use c# primarily
again, meaning to learn
maybe take a look around on npm? maybe use tags to do some searching?
I'm finally starting on my command handler, but I need help. How do I have my bot look for a certain line of text within the commands folder? Like a text file with footer info?
w-
if you want footer info use a json
Okay.
what info do you mean to get for the footer tho?
Set footer on module exports
@stable nimbus I bet there are good tutorials out there
I'm finally starting on my command handler, but I need help. How do I have my bot look for a certain line of text within the commands folder? Like a text file with footer info?
@stable nimbus i take it back, i believe you can map the footer
Human interaction is nice sometimes. I think I figured it out with dice's reference, I'll see what happens.
module.exports = {
name: "poll",
description: 'makes the message into a poll',
footer: 'footer'
}
like this?
That works too
If u ever change the footer you need to change every single one
again
Hence why probably setting a var or a json it'd be good
im gonna go fail at making a music bot
have fun! get back here when you have questions 🙂
have fun! get back here when you have questions 🙂
thanks :))))))))))))))))))))))))))))))))
do you have a file named footer.json now?
Its reading the file successfully, so thats a start, I just need it to read the data and put it in there.
in the file or the let footer?
example of the json:
{
"command name": [
"footer"
],
"command name": [
"footer"
] etc etc etc
}
module.exports = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
const embed = new MessageEmbed()
.setTitle('Ping!')
.setDescription('This is a ping command')
.setColor('#ffd700')
.setFooter(copyright);
message.channel.send('Hey ' + `<@${message.author.id}>` + '!',embed);
},```
The code
```{
"copyright": "[!] News: /news | © Fuzzy Wilson 2020"
}```
And the file.
const copyright is my reference point, and the file is in .json
i guess you could do that too
if (message.content.startsWith(PREFIX + "ping")) {
var ping = Date.now() - message.createdTimestamp + " ms";
message.channel.send("Your ping is `" + `${Date.now() - message.createdTimestamp}` + " ms`");```
how do i make ``` ("Your ping is `" + `${Date.now() - message.createdTimestamp}` + " ms`"); ``` an embed? do I make the embed in bot.on or above it?
Yeah but it returns nothing.
what are you getting?
@stable nimbus @spare mirage
you can color code your discord code snippets by adding the file ending (like .js) to your first "```"
like this
```js
```
makes it easier to read
yeah do
.setFooter(copyright[0])
.
OH! Thats how you do that! Thank you.
make a new line after ```js```
you need the js on the same line as the first ```. and you need a newline after it
Oh
hi
```
you can do it with json (and more!) too
Thanks mate, now I learned two things today!
a lot more
Okay so the response does change, it changes to undefined
^
Something like this.
Ah
{
"copyright": "[!] News: /news | © Fuzzy Wilson 2020"
}```
Thats my copyright
Yeah but it returns with [object Object]
it should become a property. so assuming let footer = require("../X.json") it should be footer.copyright
should not make a difference in this example 🙂, choose what you want
how do I make this embed send this command
Let me try the other.
AH
or how do I fix the command lmoa
it gives back { @stable nimbus ?
Reads the first bracket!
shit
Gives back [
did you stringify the json at any point?
@spare mirage message is undefined, put that after the bot.on
No my json has stayed the same.
you can use JSON.Parse(require(...)) to make it an object
@opal plank do I put everything + the embed after boton
@spare mirage message only exists after its emitted
oh ye ur right
therefore it needs to be put afetr its being initialized
json.parse is not a function
require automatically parses the JSON
nosj
I know thats whats in there.
Koya hgif
Errored out saying its not a function.
{
"copyright": "[!] News: /news | © Fuzzy Wilson 2020"
}```
@stable nimbus is this exactly your file? or is it wrapped in "" or ''?
i have a spare gift uwu
dont post it in servers, autoclaimers is an issue
Thats exactly whats in my Json
pick somoene you deem is worthy
hmmmmmmmmmmmmmmmmm
i have a spare gift uwu
@pure lion do i need to scan a code :sceptical:
no
will this work?
bot.on('message', message=>{
const embedping = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Ping :banana:')
.setAuthor('Banana')
.setDescription('Pong!')
.addField('ur dinner today', 'bananas', true)
.addField("Your ping is `" + `${Date.now() - message.createdTimestamp}` + " ms`")
.setTimestamp()
.setFooter('Justii :3')
if (message.content.startsWith(PREFIX + "ping")) {
var ping = Date.now() - message.createdTimestamp + " ms";
message.channel.send(embedping);
}```
my bot should be able to read here, this example
first to dm gets it ;)
n.eval let footer = {
"copyright": "[!] News: /news | © Fuzzy Wilson 2020"
};
console.log(footer) // @stable nimbus
now if i do footer.copyright
n.eval let footer = {
"copyright": "[!] News: /news | © Fuzzy Wilson 2020"
};
console.log(footer.copyright) // @stable nimbus
i want it so when i send a spefific message it gives everyone in the guild a certain role how do i like do that
im using discord.js
no
actually
yeah
but like i dont want to type the role
it just is in the code
ye
Loop through each member in the guild and give them the role. Keep in mind that if there are a lot of people in the server this may be considered API spam
and how do i do that
!role
?
w3schools does something on loops
Does anyone know a safe way to calculate math expressions? I tried numexpr evaluate but a friend used it to get my token.
Does anyone know a safe way to calculate math expressions? I tried numexpr evaluate but a friend used it to get my token.
lang?
Use the forEach method on the guild.members collection (https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=members), then use the member.roles.add method (https://discord.js.org/#/docs/main/stable/class/GuildMemberRoleManager?scrollTo=add)
@pure lion Python
ehhhh
you could parse them yourself
:/
would be a fun challenge
D:
ive never used py, sorry
@cinder patio what even is a foreach
.....
@clever garnet https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
googlefeud what even is a foreach
@clever garnet did you do any other programming before starting on your bot?
for each member of guild, add role
i dont understand the arrticle https://discordapp.com/channels/264445053596991498/272764566411149314/726882266361495574
then learn javascript
bruh
do you not think ive tried looking for it
Do you have any visual programming experience or software development experience? If not we don't recommend just diving right into this, taking lessons is the best thing you can do for yourself mate.
:D
"One small step for js users, but a giant leap for Dice"
it's a quote
that one yeah
oh ye
:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
i learnt js in like a week because i was bored
totally not thin pp
@opal plank I used your method, and it works just the way I need it to, thank you very much.
np
how do i get the message content after args[0]
@pure lion args.slice(1).join(' ')
Can anyone tell me how to create a bot similar to this one ?
@earnest phoenix how new are you to this?
Let's say from scratch
is it really that difficult ?
don't know I been coding with python only
well you can make a bot with python so that is a start
okay, go and check out the discord.py docs and set up a basic bot (i cant help you there, sorry)
aight I'll take a look
there are aload of things on google to get you started
tbh I was pretty sure that there is a website who is selling these things
to save time and start with business
probably is
and what is that issue
been searching day and night couldn't find a single thing about it. most communities I am in are using it
text
Error: Cannot find module '../util/UserFlags'
need help please ? userflags is in node_modules and still its not found explanation pls !???
u see
@earnest phoenix you could always try fiverr
space
not sure then, never used canva. Im guessing you have to move the location of the text

i try
@pure saddle what do you want to do?
then change the location of the text
i make it
then change the location of the text
🤦♂️
.setDescription(`**${json.data.messages[parseInt(num)].body}**`)
``` `message.channel.send(...).setDescription is not a function`
__im using (command handler)__
what's wrong ?
u can send all code
include discord.js in the command file
does anyone know if discord.py's asyncio module's event loop is being ran in only one thread or multiple?
i'm working with a shared object in an asynchronous function and my solution was to just not await any functions while i own the object's state
.setDescription(`**${json.data.messages[parseInt(num)].body}**`)
``` `message.channel.send(...).setDescription is not a function`
__im using (command handler)__
can any1 help please
@viral iris
yes
Send all of the code
yes
const Discord = require("discord.js");
const request = require("request");
module.exports = {
name:"news",
run:(message, args) => {
request(
{
json: true,
url: "https://fortnite-api.com/v2/news/stw"
},
(err, res, json) => {
if (err) {
message.reply("somting wrong!");
} else {
var num = Math.floor(Math.random() * (+3 - +1)) + +1;
message.channel.send(
new Discord.MessageEmbed()
.setColor("#0099ff")
.setAuthor(json.data.messages[parseInt(num)].title, message.client.user.displayAvatarURL())
)
.setDescription(`**${json.data.messages[parseInt(num)].body}**`)
.setImage(json.data.messages[parseInt(num)].image)
.setFooter("the official bot for lazy leaks server")
}
}
);
}
}
@pure saddle @pure lion
Why is there a random )
let me try
worked
@pure lion how can i make 3 codes with same command -news
cuz it's not working
only 1 code works
Why do you wanna do that
u don't understand
No u
i have 3 codes
i idid it the same command news only 1 respond
and i'm using (command handler)
ur on djs v12?
yeah
but some of my code is outdated
cause i made parts of it a while ago
so i'm updating some of it
@smoky spire u know what needs changing?
client.channels.cache.get(...)
didnt i give you the page with all the updates?
how to check if there is no member in voice chat with ytdl - core? My bot is playing music for like an hour without stopping
@smoky spire i get this with that
pConfig.spawnChannel isn't a valid id then
How to merge 2 codes in 1?
pConfig.spawnChannel isn't a valid id then
@smoky spire is mine valid? if not idk what to change it to
channelIDtospawnpokemonin is not an id
are you trying to get the channel named channelIDtospawnpokemonin
because that string looks like a placeholder
for a channel ID

How can i create roles in v12? I tried everything but not working its creating by name "new role" <:(
@earnest phoenix on the docs you will find the role manager
@pure lion where?
Stack overflow is the answer to starvation
......
Search
Debug
@stark kiln consider proving a hastebin with the code you need help with next time.
dont say i have to
👉👈 are you trying to flex with broken code
in nginx how can i make it so that it tries to proxy_pass first and if said proxy returns a 404 itll go on and try a directory?
hey, i'm using the yt-search npm and im having some issues with it.
(node:15300) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'url' of undefined
line affected:
const videoURL = videos.url
more context:
search(searchTerm, async function (err, r) {
const videosAAAA = r.videos
const videos = videosAAAA[0]
const videoURL = videos.url
}
:(
it works fine with single word terms, but not terms with multiple words
nvm i fixed it :DDDDDDDDDDD
does anyone know if discord.py's asyncio module's event loop is being ran in only one thread or multiple?
i'm working with a shared object in an asynchronous function and my solution was to just not await any functions while i own the object's state, should I be using mutexes just in case?
How do I show the number of servers that the bot is in
@final gate Playing or commands?
My friend is on your site, not bot @scarlet dragon
@final gate Huh wait

ok so
ok how @quartz kindle
check the tools menu
and pick your language
otherwise go to resources -> bots if you prefer manually sending a POST request
did you literally write that?
Give me the code, don't give me an explanation@quartz kindle
@final gate no

:/
hi guys discord.js is giving me the incorrect guild count on bot.shard.fetchClientValues('guilds.cache.size').then(totals => {
@quartz kindle what can i change channelIDtospawnpokemonin to?
an id
the channel id lol
what id?
it literally says




