#development
1 messages Β· Page 1552 of 1
use wordpad mostly bcs you have no money
teaching programming on paper is ridiculous yet it's the reality
I can't believe some schools actually do that
like huh? Why? When would you ever need to?
Help, I need to minimize my code. Its a big mess on one of the commands
or be like the teacher in Africa who teached MS word on a Chalkboard
let's compile the cellulose
We were allowed to use google for programming exams
What lang?
so 90% of the class where browsing Stackoverflow?
let's be honest, everyone presses images of buttons printed on tests
just for the sake of the pun
I guess so, yeah. Some students who failed asked me to post solutions on GitHub so that they could pretend to be googling
But I think the teacher overheard them cuz he said that we can't use sources posted by other students xd
what schools mostly get wrong is that programming is not about knowing how to write code, but knowing WHAT the code is doing
like, programmers are just professional browsers
But my damn fortune account it has black knight
I am sexually identified as chromium
They seem to think it's like teaching any other spoken language. Like, if you can't write it from memory, you're not fluent in it
if I was supposed to know how to write from memory I'd be called intellisense bruh
One message removed from a suspended account.
One message removed from a suspended account.
Imagine working as a developer, but if you use google you're fired
Using Google on a Google interview
duck duck go
hao123
bing
uol
what about my former college that blocked most sites, including ubuntu's?
once we were learning about ubuntu and our teacher had to undergo a ton of bureaucracy to unlock ubuntu site
Well, my high school had an E-sports section. The thing is, whenever they rebooted the network, every single online video game got blocked and they had to call the network admin.
And they had blocked the feature to change the wallpaper on our laptops
was the reason people setting nsfw wallpapers?
You'd assume that kids above the age of 15 wouldn't do such things but, there's people for everything
so I guess, yeah
once a dude cancelled one of my classmates' windows 7 shutdown, and put this site in full screen https://geekprank.com/win7-update/
he waited a long time for it to finish
ended up taking the laptop home while still on
some minutes later he cursed everyone on the wpp group
any guides on how to make voting rewards?
Damn, that's evil
webhooks are a must
then choose something nice to give to your voters
huh
how would i go about getting a message like, you are the 5th member
is anyone fluent with react.js?
don't ask to ask, just ask
LMAO
I am using pm2. When I start bot with pm2 too many cmds are appearing
so how do i set up webhooks?
im looking at my bot's page on topgg that has the Token and Webhook information
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.TOPGG_TOKEN, { webhookPort: 5000, webhookAuth: 'webhookAuth' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
was the code in the API help on top.gg, what do i have to replace?
the token, port and auth
help please
Error: let modlog = client.channels.find(gg => gg.name === "log");
^
TypeError: client.channels.find is not a function
Code
client.on("message", message => {
if (!prefixes[message.guild.id])
prefixes[message.guild.id] = {
prefix: process.env.PREFIX
};
var prefix = prefixes[message.guild.id].prefix; //
if (message.content === prefix + 'unmute') {
if(!message.channel.guild) return;
if (message.author.bot) return;
if (!message.member.hasPermission("MUTE_MEMBERS")) //
return message.channel.send(`** > Sorry But You Dont Have Perm => \`\`\MUTE_MEMBERS\`\`**`);
if(!message.guild.member(client.user).hasPermission('MANAGE_ROLES')){
return message.channel.send(`** > Sorry But I dont Have Perm => \`\`\MANAGE_ROLES\`\`**`); }
let user = message.mentions.users.first();
let lol = message.author; //
let modlog = client.channels.find(gg => gg.name === "log");
let muteRole = client.guilds
.get(message.guild.id)
.roles.find(gg => gg.name === "Muted");
if (!muteRole)
return message.channel.send(`** > I Cant Find Muted Role - β **`);
if (message.mentions.users.size < 1)
return message.channel.send(`** > Please Try ${prefix}unmute \`\`<@user>\`\`**`);
if (!message.guild.member(user).roles.has(muteRole.id))
return message.channel.send(`** > This Member isnt Muted - π€**`); //
if (message.guild.member(user).removeRole(muteRole.id)) {
let e = new Discord.RichEmbed()
.setAuthor("TayFeatures") //
.addField('** > UnMuted Member Name :**',`${user}`)
.addField('** > By :**',`${lol}`)
message.channel.send(e) //
}
}
});
help please
Error: let modlog = client.channels.find(gg => gg.name === "log");
^
TypeError: client.channels.find is not a function
Code
Damn you again?

can someone tell me how to define args right?
var args = msg.content.split(' ');
Thats my current arg definition. But the problem is, when you have 2 spaces, he thinks its 2arguments. but i want an arg when the next word startes like +mute [args1] [arg2].
@lyric mountain do you by chance now how to calculate overall member permissions
you need to extract the flags
Ping me if you have a solution
but what do you mean by "overall member permissions"?
const data = await Guild.find({}) how can i grab all documents message value?
Can you explain what it does? Why this "s+"?
So can you send me your whole args definition?
so "match one or more whitespaces"
oh ok thx
@earnest phoenix cache.find
@lyric mountain from all member roles how would i calculate all permissions
oh, that
idk if there's a build-in method to get all permissions, but you could iterate over all roles and flip permission bits
see if there's no guildmember.permissions or something
// CHANNEL PREFIX, DEFINE ARGS AND COMMAND
if(message.author.bot) return
if(!message.content.startsWith(prefix) || message.author.bot) return;
// ARGS AND COMMAND
const args = message.content.slice(prefix.length).split(/ +/g);
const command = args.shift().toLowerCase();
someone tell me what the definition is
@lyric mountain flip permissions? like ORing all role permission bitsets?
yep
I would like an API for a commands but I narrate can't you help me please
^
i was asking for the definition
ill just find it out
there is no definition.
great
Ah okey
Sorry in advance if this is not the best place to ask this. But how do I make a webpage for accepting POST requests for webhooks? I want to make my bot use webhooks for top.gg upvotes since I'm having too many problems making an API call everytime to handle votes
try this server
maybe they can help
Im talking about the link I need to put into top.gg for the webhook url but thanks will ask there
this is a top.gg specific question, not a discord api question
if anything it should go to #topgg-api
you dont need an actual webpage, all you need is a webserver
something like express for nodejs or sanic for python should do just fine
its top.gg api related in #topgg-api :/
alright thanks. I'll take a look at sanic
hey
how can i use highlight.js in my website? if you know ping please
include it in a script tag
can you send an example?
like
<script src="idk what src"/>```
have you tried... you know... the highlight.js website?
and have you tried clicking on the big red button that says "GET VERSION 10.5.0"?
why would they try that Tim /s
omg π€£ i thought that downloads it on your computer
Hello, i have a question, how would i get the server list that my bot and a user shares
so i can find someone faster
oauth2
you can theoretically filter your member cache instead but you would need to have every single member in every guild cached for that
Guys i want make on embed user#tag
i do <@${message.author.id}>
But didnt Work
It show like this
@north locust <=== this only ex id
anyone know what I'm doing wrong here?
$.ajax({
type: 'POST',
dataType: 'json',
url: '/backend/checkuser',
data: { id: id },
success: handleSuccess(res),
error: handleError(res),
});```
<center>
<pre>
<code>
/* import your packages */
const DiscordJS = require('discord.js')
const ZoroUtil = require('zoro-util')
const client = new DiscordJS.Client() // Make A New Client.. Which Is The Base For The Bot
const config = require('./config.json') // This Is Where Your Token, Prefix, etc. Should Be In
new ZoroUtil.handler(client, {
commands: './commands', //This Is Where It Will Cache Your Commands And Read It
events: './events', //This Is Where Ready, Message Events Will Be Stored.
commandtable: true /* It can be false. This Is An Example Of Table:
βββββββββββ¬βββββββββββββ¬βββββββββ
β (index) β name β status β
βββββββββββΌβββββββββββββΌβββββββββ€
β 0 β 'example' β 'β
' |
βββββββββββ΄βββββββββββββ΄βββββββββ
It Is A Table Of The Commands With An ID/*
})
.setPrefix(config.prefix)
.setOwners([/*you can add muliple. for example: */ 'owner id 1', 'owner id 2 /*optional*/'])
client.login(config.token)
</code>
</pre>
</center>```
help. it wont go in the center
it doesn't work like that
what the fuck
also, is that copy-pasted?
because that's no valid js code
it isn't js?
oh ok then
wdym?
OHH
you thought it was js
lol
its html
I didn't think it was js
oh
let's say I've seem "things" that'd make you pass out
are you sure you want to align that in center
it's going to make it absolutely unreadable
if u want to align it, you need to use a <div> for the text
and use alignment styles
but as cry said, it'd become unreadable
i did
i tried this
<div class="center">
</div>
.center {
display: flex;
align-items: center;
justify-content: center;
}```
text-align
is this applicable only for bots or for everyone? bots/humans
i think only bots
Hmmmm.
getting rate limited with the discord client 
autohotkey :^)
const members = await message.guild.members.fetch({users: [playerOneID, playerTwoID]})``` anyone know why this is fetching all members? instead of them two only?
what is the ratelimit for users?
it's user
singular
idk, try using autohotkey to spam it xD
kekw
oh thanks
any help on this? js const sizes = [4, 6, 8] if(members.size === sizes) i tried includes idk what else to try?
i wanna check number is = to one of the sizes
use includes on sizes
on sizes
or sizes.includes(member.size)
oh ok
this is why yall gotta start using ts 
That's one thing I hate about js, not knowing variable type during coding
Strong typing all the way
this
vsc works perfectly with ts
just hover over the method/property and you can see the return type
Not to say the awesome creation called
D E B U G G E R
sure, just ask away
const content = collect.first().content.split(" ")
const members = await message.guild.members.fetch({user: [content[0], content[1], content[2], content[3]]})``` this only works if a user id is given, how can i change to id and mention?
a mention is basically an id wrapped around <@> or <@!>
you can use regex or string matching to extract the id from the mention
you can also use the built in message.mentions object
help
const embed = new Discord.RichEmbed()
^
TypeError: Discord.RichEmbed is not a constructor
Discord.RichEmbed() isn't a constructor so therefore you can't use new
use Discord.MessageEmbed()
Discord.RichEmbed has been replaced by MessageEmbed
ok
Stinky eris user @delicate zephyr
damn keyboard won't let me type 
I built my own Embed constructor so Β―_(γ)_/Β―
my support still wasn't wrong
no it just wasn't correct
it was, I explained the error lol
yes but you didn't help them, that error tells them that
whatever
you did the right thing
but didn't know why he was asking that
Yea thanks it work
MessageEmbed
happens all the time, you'll get used to eventually
const is actually mutable 
we all gotta learn, we all start from somewhere
honestly, I know it is, but iirc its fucking hacky to do it

like its really hacky
just use var

it isn't hacky at all
Or let
const myobj = { ur: "gay" };
myobj.ur = "not gay";
yea you can only mutate the data of the object, not the object
i think you can use Object.freeze to make it truly immutable
yea, but what crazy person would do that
/s
do you need privileged intents to get a guild member's permissions? All my channel.permissionsFor(member) ever returns is an empty bitfield
Idk, try turning on that intent and see what happens
const Commands = category => {
return Bot.commands
.filter(command => command.help.category === category)
.map(command =>`\`${process.env.prefix}${command.help.name}\`: *${command.help.description}*`)
.join("\n")
};
if (!args.length) {
Bot.categories.map(cat => data.push(cat))
Bot.categories.map(cat => data[cat].push((`__**${cat.toUpperCase()}**__ \n${Commands(cat)}`)))
const HelpEmbend = new Discord.MessageEmbed()
.setTitle("π€Commandsπ€")
.setDescription(data)
.setThumbnail(msg.author.displayAvatarURL({ dynamic: true }))
.setFooter(`${process.env.prefix}Help [command] to get infomation on a specific command.`, process.env.bot_logo)
.setColor("#0099ff");
...
``` Hello devs! I was adding more commands to my bot wen I was met with the badass, 2080 chars limit for my help embed. So, I decided I would send each and every category as a single message. Unforchanitly, I have no clue how to do that. As you can see, I tried doing `data = []` and then push it in and send it that way but that didn't work. Here's my question, `How would I do this?`
if u did the data = [] and pushing it all correctly then the solution is kinda simple
rather than setting the description to data which is an array...
you have to loop thru each item in the data array and set the description to that
or u could create a reaction handler
@livid lichen you're using Discord.js? Use Discord.Util.splitMessage
https://discord.js.org/#/docs/main/stable/class/Util?scrollTo=s-splitMessage
I am using Discord.js.
be wary if you're using markdown though, because you might split up your formatting
Messge 1: **Comman
Message 2: ds**
for example
I like this idea right here.
Basic Commands would be b Emoji
this might help u @livid lichen #development message
im not too sure if it still works but it should be kinda similar
oh also typically only classes are written in UpperCase and other variables are written as camelCase
doesnt rlly matter
ye it's just convention
Thanks
The page is empty...
Oh wait wrong oen
I use a JSON db cuz i only store a little bit of data
sqlite 
I'll use sqlite so
Does anyone know how I can make my bot respond to the defined prefix and not to the number of letters in the prefix?
Example: if I put f!help it responds
but if I put s!help it also responds
check if the string starts with the prefix
I have it in commandHandler :Β΄u
const args = message.content.slice(prefix).trim().split(/ +/g);
const command = args.shift().toLowerCase();
The trash worked but not forward and backword.
uh what do u mean @livid lichen ?
reactions.cache i think
const removeReaction = async (m, msg, emoji) => {
try {
m.reactions.find(r => r.emoji.name == emoji).users.remove(msg.author.id);
} catch(err){
console.error(err)
}
}
how do i fix this
best way to avoid this in the first place is let your bot organically grow; don't put it on bot lists until you're verified
or, leave low member guilds and guilds with a lot of bots instantly (until you're verified)
not that leaving will help you now
you'll have to wait
that's a really bad way to detect suspicious growth, but it kinda works for discord
not that I can think of a better way to detect it
discord basically uses guilds-per-day metric
client.on('message', msg => {}); does the msg object have the locale of the user?
like en_US
that isn't shared through discords api
It should be ngl
https://feedback.discord.com it is then
could be handy to have that, specially for locate bots so they can be auto converted to native language
though, in fairness, i also think its not worth the hassle to send locale, wouldnt that be bad?
.
oh π sorry and tysm
ok you have a lot of mispelled items
Oo I can learn py from this
lol
Nvm

Lmayo
ok
ctx.author - user#0000
ctx.author.name - user
also you're using f-strings wrong
f"nice to meet you {ctx.author.name}!"
Ty
Tysm tysm
β€οΈβ€οΈβ€οΈβ€οΈ
What's an f string
pythons equivalent to `hi nice to meet you ${msg.author.username}`
Tysm
Oo
const role = message.guild.roles.cache.find(role => role.name === 'everyone');
pls help
how to get user avatar on embed author
embed.set_author(name=f"{ctx.author.name}", url=member.avatar_url)
python?
what should i write instead of url=member.avatar_url
looks like python
var args = msg.content.split(' ').split(/\s+/)
Sth like this?
@earnest phoenix you use icon_url
would make it easy to use something like i18n
url just adds a link to their pfp in the text
ty
u r the one who helped me a lot today
π₯Ί
not that, it'd probabably give away location, in a very wide way, but still do
not sure they'd be inclined to do anything that would hint where you at
ok
i will do that
idk if they do but sending the local string of the server could help in some cases
well yeah, of course there are use cases
but i dont think any of them is weighty enough to be even added
also just sending the locale string is not this big of a deal i guess. just send the client language not the system language
websites pull it from you anyways
it would be nice, for sure, but i doubt they'll add it
but yea i think its not really on a high priority for them
fuck
is there a class option to make it read-only except it can be modified internally?
protected?
if someone needs help with discord.js just ping me im bored .-.
@lusty quest do you know if theres an option like that?
readonly will conflict with the class trying to modify it
i know how to do it in C#
whats the equivalent in c#?
one sec
aight
public interface IReadOnlyClass
{
string SomeProperty { get; }
int Foo();
}
public interface IMutableClass
{
string SomeProperty { set; }
void Foo( int arg );
}
get is read only, set is read/write
you can also define if you can only write within the class but only ready outside of the class
with {private set;}
i MAY have a solution for it with getters/setters
yeah, it works fine with getters/setters
ty
good to know
i have to use a different variable though
and protect it
but private allows for internals to modify it
nice
mine is ts
its for users that help a lot in #development and #topgg-api and #support
ah ok
to appreciate them i guess
i think theres less than a dozen of people
i know 3 or so with the role
atleast ive noticed them
1- Aurel#0001 [669452973755072524]
2- Xignotic#0001 [205680187394752512]
3- Not Erwin#8753 [188836645670223872]
4- alex_#9840 [293870361001328644]
5- Extreme#1000 [300438546236571658]
6- Hindsight#2020 [139412744439988224]
7- Woo#3304 [136583532972605440]
8- Eri#1000 [187316528100802560]
9- Tim#2373 [180112943612952577]
10- XiuhcoatlSlayer#7391 [311553339261321216]```
so almost 50%
eri, xiuh, xignotic
out of all those, only tim and i arent either: staff or bot reviewers
so i assume our contributions is mainly/all due to support in #development
Well tim got a 3rd job here as the stackoverflow guy
He is a living StackOverflow
but its gonna be such a pain changing a core feature of the bot like that without losing the user data
lmao

I rewrite my bot again to use i18next with a mongodb storage. Will be annoying but worth it
im dynamiciscising(thats not a word, but you get the gist) my reminders
How can I communicate with clientside and serverside in next.js
does nextjs itself hv a features for this or I hv to use some package?
something, like a live chat project in nextjs
I should really start working on a parser but I can't stop making small edits in the interpreter π’
?? raise TypeError('Callback must be a coroutine.')
TypeError: Callback must be a coroutine.
what
show code?
need a bit of a spoonfeed rq
anyone know a postgres query to select the only the last entries non repeats?
fuck, nvm, thats not gonna work out at all
how to make a change in the text?
like
if i want to enable this text
Hello {{member}}, have a good day in {{guild}}!
it will send this
Hello @Brace#6565, have a good day in UrgA Chamber!
With .filter
@tribal siren u could replace the text
Oh replace sry.
no i mean if someone uses welcomesettings
or something else
so it automatically changes
yes
Javascript template strings are what you need
string.replace('a', 'b')
welcomeSettingString.replace('{{member}}', msg.author.tag)
member.send(`${messagee.replace("{username}", member.user.username).replace("{pingusername}", `<@${member.user.id}>`).replace("{usertag}", member.user.tag).replace("{members}", member.guild.memberCount).replace("{userid}", member.user.id).replace("{servername}", member.guild.name)}`)``` @tribal siren
ok thank you very mucyh
oh
how do i do that in python?
same
const DBfetch = await DBchannel.messages.fetch()
const DB = DBfetch.first()
message.channel.send(DB.content)
```with that code get the bot the last message that was sent in a channel, how the bot get all messages?
Truehosting1.1.1.1 because my code ended up like this
u need to see how to replace a part of a string in python
Hi
Does anyone know how to format
Using repel so I can format code easier
@lone palm Oh I forgot to link the dev question in sorry ;'
;-;
xd
I'll go to general while waiting for a response
see str.replace or str.translate
ok
no idea
Same
So there's no output?
Did you check if your bot is online? Do you ever call the client.login function?
do you ever client.on("ready", () => {})
and your bot is offline?
maybe
k
do u have any errors?
why it happens?
idk
not happening
Anyone help how to start webhook with bot?
topgg webhook?
Yep
idk
umm im trying to make a bot with java language im also using intelij Idea
the problem is that it doesnt respond to anything pls help
Wdym doesn't respond?
Are you using gradle or maven?
maven
And you added the repos and dependency in pom.xml?
yes
What version of JDA did you try to add?
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.2.0_168</version>
</dependency>
oh bruh i have this
[JDA MainWS-ReadThread] INFO WebSocketClient - Connected to WebSocket
it says this in a console
but
never said finished loading
So your bot doesn't go online at all?
its online on discord
Try downgrading to an earlier version in your dependency, I know later versions of jda can break sometimes
for newer react class components can I define state outside constructor?
ok
did someone know if you can configure es-lint to not cry about optional chaining in node?
what's the name of the rule
In your eslint config add this to your "rules" object:
"nameOfRule": "off",
woud ecma version work? currently i use 17
you can disable the rule
well eslint complains about Unexpected Token, but its valid in node 14+
wired should be supported by eslint there where a open PR on the Github repo
nvm figured it out, added es2021 support to my config
Is it bad to log every command usage and guild join/leave to a mongo collection?
na not really
although imo, i wouldn't log the guild stuff
did you create a new document for each event or did you update certain ones (like command usage)
also i would maybe suggest using a time series Database like Prometheus
const fs = require('fs');
const { Client, MessageEmbed } = require('discord.js');
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();```
why bot offline
i added client.login at end with token
Can you show all the code
did you get an error?
no
add js client.on('debug',event)=>{console.log(event)}
why did you make 2 discord clients?
const { prefix } = require('./config.json');
const fs = require('fs');
const { Client, MessageEmbed } = require('discord.js');
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
either use Destructing or chaining
it be like that
ahh yes node is fun, it errors out but still works, then you add --trace-warnings and it just ignores the flag and ask you to add --trace-warnings
you know you can just do js emmiter.on('event', callback)
right
so
emmiter.on('event', console.log)
^^
as long as the callback is a function it'll work
yea also works
i pass setIntervals and setTimeouts like that
but i just throwed in what i could remember
much easier
but i think his issue is that he got 2 Discord Clients defined
where?
he only has one
nope he got 2
well but its still a hot mess
no?
Client is a class with a constructor
its actually good to have inherited names like that
Client uppercase as constrcutor, client as constructed object
its proper syntax
nono, im well ware is copy pasted
sup
I have no fucking clue
where the heck is the REferenceError?
nodeβ’οΈ
he got discord defined?
wait it IS defined
Guys how i change
width and height
On Embed
told you its wired ass code
const { prefix } = require('./config.json');
const fs = require('fs');
const { Client, MessageEmbed } = require('discord.js');
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
// They said they had
client.login('shitty token')
LMFAO
there we go lmao
dont know why he would bring the CLient class nor MessageEmbed
if he already pulling Discord as *
or why require them separately
probably a single file bot
lul
I really dont wanna manually test this
told you
that should work though
i dont see anything "wrong" there
i see a lot of bad things, but nothing that should prevent it from running
well the message event is missing closure
they cut the thing in half
ah
node is funny
``` complains about this and i should add --trace-warnings.
stop the pm2 process, cd into the directory and start node with the flag
node: please add --trace-warnings
yea
you have circular requires?
so yeah, working with the top half he gave us
i index a function in a seperate file
@earnest phoenix you know if you dont give us all the code ur working with we cant help you
functions wont inherit context
so consider yourself stuck
they work
yea
actually, if you bind a function to the this workspace can it reference objects outside itself?
no idea
should be easy to test tho
does the function in the separate file require something in the first file?
//index.ts
import { func } from 'function.ts'
func.bind(this);
let a = 1;
func()
//function.ts
export function func() {console.log(a)}
would that work?

x doubt
same
well, the compiler would screech, specially ts, that a is undefined in functions.ts
but i wonder if you can bind the environment to the function
ahh found the issue i think, one function calls another function.
you're binding the global object to it
so it would work if you did global.a = 1, and you access this.a in the function
hmmm yeah you right
help
Code
const figlet = require ("figlet");
Error: Error: Cannot find module 'figlet'
npm i figlet ?
the heck is figlet though
if it cant find, its not there. either wrong path or you didnt install it, whatever that is
that work
it ACTUALLY works?
you're passing it to the function
as param
you gotta ignore the compile error from the function
but see if it works on index
without passing any param
just trying to access it from within as reference
functions are hoisted by defaul, so are variables, i wonder if that would play a role
i assume var might be use case here
//index.ts
import { func } from 'function.ts'
func.bind(this);
var a = 1;
func()
//function.ts
export function func() {console.log(a)}
try this luke
yea nvm, you have to use global
frick
lmao
var, let nor const work
try with var though
I did
works fine?
no
rip
it should work with var
thats what i assumed too
^^
hmm
it does work for me
actually you dont need to bind it at all
since global is the default context
Its my again
ERROR: ```js
client.guilds.forEach(r => message.channel.send(Server Name: ${r.name} and its id ${r.id}))
^
TypeError: client.guilds.forEach is not a function```
its probably because im execing it from a file
let me try without the repl then
TIL
hmm
there is for all built-in objects in node afaik, most of them just reference to the global scope tho
this is not bound to global when running the file
and var doesnt bind it to global either
it works if you do global.a
yea
and bind global
this
this refers to this, clearly, duh
yea, node is fucking whack
yay one thing finished for today, time to figure out what the smartest way would be to convert my existing localisation into i18next format
what the frik
if you console.log this in two different files
only one gets logged
i would switch to rust. would be a pain in the ass to do but probably worth it
@opal plank honestly wish I could but honestly with what little amount of time i have thats a yike
agreed, already spent way too much time on this trash
lol another wired thing, my event handler loads each event one after another, exept one that loads after the client is ready. even tho the last event that gets loaded just got 3 lines of code i could make 1
https://i.s8s.app/OzlLLc29 apperently this is wired to load
How does one get notable member
be helpfull in #development #topgg-api #support
by being noticed by senpai
you just get chosen
use serenity::{
Client, dj0ifne
}
fn main() {
femwfiwre
}
so the global this is {}, globalThis is global, and this inside a function is global
interesting
yep
Wait wtf
its fucking whack
I thought ur working with node
node and i learned some rust
hello
@quartz kindle can we just agree that Node is fucked and next chance we get to slap the creator we do with all our might?
Whats wrong with node
i think py got also some whacky stuff
node is wired
node is indeed weird
Node isnt weird, youβre just bad 
feels sometimes feels like you talk to someone with dementia
did i show you guys what happens if you use this inside a proxied class?
That's V8 though, not node
Then It's probably supposed to happen
its fucking weird tho
like
this.something()
is 100x slower than ```js
something = this.something
something()
xDDD
wait really
yea
that's inside a proxied class or just in general?
is it because of context?
inside a proxied class
wait i have a test script you can copy and paste
we're already using it.
const { performance } = require("perf_hooks");
const obj = {
str: "a",
test1() {
for(let i = 0; i < 9999999; i++) {
this.str + this.str;
}
},
test2() {
let str = this.str;
for(let i = 0; i < 9999999; i++) {
str + str;
}
}
}
let a = new Proxy(obj, {
get(target, key, receiver) {
return Reflect.get(target, key, receiver);
}
})
let b = new Proxy(obj, {
get(target, key, receiver) {
return target[key];
}
})
let c = new Proxy(obj, {
get(target, key, receiver) {
return target[key].bind(target);
}
})
let d = new Proxy(obj, {
get(target, key, receiver) {
return obj[key];
}
})
let e = new Proxy(obj, {
get(target, key, receiver) {
return obj[key].bind(obj);
}
})
t = performance.now(); obj.test1(); console.log(performance.now() - t);
t = performance.now(); obj.test2(); console.log(performance.now() - t);
t = performance.now(); a.test1(); console.log(performance.now() - t);
t = performance.now(); a.test2(); console.log(performance.now() - t);
t = performance.now(); b.test1(); console.log(performance.now() - t);
t = performance.now(); b.test2(); console.log(performance.now() - t);
t = performance.now(); c.test1(); console.log(performance.now() - t);
t = performance.now(); c.test2(); console.log(performance.now() - t);
t = performance.now(); d.test1(); console.log(performance.now() - t);
t = performance.now(); d.test2(); console.log(performance.now() - t);
t = performance.now(); e.test1(); console.log(performance.now() - t);
t = performance.now(); e.test2(); console.log(performance.now() - t);
Who is we @rocky hearth
we ts guyz... π
u too r included in my "we"
Its not a thing tho??
oh wow that's a huge difference
Ecma 2020 right? @rocky hearth
ESNext gang
its weird how you can make the proxied this 10x faster by binding it
but if you just reassign this, then it works 100x faster
whats even more weird
the reassigned proxied this can be faster than not proxying at all
guys this code make my error on last line idk why
wheres problem
client.on("message",async message =>{
if (!prefixes[message.guild.id])
prefixes[message.guild.id] = {
prefix: process.env.PREFIX
};
var prefix = prefixes[message.guild.id].prefix;
let command = message.content.toLowerCase().split(" ")[0];
command = command.slice(prefix.length);
if (command == "clear" || command == "Ω
Ψ³Ψ") {
message.delete({timeout: 0})
if(!message.channel.guild) return message.reply(`** This Command For Servers Only**`);
if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send(`> ** You don't have perms :x:**`);
if(!message.guild.member(client.user).hasPermission('MANAGE_GUILD')) return message.channel.send(`> ** I don't have perms :x:**`);
let args = message.content.split(" ").slice(1)
let messagecount = parseInt(args);
if (args > 100) return message.channel.send(`javascript
i cant delete more than 100 messages
`).then(messages => messages.delete(100))///iiYeahBoy
if(!messagecount) messagecount = '50';
message.channel.messages.fetch({limit: 100 }).then(messages => message.channel.bulkDelete(messagecount)).then(msgs => {
message.channel.send(`js
${msgs.size} messages cleared
`).then(messages => ///iiYeahBoy
messages.delete({timeout:5000}));
})
}
fs.writeFile("./prefixes.json", JSON.stringify(prefixes), err => {
if (err) console.error(err);
});
the discord docs specifically stats you arennt allowed to delete over 100 messages at a time
so?
thats not it
hes trying to delete the error message after 5 seconds
oh
but delete doesnt take a number since v12
@earnest phoenix can you repost the console log error
okay wait
Code:
client.on("message",async message =>{
if (!prefixes[message.guild.id])
prefixes[message.guild.id] = {
prefix: process.env.PREFIX
};
var prefix = prefixes[message.guild.id].prefix;
let command = message.content.toLowerCase().split(" ")[0];
command = command.slice(prefix.length);
if (command == "clear" || command == "Ω
Ψ³Ψ") {
message.delete({timeout: 0})
if(!message.channel.guild) return message.reply(`** This Command For Servers Only**`);
if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send(`> ** You don't have perms :x:**`);
if(!message.guild.member(client.user).hasPermission('MANAGE_GUILD')) return message.channel.send(`> ** I don't have perms :x:**`);
let args = message.content.split(" ").slice(1)
let messagecount = parseInt(args);
if (args > 100) return message.channel.send(`javascript
i cant delete more than 100 messages
`).then(messages => messages.delete(100))///iiYeahBoy
if(!messagecount) messagecount = '50';
message.channel.messages.fetch({limit: 100 }).then(messages => message.channel.bulkDelete(messagecount)).then(msgs => {
message.channel.send(`js
${msgs.size} messages cleared
`).then(messages => ///iiYeahBoy
messages.delete({timeout:5000}));
})
}
fs.writeFile("./prefixes.json", JSON.stringify(prefixes), err => {
if (err) console.error(err);
});
Error:});SyntaxError: Unexpected end of input
cant understand shit with such a terrible indentation, but you have either missing brackets or too many of them
Okay so I'm working on a programming language, and this:
function fn() {
console.log("Yey!");
}
for (let i=0; i < 10; i++) {
if (i === 9) fn();
}
Takes 0.17 ms in my language, and 5 ms in javascript... the crazy thing is that my language is written in javascript
he make my error on last line
that should never take 5ms in js wtf
chrome and node.js are showing me 2 different results
When I do the test in chrome it's around 0.15 ms when I do it in node.js it's 5 ms
wtf
Anyways, still very fast
Lol, yes but look at line 14
oh
Lol
did you restart your bot
what
well what is args[0]?
how did you restart your bot in under 1 second
also, the error you showed is not even in that file
But it usually works with my other commands..
something's making me think that you're not actually restarting your bot but ok
you again
I did lol
Why would I lie about that
the message "you didnt provide any arguments" is not in that file
Huh..
so your bot is sending that before it even runs that code
I didnβt really have a file with those stuff, lemme check my index.js
Damn really weird, lol I found it
why he say
let user = message.guild.members.get(message.content.split(' ')[1]) ||
^
message.mentions.members.first();TypeError: message.guild.members.get is not a function
members.cache.get
how can I change discord's redirect after a bot has been invited in a guild (https://discord.com/oauth2/authorized) ?
I already tried redirect_uri param but it doesn't change anything
oh ok thanks
Isnt that quite much for a simple code
for a low level language, yes its a lot
for an interpreted language like js, no its not a lot
.invite
then again, js is only half interpreted. It gets compiled to bytecode which then gets executed. If a piece of bytecode gets used frequently, it gets gets compiled even further, to machine code.
pretty cool
that's why it's as fast as it is
guys looks like I have a problem
Manager.on('shardCreate', (shard) => {
Logger.info(`Shard[${shard.id}] has been created!`, `Shard`);
shard.on('ready', () => {
Logger.info(`Shard[${shard.id}] is now ready!`, `Shard`);
});
shard.on('death', (child) => {
Logger.error(`Shard[${shard.id}][${child.pid}] Death`, `Shard`);
});
shard.on('disconnect', () => {
Logger.error(`Shard[${shard.id}] Disconnection`, `Shard`);
});
shard.on('error', (err) => {
Logger.error(`Shard[${shard.id}] Error : ${err.name}`, `Shard`);
});
shard.on('reconnecting', () => {
Logger.info(`Shard[${shard.id}] reconnecting...`, `Shard`);
});
shard.on('spawn', (child) => {
Logger.info(`Shard[${shard.id}][${child.pid}] has been spawned!`, `Shard`);
});
});```
this is my code
if I set 2 shards then it says this for only 1 shard
if 1
then says 0
if 2 then says shard 1
I want it to say for each shard
like
shard 0 ready
shard 1 spawned
you know that this is intended?
did you put that code before or after Manager.spawn()
shard 0 = 1st shard
yea shards start at 0
I know
before or after?
after
it has to be before
let utilcommands = data.push(commands.map(command => command.name).filter(command => command.catogery === `util`).join(', '))
var embed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setFooter(`Block | ${message.guild.name}`)
.setTimestamp()
.setColor(`RANDOM`);
if(!args.length) {
embed.addFields(
{name: `Utility Help`, value: `${utilcommands}`}
);
embed.setTitle(`Commands Menu`);
}
message.channel.send(embed);``` i'm trying to filter the commands per catogery but it gives error: `cannot read property catogery of undefined` How to fix?
all event handlers must be registered before calling spawn
ok thanks
does it mention the line?
nvm
no but i think its let utilcommands = data.push(commands.map(command => command.name).filter(command => command.catogery === util).join(', '))
yeah now it works thanks !
yea how did you export the informations on your commands?
truely a notable member @quartz kindle
lmao
this is all the code i have untill now ```js
const fetchprefix = await mongopref.fetch(client, message.guild.id);
const data = [];
const { commands } = message.client;
let utilcommands = data.push(commands.map(command => command.name).filter(command => command.catogery === `util`).join(', '))
var embed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setFooter(`Block | ${message.guild.name}`)
.setTimestamp()
.setColor(`RANDOM`);
if(!args.length) {
embed.addFields(
{name: `Utility Help`, value: `${utilcommands}`}
);
embed.setTitle(`Commands Menu`);
}
message.channel.send(embed);```
yea commands it not a property of message.client
oh
where did you set it ?
@lusty quest how do i need to define { command } than?
where did you load your commands?
code?
sure
@lusty quest here's just everything https://srcb.in/qzjTlhI9Wq
one of your commands has no name
oh
hello development chat
and your filter function is trying to do command.name.category
or... "catogery"...
your code seems to be valid, but as tim said probably missing values in a command
@quartz kindle can also the problem be that i only have catogery: defined in 2 files because i was testing LOL
hmm
than can i fix it lol
remove the map
why?
you're mapping it to name
ok
do the map after the filter
ok
@quartz kindle this?
let utilcommands = data.push(commands(command => command.name).filter(command => command.catogery === `util`).map().join(', '))
commands is not a function
ok but wich to remove then?
isnt it obvious
how do functions work in js?
im just a little newbie
if you put () after a name, that means that name represents a function
commands is not a function
you cannot do commands()
the function is map
not commands
this is the map function
if you want to move this function
you need to move all of that
uhm @quartz kindle i did this let utilcommands = data.push(commands => (command => command.name).filter(command => command.catogery === `util`).join(', ')) and now it gives 1
not just the name map
@quartz kindle if i do this let utilcommands = data.push(commands.filter(command => command.catogery === `util`).map(command => command.name).join(', ')) it just returns 1
ok
let utilcommands = commands.filter(...).map(...).join(...)
finnaly thank you so much
if (message.content.startsWith(""))
That's unnecessary... there's so much weird shit in your code
True, lol
@cinder patio aww thank you man youβre a savior lol
I removed that line, and it worked like π§

didnt i tell you to remove that line ages ago? lmao
you imply that people actual read stuff and not just skim over text and copy / paste codeblocks without context?



