#development
1 messages · Page 1779 of 1
One second
/(.*)\\(.*)\.js:([0-9]+):([0-9]+)/gi
Group 1 - the whole match
2 - path
3 - file
4 - line
5 - column
still null 
oh wait
/(.+):([0-9])+:([0-9]+)/
wait wtf
Works like a charm for me
Did you escape the slashes
oh sh
just use path.parse lol
At least we now know it’s all your fault 
hmmmm
remove /g
Flazepe version is shorter but doesn’t require a valid path in front
That’s why I was looking for a \
However you need it
requires a little more work tho
for what
const [extension, line, column] = result.ext.split(":")
now you don't have to worry about whether or not the filename might have a : in it or something
wait, can filenames contain a :
with this approach you don't need to find out
The regex still returns the right stuff even if the filename has a :
yeah but regex is ass and it'll break if you try to run your code on a unix machine
I'll keep that in mind
generally regex is a last resort. If you're parsing paths, urls, html etc use an actual parser because these are syntaxes with a specific spec that has edge cases not covered by your regex
file paths in error stacks contains :
can you give an example?
yeah... I thought they were talking about in the file path itself
we all know about the line and column
I've never seen something like that
How i can get all of data of a determined collection (using mongoose)
ok i will try
@lusty quest i tryed and it gives me only the info about the Query
no data at all
show your code
async function SearchMatch() {
const Match = require('./schemas/MatchSchema');
console.log(Match.find({}))
}
thats not how you query MongoDB with mongoose
? i am trying to log the data
ohh wait nvm
xD
const mongoose = require('mongoose');
const MatchSchema = new mongoose.Schema({
startedSearching: mongoose.SchemaTypes.Number,
oponentName: mongoose.SchemaTypes.String,
oponentId: mongoose.SchemaTypes.String,
inQueue: mongoose.SchemaTypes.Boolean,
inMatch: mongoose.SchemaTypes.Boolean,
userId: mongoose.SchemaTypes.String,
msgId: mongoose.SchemaTypes.String
});
module.exports = mongoose.model('Match', MatchSchema);
this is my schema
what i am trying to do is a match system
yep
if you hover over your match variable in your query you see that it shows your Schema right?
https://docs.mongodb.com/manual/reference/method/db.collection.find/#find-all-documents-in-a-collection its valid syntax according the docs
wait did you ran the query Async?
bcs otherwise you get a pending Promise
it gives me the same sh*t
If that’s the case I would adjust his regex to match / and \
then try await Match.find({})
just to say
yes i tryed both ways
also async?
when i use the function?
the db call
const Match = require('./schemas/MatchSchema');
async function SearchMatch() {
const db = await Match.find()
console.log(db)
yes
now it works
thx
one last thing @lusty quest
can i use
Object.keys(find).forEach(function (key) { // i called "find" the db call
});
to navigate through each object
try and see
?
but looping over the results should work like a normal JS object
you mean a for loop?
Just to say like Xetara mentioned in cases the file path uses / instead of \
/(.*)[\\|/](.*\.js):([0-9]+):([0-9]+)/gi
To still give you an alternative way
any loop will work, but for loops are faster than forEach
thanks!!!
Damn embeds
actually that doesn't work 😦
The link doesn’t work?
Actually nvm it works! I forgot that I modified your original regex a little bit!
lmao
To match the path when it's between parentheses
Working on prettier errors in JS 
The regex?
the regex was used to extract the path from the error
Ah lol
What's cool about it is that it works with normal errors too
Anyone knows what going wrong, the error is in discordjs
Data is undefined
Hmm
So change is that I ask a function of discord and give it something that is undefined
Only happens once a month
@rustic nova
thanks
i need opinion from lower level language developers like for example c
if ur making a network request, would you rather do it asyncly by yourself, ie start a thread, run a synchronous request, and then handle it
or rather have the library do the running for you and all you do is give it a callback?
cuz if its async then how are you gonna get the data out of the callback other than a void pointer, but if its synchronous ur gonna have to do thread management yourself
sir this channel is for people who don't know how to read error messages
ah ok my bad
you might have better luck asking in an actual programming server
no I'm just joking, I just mean usually people don't ask any meaningful questions here
u still make a fair point
Im using chakra's editable component and i want to modify the style of the component. Can you use style props on the Editable component?
We have a problem,
the path isn't always in parentheses
So this regex /\((.*)[\\|/](.*\.js):([0-9]+):([0-9]+)\)/ is invalid 😩
is using sentry for Logging overkill or just fine?
function FindMessage(channelId, oponentChannelId, msgId, oponentMsgId, tag, oponentTag) {
const { MessageEmbed } = require('discord.js');
let userMessage = new MessageEmbed()
.setDescription(`Match found!\nOponent: \`${oponentTag}\``)
.setColor([0, 255, 0])
let oponentMessage = new MessageEmbed()
.setDescription(`Match found!\nOponent: \`${tag}\``)
.setColor([0, 255, 0])
client.channels.cache.get(channelId).fetchMessage(msgId).then(msg => msg.edit(userMessage));
client.channels.cache.get(oponentChannelId).fetchMessage(oponentMsgId).then(msg => msg.edit(oponentMessage));
}
Why is giving me this error
is fetchMessage still a thing?
i am trying to find a message by ID
it is messages.fetch now
Anyone know how to successfully set a category overwrite for a bot to make more channels under a category (Working on a ticket bot if that helps)
SInce i am getting Permission errors with out admin and have tried giving all channel related and role management based perms, and it won't work how ever i am doing (D.js)
u might need to set your intents too, but im not entirely sure
what kinda intents would be for that? its not fetching members or presences iirc.
Unless partials count but thats for reacts(?)
Huh yeah I’m working meanwhile
Will head back to you later if I’m at home if you haven’t got a fix already
👌
Just to ask why are the parentheses being an issue anyways?
Oh nvm it will collect any chars before as well
Yeah I got it the fix is very easy 
We just gonna make sure there’s a ( or " " in front
manages channels maybe? idk
but i meant set the intent in your code
i think thats a thing
Iv a string Like "LetSayContext", and I want regex to extract, the "LetSay" part here. ie, I just want to remove Context from every string
(Im trying to make snippet in vsc, and Ive TM_FILENAME_BASE)
Does it always end with Context?
yes
There's multiple ways to do it
replace("context”, “”)
Slice, split, replace
I knew, u guyz will suggest, these methods 😆
So thats y I said, Im making a vsc snippet.
and I;ve TM_FILENAME_BASE only
See this if it helps https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variable-transforms
So can I get regex for that?
Well since it's just regex ${TM_FILENAME_BASE/(.+)Context/$1/}
[A-Z]
no I meant I want to convert the first char of a string to be an uppercase including, /(.+)Context/$1/ too
if you want to convert the result look at that url
if you want to match only if the first letter is uppercase use [A-Z] in the regex
Try ${TM_FILENAME_BASE/(.+)Context/${1:/capitalize}/}
You can also use PascalCase if you need to /pascalcase
that just results in index
idk y
I'll back come to it in future. Its not required for me right now though. Thanks anyways!
why the bot rewiever rewiev my bot at the midnight, when i sleep ??
because they were awake
i would that the review on the day, no at the midnight, that i am off from internet
Your bot should be online as much of the day as possible (ie daily restart at midnight)
why would anybody use your bot if it goes down when you're not in front of your pc lol
are users supposed to dm you before they use your bot to make sure it's up
i don't have a plan for bot to on 24/7, there is a Heroku, but is limitated
anyone wanna help me debug cursed code
why's this throwing an error? i do use ?. but it's like nah fam we don't care
what node version u running?
Is it ok to require package on a condition?
function myFun(isTrue) {
const pkg = require(`./icons/${isTrue ? 'solid' : 'outline'}`);
}
ol
okay
follow up question
why does undefined?.push(...[], 1) throw an error
nevermind
trying to have child_process in one folder, yet the dependencies are circular? any fix? idc how tedious
firstly: ?.
secondly: undefined.push is not a function
:/
Not the case, that error is caused by Node.js's interpreter
Was fixed in Node.js v15
but fr, any way to fix this?
u need node 15 to use optional chaining, do u hv that?
oh fine, then maybe node14
well he does have node 14+
cuz it send undefined.push isn't a function
push is from Array.prototype
so u can't do Number.push
or String.push
undefined?.push would return undefined, not an error
really?
undefined.push(values) would make an error
dude
optional chaining
that ? is literally an if
something?.push()
//is the same as
if(something) something.push```
huh..
thats what optional chaining does
so then he doesn't have node 14+?
it checks before continuing
its IN node 14
if he has node 14 he's fine
just run node --v and get this over with
and i'll make a very bold statement and say they are using d.js
which means theya re on node 14
since d.js requires node 14
i must have a pretty low version huh
peerDependencies are used when, we expect the user of our package to have some packages pre-installed, am I right?
10.16.0 ;-;
my original question is how to solve circular dependencies in stream.js
https://github.com/nodejs/node-v0.x-archive/blob/master/lib/stream.js is a circular dependency of https://github.com/nodejs/node-v0.x-archive/blob/master/lib/_stream_writable.js
Bruh why are you using the archived version
node-v0.x-archive
That's like v0.1
me when I found https://github.com/nodejs/node/blob/master/lib/stream.js
;--; my brain
I don't see how that's a circular dependency
this is
this isnt
@viscid gale dunno, if it might help u or not but last time when I was hving a circular dependency error, I fixed tht by adjusting the imports sequence
but that was from my own files though
he has this error
the error is 99.9% coming from their own code
not node internals
that's why i asked for it
so i can see the stacktrace
and I want answer for this
1|ccweb | Response: Service Temporarily Unavailable
1|ccweb | at RequestHandler.execute (/home/rake/ccweb/node_modules/discord.js/src/rest/RequestHandler.js:161:15)
1|ccweb | at processTicksAndRejections (internal/process/task_queues.js:97:5)
1|ccweb | at async RequestHandler.push (/home/rake/ccweb/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
1|ccweb | at async WebSocketManager.connect (/home/rake/ccweb/node_modules/discord.js/src/client/websocket/WebSocketManager.js:138:9)
what does this mean?
that the service is temporarily unavailable
Try again later
it's a server sided error
of Discord?
Welp, I'm getting a service temporarily unavailable too 
:rip:
lol
are all bots down?
yep all
That's not ratelimit
Discord Server Issues
is vue worth learning
The discord api is under maintainance probs
it comes upto usage
yes
i mean, i use react a lot
stick to one
yo guys, do you know if discord.js is having any error?
cause I'm having this:
UnhandledPromiseRejectionWarning: Response: Service Temporarily Unavailable
definitely
umm
Discord server side issues
oh, ok
literally read above
dem
this is the problem
Discord server side issues
Augusto11 — Today at 6:13 PM
oh, ok
🤔 All fine for me
I'm using interaction though
dem
To much users redeemed Free Nitro and so Discord Systems is overloaded 🤣
well i hope they resolve it quickly
wait there's free nitro?
where
am i late
;-;
ah
This guys who uses fake cc, ban them all
I have an event to do tomorrow lol
how?
while (true) makeRequestToClaimEndpoint()
by bots i mean userbots
obviously
bots can't access the claim endpoint
I have set pm2 to stop ,else it will login every sec since it throw a type error
uff
So how much time its take
count to infinity
any idea when it might be up?
by the time you finish, the error will get fixed
honestly, not sure how we would know. discord down errors sometimes are a few seconds, to however long it takes to fix it.
So all bots ere down?
No?
only some bots,since only a part of cloudfare is having issues
clouldfare
cloudfart more like thunder
i mean imagine how much traffic they handle every single day
Well fixed
yes
Ok, I want to start a new project, a currency bot. I know that you could use .json files to store data like their balance or whats in their inventory, but it is not recommended, so what can I use instead of a .json?
Database
Json is OK for small data storage where the user is meant to edit stuff
Databases are good cuz they are a lot faster, can manage concurrency, etc
a database like MongoDB will do well
Even smth like SQLite can be ok unless ur too big
Does MongoDB work with Python?
yes
Ok
technically, it works with every language.
whats the best graph lib for nodejs
(easy, advanced)?
to generate charts?
hey look it's cloudflare's stock price
yes
uh ask @Tim#2373.He is a guru
Okeeh
I'm trying to perform and aggergation query in mongoose. I defined _id and assigned it a type of a string in my schema. When I'm trying to cast a discord snowflake id to an object id it keeps saying:
Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
Is there any fix to this? Because i know that custom _ids are supported by mongodb.
grafana
In which language?
could you show the snowflake part?
your are overwriting the Id?
the snowflake id is probably longer than 12 bytes
or 24 hex chars
I don't think object id's have a limit on how large they can be?
I can easily do it through the shell tho...
I have read a question on stackoverflow, it said that mongoose auto casts the _id in findOne and find it did indeed work. But in aggregation i need to do it myself.
do smbdy hv ans for this?
It means the package is optional and that npm won't install it when the user installs your library
you have to check if the package is installed yourself in the code to avoid errors
I'm trying to make react package for tailwind's @heroicons/react
To use this package, we've to import each icon to use.
Rather I'm making it so, we import a wrapper, and we only hv to provide the name of the icon to use.
So to achieve this, do I hv to install react as a peer dependency or what?
This is my index.ts for my package. The jsx is also not working.
currently Ive installed, react as a peerdependency
window.onload = () => {}
haha
recently dipped quite a bit
bro it's almost literally at an all time high
rn?
yeah 94
weow
I got in at 17 right at the ipo
and sold off a few months ago at like 70 right before it dipped
yeah its waaay back up
wow
is anyone available hear? i need help 
first you ask your question
i want a random cat image from unsplash.com to be sent by bot on command , this is not working ;-;
client.ses=aiohttp.ClientSession
@client.command()
async def catt(ctx, *, search):
search=search.replace(' ', '')
unsplash=('api key')
url=f'https://api.unsplash.com/photos/random/?query=cat&client_id={unsplash}'
async with client.ses.get(url) as r:
if r.status in range(200, 299):
data=await r.json()
url=data['urls']['regular']
embed=discord.Embed(
title='Here is a cat image'
).set_image(url=url)
await ctx.send(embed=embed)

ah, so you've already set it up properly
you need to supply search argument
probably ?search=something
read the docs to see whether that's a url param or a header
oh, okay , i'll try that 
anyone? 😄
there is a way to reset the command cooldown and make it a daily command?
I have a for loop that gets all of my bots prefixes for the servers
How do I get the top 10 most used ones
And how much they're used.
hey, it's working now, thank you :)

yw
👍
why does my flex content not stay at the center of the page, and why does it push the right side of my nav items a bit?
https://i.callumdev.xyz/txheh.png
https://i.callumdev.xyz/y2ote.png
% in flex??
like, flex is already a space calculator
flex 1 in a div with 3 elemens mean each takes 33% of the space
if one has flex 1 and the other 2 have 2 it means it'll take 1/5 of the available space
align-items ?
F
I sent that too
I'll provide everything I have to prove I'm clear
anyone know why pm2 would be spinning up 25 of the same screen?
im having it run a screen function and it just errors for no apparently reason and makes 25 screens
200 maybe?
Depends on what you're doing tbf, but 200 is fine
That's it then
Unless you want to return actual data
In that case just...well...return it
Daring today ain't we?
uncool
I've seen a lot of users posting that kind of scam recently
maybe their accounts are getting hacked
Is it supposed to have return data?
If not, 200 is fine
You could go with more specific 2xx statuses if you want
Doesn't discordjs have integrated interaction handling?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i have a discord bot linked to turn on a server that i want to have start up a minecraft server using screen and pm2
when i turn pm2 on it makes 15 screens each one at the "loading libraries" screen
it says theres errors but when I run it without screen it works fine and i cant find the error
settings: {
channel: {
type: String,
required: true,
default: "msgsent"
}
},
levels: {
type: Object,
required: true,
default: {}
}
}```
How would I update leveling.levels.test with mongoose?
any command suggestions?
eval command that anyone can use 🙂
Tim, you're smart
Ooo, command that prints out your credit card information to the channel 🙂
Ah yes, very good for claiming free three months of nitro!
For legal reasons that was a joke
Yes, don't do that. But if you do, invite me to the channel first please.
Got my eye on something on Amazon.
just use Piston API and you are done lol
The credit card information command would be an awesome one 😉
get a command that register credit cards to unlock a premium feature.
use that credit card to buy 100's of nitros
dm people saying you got nitro giveaways
tell them to join you only need to invite the bot to 5 servers
give random nitros with the credit card u used
rinse and repeat
ggez, you're now as big as mee6 /s
and then 3 weeks later go into jail for Federal Crimes, Tax Fraud, and Theft
what are they gonna go? come here in brazil to get me?
everyone knows we dont have laws, its all jungles
damn
Hey. Do guild permissions apply to ApplicationCommands? (/cmds)
or are they independent?
<style>
.entity-header__image {
border-radius: 50% !important;
border: 3px solid gold;
animation: float 5s ease-in-out infinite;
}
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2);
-webkit-transform: translatey(-30px);
transform: translatey(-30px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(0px);
transform: translatey(0px);
}
}
.entity-wrapper {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('your image url');
background-repeat: no-repeat;
background-size: cover;
scrollbar-width: none;
}
.entity-wrapper::-webkit-scrollbar {
display: none;
}
body{
scrollbar-width: none;
}
body::-webkit-scrollbar {
display: none;
}
#menu {
background: transparent;
}
.entity-content__description {
background: transparent !important;
border: none;
}
.entity-content__divider {
display: none;
}
.entity-hint {
display: none;
}
blockquote {
background: linear-gradient(90deg, #363636 30%, #fff0 100%) !important;
}
</style>
``` @drowsy ledge
thx
no problem ofcourse
:D
What do you mean?
@sly sierra to use ^ jsut put it at bottom of your long description on edit page
It's up to the dev to modify behavior depending on your permissions as command invoker
You can use slash commands only if you have the according permission
aight homie
and add your imagewhere it says "your image url"
and to change the border color
.entity-header__image {
border-radius: 50% !important;
border: 3px solid gold;
animation: float 5s ease-in-out infinite;
}
change gold to a color you want, red, blue, black, green so on
Like if a bot doesn't have Embed_Links but a user uses a /cmd then will the bot be able to send an embed?
.entity-wrapper {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('https://static.theprint.in/wp-content/uploads/2020/03/minor-planets.jpg');
background-repeat: no-repeat;
background-size: cover;
scrollbar-width: none;
}
</style>```
CSS For top.gg custom background ^^
btw change the background: url('https://static.theprint.in/wp-content/uploads/2020/03/minor-planets.jpg');
Change the link to the image u want
<style>
.entity-wrapper {
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background: url('your image url');
background-repeat: no-repeat;
background-size: cover;
scrollbar-width: none;
}
</style>
there


yea
ye
you use a custom file for status or your main file?
whenever i add status: "dnd" it doesnt do anything
i can send my status code
console.log(`${client.user.tag} is Now Online/Updated`)
client.user.setPresence({
status: 'idle',
activity: {
name: `${index}`,
type: 'WATCHING',
}
});
How do you send files over 8mb from a discord bot?
const ap = AutoPoster(process.env.TOPGG, client)
ap.on('posted', () => {
console.log("\n")
console.log(`Bot updated! | Info : Guilds - ${client.guilds.cache.size}, Channels - ${client.channels.cache.size}, Users - ${client.users.cache.size}!`)
})```
top.gg stat updater if u are too lazy to read the docs
;should i just plot that underneath my cleint.on("ready", () => {
yea
client.on("ready", () => {
console.log(`${client.user.tag} is Now Online/Updated`)
client.user.setPresence({
status: 'idle',
activity: {
name: `${index}`,
type: 'WATCHING',
}
});
});
there
const config = require("../config.json");
module.exports = (client) => {
console.log(`${client.user.tag} is Now Online/Updated`)
const messages = [
`${client.guilds.cache.size + 1} Servers | n.help | n.vote`,
`111 Commands | n.vote`,
`${client.guilds.cache.size + 1} Servers | n.help | n.vote`,
`111 Commands | n.vote`,
`${client.guilds.cache.size + 1} Servers | n.help | n.vote`,
`111 Commands | n.vote`,
`${client.guilds.cache.size + 1} Servers | n.help | n.vote`,
];
setInterval(() => {
const index = messages[Math.floor(Math.random() * messages.length)];
client.user.setPresence({
status: 'idle',
activity: {
name: `${index}`,
type: 'WATCHING',
}
});
}, 8000);
}
thats my actual status code
lol
its changes every 8seconds
let wordArray = message.content.split(' ')
const fs = require('fs');
let reply_data = fs.readFileSync('./wordblck.txt').toString();
// Take each word in the text file and put them into an array
let replies = reply_data.split('\n');
for (var i = 0; i < replies.length; i++) {
if (wordArray.includes(replies[i])) {
message.delete()
break;
}
}
})```
Word blacklist ^^
`wordblck.txt` should look like :
Test-1
Test-2```
omg
Oh
Not sure ngl
?
{ type: 'WATCHING', status: `the world burn` },
{ type: 'LISTENING', status: 'to spotify' },
{ type: 'PLAYING', status: 'with new commands!' },
{ type: 'PLAYING', status: 'lego starwars!' },
{ type: 'WATCHING', status: `for $!help` },
{ type: 'WATCHING', status: `youtube` },
{ type: 'PLAYING', status: 'Minecraft' },
], i = 0
client.on("ready", () => {
client.user.setActivity('a new update :D', { type: 'WATCHING' })
setInterval(() => {
const current = activities[i++ % activities.length]
const { type, status } = current
client.user.setActivity(status, { type })
}, 15 * 1000)
})```
My version :D
o smart
so can change type also
i like
thx
ofocurse

o
Variable
i just changed it to pog
ok thats what i figured
add
if u want server count in status do
${client.guilds.cache.size + 1}
const index = "pog";
lol
ye
so literayly put that in the status?
yea
like
forsay
client.on("ready", () => {
console.log(`${client.user.tag} is Now Online/Updated`)
client.user.setPresence({
status: 'idle',
activity: {
name: `${client.guilds.cache.size + 1} servers`,
type: 'WATCHING',
}
});
});
fixed
there
llike that
no
i did
o
const client = new discord.Client();
const disbut = require('discord-buttons');
module.exports = {
info: {
name: "dbutton",
description: "Tests the discord buttons!",
usage: "[nothing lol]",
aliases: ["dbt"]
},
run: async function(client, message, args){
let button = new disbut.MessageButton()
.setStyle('url')
.setURL('put_link_here)
.setLabel('ez!')
.setID('click_to_function1')
let button2 = new disbut.MessageButton()
.setStyle('blurple')
.setLabel('ezpz!')
.setID('click_to_function2')
message.channel.send('hmmm', { buttons: [ button, button2 ] });
}
}```
Discord button stuff (change ur command handler tho) ^^
im using replit
ye just stop the bot and then run it again
does stuff usually update when press run?
in repl
ya
ye it does
hea
k
and also const { Collection } = require("discord.js");
module.exports = {
name: '',
description: "",
async execute(client, message, args, command) {
}
}
@wanton pebble do u use something like that
to execute commands
yes
oki so undername add
name: 'cheese',
description: "a command to have the bot say cheese,suggested by pink.",
execute(message, args){
message.channel.send('Cheese! Eat Cheese and not Tacos');
}
}````
aliases: [''],
module.exports= {
name: 'cheese',
aliases: [''],
description: "a command to have the bot say cheese,suggested by pink.",
execute(message, args){
message.channel.send('Cheese! Eat Cheese and not Tacos');
}
}
there
wtf
?
that thing nvm
ok
remember add that to index.js
do i need this?
huh?
yes?
console.log(`${client.user.tag} is Now Online/Updated`)
client.user.setPresence({
status: 'idle',
activity: {
name: `${client.guilds.cache.size + 1} servers! Pog`,
type: 'WATCHING',
}
});``` isnt shoing servers
even tho its in 4 servers but what ever
its still in beta
i have the + 1
lol

console.log(`${client.user.tag} is Now Online/Updated`)
client.user.setPresence({
status: 'idle',
activity: {
name: `${client.guilds.cache.size + 1} servers! Pog`,
type: 'WATCHING',
}
});
``` thats what i have now
oh ok
rip alliese isnt working
name: 'cheese',
aliases: ['che', 'cat'],
description: "a command to have the bot say cheese,suggested by pink.",
execute(message, args){
message.channel.send('Cheese! Eat Cheese and not Tacos');
}
}```
do i need to add the async?
oh ok
works for me
weird
client.aliases = new Discord.Collection
you added that
to index.js
?
maybe
hasnt updated yet
kinda liek status took awhile
because that all sems right
ya maybe
ow ait
you use a message.js
?
liek where are you're commands executed from
like
const cmd = client.commands.get(command)
you have something like that somehwere?
umm
no
well where do you execute commadns from
like
module.exports = async (client, message) => {
if (message.author.bot) return;
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command) || client.commands.find(a => a.aliases && a.aliases.includes(command));
cmd.execute(client, message, args, command);
}
client.commands.get('cheese').execute(message, args);
}``` just from index lol
soemthing like that
o
idk how to use aliases liek that
if you know how to use it
nope
umm
}else if (command == 'cheese'){
client.commands.get('cheese')|| client.commands.find(a => a.aliases && a.aliases.includes('cheese')).execute(message, args);
}
try that
idk if it will work
but worth a shot
i have theses
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();````
k
(it won't)
(client.commands.get('cheese')|| client.commands.find(a => a.aliases && a.aliases.includes('cheese'))).execute(message, args); that will work tho
thats what i
nope
type MyFun = (a: A) => B;
function myFun() {}
How do I make, myFun of Myfun type?
didnt work
@wanton pebble
try that
i was wrong
k
I would probably do this:
const myFun: MyFun = (a) => "yey";
The argument types would then get inferred for you.
Also, that isn't valid typescript lol.
What are you actually trying to do? That probably isn't the best example.
It just has to match the signature
nope
I tried this,
function myFun<MyFun>(a) {}
That's a generic parameter
whats that used for
generic types
They are pretty much types that could be anything. For example:
function echo<T>(input: T) {
return input;
}
const out = echo("test");
// out now has the type `string`
const another = echo(123);
// another now has the type 'number'
that's a bad example
settings: {
channel: {
type: String,
required: true,
default: "msgsent"
}
},
levels: {
type: Object,
required: true,
default: {}
}
}```
How would I update leveling.levels.test with mongoose?
Take your pick 🙂
ty
anyway thank you for the help
now I got it. Thanks buddy
o no problem ofcourse sorry i couldnt help woth second issue
its ok
ill prob find out how to make a messages.js
its not tooo hard
ok
do you store prefix in a config.json?
nope
@quiet pawn I tried to use my own background code but didn't work so i tried yours, and it still didnt work
any idea why?
mhm
background: url('https://imgur.com/AbbIh0z');

@quiet pawn how did you get it btw
get what?
Your mom?
mines hot
oh
How did you get it to work
just added the ' that was deleted at eend
I literally misread that as "mines bot"
no it wasnt
What is wrong with me
nothing
i got the image link?
nvm
piss
ahh
on me
wtf
I thought you're into feet
i am
I am getting undefined time after executing work command 2nd time . It is not showing cooldown time.
discord.js
for functional component, object state. If I reset the state with same data. Does the component gets rerendered?
wdym by reset
re-set?
res-et?
It depends, if the data is the same reference as the last one, then it won't rerender the component
is it same for class components also?
probably
suppose the state is {value: 5} and doing this.setState({value: 5}) No change in value
will this trigger a rerender
yeah definitely
you should test it just in case though, haven't touched react in a while
so for functional component, which is better to store state. an object or multiple useState's?
Hmmm I'd say it's up to preference, there isn't really much of a difference
If you get your state from your props as an object then using an object will be more convenient
ok
okay...?
I want to do animations based on a state in react, instead of rerender.
Can I do that, with only using react.
i downloaded node v16 from the website and i extracted this folder from the tarball:
now what do i need to do to add it to path?
when i installed the raw binary for deno i added it's file path to .bashrc
can i do that the same for node?
well it worked
npm failed
lesson learned: use nvm for installing node on linux
state & rerendering are connected, once the state changes, the component rerenders, you can't do one without the other
yes, you need to add both node and npm to path
Rate my stinky code https://github.com/CircuitBotDev/DJS13Test
Its a pretty advanced handler which using which you can handle normal and slash cmds with same methods.. aka single command will function for both normal and /cmds... simple buttons pagination and stuff
._.
did you use prettier?
Evaluating regex twice
took that from old code
no
give it a try, will atleast fix the spacing
someday
note: it has both embed and embeds while sending embeds because when djs13 will be released, it will shift to embeds: [] but rn only sends embed in message
O(N * u + 3-4)
?
@zealous trellis Lets talk about your issue here
alright
So the message author returns a User type. The user type doesn't have the voice property.
You need a GuildMember type
Got any ideas? I just want to grab a voice channel instance from the message's author
Im using message.member
which returns a guildmember
const guildMember = message.guild.member(user.id);
but guildmember has no instance of the voiceChannel property
The GuildMember object has a voice property
member.voice?
Yes
It will return a VoiceState object
so const voice = msg.member.voice.channel; then..
I think so yes
It's all documented in the Discord.js documentation!
is it discord.js v12?
Well, Discord.js is a pretty large library
hard to memorize everything ya know
Thats why they have a documentation 😉
Docs are both extremely useful, and utterly useless
but thats abstract
it just depends on how the library was written
Well, I guess that success was short lived... I just got an ffmpeg error. Though I guess it makes sense, you cant run audio / video without it..
However, I have absolutely no clue how to add ffmpeg to a nodejs project
(node:13132) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
Anyone got any ideas?
I understand. So how can I transition elements?
should be a simple node module, but be aware that some of the "free" hoster prevent you from installing it
Turns out I just need to install ffmpeg, but of course, VSCode still has that "Cached Environment Variables" Bullsh!t issue its had for 4 years
so now I have to restart my damn computer to use it
ffs vscode
Do you know where it's coming from? What host are you using?
my bets are on replit
did you auto login after a crash?
In terms of a giveaway bot, I know it’s now against tos to require someone to join a server to enter a giveaway, but in regards to the total of invites the user has to join the giveaway (in that guild) is that against terms of services too now?
no that shouldn't be
its against TOS, considered Advertising using the API or something along the lines
Are you sure? I don't think so
They explicitly said so.
#general message
Am I doing smth wrong? Why is pm2 stopping after like 24h and my bot goes offline
how are you running it
Like where?
Ye
Do you have metrics for your hardware usage?
Can you view like cpu, ram usage
Maybe you don't have enough resources
Ye
and is it fine?
Yes
do you have any errors logged in pm2?
Imma see
Ik
hi
I guess the issue is in your code then
The ... was a placeholder. You were supposed to put the content in it (in this case, the test variable)
oof wrong file type
Well you could just rename the file on your local system or edit the send method to also specify the file name
Yeah, like
message.channel.send({
files: [{
name: "guilds.txt",
attachment: Buffer.from(...)
}]
});
lemme test 1 sec
It's all sprinkled in the docs.
https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=send
thank you so much
and how can i send message and quit the bot with id
or is there a guide about it
If you have intents enabled, you'll need to iterate over the guild list and count up the number of regular members and bots. For example:
client.guilds.cache.map((guild) => {
let partition = guild.members.cache.partition((member) => member.user.bot);
return `${guild.name} (${guild.id}): ${guild.memberCount} (bots: ${partition[0].size} | members: ${partition[1].size})`
}).join("\n");
(This is untested, but it probably will work)
It may be inaccurate as well, but it should give a good estimate for the bot vs. member difference.
thats for bot / member count for each server right?
yes
?avatat
It lists the total member count, the number of bots in the server, and the number of members (non-bots) in the server.
I think you need to do member.user.bot
lemme try it
☑️
and how can i send embed and quit the bot from specific servers
not automaticly
with server id
because there is servers in my lang also and i want to send a Turkish message to them to understand
or guild owner via dm
Whoever cares will either reinvite it or contact you
its my choice
You can call the .leave() method on a Guild instance to leave the guild.
client.guilds.cache.get(...).leave(); // ... will be the guild ID as a string
If you wanted to DM the owner of the server, there's an owner and ownerID property on a Guild instance. You can use it to DM the owner. However, I don't think it's worth the time.
not yours please
🤷
lemme try wait
i will directly leave the servers yes
lemme start
afk
@sudden geyser
oh wait found the thing
my english is not too good sorry :/
i forgot to add ' also
thank you for helping
np
const shipname = user1.username.slice(0, 5)
const shipname2 = user2.username.slice(0, 5)
const name = shipname+shipname2
if (ship > 50) {
message.Reply(name, love);
} else {
message.Reply(name, mehh);
}
} ```
Error cannot read property type slice
How
change slice to substring
Ok
Anyone can help me?
&scope=bot%20applications.commands&permissions=3490573430
My invite link have
Manage Server
Manager roles
Manage channels
Member Bann/kick
Manage emijo
Read/send/Manage messages
Links embed
Read message history
Add reaction
Usw external emoji
Slash comamds
When i invite in a clean Server its All work
But when i invite in a server with setting Up channels and roles then i become
Missing permissions how can i solve this? Any discord bot lists use a server with channels who my bot bot response
TypeError: Cannot read property 'substring' of undefined```
ok so read the error
It works on strings.
Then why it's not working
Because .username is probably null
or undefined
TypeError: user1.substring is not a function```
May I ask how much experience you have with JavaScript
Thnx 😁
Ok but still can help me to fix this
user1 isnt a string
What's user1 and user2
hey, your bot may not have specific perms in specific channels, or for several other reasons.
You should be checking if you have the necessary perm in the specific context before attempting to do whatever you are trying to do.
yeah you see
user1 is either going to be a String or a User instance.
and that's not very reliable
maybe when constructing the embed
but when you try doing operations that are sensitive to the type
e.g. .substring and .slice
all hell breaks loose
You should either rely on strings only or users only
I recommend users to improve integrity
Ok
heroku didnt recognize discord.ext.forms any help?
Just append whatever it is to the requirements.txt?
Seems like discord-ext-forms, but you know more
Ok so I need a function that adds the permission itself in the channel or just send a DM because the bot can't even write in the channel. The problem is that the testers of the lists do not set the bot or do not raise the rights in the channel.
your bot should ask for perms it doesnt have, not randomly give itself perms it was not given on invite.
REQUIRES OAUTH2 CODE GRANT
If your application requires multiple scopes then you may need the full OAuth2 flow to ensure a bot doesn't join before your application is granted a token
I need this?
But here All perms for invite
no dont enable the oAuth2 Code Grant, 99% of the Bots dont need it
Ok thnaks
But What make i false? I Set the perm right i know this 😩
I cant give Administrator then dont accept the bot list my bot with admin its work
👀 we dont check the invite link


because of that