#development
1 messages ยท Page 1191 of 1
@earnest phoenix
name: 'kick',
description: "This kicks the user mentioned.",
execute(message, args){
if(message.member.permissions.has("KICK_MEMBERS")){
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.kick()
.then(() => {
message.reply(Successfully kicked ${user.tag});
})
.catch(err => {
message.reply('I was unable to kick this user.')
console.error(err);
});
}
} else {
message.reply("You didn't mention a user to kick!")
}
} else {
message.reply("You do not have permisson to execute this command!")
}
}
}```
how do i make it so i cant kick myself
Use an if statement
ezz pzz
oki
wait
if my bot
is uploaded to top.gg
will i be able to make a website
with .gg
like
or
dont
ladder
type
please
sorry
and nope
oh
you'd have to buy ur own site host
Certified bots can use a vanity URL like top.gg/bot/mycoolbot but other than that, no
There's no really best way to have a free website other than using a free domain
websitename.domain
yeah
Most of them are
DBL is not a place to find developers for jobs. You can try and put a request on Fiverr or Freelancer. Please do not post the request again. Doing so may result in punishment.
I need some help About canvas
Sometimes it's easier to maintain a project solo than with people you don't know 
Sometimes it's easier to maintain a project solo than with people you don't know :blobshrug:
this^
well, easier and safer
u can rely on urself the most
unless you're a lazy bum like me
or me ye
then your projects take ages to get done
then your projects take ages to get done
or you have loads of unfinished ones
lmao Tim
or you learn a language and then give up on a project and forget about it resulting in lots of unfinished projects
COULD NOT BE ME
I promised to help someone rewrite their bot in fucking winter
5 months later, I only rewrote the main file
Is it in Python?
no its in roblox lua
Sure, I'll slap a mem leak somewhere
there are no libs for roblox lua cause you cant run stuff like discord bots in it
but there has to be a way

if its code then its possible
are refractors and switch cases recommended for js bots?
why not
idk im rewriting my bot so i thought about doing that more efficiently
@quartz kindle heyo, does djs light have an option to work with a custom sort of caching system
like quickly adding a custom external cache and just letting the lib use it through scaffold funcs
you'd need to write it yourself
if you want to hack djs to use an external storage you'd either need to rewrite almost every djs method out there to support async calls
f
or use something like better-sqlite3 which is synchronous
so you can hack it into collections
so there's no easy enough way to do so
puts out my plans of using something like redis to handle the caching
you're not the first to try
the problem is that all djs internal functions use .cache.get and such
you cannot hack them to use redis because the entire lib expects it to be sync
maybe eris is better, though it has zero good voice
eris has the same problem
i'm just trying to make a small music bot but pull mem use and such as low as it can go
yeah
@solemn leaf Oi
<Video Title>.replace(/\&\#\d+\;/g, group => String.fromCharCode(group.match(/\&\#(\d+)\;/)[1]))```
This would make it work
discord.py
In TextChannel.edit, the overwrites kwarg expects a target-PermissionsOverwrite dictionary where target can be either a role or a member. Is it possible to simply pass discord.Object as the target?
Reason for my assumption is because I feel that discord.py internally simply gets the .id property of the target and sends it in request payload
@earnest phoenix so
${results[0].replace(/&#\d+;/g, group => String.fromCharCode(group.match(/&#(\d+);/)[1]))}
really looks like i mashed my keyboard to me there
${results[0].title.replace(/\&\#\d+\;/g, group => String.fromCharCode(group.match(/\&\#(\d+)\;/)[1]))}```
@thick gull That's how regex works
holy
Like you let your cat walk on your keyboard

is this how all languages were made
some just
slammed their keyboard
really seems like it to me
gj
K made that myself
@quartz kindle based on the defaults of the light package though, dropping it into an existing music bot, should it still work or would there be some issues with how it'd work
Gave me some headache
very much wanting to use it but i dont want to make dev painful
totally didnt ping everyone in a server with a bot like that
good
this was just for test
Damn I'm happy i know regex that i can make things like that
Regex is so helpful
Regex is like riding a bike. Looks impossible at the start then gets easy later on.
But regex Should be avoided as much as possible
Why avoid it? Embrace it
No i mean
regex gets resource intensive
Idk why people say, "avoid using regex as much as possible"
"it's slow"
Wot
Regex is not slow and never was
It can be slow.
how does one even learn regex tho
You can write it poorly as well for how small it can be.
You learn regex by trying it out.
This site in particular: https://regexr.com
Press on Cheatsheets or RegEx Reference on the side
thanks lite
It can be slow.
@sudden geyser Yes if you include millions of characters just for a single regex
@rancid dune Ask your question in here, please.
I don't remember how long it was but there was some giant regex someone wrote to match all email addresses
it was like 300k characters
hmm does anyone know a good music library and the version of it since im hosting on heroku
music library?
I hear talk about erela.js
The best way to play Stream buffers of a youtube video or whatever is using ytdl-core
do i have to provide links for it?
youtube-dl 
or just names?
ytdl-core can only search for links
You can use an npm package like simple-youtube-api to get videos with names with an api key
so if i do like
@clear wraith
Of course
Yes? @rancid dune
If the song exists
then i just do .catch this song was not found?
A stable music system is way harder than you think, but up to you to make one
oh ok
@sharp thicket Can work but i always use try catch
I need help
with?
Canvas
Very descriptive
Yea.D
I want use
Custom font
And
I used in glitch
But ฤฑ cant use in my pc or vds
<canvas style="font-family: comic sans ms> </canvas>
is there a specific format to upload ur bots files to a private github or can u just upload ur entire project folder as is if it already runs fine on node and on heroku?
github isn't a server platform
it's just file hosting for repos
it doesn't care what type or what language your project is in
@faint prism ฤฑ know
i wanna upload my files to there so i can then import them to glitch.com
You know what?
<canvas style="font-family: comic sans ms> </canvas>
@faint prism
lol good luck, auger
i mean neither are meant to be used as a platform for hosting bots in the first place
both glitch and heroku started cracking down on projects misusing their platform
yeah but whats the fun in using theings for their intended purpose XD
@brave orchid
https://www.w3schools.com/html/html5_canvas.asp
both glitch and heroku started cracking down on projects misusing their platform
@earnest phoenix according to their forums discord bots are allowed ;-;
they made that statement a while ago
We are all just ultracrepidarians
they recently announced that they will start blocking and terminating projects using uptimer-esque bots
"recently"
Sad
what can i use for a discord bot that has a database ๐ญ
No more free platform then
fck
what can i use for a discord bot that has a database ๐ญ
@forest drift mongodb atlas
what can i use for a discord bot that has a database ๐ญ
@forest drift MongoDB Atlas and mongoose module
Google it. It's a free nosql database
Google it. It's a free nosql database
@faint prism Google
tell me more please
Are you asking me to Google it for you?
so its like heroku but supports databases?
no
It is a cloud db
so i wont have to come back to my pc to find 500 pings from my friend pinging me complaining that the bot is down
you guys misunderstood him, he wants a hosting service that supports databases, not a database
oh...
Any VPS works
Databases. Plural?
Get a cheap one
so, could i combine it and heroku?
Yes
it hosts the database and heroku the bot?
Vps
@brave orchid
https://www.w3schools.com/html/html5_canvas.asp
@faint prism ฤฑ said ฤฑ want use custom font file
const sequelize = new Sequelize('database', 'user', 'password', {
host: 'localhost',
dialect: 'sqlite',
logging: false,
storage: 'database.sqlite',
});
const strvarsave = sequelize.define('strvarsave1', {
name: {
type: Sequelize.STRING,
unique: true,
},
description: Sequelize.STRING,
});
thast what i currently use for the database
@faint prism ฤฑ said ฤฑ want use custom font file
@brave orchid then use CSS. What's the problem?
Well mongoDB doesn't use sqlite i don't think
;-;
Idk
For discord bot
mongo and sqlite are polar opposites
so i have to recode almost a thousand lines... eh not even suprised anymore
Well mongoDB doesn't use sqlite i don't think
@high bough it uses BSON iirc
Ahh, yeah, that's right
so... what database host could i use thatd work with sqlite...
Sqlite is relational,
Mongodb is non-relational
let text = Canvas.registerFont("/app/9a74334b-2f2a-4a8c-8c2d-9a81bd279d6b%2Ff7b0877a-f406-4222-bd77-33e69195fcd0%2FBebas Neue Pro Bold.otf", { family: "myFont" })
Like this
This is in glitch
Is that a question?
it's just so funny that I made my mongoDB login smlt
mongoose.connect(
`mongodb+srv://${login.mongodb.username}:${login.mongodb.password}@${login.mongodb.cluster.url}.mongodb.net/${login.mongodb.cluster.database}?retryWrites=true&w=majority`, {
useUnifiedTopology: true,
useNewUrlParser: true
}
).catch(err => console.log(err));
I want use this in my PC or vds
Since this is relevant again, here is my mongodb code
#development message
you could've made that less of a pain by using ef core ๐ @faint prism
consider migrating your code to it later on
ah god i just spent today coding the sqlite stuff... eh i got nothing better to do
been coding for almost 3 days straite... (shown in my current status) who needs a life...
i mean without sleep
yeah me either :)
What are you using it for? Just for learning?
skillz, props to u dude
you could've made that less of a pain by using ef core ๐ @faint prism
@earnest phoenix I've never used Entity Framework, but it's something I've considered learning. With my current approach, I'm free to make my db context anything I want without refactoring
imma have mental issues by the time i get this bot working
the beauty of โจ abstraction โจ
Mhmm
im considering making a new computer with my old motherboard just to host the bot now...
would that work?
yeah
ive only ever run it for 24 hours on my current computer
you can even run it on a mini pc, i.e raspberry pi
would it be worth it?
if your internet is reliable, go for it
i have a rasberry pi 3 thats just collecting dust :D
polymorphism is the beauty of c# @faint prism ๐
how do u code a raspberry pi 3 -___-
"code" ?
well setup
Lol
there should be a plethora of tutorials online
the one i have is a completely factory default one...
they scammed me, i was given a corrupt 16gb sd card for it
It's a server
i have fedora 32 software on this computer im using rn
would that work to setup a raspberry pi?
i wonder if i could make a bot that u can codse in commands from discord :D
like where it adds new module.export files that u custom conde on the actual discord server :D
is making a bot that secretly gathers data without the users concent and stores it externally allowed 
Considering you need to state what data you collect no
What do you need to collect which you don't want to state to your users anyway.
that ruins the fun... welp back to a boring helpful bot 
What do you need to collect which you don't want to state to your users anyway.
@sudden geyser ;-; no comment... just maybe every message they send to build a database on every user that comes in contact with the bot to later be used as an april fools day update where u can type(prefix)what did i say(?)where itll then send a completely random message u once sent, showing the day, time, server and channel where the message was sent
would that kinda thing be allowed?
Not without their consent
darn... its not rly a suprise if they already know ๐ญ
TOS says you can't use a user's data in a way that is considered unexpected or will surprise them
how would i get their concent without them rly knowing?
thats not called malitious, thats called boring
You HAVE to ask the user
i mean like have a checkmark reaction embed, where it says "do u accept this bots t's and c's and privacy policy?" with a link to a 20k page doc where theres 3 lines that mention the gathering of data for later use?
You need to get "consent" from the user. An example of consent would be having the user run a command where they basically say "Yeah I agree". Heck, even interacting with the bot can be consent.
They're also requiring bots to have privacy policies as well so you could look at that.
so, with a link to a 20k line page, theyll just accept and never be the wiser?
i like ur thinking ๐
lol
bring your lawyer 
This is just like oauth2 applications
bring your lawyer :owoOmegaNom:
@sudden geyser i already have an army of them cause im bound to stuff up
Get a fucking DPO also 
<The hell is DPO btw>
I need an server creator bot what i can use
Dpo?
Data protection officer
oh no the mod ;-; nothing to see here heh heh ๐ deffinately not planning a way to legally log every users data without their knowledge lol, what would make u think that heh heh ๐
Guys I need an server creator bot what i can use
@slender thistle
Btw Shivaco, Thanks for your help with my bot in the past
oh phew its a cool mot ๐
Your legal responsibilities to ensure compliance with Discord ToS, not mine
@slender thistle did tou see my letters
You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.
Bruh
so if there was a link to a 20k page doc and 3 lines requested the permission to log their every action where they have to click accept on that 20k page document?
thatd count as getting concent?
:D
I'm not a lawyer
Welcome to the jamie show, legal ways to break the law XD
FWIW put it somewhere where the user can clearly see it
Are you guys talking about privacy policy
User consent
right got it, make everything size 15 and that concent size 6 XD
Shivaco, I know I say this everytime I see you, but thanks for your help on my bot, as really nobody else helped
etc etc explicit and informed user consent
do u rly need concent to tracj a users every move eh
Yes
no fun
Nothing legal is fun
T-T im underage and in a different country... safe :bliss:
and if you're in this industry to track users, have fun if you get lawsuits thrown your way
nununu
Your parents may be held accountable legally still
not my plans
do u rly need concent to tracj a users every move eh
@forest drift Have you realized that oauth2 would never do anything unless you authorize it?
This case is that thing of a kind
It needs consent
ah ok
so, just somehow trick them into concent?
.... all for a future april fools command... the work i do for so little
Ask them if they want their data tracked or not
That's the pain of compliance with a company's guidelines
Or just do an announcement, say who allows their account to be tracked react with ๐, if no then react with ๐
All easy
You either comply or get shit thrown your way
do u rly need concent to tracj a users every move eh
welcome to discord
yup
discord tracks almost every move you make lol
if you open up inspect element you can see the element for it
but there are always ways to get someones concent without them actualy knowing theyre giving concent to tracking
discord tracks almost every move you make lol
@earnest phoenix so true
does anyone here know how to make commands two words long
Discord already tracks what you do
Asks users to ask for consent to track others data
Discord logic
if i, a 15yr idot can code custom discord themes, imagine what someone with skills can do
That's storing user data without consent and you are liable to have your access to API restricted
or possibly even a fucking lawsuit if it's severe enough and if Discord cares
again... all for a april fools command....
or just don't make it and don't bother
behind the scenes all companies sell and exchange data, they're just legally obliged to say they aren't
Simple as it is
<Says like if many cares about their user object for example to be stored>
welp im stuborn and now set on getting the data for the april fools command, time to learn law :/
But it's discord's ToS
@forest drift relatable
anyone know how a 15yr can become a lawyer and potentialy take on discord all for an april fools command? ๐คฃ
No sorry
darn... welp time for my plan B
Do you really need to get your whole reputation and maybe your life because of a lawsuit to be applied to be ruined for an april fools thing?
worst case scenario your account and bot gets banned
Do you really need to get your whole reputation and maybe your life because of a lawsuit to be applied to be ruined for an april fools thing?
@earnest phoenix yes XD
message.channel.send('no');
} else {```
how do i make it so if the message contains @ everyone it says no
worst case scenario your account and bot gets banned
@split hazel i mean thats not too bad?
well depends
This is why I sometimes hate the Discord bot dev community
no one takes legal shit seriously
just lose 300+ friends, multiple servers, a few bots... worth it for the april fools command
what april fools command
i wanna track user data to eventualy make a command where u type (prefix)what did i say(?) and itll post a random message uve posted in the past, including the timestamp, date, server, channel
@mystic pike if question.includes("@everyone")
^
ReferenceError: prefix is not defined```
thank you
A blind guess but you get the point
Could someone help?
u have no prefix ;-;
I do
its literally in the error message, just check over the variable names
message.channel.send('no'); } else {``` how do i make it so if the message contains @ everyone it says no
@mystic pike js if (message.content.match(new RegExp(`\<\@\&?${message.guild.id}\>`))) { return message.channel.send("No"); }
the question.includes works
why use regex for everything
Because yes
also the ateveryone isn't converted into a mention
can i somehow sponsor dbl just long enough to make them add a :troll_face: emoji?
It's in my config
did u link ur config?
Works for every other command
not everything is money. Try to suggest it to admins
@earnest phoenix js let prefix = <Your config file>.prefix;?
High chances of it being rejected
did use
const {prefix} = ect
or smt else?
High chances of it being rejected
@slender thistle i shall prepare a 25 hour long speach and start a roit for it lol, also btw the sponsor was a joke, i have no money, this is 2020
can i somehow sponsor dbl just long enough to make them add a :troll_face: emoji?
@forest drift Did you think they would listen
nope
Hell in the no of no
i just rly want a :troll_face: emoji
itd be perfect
and i cant afford nitro do idk
Idk man, i haven't slept in 2 days and this is what we're doing
but thatd only work if they were bi like me or gay
Idk man, i haven't slept in 2 days and this is what we're doing
@earnest phoenix im almost at 3, check me status lol
theres a reason i cant spell atm
or even be gramatically correct
im more productive when im tired lol
Damn this is extremely off topic
adhd, proven to be EXTREMELY productive when tired
@slender thistle Oi mate, what we doing
working out how to bypass discord concent rules
This is off topic at it's finest level
my bot @ember pumice is not cerified
off-topic at its finest, yes
It's not even approved to be even certified @sly thorn
we mayaswell just merge development with offtopic
No
it alwasy goes offtopic
Then what happens... A mute
because someone can't use channels properly
;-;
guilt af

ah yes, so back to bots, how do u get an external database to work with heroku ๐ญ
Just learn how to use MongoDB
An external database
another learning... code used to be an escape from work, now i realise its even more imprisoning
How is it approved for accreditation @earnest phoenix
by waiting
For wot
can take months lol
Around a month*
ah... i was told 1.5 months... glad its gone down
It actually takes 69 years
How do you set an embed to a random color?
setColor("RANDOM")
ohh okay thanks
thats so much easier than what i did...
i made a 6 character number/letter randomizer ;-; why dont i just google before wasting my life...
Look at the source code to see how it's done
Or just eval js Discord.MessageEmbed.prototype.setColor.toString()
In the end you either do it yourself or make the tool do it
ight im almost falling asleep at my pc... cyall in 24 hours... 72 hours up, 24 asleep, the perfect scdule
We all devs at least head to stack overflow
CIS Test
Quick someone tell me how they would approach the following problem without googling it:
You are prohibited from using toUpper and toLower in your language of choice```
oooo im a dev ๐
big mistake boosting my confidence
time to go tease myself in the mirror about being lonley to lower it again. cya
ASCII char time
probably not the best solution but i'd make an object with the whole alphabet and the lower/upper case
see thsi one know how to make over complicated things :D
string Convert(string s)
{
string upperS = string.Empty;
for (char c in s)
{
upperS += (char)((int)c-32); // Probably don't need casts, but fuck it
}
return upperS;
}
my bots at around 5k lines, but if i were to actually make it compacted with better functions itd be around 800 lines...
Is that Typescript or what am i missing here @faint prism
see sharp
Y'all should know I'm a C# dotnet fanboy by now
anyway, goodnight, or well goodmorning, ill be back to annoy everyone in 24 hours, so dont worry about being free for too long ๐ผ
*๐
Nobody else gonna participate in the coding challenge?
Imagine being smart for coding challenges
for a challenge i wouldnt care if it takes 100ms
i used to do a bunch of CTFs when quarantine started
i used to do a bunch of CTFs when quarantine started
@earnest phoenix Ayy InfoSec, nice
Are you in Australia or something ||(upside down joke)||
croatia
o h
I've got some experience using a few different pentest frameworks.
Never really wrote my own exploits outside buffer overflows or format string attacks
console.log(oldPresence.clientStatus)
console.log(newPresence.clientStatus)
using the presenceUpdate event, this returns either
{ mobile: 'online' } / { desktop: 'online' }
im not sure how I would put this into a string.
idk if im just really tired rn but brain isnt functioning
it's an object
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('message', message => {
if (message.content === "Gรผnaydฤฑn")
message.reply("Gรผnaydฤฑn!");
else if (message.content == "yardim")
message.reply("yardim!")
})
client.login(proc.env.Token);
done. idk JS though. But I tried
i went over some old ones from 2015, there's quite a few good ones like night sky
i'm sure that reply() isnt a function either
message.reply
client.on('message', message => {
if (message.content === "Gรผnaydฤฑn")
message.reply("Gรผnaydฤฑn");
})
oh im an idiot my bad. Of course that's where it goes
coding challenge: make a turkish bot
@split hazel But yeah, done ;)
https://discordapp.com/channels/264445053596991498/272764566411149314/748334066822283404
has to auto respond to yardim too
@faint prism I tried to do your test function, but it's late isn't it
function nativeUpperCase(string) {
let mainString = "";
for (let e of [...string]) {
let charCode = e.charCodeAt(0);
charCode >= 97 && charCode <= 122 ? mainString += String.fromCharCode(charCode - 32) : mainString += e;
}
return mainString;
}```
In js
done
will that even work
message isnt string
has to be an else if innit
oh?
<condition> ? <If true> : <if false>
Is a thing
@split hazel You were talking to me?
ITT #development makes a turkish bot
Oh k
ftfy btw Speedy
@faint prism not sure if the way you did it works
but
const Discord = require('discord.js');
const client = new Discord.Client();
fixed in Commit 4 ๐
you also need to add a broken patreon wall
is there a way to read JSON objects without the name of the objects
the name of the objects is pretty random
and its an API
so yeah
object.guild.members[0].expHistory.y57dgj42iy3ved
is the file
i want to change y57dgj42iy3ved
you could grab the keys with Object.keys(object.randomjsonwithrandomkeys) which returns the array then you can do something like expHistory[Object.keys(expHistory)[0]] depending on what you need
if there is one element in it for example
if there's multiple increase the index to your desired result
uh
how to get needed args in node?
Example:
function test(bot, msg, need_for_test) {
...
}
module.exports={
"run": test,
"params": [bot, msg, val]
}
How to send this params from command handler function?
i want to change
y57dgj42iy3ved
Object.keys returns an array of the provided object with every key in order
oh
so if you have an object { a: 1, b: 2 } it would return ['a', 'b']
yep that would include the random key
is it only one random field in the object?
I mean you can iterate over them, since you already have the key name you can just run objectwithdata[variable that has your key]
this is the equivalent of data.abcdedg
hi guys i have a question can this be rewritten any cleaner?
const coowner_discord_data = async () => {
d = new Array()
await owners_dbdata.co_owners.map(async user => {
const promisereturned = await client.users.fetch(user.id)
d.push(promisereturned.toString())
})
return d
}```
this returns an array of `User{}` objects and I need to `<User>.toString()` them but is there a cleaner way of doing this?
ok ill try something and ill send updates
huh
Asking about your attempted solution rather than your actual problem
what is actually your goal
@spare gale what do you mean?
ill need to get some args for bot command, but only for this command.
like:
module.exports = {
...
"params": [msg, var1] //var1 from command handler, only for this command
...
}```
i dont get answer for my last question and try to go another way xD
const array = Object.keys(verifyValue.guild.members[0].expHistory)
for (let l of array) {
console.log(l)
}```
@split hazel it works thanks
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/748348396611305483
and how to get variable var1 by name?
what do you mean var1 by name
its literally var1
params is an array. if you try to access params you get an array return value
you dont have client defined anywhere in that file @clever vector
the error is came ffrom this file
ow...
i know it -.-
array for many params -.-
for forEach this array
params is an array. if you try to access params you get an array return value
const Discord = require("discord.js");
const config = require("./config.json");
const botClient = require("./handler/ClientBuilder.js"); // We're gonna create this soon.
const bot = new botClient();
require("./handler/module.js")(bot);
require("./handler/Event.js")(bot);
require("./uptime.js")
client.package = require("./package.json");
client.on("warn", console.warn); // This will warn you via logs if there was something wrong with your bot.
client.on("error", console.error); // This will send you an error message via logs if there was something missing with your coding.
let memberlog = "747654034508349530";
client.on("guildMemberAdd", member => {
if (member.guild.id !== "725952860076113962") return;
client.channels.cache.get(memberlog).send(`Welcome to the **${member.guild.name}**, <@!${member.user.id}> !!!`);
})
client.on("guildMemberRemove", member => {
if (member.guild.id !== "725952860076113962") return;
client.channels.cache.get(memberlog).send(`**${member.user.tag}** left **${member.guild.name}**.`);
});
client.login(process.env.SECRET).catch(console.error); // This token will leads to the .env file. It's safe in there.
@spare gale so are you saying that var1 can be a different value name in every file
@clever vector replace
const bot = new botClient(); to const client = new botClient();
@clever vector youve defined the discordClient as bot not client
Ohh
Move that hardcoded user id into config
Thanks @spare gale and @plush magnet
var1 defined in commandhandler and i need to send it from handler to command, but only for test command
@spare gale so are you saying that var1 can be a different value name in every file
@plush magnet
what its mean [Symbol (code)]: 'TOKEN_INVALID'
what its mean [Symbol (code)]: 'TOKEN_INVALID'
your bot token is invalid
@spare gale well can you give me more information then 3 lines of code in a file
@split hazel now how do I store all those values inside a variable? using a loop
object[key]
How to fix that Invalid
no
oh it's up to you
each value for each variable
I'd make an array and push all the data there
then map it and do whatever to display it
I'd make an array and push all the data there
@split hazel how do i do this
i know how to fix that invalid
ah nvm
oh lord
@split hazel how do I add up all the values I end up with?
@plush magnet
handler.js:
...
var var1='test'; //need to send to command
const command = bot.commands.get(msg.content.toLowerCase().split(' ')[0])
|| bot.commands.find(cmd => cmd.alts && cmd.alts.includes(msg.content.toLowerCase().split(' ')[0]));
if (!command) return;
command.run(msg, args)
...
test.js
function test(msg, args, loll) {
return msg.channel.send(loll);
}
module.exports = {
"admin": false,
"name": "test",
"params": ['test'],
"run": test
}
values are numbers right
Guys there is another problem
my bot prefix is /
but
its can use with all other prefix\
??????
I can't really explain it so I recommend you read this https://stackoverflow.com/questions/1230233/how-to-find-the-sum-of-an-array-of-numbers
then youre not passing the prefix correctly @clever vector. use a debugger to help you
my bot wont leave after the ffmpeg audio is done
function play(connection, message) {
var server = servers[message.guild.id];
server.dispatcher = connection.play(ytdl(server.queue[0], { filter: "audio" }));
server.queue.shift();
server.dispatcher.on("end", function () {
if (server.queue[0]) {
play(connection, message)
}
else {
connection.disconnect();
}
})
@carmine summit please reffer to the javascript documents to find Methods and values for base classes
How to use debugger on Repl
client.on('message', message => {
if(message.content === 'You suck') {
message.channel.send('ok');
message.author.send('did u say i suck?');
message.guild.leave();
}
});
lol
https://srcb.in/d69d7766f0
ReferenceError: args is not defined
Not a clue what to do
@carmine summit please reffer to the javascript documents to find Methods and values for base classes
@plush magnet please english
my cosole says sql.get is not a function
@pulsar fossil
message.guild.ban(message.guild.members.cache.get("bot.user.id"));
)))
wait wut?
xD
@carmine summit if that wasn't English then pigs can fly -_-
here is what im talking about https://developer.mozilla.org/en-US/docs/Web/JavaScript
if you want to find something to do with arrays check the arrays arean. theres a value called length. thatll tell you how many values the array is holding
my bot is v11
@pulsar fossil just read the new updates on http://discord.js.org/
err: coomands isnt a word
@pulsar fossil force update
@pulsar fossil then you bot is shit
wow
no not one command wtf
my bot has 60+ commands lmao
@pulsar fossil force update
@plush magnet wdym?
in 60+ files?
my bot has 60+ commands lmao
@pulsar fossil
@spare gale what are you trying to find the value of? "params"?
I can't really explain it so I recommend you read this https://stackoverflow.com/questions/1230233/how-to-find-the-sum-of-an-array-of-numbers
@split hazel
int[] myNums = { 1, 3, 6, 9 }; // Sum: 19
int sum = 0;
for(int i = 0; i < myNums.Length; i++)
sum += myNums[i];
Console.WriteLine($"The sum is: {sum}"); // The sum is: 19
Some extensions also have Array.Sum()
in 60+ files?
@pulsar fossil
@spare gale no, allthe commands are in index.js
@spare gale what are you trying to find the value of?
"params"?
'test'
in params
this is js not c#
The use a foreach.
You're just adding to an int foreach of the integers in the array
message.channel.idk(idk) return; well.uhh.idk
why is everyone trying to reinvent the wheel to find an array length. javascript literally gives you a value to tell you how many items are inside an array
return; then run code
that isnt gonna run that code
message.channel.idk(idk) return well.uhh.idk;
this is js not c#
@split hazel JS and C# are both OOP, so the general approach to the issue is the same.
js is not oop
message.channel.idk(idk) return well.uhh.idk;
@solemn leaf this isnt even a code![]()
@spare gale command contains the params value inside it. thats how you get the value
js is not oop
@earnest phoenix oops. Guess I need to fact check myself
there are libraries following oop but js isn't oop
Like TS?
bcs we have been doing it for a while
Experience and patience
ts is it's own language but still not oop since it's a superset of js
guys why u all so good at bots
@pulsar fossil Because some of us took the time to learn how to do more than Hello World in a language
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/748354042270318592
*i need to get value of variable with name test in commandhandler
in params
@spare gale
js objects are just actually dictionaries
all properties and methods have mutability
Hey guys how to install quick.db on VS Code
npm i quick.db
@spare gale I explained tyo you how to get the value
@pulsar fossil Because some of us took the time to learn how to do more than Hello World in a language
@faint prism when i started leaening i didnt even see that hello world thing i literally went to the code and typed:
bot say welcome to the server. when someone joins

(a) you dont install it on vs code but rather in your project (b) follow the install instructions on the npm page
and if youre using VSC you should set a debugger up cause that will save you time
gg guys my first ever code
when someone says :'hi':
answer with hello!
then dreact with ๐
this is what i typed 6 months ago
lol

not a real programmer if you haven't tried making minecraft plUgInS
@earnest phoenix No u
I didn't like java then, and I still don't
i dont like java either
@faint prism mine was luau
but since ik C#, I can write Java no problem

started out with it though back in 2012
i want to learn c++
eh
i want to learn c++
@pulsar fossil Don't really recommend that unless you take college computer science courses
i just don't see the appeal in java and see c# as the superior language
Same
hi I would like to introduce you to Android
My school course this year is java and Iโm not excited:(
thats why java.interop exists
Itโs teached by this guy who looks older than the internet but Iโll give him the benefit of doubt
i think c++ codes are like this
press('Z') = walk forward
press('SPACE') = jump
press('V') = boost
then>close game
Lmao
hi I would like to introduce you to Android
@plush magnet Xamarin removed the need for java there too
everytime i see codes used every fiber of my body cringes
no one uses that in mass
@earnest phoenix how do u feel when u see my codes
example
bot online => mesage send im online. go offline {6seconds late}); /}
coder
Bro my friend say need to install python in order to ran npm install quick.db

it's a native dependency
But why he do that LoL
just use couch or something
Can i install it without python?
how many times do we have to tell you
go read the instructions on the npm page
they tell you what to do step by step
it's a native dependency
it needs to be built for the platform
tfw flexing your coder skills by writing 2 apis in different languages just because some logic slightly runs faster in the other language
lmfao
me too
i wrote an electron app that communicates with c# via named pipes
because c# is way better and faster for what i'm using it for
electron is there just to give it pretty visuals ๐๏ธ ๐ ๐๏ธ
cpp coders writing 4 lines to make a code run 0.5 seconds faster
assembly coders making 4000 lines of code to make the same command 0.3 seconds faster
I AM SPEED
Have you tried the core 5 preview 8 on any projects yet?
I'm about to give it a whirl
vs doesn't even support it properly i think
^
ReferenceError: args is not defined```
I thought it was right, can someone help
define args
args is not defined
Wdym
where did you define args
if youre going to copy code at least know how code works
^
This was the only command I copied because I couldn't get my own to work
it isn't an excuse
lol
that still doesnt change what we've said lol
Read code snippet, think about it, then implement the logic yourself.
Copy/Paste = bad
Alright, my bad
So think about it
does args = something at the point you're trying to reference it in "your" code?
@earnest phoenix lets goooo
how do i or
||
i tried that
what lang
if (usermessage.includes('bad word 1' || 'bad word 2')) {
message.channel.send(${user} + ' NO BAD WORDS!!!');
}
o
You aren't comparing anything here:
|| 'bad word 2'
?
what do i compare it with
What you compared the 'bad word 1' with...? lol
but how
if (usermessage.includes('bad word 1') || x != 1 || x = 5 && true || false)
You get the idea ๐
i tested it and it works
๐
but now my bot is flooding the chat
lol
@earnest phoenix
I guess standard is just more stripped down?
Build w/ standard 2.0: Time Elapsed 00:00:02.46
Build w/ 3.1 Time Elapsed 00:00:05.34```
it detects if any message is a bad word
if (usermessage.includes('bad word 1') || ('bad word 2')) {
message.channel.send(${user} + ' NO BAD WORDS!!!');
}
what am i doing wrong
again
you can't compare 'bad word 2' with nothing
also, it might be spamming because if ('some string') evaluates to if(true) (iirc)
you have to do what you did for 'bad word 1' for 'bad word 2'
@mystic pike
No worries, common beginner mistake
But, check my example again
What you did was essentially:
if (x = 1 || 2) which isn't correct, because 2 is not being compared with anything
What you should be doing is:
if (x = 1 || x = 2)
@mystic pike Does that make sense?
for (let m = 0; m <= verifyValue.guild.members.length - 1; m++) {
const array = Object.keys(verifyValue.guild.members[m].expHistory)
//l = values, m=members
for (let l of array) {
var weekOne = verifyValue.guild.members[m].expHistory[l]
console.log(m + '/' + l)
console.log(weekOne)
}}```
how do I store weekOne as an array?
ok so the bad word filter works but people can say bad words in caps is there a way to make it stop that
without typing every bad word everyway possible
convert it to lower/uppercase
?
here's just a small tip
don't waste time on word filters
you'll never be able to achieve a good one
my bot wont leave after the ffmpeg audio is done
function play(connection, message) {
var server = servers[message.guild.id];
server.dispatcher = connection.play(ytdl(server.queue[0], { filter: "audio" }));
server.queue.shift();
server.dispatcher.on("end", function () {
if (server.queue[0]) {
play(connection, message)
}
else {
connection.disconnect();
}
})
@earnest phoenix my bot is more of a meme bot
i want to as a joke censor basically everything
That's because there's no end event
its finish
There's no finish event either.
@sudden geyser wdym
From what I see on the docs (https://discord.js.org/#/docs/main/stable/class/StreamDispatcher), there's no end or finish event. Keep in mind .play() returns a StreamDispatcher. As for how to know when the video has finished I don't know myself.
Let sse
?
finish seems to work
YEAH
The reason why finish work is because
imma test if my queue works now
So techniclly, finish exist
Np
Your queue code is bugged
Check how long the video is
And do a timer
As a safety precaution probably add 5 seconds to that timer
Least that would be my solution
Isn't the issue not knowing when to stop playing?
It is fixed
Ah
The issue is the queue code
let servers = {};
function play(connection, message) {
var server = servers[message.guild.id];
server.dispatcher = connection.play(ytdl(server.queue[0], { filter: "audio" }));
server.queue.shift();
server.dispatcher.on("finish", function () {
if (server.queue[0]) {
play(connection, message)
}
else {
connection.disconnect();
}
})
}
if (!servers[message.guild.id]) servers[message.guild.id] = {
queue: []
}
var server = servers[message.guild.id];
server.queue.push(`https://youtube.com/watch?v=${results[0].id}`);
if (!message.member.voice.connection) message.member.voice.channel.join().then(function (connection) {
message.channel.send(Embed);
play(connection, message);
})
})
this is the full code for playing
I've not worked with audio at all but is the que just a bunch of urls and/or files?
urls
Its an array of data
and server id
for (let m = 0; m <= verifyValue.guild.members.length - 1; m++) {
const array = Object.keys(verifyValue.guild.members[m].expHistory)
//l = values, m=members
for (let l of array) {
var weekOne = verifyValue.guild.members[m].expHistory[l]
console.log(m + '/' + l)
console.log(weekOne)
}}```
how do I store weekOne as an array?
you shouldnt do
[0]
Instead
Check the length
If the length is 0, then the queue is empty
Yeah the length might be zero which might cause an issue
0
ummmm
0 for empty queue
Well depends how you want the que to play out
i need help
Do you want the code to run when its not zero or when it is zero
nope
I should honestly do something with VC in discord
@solemn leaf are you using VSC? If so are you using the debugger?
?
Not to be rude, but your code is super messy
mine or?
Visual Studio Code
im using vsc
Your code aki
Are you using the debugger?
is that the red dot thing?
Yes
But you need to run it with the debugger
On the left you have a bug looking section
Click it
At the top there a gear cog with probably an orange button
If you click it you can create a node.js app launcher with the debugger which makes the red dots work
Do you see the bug icon on the far left in VSC
That is debugger icom
Yes do that
When your code runs it will stop at any red points
And you can inspect what values are being held
Probably best you search how to use VSCs debugger
Or you can use intellij webstorm, for better experence
It'll help a lot with questions like
Why isn't this if statement working
Why is this undefined
So on
Nono you launch it from the debugger section
Its best you probably just create that launch.json file to run a node.js environment starting from your bots main file
now im confused
Show me the entire debugging section on the left
imma watch
In this video we demonstrate the basics of debugging a Node.js app.
You can download VS Code at https://code.visualstudio.com
@carmine summit wdym
@earnest phoenix i would like to store weekOne as an array that I can add after
@solemn leaf just press that gear don't worry bout the video atm



