#development
1 messages · Page 1862 of 1
un true
lemme see
One person said me that I will be a good choice that I make my own slash commands lib using discord development docs
that is the best choice yes, just a lot harder to do
no it doesn't appear in DMs
If you know how then yes
it is a good choice
and in the guild where I registered it yesterday the commands break with a timeout error
Ima use tims tiny-discord lib
tim is there a discord for said lib

astro dev
its on my discord lol
Which language is it sir??
js
ads
you may take a look into the source code, he might put some malware in it
@ mods!1!!
malware that changes your message content to youtu.be/dQw
obfuscate your lib's code to include a bitcoin miner
dont u dare
unless I am getting a cut

xD
not very efficient cuz it's a js lib
try bitcoin gold
it can be mined on a potato (pc)
5% cut
obfuscate your lib's code to include a bitcoin miner
Yes and put the shared secret into the config.json or better top.json.secret
top secret
bottom secret
the js code can pack a binary, write an exe file and run it with exec :^)
lol install gminer with configurations to mine btg
or even better, put the miner as a native addon
miners are pretty hard to make
especially if you want to be storage efficient and dont wanna download the entire 196GB bitcoin blockchain
which is what bitcoin core does
it's been going on for 12 years bro
Now bot devs wont be able to complain about not being able to afford a cheap vm and heroku/that other free hosting service would be obsolete
oh btw
there is a vps that support payment via crypto
how to get free vps 101:
add miner to tiny-discord
use crypto to buy vps
host botum for FREE
Imagine the people who used btc back in the days when it was worth 1$
Homie used 14 btc on a pizza

or
someone threw away a hard drive containing 50 btc
host the bot inside the ethereum blockchain
yikes
bot crashed because too many instances
they would be a millionaire
probably
Is it still worth 50k?
smart contracts are decentralized
aka more than one instance
48 i think
it really skyrocketed during this pandemic smh
48050$
Used to only be worth like 8k before this started
now its worth almost 50k
because people want to earn money during pandemic
tim you do trading?
a bit
damn I invested in you, where's my profit, Sir?
you want 10% of my 20 bucks profit?
lmao
ill sell tim as an nft for 69k 
wut 10%?... more like 100%
lmao
imagine being an even bigger capitalist than u
get elon musk to tweet about it a few times
not another erc20 token pleaseee
lawl
erc20 too expensive
erc20 tokens have insanely high fees
bsc20 is where its at
last time i checked lotto had a fee of over 300$
I dont know a damn thing about coins
so ima step out
a token is a coin that runs on another coin's blockchain
I see
like a very expensive parasite
So does that mean someone could make a coin off of btc? (I assume such already exists)
tron used to run on ethereum before it ascended to heaven moved to it's own blockchain
btc doesn't support tokens
Ah
bitcoin cash does
btc doesnt support smart contracts
ye they are dumb af
ethereum is the biggest blockchain that supports smartypants
why
lmao
binance DeX is one (and only) of the DeFi apps that run on ethereum
i dont think theyll let eth go so easily
please ignore the fact that the creator of eth recently bought a million shiba inu tokens
lmao
and then donated it
isnt shiba dying tho
to the government
no?
government taking crypto now?
government: bans crypto
also government: did you know we support donations via crypto
ALSO also government: allows exchange apps to put the words MADE IN INDIA (crypto banned in india) on their app page
looks like dying to me
also, i tried buying shiba right before it skyrocketed
but uniswap trolled me
pump and dump?
i lost my eth and got nothing
fek uniswap
why would you use swap instead of trade
the minimum swap amounts are worth more than my soul
because it was not tradable anywhere
wat
it was right before it skyrocketed
it does have exchanges
it wasnt on any exchange
they removed the coin from exchanges to prevent people getting trolled?
oh
swapping was the only way to get it
If your PiHole is blocking that site, u know it's just scam
Well fuck this shit, internet gave up again
God damn mother fucking shithole country
excuse me
And there we go, I'm back, god bless USB tethering
lmfao
If the router would be a little more intelligent it wouldn't take like 30 mins to switch over
Damn dude summoned an inner cussing demon
STILL OK
Yeah because the IP was, GUESS, still ok (after reiniting the connection)
Thankfully the servers are continuesly resolving the DNS name and update the firewall each minute if my IP changes or I would be fucked
But you’re locked out each time for max 1 minute the router decides to reconnect via. USB tethering just because the cable initialization didn’t work once again
Just trash
Anything is trash, even trash is trash
is it enabled in the code also?
Its v12 with node v16.7.0
hi, I installed the most recent download of node and still cant get my bot online. I'm getting this error "SyntaxError: unexpected token '?'"
full error
What does “node -v” say
if you did npm i node you have to run node using npx node
maybe I should try that
how did you install it? that error means whatever you installed is not actually the latest version
16.8.0
show your code
tim the msi package says later version of node is installed
how do i delete later version data
its nothing rn other than i ping pong
can you show the full error?
(i tried to install v16 with zip)
wut
it doesnt let you install?
because i extracted v16 to nodejs folder in program files
windows hates me
there is an nvm for windows
too many install steps
well you can download node as a zip
and run it directly from the folder
without installing
^
SyntaxError: Unexpected token '?'`
yes
but that code is not on your pc
im using repl
what you install in your computer has nothing to do with repl
what have i done wrong?
replit is a hosting service, its not inside your computer
what you install in your computer has nothing to do with replit, replit cannot see it
you have to update node inside repl.it, not in your pc
how do i do that?
try
npm i node@v16
in your .replit file:
run="npx node yourfile
this is what i do
however there are currently 3 ways of doing it unofficially
code's way is one of them
imma try and see if it works on my pc
the other two ways involve using a non-node repl
like a NIX or a BASH repl, i have examples for them if you want to give them a try
perhaps install it as a package?
im just looking at the modlog and bruh, all bots are getting declined
Because the approval channel is hidden
#logs is hidden because someone pinged bot developer role there
can someone help, im trying to do something, i have code stored as a const so i can send it later but a part of the code is : let pull = require(\`\${__dirname.replace("\handlers", "\events")}/\${file}\`); as the \ infront of the \events and \handlers make it so that the e and the h dont show aswell as not showing the \ infront of them both.
wut
what happened? lmao
how do i play music in stage channel
\ is an escape character
use either / or \\
but \ dosent make the \ infront appear
wdym
nvm, i was dumb, got it to work now, Thanks!
the character \ is a special character that makes the next character be interpreted literally
so to write an actual \ in text, you need to use \\ to basically make itself be interpreted literally
What I get when logging the channel, which was created:
<ref *2> TextChannel {
type: 'GUILD_TEXT',
deleted: false,
guild: <ref *1> Guild {
id: '860186681084870686',
name: 'Loggy testing',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
. . .
sendChannel.send(channel.type.toString())
Cannot read property 'toString' of undefined
Why cant he get .type of channel?
show more code
Someone called &&&&& had their bot name as <@&bot developer role id> and since they're using webhooks it actually pinged the role in logs
lmfao
i wish i saw that
That's really clever and mean at the same time
the lengths people go to find exploits and weaknesses is amazing
xDDDD
Although a quick fix would be adding `` to both ends of the bot name
Big brain
A quick fix would be to set allowed_mentions to only ping users
Or literally no one at all
do you get the dev role if a bot you made is approved?
Correct
k
Yeah damn funny they don’t even serialize the names
Would probably be damn hard to put it into a code block
Undoable
What would be the best way to integrate premium features for a discord bot using patreon?
Would the best way to be making a request to the API every couple of minutes?
Or using the patreon bot to give user their premium roles, and then giving them premium after detecting that member update?
Doesn't Patreon have a feature where it sends HTTP requests to your webserver when someone donates
I believe so, but doesn't accept IP's instead of domains lmao
Assuming that would be the best route?
Well then use a dynamic dns name if you haven’t a static IP
Even more easier if you have a static one
@shadow frigate
okay
In the Channel create event can you access the parent name, too?
When I log the channel there is only the property parentID:
let parentId = channel.parentId;
channel.parent is a getter
so it doesnt show up if you log the channel
but it does exist
the bot is already using v13. Am i using outdated message event commands or something like that?
Outdated nodejs version
how do i update node.js
There’s a few methods to update nodejs in replit, however I know how to do a whopping none of them
dang
This
still nothin'
how would one go about making a javascript youtube downloader?
i just want to download the audio
ytdl is probably the best option for that
Careful though, YouTube might get mad at you
sad groovy sounds
😔
is there a way to clone a repl
yes
how
if its someone else's repl, open the repl and click fork
what if it's my own
if its your own go to https://replit.com/repls
and click on the repl's options and click fork
or just click your repl's name and open the three dots menu
Hey! I finished my first project in CSP, anyone got any feedback for me?
This simple password generator was created for an AP Computer Science Principles assignment as our first ever project. Ever. 😉
good for a first project
seems like it takes a phrase and replaces letters with lookalikes?
issue with that is many password crackers will test that way
add a button to generate it without reloading the page
however since its so long it won't matter
also, the assignment says the password should be different for each website, although it techincally is, there doesnt seem to be any specific thing to differentiate between websites
for the assignment you'll probably do well but in real life application, you wouldn't want a password generator that explains exactly what it does
thats not really an issue since there is nothing an attacker could gain from that knowledge
besides a slightly narrower list of possibilities
well an attacker would know that a dictionary attack would need every first letter caps and those letters replaced with numbers
its true that this generator severely lacks randomness
the only random element is the random words
everything else is fixed transformation
I wish I was doing programming like this in my CSP class
CSP as in Computer Science Principals?
whats the perms to send embeds in a discord bot?
EMBED_LINKS
thx!
So im using mongoose
but its not adding fields
const user = await client.schema.findOneAndUpdate({ User:message.author.id }, { $set: {Tiks: 500} })
user.update(
{ Biks: 500},
)
await user.save()
message.reply(`Done`)
when i run the command
why are you setting it to the same value twice?
you need node 16
If I have an array of numbers:
number[0]: 1200
number[1]: 1253
number[2]: 985
number[3]: 1020
How would I arrange the array descending like this:
number[1]: 1253
number[0]: 1200
number[3]: 1020
number[2]: 985
js?
Yeah JS
I looked it up on Google and according to w3schools using .sort will sort based on the first number. So it’ll be:
985
1253
1200
1020
I think
sort takes a function, you can sort any way you want
arr.sort((a, b) => return a - b); will sort them forward, so b - a sorts decending
Oh I see. Alr thx
for nodejs node-gyp, what vs version are you all using? 2017 doesn't seem to want to install zlib-sync no matter how many times I repair or fresh install it or node and everything related to node
My computer books have had QBasic for 4 years and we never did it
I'll be in trouble if we have to learn it now because I'm not used to UPPER_CASE
def is_empty(l):
F = "F"; A = "a"; L = "l"; S = "s"; E = "e";
if isinstance(l, list):
if len(l) >= 1 and list.__len__(l) > 0:
for _ in list(l):
if _ in list(l):
return bool(l)
else:
return l.__bool__()
else:
return bool(l)
else:
return True if bool(l) else False
else:
return False if bool(l).__str__() == "".join(eval("""''.join([F, A, L, S, E])""")) else True
@earnest phoenix
What is the difference between using len() and list.__len__()?
Same thing
Prettiness
python prototype based programming poggers
That's what she said
python has always confused me with its __blah__ shit
Dunders ftw
I would probably understand it if I looked it up
but I couldn't be bothered lawl
Yeah skill issue
node-gyp continues to confuse the fuck out of me
MSBuild command exited with code 1
that's great and all, but what's the issue
Code 1
dont you need windows build tools for that stuff
newer versions of node come with chocolatey which installs python and vs
wbt is pretty much deprecated unless using a legacy version of node
somehow my msbuild_path npm var got changed to =

why is it not responding when i type "start" in terminal
code:
const {EventEmitter} = require("events")
const event = new EventEmitter()
// 0 1 2
// 3 4 5
// 6 7 8
let started = false
const structure = [0,1,2,3,4,5,6,7,8]
const wins = [
[0,1,2],
[3,4,5],
[6,7,8],
[0,3,6],
[1,4,7],
[2,5,8]
[0,4,8],
[2,4,6]
]
const combination = {
p1: [],
p2: []
}
let player = "p1"
function loadStructure(){
let res = ""
let n = 0
for (const i of structure) {
if (typeof i === "number") {
if (n===3) {
n=0
res+=`\n${i} `
} else {
res+=`${i} `
}
} else if (typeof i === "object") {
if (n===3) {
n=0
res+=`\n${i.p}`
} else {
res+=`${i} `
}
}
n++
}
return res
}
//cnsole.log(logStructure())
function checkWin(){
let winner = ""
const strP1 = combination.p1.join("")
const strP2 = combination.p2.join("")
for (const w of wins) {
if (strP1.includes(w[0]) && strP1.includes(w[1]) && strP1.includes(w[2])) {
winner=true
} else if (strP2.includes(w[0]) && strP2.includes(w[1]) && strP2.includes(w[2])) {
winner=false
}
}
return winner
}
function useSlot(index){
if (!structure[index]) return false
if (typeof structure === "object") return false
if (player==="p1") {
player="p2"
structure[index] = {
p: "•"
}
combinations.p1.push(index)
} else {
player="p1"
structure[index] = {
p: "×"
}
combinations.p2.push(index)
}
}
function end(r) {
console.log(r)
process.exit()
}
console.log(`Please enter "start" if you want to start a game!`)
event.on("input",(str)=>{
//console.log(str.toLowerCase())
if (str==="start"&&started===false) {
started=true
console.log("a")
console.log(loadStructure())
}
if (started===false) return
const used = useSlot(Number(str))
if (used===false) end(`There was an error when using a slot!`)
const winner = checkWin()
if (winner==="") {
//Nobody wins
console.log(loadStructure)
} else if (winner===true) {
end(`Player One wins!`)
} else if (winner===false) {
end(`Player Two wins!`)
}
})
process.stdin.on("data", input=>{
event.emit("input",input.toString())
})
pretty sure the input includes \r\n
you might want to log the str
it just logs "start"?
console.log(str === "start")
ah
ic the prob
i wonder why theres an extra "\n"
guess ill just check if its startswith
it works now
thx!

Check where the error came from
you would go to the path it specifies which is the play.js file and go to line 88 column 22 where a .on will appear
something.on where something is null
replace something with whatever is there
what do i replace queue.connection with?
Why it turns a promise
And first time it said message content is empty
If x.size = 5
How it is empty?
It needed to be a string
x.size was a number, I believe
Discord.js v13 (I assume you're using that version) requires strings as parameter
x.size + " K" yields a string which is why it could send successfully
You could also do x.size.toString() or `${x.size}`
I believe that's what the migrating docs said
You should read https://discordjs.guide/additional-info/changes-in-v13.html fully first
guys
I need to do something like this
I am using Canvacord
user inputs the command
if it's in the list then I want it to get the image from canvacord
problem is there are over 20 options and I cant use if else for ever one of them
Can I do something like canvacord.${input}
because it doesn't seem to work
like this
From the colour of the variable you're probably not referencing it anywhere
I am not
because I re defined it after testing it
it never worked in the first place
And to use the dot notation for objects without a definite value you just do canvas[method]
oh that's a thing?
You probably don't want to make that a string too
otherwise it won't execute as code
symbol moment
canvas[method](img1)
Yes
thanks
And please be careful with it
sure
I want to have routes like this in my nextjs app:
/servers - Displays the guilds you are in
/servers/[id] - See info for that guild
/servers/[id]/config - Edit info for that guild
How would I do that?
[[...slug]] catches everything after [id]
and folder names don't work so how would i do the config page
already read that
Then it should of worked. How are you doing it?
Yea.
wait i read the wrong docs

lmao
did you read nuxt docs?
kekw
does [stuff] work on folder names
I am not too sure tbh
because then I can do this:
pages
/servers.js
/servers
/[id].js
/[id]
/config.js
I haven't tried what you are doing I just know docs exist for it
Most likely yea
imma try it and see
It would make sense for it to exist
How else would you make routes for users?
cause then you'd be able to do https://domain.com/userID/config
they say discord docs are the worst
Maybe because it is
I get Invalid CSRF error when I want to add my bot to https://top.gg/bot/new :/
any java developer who worked with github api from kohsuke
very specific
you should just ask your question
there probably isn't an exact person that did that
Hi, slash cmds worked fine until I re-invited my bot to the guild. Now the cmd is no longer available. Here is the code (using Discord.js) and the API doesn't repond with an error:
export async function registerSlashCommands() {
const rest = new REST({ version: '9' }).setToken(config.bot.token)
const res = await rest.put(
Routes.applicationCommands(client.user.id),
{
body: [
new SlashCommandBuilder()
.setName('test')
.setDescription('just a test'),
]
},
)
console.log(res)
}
->
[
{
id: '882200863689568277',
application_id: '415565607434453025',
name: 'test',
description: 'just a test',
version: '882233625825906708',
default_permission: true,
type: 1
}
]
Did I missed something, a permission ?
maybe you didnt re invite your bot with the application.commands scope?
mmh I don't really understand what scopes are so maybe that it
How can I add the scope?
can anyone help me with c#
Select application.commands while u create the invite link in discord developer portal
thanks a lot!
can anyone help me about c#
Ask your question, and someone who knows c# might help you
 **Online:** ${members.filter(member => member.presence.status === 'online').size}
^
TypeError: Cannot read property 'status' of null
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WebClient wb = new WebClient();
string VersionOf = wb.DownloadString("https://raw.githubusercontent.com/thisisholydeveloper/versionlxyon/main/version.txt?token=###");
if (Application.ProductVersion == VersionOf){
MessageBox.Show("A newer version is avaiable", MessageBoxButtons.OK);
}
}
i have a file on github and ill update it to latest version
and if application product version is not same at the github it wont work
do you have presence intent turned on
both on your code and dev portal
GUILD_PRESENCES ?
i guess
I have it
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WebClient wb = new WebClient();
string VersionOf = wb.DownloadString("https://raw.githubusercontent.com/thisisholydeveloper/versionlxyon/main/version.txt?token=###");
if (Application.ProductVersion == VersionOf){
MessageBox.Show("A newer version is avaiable", MessageBoxButtons.OK);
}
}
i have a file on github and ill update it to latest version
and if application product version is not same at the github it wont work
can you not spam
afk
what is members ?
const members = message.guild.members.cache;
Hmm
member?.presence?.status
kk
short answer: to not get errors
long answer: obj?.hey checks if the hey property exist if not it returns the parent of that property(obj)
Oh but i am trying to find all server members status
wait
 **Online:** ${members.filter(member => member?.presence?.status === 'online').size}
 **Offline:** ${members.filter(member => member?.presence?.status === 'offline').size}
 **Idle:** ${members.filter(member => member?.presence?.status === 'idle').size}
That what i am trying to do
ok so from what I understand slash cmds are for applications not bots. So, if you want both, you need to invite the bot (scope=bot) and the application (scope=application.commands). Am I right or is their a mean to invite a bot with slash cmds ?
u do t have to use ?. all the time
only use it if u feel like it could or couldn't exist in the object
It's both, for applications and for bots
You can invite an application to a server with just the applications.commands scope, but it can only respond to interactions
then why it doesn't work when I invite the bot with scope=bot ?
You need the bot scope to obtain guild information
You also need applications.commands scope for slash commands
ok but it will work ?
if the docs says it returns something like ?idk then u should use the null operator??
what does the ?. called again?
optional chaining operator
ah ok
I am using discord.js-pagination package
const curPage = await msg.channel.send(pages[page].setFooter(`Page ${page + 1} / ${pages.length}`));
^
TypeError: Cannot read property 'setFooter' of undefined
pagination(message, pages, emoji, timeout)
}
}
what's pages and what's page
Pages are
const pages = {
embeds: [embed1, embed2]
}
try pages.embeds[page]
const curPage = await msg.channel.send(pages[page].setFooter(Page ${page + 1} / ${pages.length}));
this line not in my code
soo is pagination(message, pages, emoji, timeout) your code?
try pagination(message, pages.embeds, emoji, timeout);
ok
I think the pages parameter requires an array and not a object
DiscordAPIError: Cannot send an empty message
i think that package doesn't support v13
Maybe embeds: [pages] ?
How can I invite a bot that can add slash cmds? Should I specify 2 scopes (bot and applications.commands) in the URL?
I think
Yes
how do I get a specific role from a server in djs?
it's showing the error cannot read the property of roles of undefined
client.guilds.cache.get('guild id').roles.cache.get('role id');
is guild id an actual id?
yes
if so thats the problem
sorry but I can't find anything in the doc. If I use scope=bot&scope=applications.commands only applications.commands is retained and if I use scope=applications.commands&scope=bot only bot is retained
it may not be in the bot's cache
also how do i check if my bot is invited with application.commands scope?
@subtle kiln someone already sent you the format
log the guild
roles are always cached
ok
guilds are always cached as well iirc
Ha yes I didn't paid attention to the full URL, thanks!
so it could be it isn't a valid guild id
show the actual code instead of putting "guild id"
so its not getting an actual guild
?
Also I am sure you can generate URLs inside the dev portal itself which is an easier method
as of rn I dont think you can.

Best you can do is make sure you provide the scope in the invite url when giving it to top.gg
ehh ill just screw text commands
or whatever
Dpy
I'm using https://discordapi.com/permissions.html
A small calculator that generates Discord OAuth invite links
the guild is coming as undefined
nvm just realized slash commands r not finished
even if the bot is in the guild
r u sure its the correct bot
yes
correct guild id?
Why gives undefined ?
 **Verification Level:** ${verificationLevels[message.guild.verificationLevel]}
if so idk whats happening
@near grotto What exactly are you doing again?
yes
wait does it matters if its in an event?
I am trying to check the if the author has a role in the bot's official server to use the dev cmds of the bot
replit
Just use discord dev portal, way easier
no
like messageCreate or something
ahh wait
If so you can just use message to get the guilds roles
instead of getting from cache
Well that will do it
Yes that way less confusing, I'll check that
I would suggest hard coding the users who can use dev commands (the bot's devs) IDs into the bot and to check if the author ID matches the hardcoded IDs. Its more secure this way
ok
${verificationLevels[message.guild.verificationLevel]}
Gives Undefined
Missing intents ?
What is verificationLevels
const verificationLevels = {
NONE: ' None',
LOW: 'Low',
MEDIUM: 'Medium',
HIGH: 'High',
VERY_HIGHT: 'Very High'
}
VERY_HIGHT
That could have returned undefined if the server u checked had a very high level
I got trolled by Discord
Been debugging my code for 17 hours only to realize my code was fine and discord blocked me for too many guild command register requests
more of a math question this time but
lets say I have an array of objects an each object has 2 properties which are each numbers
kinda like
[{ damageToSelf: 5, damageToEnemy: 4 }]
fuck
how would I find the element that gives myself the lowest damage
math this early in the morning
and the enemy the most
I just need to get the element in the array that has the lowest damageToSelf and highest damageToEnemy
javascript btw
cant you just use reduce on the both damages and sort the array so the object that deals the least amount of damage to yourself and the most to the enemy is at the front?
I can't remember how reduce works
also its not like I want to find the highest value of a single property in an array
its with 2 properties
one with highest and lowest
${message.guild.fetchOwner.user.tag}
Not working
${message.guild.owner.user.tag}
too
can you please provide errors and do you actually read them?
TypeError: Cannot read property 'tag' of undefined
ok
too many tests
I should've just reloaded my command's run function instead of reuploading the entire shit
Then ?
do I really need to explain that
Can't you auto complete the last step in ur brain
Tbh u need to stick to one, or find a way to average it
For example lets say u have an array like this
const arr = [
{ damageToSelf: 1, damageToEnemy: 6 },
{ damageToSelf: 4, damageToEnemy: 11 },
{ damageToSelf: 2, damageToEnemy: 9},
]
```In this, as per your need the lowest `damageToSelf` is 1 i.e `arr[0]`. But also as per your request highest `damageToEnemy` is 11 i.e `arr[1]`
So if you need with both the requirements it would need to return 2 values from the array

(lowestdamage + highest damage) / 2
basically I just need the element in the array where both properties have like the highest distance
lol
find using that
const owner = guild.fetchOwner()
${message.guild.owner.user.tag}
TypeError: Cannot read property 'user' of undefined
Like the difference between damageToSelf and damageToEnemy is highest?
yes
How is the event called when someone leaves and joins the voice chat?
It cant be voiceStateUpdate because I already tested that
v13
but the difference is positive in my direction
ofc
that I get less damage
than the opponent
guild.fetchOwner is a promise
A promise will ALWAYS resolve after the next line of code
await the promise
ok
element were both have the highest distance but so damageToSelf isn't higher or equal to damageToEnemy
yo your about me says you're learning python
try it and see
Idk
not working
if it errors read it and try and solve your issue before coming here. Learning to read errors is vital
absoluteValueOfNumber(lowestDmg - highDmg) ?
How is the event called when someone leaves and joins the voice chat?
It cant be voiceStateUpdate because I already tested that
v13
your message has been gracefully ignored by the bot dev community
Yea it sucks
but
ok
if people neglect to try and solve their issues first
wait I might have a solution to my own problem now
people will slowly stop helping i feel
You’re speaking to djs users here misty you should know better than to try to give good advice 
or maybe I don't
rude but good
But jokes aside learning error messages is important
Learning errors
I’d say js gives pretty readable errors
Like Error, TypeError, etc?
Yeah
combined with console.trace === debugging go brrrr
Learning where to find errors in your code when it throws
What's good about detritus
detritus sorta sucks at that
detritus just sucks in general rn
I’m pretty new to C++ and I can tell you that it spits out dogshit errors that are unreadable (for at least me, probably because of my experience level)
that sounds like javascript sucking
the fact you gotta do some wacky ass shit to even override types
it's a discord lib that's why
Cakedan was one of the few who survived reading the discord docs
Erwin honors detritus for that
and the fact you gotta do wacky ass shit to extend one of their classes
like Guild
umm
discordjs doesn't support extension anymore for the same reasons
so what's your point
Do you think I use discord.js?
That structures kind of extending is bad practice
console.log(`${client.user.tag} has logged in.`);
client.user.setActivity(`${client.projectsSize} Project(s) | Made By ZeroNaruto`, {
type: "WATCHING",
});
};
i use node java
lawl
wot
java is eh
java's nice
Java is nice
I prefer kotlin over java
C# is improved Java
yucko
combine java + scheme + brainfuck
a new language is born
Lmfao
Honestly been getting into Java recently cus that’s what we’re taught in our CS classes at school
Even though I’d rather learn more C# or C++
if I was taught java in CS I would cry
Why would I learn java there if I can just learn it from traversy media

no one knows c#??
Honestly I don’t like my CS class
what's special about c# anyway
The teacher told us we can’t use anything we haven’t learned in her class
So I’m stuck out here writing like 30 println statements so that she can introduce us to loops
Y'all think you suffer
My computer books have had QBasic for 4 years but we never learnt it and I heard in the next year they're going to teach us that, from the ADVANCED BOOKS
Lawl
what lawl
I should’ve skipped AP CS and gone to CS3 tbh
Ask her to do fizz buzz
honestly programming should be taught in a multi-language way
What's CS3?
There’s no prerequisites
Computer science 3
Computer science 3
${message.guild.ownerId}
Working but
${message.guild.owner.user.tag}
TypeError: Cannot read property 'tag' of undefined
since all languages share the same principles, and the principle is way more important than the syntax of X lang
guild has no property owner
Only ownerId
ok
If you need the member object, use <Guild>.fetchOwner()
I need help
command name is invalid
TypeError: Cannot read property 'user' of undefined
🤦
I told you that guild doesn’t have a property of owner
How can I fix?
give it a valid command name?
https://discord.js.org/#/docs/main/stable/class/Guild @pallid jungle
How
7 line fizzbuzz:
const fizzer = { 3: "Fizz", 5: "Buzz" };
const numbers = Array(100).fill(0).map((_, i) => i + 1).map(n => {
let new = "";
Object.keys(fizzer).forEach(f => f % n === 0 ? new += fizzer[f] : null);
return new || n;
});
console.log(numbers);
wdym how?
Ew forEach
k
That just looks bad
and unreadable
Also you forgot 15
smh
isn't that what you do in an interview?
make your code unreadable so your co workers can't complain about it
I didn't
lmao
It automatically combines it with the new variable
what is fizzbuzz supposed to do again?
wait
Some stupid shit
like print fizz or buzz instead of the number whenever it matches the modulo?
1 2 Fizz 4 Buzz Fizz
If n % 3 and has no remainder it will print fizz and same with 5 it will print buzz and same with 15 it prints fizzbuzz the rest of the numbers print as normal
When multiple of 3 type freeze
When multiple of 5 type breeze
idek if the code works
lemme try it and see
kids this is why you always keep an ide on your phone
How is the event called when someone leaves and joins the voice chat?
It cant be voiceStateUpdate because I already tested that
v13
var Discord = require('discord.js');
module.exports = {
name: 'voiceStateUpdate',
async execute(oldMember, newMember, logChannel) {
console.log(oldMember)
console.log(newMember)
}
}
doesnt react to there
var 
how will I do?
for i = 0; i < 100; i++ {
if i % 15 == 0 {
fmt.Println("FizzBuzz")
} else if i % 3 == 0 {
fmt.Println("Fizz")
} else if i % 5 == 0 {
fmt.Println("Buzz")
} else {
fmt.Println(i)
}
}
That is exactly what voiceStateUpdate does
rejected
but it doesnt work
the event doesnt exist for me
Any errors?
My god i cannot save my code because of Android's state of the art file opener
Saying it doesn't work is useless to us
no. This event just doesnt get triggered
Array(100).fill().map((_,i) => !(i % 3) ? !(i % 5) ? "fizzbuzz" : "fizz" : !(i % 5) ? "buzz" : i);
Ah yes
The one liner legend
I just don't like how that looks at all
Now make it work for bizz when it's a multiple of 7
Í have an event handler and all event are working fine. The handler isnt the problem
for my code you just need to add one key to the fizzer object
like in addition to the 3 and 5?

or replacing one
In addition
and name it what?
number: "bizz"
Do u have the GUILD_VOICE_STATES intent enabled on your client?
nope
look at me saying my code is epic even though i haven't tested it

xD
so now you can have triple matches, like fizzbuzzbizz?
Yes
i see
Only use a prime number for the keys though
nvm use anything
i forgor you are supposed to actually allow multiple output
does the code actually work though
How can I check in this event: voiceStateUpdateif someone leaves or someone joins?
@signal estuary try putting some console.logs in your event handler
I did:
var Discord = require('discord.js');
module.exports = {
name: 'voiceStateUpdate',
async execute(oldMember, newMember, logChannel) {
console.log(oldMember)
console.log(newMember)
}
}
but how do I get if someone leavs or someone joins. I mean there is both in one event
and how are you registering the event
this isnt important I guess
Check if the parameter you are looking for is changed between the two objects, i.e oldMember and newMember
like this? ```js
keys = { 3: "fizz", 5: "buzz", 7: "bizz" };
Array(100).fill().map((_,i) => Object.keys(keys).filter(x => !(i % x)).map(x => keys[x]).join("") || i);
oh my god
that's amazing
Also i dont think it returns a member object
i really dont wanna know how thats gonna work
that works
yes
Questioning tim's code is questioning reality
I mean it sorta makes sense
i mean its pretty basic lol
Lmfao
@drowsy crag
@ancient oar @drowsy crag
look at me pinging the offender instead of replying to their message
Lol
@ancient oar no ads pls
But toooooooooooo much operators and symbols for my eyes
Sorry I was just making my bot ad
So,
Sorry
@quartz kindle explain it please
lmao
Well Tom Scott's improved version has an if statement for every single word
Lol
Can you test my version to see if it works
I can't cuz im on mobile
#development message
is tim typing another brainfuck
and how? Still dont get it
on every index, you list the keys from the object, filter them by whether they pass the modulo check, then remap them to their values, aka the words, then join the words together and return the joined word, or the number if the joined word results in an empty string
imagine join when you can concatenate a string
doesnt like the fact you use new as a variable name
who cares
¯\_(ツ)_/¯
well
node does
lawl

if(oldMember.channelId !== newMember.channelId) {
console.log('Member joined / left / moved to a new channel')
}
Refer https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-voiceStateUpdate and https://discord.js.org/#/docs/main/stable/class/VoiceState for more properties
heres a reduce version ```js
keys = { 3: "fizz", 5: "buzz", 7: "bizz" };
Array(100).fill().map((_,i) => Object.entries(keys).reduce((a,b) => !(i % b[0]) ? a + b[1] : a, "") || i);
js doesn’t even know what’s happening anymore, it just accepts its fate
try and do this exact thing but in go

class go {}
put code in constructor
go doesn't got classes
go away
no u
2 characters smaller
keys = { 3: "fizz", 5: "buzz", 7: "bizz" };
Array(100).fill().map((_,i) => Object.entries(keys).reduce((a,[x,y]) => !(i % x) ? a + y : a, "") || i);
you are putting too much time into this
what work do we have to do
making use of free time by brainfuck
Do the fibonacci sequence
Array(100).fill().map((_,i) => Object.entries(keys).reduce((a,[x,y]) => i % x ? a : a + y, "") || i);
inverted the ternary, so no need for extra parenthsis anymore
It is where the two numbers before equate to the number after
last number + current number = next number
0 1 1 2 3 5 8 13 21 etc
make pascal's triangle
I dare you
kekw
Ima try and do the fib sequence rn
hol up
Just to let you know pascal's triangle extends infinetely in ALL directions
so it's a pascal's square
can I access in the voiceStateUpdate the user / member object so I can use
.avatarUrl()
var Discord = require('discord.js');
module.exports = {
name: 'voiceStateUpdate',
async execute(oldMember, newMember) {
}
}
oldMember.avatarURL is not a function
oldMember is a member
avatarURL is for user objects
try oldMember.user.avatarURL
TypeError: Cannot read property 'url' of undefined
at play (/home/runner/Discordjs-MusicBot-1/commands/p.js:121:39)
at StreamDispatcher.<anonymous> (/home/runner/Discordjs-MusicBot-1/commands/p.js:134:11)
at StreamDispatcher.emit (events.js:326:22)
at finishMaybe (_stream_writable.js:639:14)
at _stream_writable.js:616:5
can some one help me with this error
You need to give us some code so we can help you
async function play(track) {
try {
const data = message.client.queue.get(message.guild.id);
if (!track) {
setTimeout(() => {
data.channel.send("Queue is empty, Leaving voice channel");
message.guild.me.voice.channel.leave();
return deletequeue(message.guild.id);
}, 900000)
}
data.connection.on("disconnect", () => deletequeue(message.guild.id));
const source = await ytdl(track.url, {
filter: "audioonly",
quality: "highestaudio",
highWaterMark: 1 << 25,
opusEncoded: true,
});
const player = data.connection
.play(source, { type: "opus" })
.on("finish", () => {
var removed = data.queue.shift();
if(data.loop == true){
data.queue.push(removed)
}
play(data.queue[0]);
});
What is on line 121
Send in code blocks
[0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 194 196 198]
So I did it completely wrong
@earnest phoenix lol even number generator
Yea
I fucked up
voiceStateUpdate emits VoiceState object and not member / user object
const source = await ytdl(track.url, {
filter: "audioonly",
quality: "highestaudio",
highWaterMark: 1 << 25,
opusEncoded: true,
});
the first line
func main() {
var lastNum int;
var nums []int
for i := 0; i < 100; i++ {
lastNum = i
nums = append(nums, lastNum+i)
}
fmt.Println(nums)
}
Now that I think about it this ofc wouldn't work
whats the track
Track is undefined
console log track
I had brain fart
It doesn't exist
I got it to work
I wonder how you would do the fib sequence

🤔
Whats a fib sequence btw?
reason for this error ?
this
last number + current number = next number
Ahh one sec
Current number is probably 2
Array(100).fill().reduce((a,_,i) => (a[i] = (a[i-2] || 1) + (a[i-1] || 1)) && a, []);
it just specified that last num + curr num = next num
yep thats it
I just stopped it till that, otherwise it can just go indefinitely
F
package main
import (
"fmt"
)
func main() {
var nums []int
for i := 0; i < 100; i++ {
nums = append(nums, FibonacciRecursion(i))
}
fmt.Println(nums)
}
func FibonacciRecursion(n int) int {
if n <= 1 {
return n
}
return FibonacciRecursion(n-1) + FibonacciRecursion(n-2)
}
This supposedly works
but I didn't do it myself

Jeez
jeez nuts
Ah shoot I got school soon
ffs
Array(10).fill(0).reduce((acc, cum) => Array.isArray(acc) ? [ ...acc, acc[acc.length - 1] + acc[acc.length - 2]] : [0, 1, 1]);
@quartz kindle does this work
yeah it does
nice


