#development
1 messages · Page 1165 of 1
can't you just use the built in HttpClient?
i'm super new to java so i don't actually know what that means
i just wanted to see if it was a thing i could do as easily as nodefetch
google java http json request example
afaik HttpUrlConnection should be the easiest to use
i think for now i'll stick to other things lol
wait nevermind i managed to get it kinda working
using this code, how would i go to https://api.mojang.com/users/profiles/minecraft/(mcUsername) and get the value "id" from the json file?
if needed i can send the ss of what it looks like
wait
nevermind i don't know what to do man
I've figured out why my DB is so big
I'm probably just gonna drop this table and make any feature that uses it opt-in
At least I have no anti-patterns (:
don't insert until you have an actual need to
i did a big oopsie of having anyone who uses a command inserted into a database
hey guys if anyone could help me i want to get news feeds into a channel in my discord like benzinga news cnn etc is there a way to do this?
causing a growth of a bunch of unnecessary data
not the place to ask the question, anyways, make your server a community server in the server settings @obsidian wagon
check out APIs for news feeds, and make a bot to subscribe and track them
XD
look if zapier or IFTTT have something like that (or support for RSS feeds), if not you'll have to make it yourself
Yea
I actually did worse than insert every time they run a command
I'm storing data for every member who sends a message
It's for two features that are hardly used, so I'm just going to make them guild-based opt-in
I have an integer for a user increment on a message
im edgier, i store the message without content
9TB of space, yank it into the bd
👀
i saw that
I have multiple integers increment per message
And other data stored upon the first time sending a message, too
This is basically what each of the 7000+ documents in the table look like
Most likely, I'll just drop the table, than my DB will only be about 400kb or so
I lied, this entry is a bit bigger
is that all user data?
was about to say taht too
Only member data
There's another table for user data that is not bound to guilds
But it's alot more sane
At only 6 documents
hmm, my bot can only join in a channel per one guild 👀 Can I post my music bot script in here? I dont see why this happens
Nope
After I drop the table, I plan to make it opt-in per guild
As this is ridiculous
hmm, my bot can only join in a channel per one guild 👀 Can I post my music bot script in here? I dont see why this happens
@midnight blaze like a user, you can only be in 1 channel at a time
@midnight blaze Discord limitation
oh?
Oh, weird
damn
Oh wow
I hope your privacy policy mentions that
it does
var queue = []
async function startPlaying(voiceChannel){
var connection = await voiceChannel.join()
var info = await ytdl.getInfo(queue[0])
connection.play(ytdl(info.url))
.on('error', (err)=>{
console.log(`REEEEEEEE An error occured.`)
console.error(err)
})
.on('finish', async ()=>{
queue.shift()
if(queue[0] != undefined){
startPlaying()
}else{
await voiceChannel.leave()
}
})
}
client.on('ready', ()=>{
console.log(`Bot is ready on ${client.user.tag}!`)
})
client.on('debug' ,(debug)=>{
console.log(debug)
})
client.on('message', async (message)=>{
var prefix = 'kk'
if(!message.content.startsWith(prefix)){
return
}
var command = message.content.split(' ')[0].replace(prefix, '')
if(command == 'play'){
if(!message.member.voice.channel){
message.channel.send(`REEEEEEEE join a voice channel`)
return
}
var link = message.content.split(' ')[1]
try{
linkURL = new URL(link)
}
catch(err){
message.channel.send(`REEEEEEEE enter a valid youtube link`)
link = undefined
}
if(link == undefined){
return
}
queue.push(link)
if(queue[1] == undefined){
startPlaying(message.member.voice.channel)
}
message.channel.send(`Starting to play your song`)
}
})
Oh, ok
only authorid/channelid/guildid
im not interested in content of what people say
only stats
lol
dataphile
oh, @midnight blaze, use a separate queue array for each guild, and play the song in the respective channels
you can use a map object, it allows for key-value data such as guild-queue
Anyways
I'm going to work on my bot rewrite for the next 15 minutes
It would be a breeze, except I'm trying to manage 2 chat clients at once
So I have to write interfaces and implementations, instead of using the raw libraries
I see, ok , thanks
wusup?
I've written an entire source folder dedicated to interfaces (and a few exceptions), oof
oooh neatly organized
lemme post code porn too
every event with its own handler

wew those setintervals LOL
Nice dashboard
I was thinking of writing my own dash, but it wouldn't post memory usage or anything
i could merge two of them
but sometimes i need to switch the values
still playing with how often i should be logging data to my database
per minute? per 5m? 10? 20?
I'm working on V4 rn
Right now I'm running V3 in deployment
V4 will be amazing (:
what kind of data are you storing? o.o
emojis, logs, profilers, events, voice activity, message activity, and a lot more
if you do cache the info, maybe you can use a threshold-based timer?
like hitThreshold || maxTime
im using set interval for that
im passing variables on that, once the code runs, it sends that cache and resets it
basically that
I'm kinda new to Twitter too so I'm not really sure how it works
cache this until setInterval() runs
yeah its working @earnest phoenix
I don't have actual "versions"
But
V1) A terrible bot, completely scrapped
V2) Throw away V1, switching to async .subscribe
V3) V2, but refactored to use .flatMap instead of .subscribe
V4) In progress, rewrite from scratch. Abstracts the chat library away from the code, also improves code writability in the tiniest bit. Another goal is to work on a singular feature at a time, so I am forced to make everything work perfect before moving onto the next feature.
Ahh okay, tysvm
let a = 0;
setInteval(() => {
database.send(a);
a = 0;
} ,1000);
client.on('event' () => {a++};
@fluid basin to put it very basic, thats what im doing
of course, with maps and more complicated stuff
yeah I'm suggesting something like
every sec, it'd send whatever a is
let a = 0;
setInterval(() => {
if ( a < threshold) return;
database.send(a);
a = 0;
}, 5000);
could be doable too
could also add that if on the event
if ( a > threshold) database.send(a);
yeah well you have to reset a too
Goodnight, I didn't really work on my V4 those 15 minutes...
@fluid basin I tried with MAP, I am just new with it, I would like to know how to use it. I worked with db before, but dunno, I feel like I am close to understand it, can you check the code again? It seems like something is missing
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map official documentation and examples, for your information
ah shit, here we go again...
and I follwed the guide and it works fine, the only thing that is not working rn is that the array in the map are always empty
I dont need the answer, just let me know if I am on the right track. 🙏 ^^
Why would it be always empty? Are you accessing the map correctly?
Use the guild ID as the key, instead of the guild itself
I use the guild ID as the key
I think I do access it correctly, I do console log it and it seems fine
the push function works also, but it still is empty, no errors
use array mutators such as push and pop
still empty?
yep
could I take a look at your code again
that would be amazing
ah theres the problem at line 32
use map mutators methods, not array accessors
the example on the mdn page is marked red and means its a bad example (what you should not do)
follow the green one or scroll down for more examples
@opal plank My actual code is not as beautiful as my organization though...
wew lambdas
Look at that nesting level
Why? You got a screenshot?
Oh my god, wow
Nice stairscase
thats the defintion of 'idk how to do it in a good way, but i can make it work'
that was me a couple days into Js
What are you nesting there for?
For me, it's because I'd loose access to the variables if I didn't nest
But I've been told it's bad to use an AtomicReference to store variables
i was chaining .then()'s
Ah, ok
promise.Resolve.then(=>)
gosh, use await 
callbacks => callback hell,
promises => promise hell
thats why async was born
well yeah, im well aware now, but abck then i didnt get to async yet
even i knew whatever the fuck i was doing, it was wrong
Ah, ok
I had forgotten about JS promises lol
I was initially thinking Reactor's .then
Which is similar, but different
before making a bot you should make sure you know how to secure your bot token and any other credentials. @earnest phoenix
The Reactor equivalent of JS .then is .flatMap
Or .then, but only if you don't need the argument
Usually, flatMap saves you from this kind of nesting
await is a blessing
before making a bot you should make sure you know how to secure your bot token and any other credentials. @earnest phoenix
@sinful lotus i did
k
oh
@opal plank except for the fact that sometimes UncaughtPromiseRejections are hard to track
not if you smart enough
or dont put eval on your "production" bot
i can eval my token fi you wish
what is that thing
.flatMap is a blessing
Before I started using .flatMap, I had code like this:
Just for a ban command...
Good thing I started using .flatMap (:
Well, goodnight
Ngl, for a second I though the code above was java
everything is java if you squint hard enough
Gn

const Users = require('../../models/users');
Users.find({ votes: >= 1 }).then(docs => {
docs
});
Like this
How can i check is votes is greater or equal to 1
so you want a list of users that is greater than 1 vote?
Yes.
Sorry, I wasn't very clear.
use query operators such as $gte or $gt
your welcome
e.g. query.find( { marks: { $gte: 89} } )
gt is greater (>), gte is greater or equals to (>=)
OK thanks!
np
alternatively, you can use the query syntax:
query.find().where('votes').gte(1).exec();
MongoError: unknown operator: isArray
ah
I'll try that.
yeah that works.
Thanks!
@earnest phoenix do you need help getting the bot back?
Did you regenerate the token?
Just don’t give out the token
That’s all
Don’t record, stream, or do anything that shows the token
If you stream yourself coding, put the token in a Json and load it
be aware about github. Maybe put in .gitignore
He didn’t hack you, he just grabbed your token somewhere, regenerate it and ur fine
I keep my git on private
i need help in not getting hacked again
@earnest phoenix try to "hack" it urself
The best way to fix code leaks is to try to self-sabotage
As a security layer, ask someone else to try to "hack" ur bot, then ask them how they achieved it
Note the quotation marks
you either have the token or dont
yeah
ik
i get you i was trying to tell them that you cant hack a token
I have like 2-3 people constantly trying to break my bot's money system (non intentional), thanks to them I fixed about 5-7 issues last couple weeks
tip, whenever you design something for public use think as your user with the most malicious intents to break it
hmm
best mindset to work with and write bug free code
tip, whenever you design something for public use think as your user with the most malicious intents to break it
too much design considerations
XD but its the truth
it works
the only way they can get access to the token is by hacking my cloud account
TL;DR: be your own devil
and thats quite impossible
What about that dude whom you share the cloud with?
good that this happened
Is he/she trustworthy?
i will be careful from next time
What about that dude whom you share the cloud with?
@lyric mountain i didnt share with anyone
Oh, I though you said u did
nah..
you leaked it somewhere if it was hijacked, the token can also be extracted from the process memory that's running the bot so you might want to check for malicious admin privileged programs
ohh
process memory that's running the bot so you might want to check for malicious admin privileged programs
@earnest phoenix presumably if said admin has access to processes then they have access to the file system and can access you configs file unless your doing on boot hand in
how to do I configure shards?
whats your lib?
when someone uses the kick command and even tho the bot couldn't kick the mentioned user, it still sends the member kicked message. How can I make it say that it couldn't kick the mentioned member?
shortest way to get bot ws latency using eris? (1 shard only)
Handle exceptions properly @rancid bramble
And don't send the message BEFORE attempting the kick, in the code
Anybody know how to get a custom status on your bot that shows the number of servers it is on?
I've been trying to figure it out and can't seem to find anything about it anywhere
Wdym lib
this is probably what you're looking for https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setActivity
client.user.setActivity('in X servers');
shortest way to get bot ws latency using eris? (1 shard only)
anyone?
client.user.setActivity('in X servers');
@sonic lodge I know how to set a bot activity, but how do i make it automatically change the number of servers everytime its added
on a guildCreate event
watch for the guildCreate event
ok
when that happens, just grab your bot's guild count and set the activity to that
yes
well the bot has to share a server with that user to dm them
i don't know if you can do that before your bot is removed
Is it possible to change the encoding in json.sqlite?
Cuz i have lots of weird characters in there
Cuz i have lots of weird characters in there
@earnest phoenix
No lol
But u can download a databse reader
client.guilds.cache.get('supportserver').ban(guild.owner)
@thick gull
Lol it won't work
But maybe I can ban some people 😉
I have downloaded quick.db
@earnest phoenix https://stackoverflow.com/questions/25722585/convert-sqlite-to-json
Or
"SQLite to JSON Converter Online - MyGeodata Cloud" https://mygeodata.cloud/converter/sqlite-to-json
Oh thank you
Oh
Yeh
But "SQLite to JSON Converter Online - MyGeodata Cloud" https://mygeodata.cloud/converter/sqlite-to-json
This is good option tho
The gifs arent randomizing can some help??
Math.random is very biased
what should i use @fluid basin
i think he was joking lol
k
idk why isnt it randomizing
is a new one chosen each time your bot restarts?
YALL how do we get bots
is a new one chosen each time your bot restarts?
@sonic lodge yes
then you're generating the random number only once
then you're generating the random number only once
@sonic lodge how to gen it each time the command works
whenever you run the command, you need to generate a new one
yess
where do you send the gif link
in a embed
Anyone?
i will send the pic
How can we add bots to group
https://top.gg/add iirc, and #support @faint flax
Ty
above const embed...
set pick to a new gif link
i didnt get you
move the line that sets pick to a new random gif link before the line that creates the embed
ok
i was wondering that too
condense it into one, or even better, use a command handler
ok
switch(something) {
case 1 : //do a
break
case 2: //do b
break
case 3: //do c
break
}
@earnest phoenix
ok
move the line that sets
pickto a new random gif link before the line that creates the embed
@sonic lodge but i have set it as set image
i meant this
let pick = // random gif
const embed = new Discord.MessageEmbed()
.setImage(pick);```
yes?
very good
anyone familiar with mongoose here know what this error means?
openUri() is not a promise
bruh https://stackoverflow.com/questions/63478824/mongoose-error-conn-openuri-then-is-not-a-function
why
soo.,... i cant figure why its sending 2 messages at once??? its only ment to show once but for weird reason it shows 2 instances
Hello could someone help me?
how to make aliases for commands?
i wanna make a dashbord
@delicate shore I wouldn’t advise making one for just nick and prefix
kinda a waste of time when you can just have a command to do that
I have a paid domain
i already have clareemey
how to make the bot change his prefix?
I have a paid domain
@misty sigil me too
w/ a command
how to make the bot change his prefix?
@cinder sandal database
how to make the bot change his prefix?
@cinder sandal dyatbase
I started now with lavalink, followed this video: https://www.youtube.com/watch?v=_oM6ftzy33g
but I got this error and I can't find anything on the internet
=== [ LAVALINK RESOURCES ] ===
› https://pastebin.com/kNa7nULz
=== [ VIDEO AUTHOR ] ===
› Gavin ( aesthetical#2545 )
=== [ OUR WEBSITE ] ===
› https://discordbots.co
=== [ DISCORD ] ===
› https://discord.gg/WeftAFp
In our Discord server, you can get support with fixing y...
wot
what error
which error
what error
error. says everything
It’s only 1 ?
who even uses node v14
i use the stable version (v12)
i use node 12
I'll try to update and see, thanks anyway
i use node v12 because... i have windows 7
i use node v12 because... i have windows 7
@cinder sandal wow
r
The error isn't their fault
win 7 is wonderful
The error isn't their fault
@golden condor yes
You could just get Linux instead lol
^
linux tough
I should make a tutorial on how to dual boot on medium
windows ez
i will kind aget linux too but with dualboot
I have dualboot because of that kk
does vscode has a node.js terminal built-in?
@golden condor do i
We can run 2 bots in one bot
T
does vscode has a node.js terminal built-in?
@cinder sandal yes
@earnest phoenix what?
Do it dualboot tutorial
I am trying to run 2 bots on in one application
Not sure how I'll get the images tho
@cinder sandal yes
@misty sigil can the built-in node.js terminal run the bot
I'll use some old pc I've got
yes
@earnest phoenix once it's done I'll let you know
I am trying to run 2 bots on in one application
@delicate shore
client and client2
a ?? b => a == null ? b : a
what
Yep
null coalescing operator
client and client2
@misty sigil yes and for events like messagei will do client2. right ?
What does c++ mean?
lang
Token that you tried to log in with was invalid
it just so happens that I just generated a new one, that's why it's strange to me
ow shit
1moment

you think it's going undefined cause im using the cloud.mongodb.com and hitting a ratelimit?
yeah i was testing something
and it randomly said undefined
so i just started spamming to see if it was a ratelimit or something
here i wasnt even spaming anything it just said undefined randomly
so im not sure
i just checked if message.content started with my bot's <@ID>
its probably ineffecient
but /shrug
¯_(ツ)_/¯
message.content.startsWith(<@!blah>) || .startWith(<@blah>) {} ?
should work if you did that
it's been one month 6 days my bot not reveiwed by @cosmic surge
if the bot is nicked there will be a ! infront of the id
string
it seems to happen in little spikes
h
h
it's entirely possible i messed up the schema cause this is my first time using mongo
h
o

Are you using mongoose?
const guildSchema = new mongoose.Schema({
guildID: String,
prefix: String,
announcementsChannel: String,
ignoredChannels: Array,
})
i felt it would be more reliable to use mongoose instead of abcdb cause you could just dip randomly
and then my code would die
:)
yes
What
just randomly vanish
lol
off the face of the internet
The docs still exist
and never update your abcdb
And the package works
It just wouldn't be maintained
Yeah but I won't go off the internet any time soon :)
'tis fine i want to learn mongoose anyways
mongoose.model(guildSchema) ?
yea
ok
module.exports = mongoose.model("guilds", guildSchema)
It should work
it works fine
I have never been rate limited
i mean it might be because some of my code is still in quick.db
perhaps
still messing around with mongo
how to make aliases for commands
discord.js
Collection#migrateFromQuickDB what
i was geniunely considering not learning mongo and then just migrating to quickdb every time i startup on my bot

ops
let prefix;
if (message.channel.type === "dm") {
prefix = defaultprefix
} else {
db.set(`guild.${message.guild.id}.ignoredChannels`, [])
if (!db.has(`guild.${message.guild.id}.prefix`)) {
db.set(`guild.${message.guild.id}.prefix`, defaultprefix)
db.set(`guild.${message.guild.id}.ignoredChannels`, [])
}
let findGuild = await Guilds.findOne({
guildID: message.guild.id
})
if (!findGuild) {
findGuild = new Guilds({
guildID: message.guild.id,
prefix: defaultprefix,
announcementsChannel: `0`,
ignoredChannels: [],
})
await findGuild.save().catch(e => console.log(e))
}
await Guilds.findOne({
guildID: message.guild.id
}, async (err, guildChosen) => {
prefix = guildChosen.prefix || defaultprefix;
})
}
this is probably very sloppy
some of it is still in quickdb
idk
Is defaultprefix undefined?
i just mashed together whatever i could use my brain on
default prefix is defined in a config.json file
which i am requiring
const {
token,
version,
defaultprefix,
mongoDB
} = require('./utils/json/config.json');
idk
kek
i used whatever 2 braincells i had after playing animal crossing for a full day without sleep
What was it?
but i had two different things for findguild
o
const ytdl = require("ytdl-core");
const YouTube = require("simple-youtube-api");
const youtube = new YouTube("API");
module.exports = {
name: 'play',
description: "play",
async execute(msg, args) {
const args2 = msg.content.split(" ");
const queue = new Map();
const searchString = args2.slice(1).join(" ");
const url = args2[1] ? args2[1].replace(/<(.+)>/g, "$1") : "";
const serverQueue = queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
if (!voiceChannel)
return msg.channel.send(
"I'm sorry, but you need to be in a voice channel to play a music!"
);
voiceChannel.join().then(connection => {
// Yay, it worked!
console.log("Successfully connected."); if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
return msg.channel.send(
`✅ **|** Playlist: **\`${playlist.title}\`** has been added to the queue`
);
}
}
}```
SyntaxError: await is only valid in async function
i do
async execute(msg, args) {
is there a line
wha
@delicate shore async connection
Also
in the .catch i had
Why not just
@delicate shore async connection
@golden condor what?
ok
the command handling from discord js guilde doesn'te even work
nice
Just use collections
i use fs
@delicate shore
it uses a mix of the two
^^
fs/collections
oh ye
^^
yea
read the folders
yep
yes
const ytdl = require("ytdl-core");
const YouTube = require("simple-youtube-api");
const youtube = new YouTube("API");
module.exports = {
name: 'play',
description: "play",
async execute(msg, args) {
const args2 = msg.content.split(" ");
const queue = new Map();
const searchString = args2.slice(1).join(" ");
const url = args2[1] ? args2[1].replace(/<(.+)>/g, "$1") : "";
const serverQueue = queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
if (!voiceChannel)
return msg.channel.send(
"I'm sorry, but you need to be in a voice channel to play a music!"
);
voiceChannel.join().then(connection => {
// Yay, it worked!
console.log("Successfully connected."); if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
return msg.channel.send(
`✅ **|** Playlist: **\`${playlist.title}\`** has been added to the queue`
);
}
}
}```
H
lol
Do you use a custom command structure?
hey
me?
hey
Yes
yes
Nice
let me send somethng here
Go on
Is there any way if someone does s!help play
yes
yea
check the first arg
Check if it's a valid command
If it is
Get the info
If not
Return that it isn't valid
how to get info
it basically doesn't work i thinks that the command doesn't exist and does nothing
command handling bad
@delicate shore collection.get
it works for me
Because he hasn't applied?
@golden condor they dont have a bot
Or is stil waiting for a turnaround
@pliant gorge is waiting
Because it is massive
@earnest phoenix ask here
kk
.
Wait i will ask later cuz i need to eat now @delicate shore
ok
why
my command handling ingnores itself
basically it ignores the fs thing, and ignores the commands folder
SEND CODE
Wait what
dude
Can I ask you if it is possible for you to show us your code?
i removed the command handling code
oh
So it should work in that case
should the fs thing be at the stat of the code or under require .env
start
Dotenv not require env
typo
forgot what the env module is named
basically u should put require fs upon require dotenv?
and should i remove the commands from the main file and put them into the js files in commands folder?
Is
is
is Oxide hosting better than GalaxyGate
is Oxide hosting better than GalaxyGate
Discord lagging wth
Discord lagging wth
hi
@coral trellis do the -vps
and should i remove the commands from the main file and put them into the js files in commands folder?
@cinder sandal
-vps
@delicate shore they are both good, but gg is known to be faster
-vps
A VPS or virtual private server is a virtualized server instance run in the cloud. It acts like a normal server, allowing you to remotely login and manage it just like a physical server or computer. If you're looking for a way to keep your bot online 24/7, a VPS is a great option.
Having trouble choosing a VPS provider or don't know where to start? Click here for a list of common and affordable VPS providers.
Rpi?
replit
If you've got a static html page then glitch
Are free
really?
oh ok thnx
for bots i would home host
@golden condor which vps u use
Unless you got a vps
i host with heroku
I use contabo
I might get a DO
Sorry What?
hi, this is wrong?
Contabo?
I use contabo
German server provider | #VPS from €3.99 / mo | EU and US Locations available | 15+ years of experience | 70k+ happy customers | #hosting #cloud #infrastructure
What is tracks
They are quite cheap
sorry no i saw it
1x lavalink
their website is ugly
I think your issue is you're not accessing tracks properly
Yeah it could do with a revamp but the point still stands, it's good.
I'm not sure how lava link works
you could check tracks with console.log
and go from thrre
lol
¯_(ツ)_/¯
it isn't .info.setTimestamp
that's what I would do if I was thrown code and had to fix it
Timestamp is fine
burber is back
It isn't a property that exists
yes it is
That's why it's undefined.
kek
oh Fuck me im blind
Not the embed
I thought you meant the embed
That's why it's undefined
Gg
how to make arguments without the commas ,
It's an array?
Join with something other than commas
It's gonna have commas
and how would it be the right way? : /
no he is splitting in commas
A
Even if i do .join(' ')
He means like argN,argN etc
video I saw was like this, I know nothing about lavalink
.join turns the arrays
^
into a string with spaces
join turns the array to a string
He is splitting straight facts
Joined by the character you specify
so ["blah", "Bleu"]
becomes "blah Bleu"
i have .join(/ +/g)
just do .join(" ")
argumens with commas are kinda useless
Can someone send me the mdn pages for array.reduce and array.sort, they really confuse me lol
with spaces better
"blah Bleu"
.split(" ")
would become
["blah", "Bleu"]
wait
am i doing this right
kek
YES

thx
i have .join(/ +/g)
@cinder sandal you are turning the array into a string not turning a string into an array
@cosmic surge
Idk why but I am just so confused by reduce and sort
yeah like
Sort is just sort
[1, 2].join(", ") returns "1, 2"
No
Wrongg
@radiant knot can you not keep accidentally sending an apk file in this channel
cause you've sent it here twice
kek
I need the mdn stuff for this I am very confused by these two functions
@radiant knot can you not keep accidentally sending an apk file in this channel
@thick gull i send these my mobile
@radiant knot that is just virus
I dont say install them .p
go to #memes-and-media
Yeah, I made a package
do u make custom bots ?
@delicate shore lol why
because
@delicate shore lol why
@golden condor you can earn some $$
god fuck why @pure lion
It doesn't work properly
@delicate shore I tried to before but it didn't really work
Lmao
oh
@golden condor same
Wdym
That actually looks epic
I really can't be bothered to pay for hostinf
So it's inefficient and when I add new data it needs an update

I want to make an actually useful package but idk what
Like?
Why is that?
you'll get an idea eventually
@fathom sky literally 0 clue what you're trying to do here
Try pnpm enable
i did
Oof
what's the best way to delete an embed?
is pnpm a valid path?
Try looking at docs
i was trying to mess around with message.suppressEmbeds() but i cant figure it out
Just delete the message
.then(msg => {})?
^^^^^ or await
any markdown guides?(pls ping as i have this muted)
Please help
nice api key
lol
const ytdl = require("ytdl-core");
const YouTube = require("simple-youtube-api");
const youtube = new YouTube("api key");
module.exports = {
name: 'play',
description: "play",
async execute(msg, args) {
const args2 = msg.content.split(" ");
const queue = new Map();
const searchString = args2.slice(1).join(" ");
const url = args2[1] ? args2[1].replace(/<(.+)>/g, "$1") : "";
const serverQueue = queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
if (!voiceChannel)
return msg.channel.send(
"I'm sorry, but you need to be in a voice channel to play a music!"
);
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
return msg.channel.send(
`✅ **|** Playlist: **\`${playlist.title}\`** has been added to the queue`
);
}
}
}
Could anyone pls help with my command..my bot isn't joining
@earnest phoenix u removed line i said u
No it seems like i cant show the key
const connection = voiceChannel.join().then(connection => {
// Yay, it worked!
console.log("Successfully connected.");```
Someone deleted my code
this one
oh
yeh
const ytdl = require("ytdl-core");
const YouTube = require("simple-youtube-api");
const youtube = new YouTube("youtube api");
module.exports = {
name: 'play',
description: "play",
async execute(msg, args) {
const args2 = msg.content.split(" ");
const queue = new Map();
const searchString = args2.slice(1).join(" ");
const url = args2[1] ? args2[1].replace(/<(.+)>/g, "$1") : "";
const serverQueue = queue.get(msg.guild.id);
const connection = voiceChannel.join().then(connection => {
// Yay, it worked!
console.log("Successfully connected.");
if (!voiceChannel)
return msg.channel.send(
"I'm sorry, but you need to be in a voice channel to play a music!"
);
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
return msg.channel.send(
`✅ **|** Playlist: **\`${playlist.title}\`** has been added to the queue`
);
}
}
}
}
idk..i have an error
@earnest phoenix which error

okay so
const ytdl = require("ytdl-core");
const YouTube = require("simple-youtube-api");
const youtube = new YouTube("key");
module.exports = {
name: 'play',
description: "play",
async execute(msg, args) {
const args2 = msg.content.split(" ");
const queue = new Map();
const searchString = args2.slice(1).join(" ");
const url = args2[1] ? args2[1].replace(/<(.+)>/g, "$1") : "";
const serverQueue = queue.get(msg.guild.id);
const voiceChannel = msg.member.voice.channel;
// Yay, it worked!
console.log("Successfully connected.");
if (!voiceChannel)
return msg.channel.send(
"I'm sorry, but you need to be in a voice channel to play a music!"
);
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
return msg.channel.send(
`✅ **|** Playlist: **\`${playlist.title}\`** has been added to the queue`
);
}
}
}
Both
really?
but isn't user universal
i mean user is property for a user like @delicate shore is a user whose presence is dnd
but a member does not have presence
thingy so
I thought user was a person outside of the server
And member a member in the server
I'm guessing with the id
yeh but how can one get member property of a user
With the api you can get usernamr etc from an id, doesnt matter if the user is in the server or not
yeh but how can one get member property of a user
like if i do s!ban 48923598852
Do i need. to get member property of user
Not sure actually
to get a member object from a user object you have to either:
a. check the guild's member cache and get the member that matches the user id
b. fetch the member using the user id
you dont need the member to ban/unban, the user id is enough
you dont need the member to ban/unban, the user id is enough
Oh ok thanks
iirc that's a thing right
@thick gull what is iirc
if I remember correctly
best music player for java?


anyone?
