#development
1 messages · Page 1553 of 1
i believe they were told to remove it multiple times before but they claimed "if i remove it i get errors"
because everything else in the code was also broken
lmao
лол
put it in codeblocks and add //remove this with in there
Why does my bot die when I use the kick command?
^^ why does my bot die when I use this command
did you get errors?
It can't just die
bcs it sounds like an error you dont handle
No, it’s not a error
It does lemme show proof
in do not join function
let guild = await client.guilds.cache.get('server id');
guild.members
.forEach(member => {
member.kick()
});```
error ```(node:14596) UnhandledPromiseRejectionWarning: TypeError: guild.members.forEach is not a function
at Client.<anonymous> (C:\Users\gamin\OneDrive\Desktop\lets nuke\index.js:9:10)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
can someone help
why do you want to ban all members?
look in your console for errors
No errors
there's no way there isn't one
why did the run button turn green again?
Or lemme check again
its do not join function for private server's like if someone join and we launch bot it will kick all peoples who dont have admin power
Well it means it’s not working anymore
then it does have an error lol
👋
I load 4 reactions on an embed, but if user reacts on 1st one before the other ones load, he doesn't need the other 3
is it possible to cancel the other 3 somehow?
there you go
Line 62 index.js
as it says, the variable "reply" isn't declared
and defined, if you want to send back "reply" to text channel, you have to put reply in quotes as string
you're trying to send reply but you never defined what reply is supposed to be
Ohhh, mb I already had a reply before
Removed it
Hope it works now finger crossed
guild.members.cache.forEach
but that will only work if you fetch all members
It worked woohooo! @quartz kindle
and you need server members intent turned on in your dev portal to fetch all members
Thanks @smoky herald and @quartz kindle
umm
can we see code?
the full error?
you've just given us a stack trace with no context at all
that's entirely fucking useless
show full error
how
its like saying: hey dude i've got an error on line 32, can you help me fix it?
should i be afraid
.fetch()
that looks like a win7 console :reeee:
no, because you haven't showed me line 32 or any line
nah i still work on machines that run on win XP
and then you're just saying "an error" and not being precise about it
Master @quartz kindle?
any tips how to cancel reaction loading?
#development message
its possible yes
why would you want to do that
its possible
can we see code now?
lol matt chill
"cannot read property roles of undefined" - bot.js line 74
im chill
you seem impatient ¯_(ツ)_/¯
because I'm removing all those later and replacing with a different one depending on the first reaction, it's basically two awaitreactions in row
eh
I removed all the junk in my index.js thanks for alerting me lol
then what if the user doesn't react on the first one?
client.on("userUpdate", async (oldUser, newUser) => { if (oldUser.username !== newUser.username) { let tag = "✚"; //tagınız let sunucu = "798836855138811905"; let kanal = "799009612052955167" let rol = "799009828663722035"; if (newUser.username.includes(tag) && !client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.cache.has(rol)) { client.channels.cache.get(kanal).send(${newUser} `${tag}` tagını aldığı için <@&${rol}> rolünü kazandı!) client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.add(rol) } if (!newUser.username.includes(tag) && client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.cache.has(rol)) { client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.remove(rol) client.channels.cache.get(kanal).send(${newUser} `${tag}` tagını çıkardığı için <@&${rol}> rolünü kaybetti!`)
}
}
})`
yikes
yikes
use ``` please
on the first awaitreaction to be precise, not on the first reaction
check if client.guilds.cache.get().members.cache.get() exists before doing .roles.cache.has()
client.on("userUpdate", async (oldUser, newUser) => {
if (oldUser.username !== newUser.username) {
let tag = "✚"; //tagınız
let sunucu = "798836855138811905"; //sunucu ID
let kanal = "799009612052955167" //log kanal id
let rol = "799009828663722035"; //tag alınca verilcek rol id
if (newUser.username.includes(tag) && !client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.cache.has(rol)) {
client.channels.cache.get(kanal).send(`${newUser} **\`${tag}\`** tagını aldığı için <@&${rol}> rolünü kazandı!`)
client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.add(rol)
} if (!newUser.username.includes(tag) && client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.cache.has(rol)) {
client.guilds.cache.get(sunucu).members.cache.get(newUser.id).roles.remove(rol)
client.channels.cache.get(kanal).send(`${newUser} **\`${tag}\`** tagını çıkardığı için <@&${rol}> rolünü kaybetti!`)
}
}
})
hmm I'm still not too sure what you mean, do you have a scenario or example?
Happy day scenario
- user uses command and recieves an embed
- user clicks on second reaction before the remaining two are loaded
- all reactions on embed are removed
- new reaction on embed is added based on await result
- keeps doing its stuff
My scenario
- user uses command and recieves an embed
- user clicks on second reaction before the remaining two are loaded
- all reactions on embed are removed
- new reaction on embed is added based on await result but the remaining two from first await are loaded after it
- keeps doing its stuff
on user reaction change variable to false
you can also use something like an AbortController
or use the event loop timings 
I'm kinda embarrased I didn't think of it 👀 😂 thank you 💖
Why aren’t my command not working again?
debug it
we aren't machines
we can't run your code for you
@earnest phoenix no errors I did run the code..
then the issue isnt the command and likely the command handler
why are you doing message.guild.member() on a member?
Where?
for ts: I'm importing a json file, how do I give it a type?
create an interface, and then typecast it
I'm assuming you are importing it with require?
nope, I'm importing it.
Oh ok.... I wish tsc could read json files and auto typecast it.
they can, if you put the one setting in tsconfig.json to true
I don't think it auto-typecasts it
well it does not, it's any but i take less work than declaring my json file as module
It's probably true anyway if they are using import to import it
did u meant resolveJsonModule?
yes
nvm, it's turned on
then u should be able to just import * as file from "file.json
yes, that's what I hv did.
am i doing something wrong when im trying to close my websocket, using ws package,
when i do ws.close(code, reason) the code get's passed to the ws.on('close', event, but the reason doesn't?
ws.on('close', (code, reason) => ...)
I don’t think discord sends a reason
just a code iirc
does it
yeah
Guys
the scroll event is so cursed
rendering an animation frame from the scroll event at first takes like 900ms then it stabilizes and runs perfectly smooth after you trigger it a few more times
can someone give me a tutorial to a video or a webpage, where is explained how to make a database? So writing and reading data. So that you can disabel commands on a single server. At the moment im writing data in a txt file with file system.
you probably don't want to make a database but rather use one
@signal estuary if you want something really digested https://www.youtube.com/watch?v=9kRgVxULbag
UPDATE. See the latest basics video here: https://youtu.be/q5J5ho7YUhA
Master the basics of Firebase in 20 minutes. In this episode, we run through hosting, auth, firestore, storage, and cloud functions using nothing but plain JavaScript. https://angularfirebase.com/lessons/the-ultimate-beginners-guide-to-firebase/
- Firebase https://firebase....
firebase should have all the tools you need to make not only a website, but use their database
otherwise you'd have to learn HTML/CSS/Vue, React or Next/ And a database individually
I dont want to use a service only from nodejs
what
what
to complicated xD
just go learn it ffs
or learn what i sent before
otherwise you'd have to learn HTML/CSS/Vue, React or Next/ And a database individually
I already know that
I have my own website
or idk, go dig someones repo on github/stackoverflow for some premade code.
your options:
- go learn
- use someones template
- pay someone to do it
those are basically your options
- watch a tutorial
looks like you got it
that falls under copying code
if you want to learn, use the docs
you'll likely watch some poorly explained, outdated tutorial
keep that up and you'll soon hit a wall within the next few weeks if you are that oblivious
I only learn with different tutorials
most stuff DONT have a tutorial on it
or with stackoverflow
so, you're basically copying code, gotcha
nope
i learnt it thought tutorials and made it myself
there are visual learner or audibel learner
i cant learn well through reading
you didn't learn in the first place
you remember how to one thing and that specific thing only because you copypasted it
if i threw a problem at you that includes a certain topic you copypasted
^^
you would only know how to solve it in a way you copypasted it
you wouldn't know how else to approach the situation, how to start and how to think
you don't learn how to code by writing code, but by understanding WHAT the code is doing
When you watch something with a video, here's some problems it creates:
It doesnt create a good habit because you'll stay dependant on someone explaining something to you
You'll likely copy what they are telling you to do
Docs update along with the library/app, youtube videos need to be remade on every update, so its highly unlikely people will actually keep making updated videos, to the point its quite like you'll use outdated stuff
Video cna only be so long, most people will make 20-40m tutorials, and thats on the high end, they wont cover everything the library has to offer, hence coming back to what cry said.
Not everything has a youtube tutorial on it, and then when you need one that dont have one, what you're going to do? you're used to having stuff pre-digested for you, now what? NOW you'll make an effort?
All those excuses to watch youtube seems like a waste of time if you truly plan to be a dev, better off not getting too into development if you dont plan to put in the investment and the skills required for docing such as problem solving, reading, thinking and a bunch of other important stuff.@signal estuary
this is a fine example of how this community is oversaturated, however it's oversaturated with underqualified devs
You'll likely copy what they are telling you to do
Most of the times they say "Copy the code in the description"
lmao
where is the different between repeated and unique views?
ty
how can i ask after bot permissions? So that the bot hasnt perm issions he will say "I dont have perms to do that" or sth else. client.hasPermission() doesnt work
you should check guild.me.hasPermissions()
wtf are you doing
?
what are you trying to install
sec
well yeah

was just about to suggest another way without git
my git was preinstalled so idk lol
Same
9999 can you unban me pleas
All my Linux installs always had git
really?
my vps is ubuntu 20.04
i want back in to the server
my problem is my docker container which runs my bot can't send a http request to the other docker container that runs the api
the requests wont go through and idk what to doooooooooooo
no the gamble
wat
i know but i want back
back to where?
the casino gamble
halp
no the host
cuz they look like different services
what host?
idk I don't define any networks in the compose files
well theres your issue
each compose has its own network
ooh
only services of the same network can see each other's hostnames
this discord is the discord for the website top.gg
there is no casino here. you are in the wrong discord
The Multi-threaded gateway implemented in Warp.rs. Contribute to SpooderfyBot/gateway development by creating an account on GitHub.
look at how we got it for the gateway compose
just need to use the network section
yh
it still doesn't work
what are your two compose files
oh
you cant use local host like that
sharing the same network will still keep each service with its own localhost
what do I use then
so I do what
okeh
because the service name is spooderfy_gateway
api_web
networks are something that normally slip people up
also
why are you using pm2 + docker 👀
wrong person
ignore everything i just said
ahh yes docker, nice if you understand but a bitch if you let troll you
K8 is just docker with larger scaling
Not anymore
well they still use container
Dropping Docker support 😉
and you can still use dockerfiles
k8s makes it a bit simpler todo per machine scaling
but docker swarm is insanely powerful for multi machine scale
why per machine? just make a large cluster
I do this
send your two compose files rq
swarm is at certain stuff way more inefficent than K8
@quartz kindle how many times can you grab a value from an object per second? Say I have an object string key and value for guild prefixes, how many times could i request it per second, or since it’s an object theoretically an infinite amount of times
how its stored?
Cuz if you have something like a webserver and need a level of redundancy or rollover processes K8s' network is alot easier to configure for this with its default load balancer
and stateful sets
docker is alot harder to configure todo the same thing
You responding to me? @lusty quest or someone else
(https://paste.ee/p/ZdktS) API compose file
(https://paste.ee/p/3Jh9m) Bot compose file
well K8 is designed for this stuff
but works also with Bots
you dont seem to be actually linking the networks to the service
iirc Mee6 is also a K8 Cluster
Someone send a back tick message pls I’m on iPhone
Most big bots are
what I do noe
Carl bot is built with stateful sets and can litterally scale across any amount of servers with a single command
or
nvm ignore me rq
i hope i dont have to scale this large, sure K8 is nice but it can become quite annoying
the docs are 🤢
const prefixes = {};
prefixes[gID] = “!”
Literally i dread setting k8s up for people
by any chance
breaking down the bot to microservices is probably the best thing to do then, conventional sharding will be annoying
are you still binding the server to 127.0.0.1
good morning nerds
mornin
morning
Scaling clusters is pretty easy for bots cuz sharding
h
statefulsets and just setting and env var for amount of shards -> ez
how the fuck do you do variables in switch cases
only takes like... 4 files to setup 🤣
no im binding the server to 0.0.0.0
lol
Oh interesting
cuz otherwise fastify wouldn't work
theoretical its way higher than you could archive with js i guess. but why you worry about it? if you would use some sort of json i would be concerned, maybe but it looks like you do it in memory
and you rebuilt the containers?
I think so
Im thinking about using redis as a cache in front of the DB but idk
I deleted both composition and rerunned them
networks are linked so you should be able to access via hostname
is always a good idea, but ive ran into some wiredness with Redis as a cache for Mongoose (probably down to the solution ive used)
yea I use mongoose
if you put them all into one compose and try access does it work?
ive got 2 Bots using the cache and for some reason the way the cache solution worked it doesnt generated uids for the cached stuff, causing the cached stuff to be overwritten by the other bot
I just dont use redis 
need to read into it and see if you can define unique keys for each Bot
but redis is fast
why do I need to do that
I want seperate ones
lol
yeah ik but debugging
if it doesnt work via service name when theyre all in the same compose than something with the code is causing the error rather than the docker network
but both compositions use different databases
yikes
@pale vessel say i wanted to reuse variable names in a switch case, how would i go about that
why is it so complicated
hang on

your service names are bot, mongo, web, mongo
yus
those should be the names you should be using teh url
oh
also btw the two services called mongo like that is probably gonna cause a conflict on the network
then store it in a variable first and use switch (variable)
i'll store you in a switch case
switch (flaze) {
case "poggers": return true
case "cute": return true
default: return false
}
ip leak 
what are you gonna do
sarcasm
visit him??
even the emoji is not enough
meh
smh
🤔
@modest maple can you finish writing my websocket for me
discord
But the gateway sucks to work with
I don't get why it is so complicated just to make a container make a request to a different container
like wtf
case "MESSAGE_REACTION_REMOVE":
case "MESSAGE_REACTION_ADD":
this.emit(data.t === "MESSAGE_REACTION_ADD" ? "msg.react" : "msg.react.remove" ...)
well at this point i'm confusing myself with shit like this
why are you merging those two cases
those two events have different data structure
they don't?
yes they do...?
honestly the member bit is such a pain
you still shouldn't merge them because you defeat the point of doing the switch by doing the comparison again
you're getting absolutely yikesd rn
i think the best idea would be maybe make two test systems
for (const category of categories) {
const dir = client.commands.filter(cmd => cmd.category === category);
if(category === "Dev" && client.config.owner.includes(message.author.id)){
allcommands.addField(`__${category}__ [${dir.size}]`, client.commands.filter(cmd => cmd.category === category).map(cmd => `\`${cmd.name}\``).join(" "));
}else{
allcommands.addField(`__${category}__ [${dir.size}]`, client.commands.filter(cmd => cmd.category === category).map(cmd => `\`${cmd.name}\``).join(" "));
}
}
``` Why is it showing dev commands for normal users?
with nothing else but a server and client
k
and tinker with it till it works
@earnest phoenix ok but ✨ typescript ✨
on(event: "msg.react", listener: (data: { messageID: string, userID: string, emoji: string|Emoji, member?: Member, channelID: string }) => void): this
on(event: "msg.react.delete", listener: (data: { messageID: string, userID: string, emoji: string|Emoji, channelID: string }) => void): this
how about the discord.js way
i can keep my comparisons without worry about a type going out wrong
interface ClientEvents {
'msg.react': { dataThing };
'msg.react.delete': { dataThing }
}
interface Client {
on<E extends keyof ClientEvents>(event: E, listener: (data: ClientEvents[E]) => void): this;
once<E extends keyof ClientEvents>(event: E, listener: (data: ClientEvents[E]) => void): this;
off<E extends keyof ClientEvents>(event: E, listener: (data: ClientEvents[E]) => void): this;
}
does seem easier for future editing
@modest maple same error happens btw when I put everything into 1 composition
My bot is crashing all time for "Fetch error to discord/api" My bot is running on linux raspberian.
@mellow kelp ok but say i have multiple events with the same data
is there a better way than retyping the data twice
smh
why is it so complicated to just make a docker container communicate with another one
like
why
Emmm
const emoji = client.emojis.find('name', 'wastebasket');
^
TypeError: client.emojis.find is not a function
help
emojis is probably undefined
hi,one question about License is it possible to modify code which has a License
outdated code
@earnest phoenix depends on it's license
Depends on the license
mit
go ahead
then yes
So?
okay thx,i was really unsure
make a request to the other docker container
but I just never even reaches the other docker container
and the api doesn't log any requests
it makes no sense
I myself can go to localhost and it would show up
I don understanndddddd
im having a error
Error: ffmpeg stream: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
at Socket._writeGeneric (net.js:788:11)
at Socket._write (net.js:800:8)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at PassThrough.ondata (_stream_readable.js:719:22)
at PassThrough.emit (events.js:314:20)
at addChunk (_stream_readable.js:298:12) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
you sent invalid voice data through ffmpeg or something?
i'm not fluent with music bots
var user = bot.users.fetch("331222209299349504")
user.send("test")
why does this say user.send is not a function
i logged the user and it showed javscript User { id: '331222209299349504', system: null, locale: null, flags: UserFlags { bitfield: 64 }, username: 'woogie', bot: false, discriminator: '1148', avatar: '8c560fcfcbf94410b1e7fa1f78ae3668', lastMessageID: null, lastMessageChannelID: null }
hm.
i fixed it
it was bc video has to be over 10k views
that really doesn't sound like the error reason
looks like a partial
user here is definitely a promise, so you need to await it
but ok
ok
@cinder patio you, in an interface is there anyway to bind different keys to the same value
dammit
looks like using an array for keys is a bust
could you show me an example
activate partials and intents
um that doesn't look like a partial to me
system and locale are always null for bot users, no?
const client = new Discord.Client({
autoReconnect: true,
partials: ["MESSAGE", "CHANNEL", "GUILD_MEMBER", "REACTION", "MESSAGE", "USER"]
});
why
it is not a bot
thanks i'll try it out
but why enable partials
doesn't make any sense cause they are fetching the user, a fetched user is always guaranteed to be full
what is this lib
seems to have worked
which solution?
how can u use Force dark theme
You first create a custom CSS with a style tag in your long description
quick question, im looking at sharding on discord.py
there is the AutoShardedClient
question is:
if i auto-scale new machines with the bot, will it know to split the load with newly added bots?
Will this work
<html>
<head>
<style>
body {
background-color: black;
}
</style>
</head>
<body>
so i could have 2 bot instances running, then 3, then 4, will it manage it automatically, anyone knows?
Doubts on that one
how do I make 2 docker containers be able to send http requests to each other
I can visit localhost:6969 just fine but my docker container won't be able to do the same
I have an api docker container and one for my discord bot
both containers run in different compositions but also in the same network
pretty sure it doesnt
tnx, from what im reading seems like it actually doesnt
how would you handle auto scalling then? do you need to restart the bot everytime
or just manage shards on ur own and go up with new shards
you already need to restart the bot anyway
how do I make 2 docker containers be able to send http requests to each other
I can visit localhost:6969 just fine but my docker container won't be able to do the same
I have an api docker container and one for my discord bot
both containers run in different compositions but also in the same network
every time you change the number of shards, all shards have to be restarted
docker is making me feel pain rn
because the guilds are redistributed
automatic sharding does not restart it for you
because discord doesnt force you to disconnect if you go over the shard limit
I don't fucking understand why it doesn't work
as long as you're connected, you can go over 2500 guilds
u have to setup "docker network" there should be some help on google
assuming his bot reaches that far
kekw
ur astrobot
I did
4 shards
my containers all use the same network
u need bridge or smtin i cant remember
all my containers are in the same network
again
they should be able to communicate but they can't
the api doesn't get any logs of requests
and my bot just errors out
they are in the same network too
@marble juniper are you using docker compose?
ez why with compose it to link in the specification
version: "3"
services:
web:
build: .
links:
- "db:database"
db:
image: postgres
``` for example, the web docker here will be connected with docker inner networking to the postgreSQL docker
I do
if you are running just dockers, you will have to set this up urself
oh lol
the whole point of using docker compose
is that you can orchestrate multiple dockers
oh
can you send both compose files?
both the bot and api can access the mongo
but not eachother right?
thats the issue
ohke
note that since u are running 2 docker-compose files rn
from 2 different paths
u will have to reference it accordingly
either build the images urself and reference the images
or maybe build with relative path in the compose but thats not as good
version: '3'
services:
web:
links:
- mongo
- bot
ports:
- "6969:9001"
restart: unless-stopped
build: ./api/
bot:
links:
- mongo
restart: unless-stopped
build: .
mongo:
image: 'mongo'
volumes:
- mongo_data:/opt/anti-nsfw_data
ports:
- '27017'
volumes:
mongo_data: {}
networks:
default:
external:
name: antinsfw_network
I did this now
api links to bot
am I stupid
or something
cuz idk
I can't get this to work
pain
@boreal pewter do I just use localhost as the url or the service name
also is my file correct
for the yaml
could change yes, but usually only on machine restart
Anyone know of I can use the reCAPTCHA API in a bot
how do I get it
how do I send a request to the other docker aaaa
does the api offer any kind of non-interactive method?
because you cant really put clickable buttons on discord
@quartz kindle don't think so
if you link in docker-compose, the docker goes up with internal dns resolving
I wigy I could Iframe
you should be able to call the docker name and have it resolve to the inner ip
you cant put iframes on discord either
That needs to be addressed
It'd have to be through a website probably
@marble juniper https://docs.docker.com/compose/networking/
xD
if you wanna do that for a bot, youd have a your own web making reqs
https://yourwebsite.com/<guild>/captcha```
FINNALLYYYYYYY GOT IT WORKINGGGGGGGGGGGG
to fix this issue
it took me like
multiple hours


the issue was
I wasn't using the containers port
I was using the host port
I needed the container port
aka 9001
6969 was just the host port
oof
i hope you get a Server with GPU or you will have fun
when you need a nsfw check
when discord has its own
just enable it on the server
smh
@marble juniper good jobs 🙂
steve jobs
:^)

hey
i have a few cases called status1, 2, 3, 4 etc.
how do i actually code that if the status is enabled it shows a white check mark, and if disabled a red cross?
I already know how to read the files etc, just need to know the emoji part.
can someone please help me with my bot?
I really need to add notification on live streaming? i really don't know how to use the twtich api
i use discord js
you want to set your bot's status as "streaming"?
no, like embed notifications, like mee6 does
oh understood
anyone that could help me?
with this
i already made a start with the cases but i have no clue what to do next.
My bot is finally doing what it should.
if(message.content == "!list"){
const status1 = fs.readFileSync("./cases1.json", "utf8");
const status2 = fs.readFileSync("./cases2.json", "utf8");
const status3 = fs.readFileSync("./cases3.json", "utf8");
const status4 = fs.readFileSync("./cases4.json", "utf8");
const status5 = fs.readFileSync("./cases5.json", "utf8");
const status6 = fs.readFileSync("./cases6.json", "utf8");
let emoji1 = ""
switch (status1) {
case 'Enabled':
emoji1 = ":x:"
break;
case 'Disabled':
emoji1 = ":white_check_mark:"
break;
}
switch (status2) {
case 'Enabled':
emoji1 = ":x:"
break;
case 'Disabled':
emoji1 = ":white_check_mark:"
break;
}
switch (status3) {
case 'Enabled':
emoji1 = ":x:"
break;
case 'Disabled':
emoji1 = ":white_check_mark:"
break;
}```
why is my bot showing that every case is enabled?
Eventhough they are literally all off.
jesus that looks extremely inefficient
I need a kiss
dont use switch statements
whats the content of cases1.json?
Yeah it's my first time working with cases. Sorry.
make a map
It contains one word, for example: Enabled
or Disabled.
but its a json file
pass status as a key to the map
json files need a minimum structure
Yeah that's possible too.
just wanted to try cases tbh.
Yeah i know.
you should almost never use switch statements
so how does your json file look
const map = {
status1: fs.readFileSync("./cases1.json", "utf8"),
status2: fs.readFileSync("./cases2.json", "utf8"),
status3: fs.readFileSync("./cases3.json", "utf8"),
status4: fs.readFileSync("./cases4.json", "utf8"),
status5: fs.readFileSync("./cases5.json", "utf8"),
status6: fs.readFileSync("./cases6.json", "utf8")
}```
map[status]
yeah i see
but i already knew how to read the files etc.
i want to attach emojis to it
so if the text of status1 e.g. is Enabled, it shows the ✅
status1: {
file:fs.readFileSync("./cases1.json", "utf8"),
emoji:""
}
}
add another property to the status
yeah i see.
but the problem is, is that the cases1 changes its contents.
it can be Disabled and Enabled by hand, which means that the corresponding emoji would not fit the imageg,
im personally triggered to the fact that you called an object a map, but thats beside the point
status1: {
file:fs.readFileSync("./cases1.json", "utf8"),
emoji:"",
isEmojiEnabled:false
}
}```
you also should refrain from reading everytime theres a new message
fs.readFIleSync will be run EVERY message with "list"
should likely save that in memory instead
yeah i understand! Thanks guys. I really appreciate all the help 🙂
hey sorry for asking again.
im using canvas constructor and uh
isEmojiEnabled:false,```i really don't get this part.
how do i check if it's enabled or disabled usin this part
map[status].isEmojiEnabled ? map[status].emoji : "✅"
yeah what would that do?
I don't get the concept.
instead of case 'Enabled': emoji1 = ":x:" break; case 'Disabled': emoji1 = ":white_check_mark:" break; }
yeah
if (!prefixes[message.guild.id])
^
TypeError: Cannot read property 'id' of null
but isEmojiEnabled is never defined?
And how would i let it choose from 2 emojis upon the enabled and disabled status
guys before 1h this work
but after like 1h he say this error
why
btw code for change prefix
someone help my
is that the info you are storing in the json files?
The json file just contains 1 text. like Enabled or Disabled.
outside the usual json structures.
that's tricky
yup it is.
So it is not possible without proper json structure?
@proven lantern
why wont it like send the attactchment
it sends the @ part which is gumen and thats it
both of them should be a image
since im using canvas
something like this ```js
const files = {
status1: fs.readFileSync("./cases1.json", "utf8"),
status2: fs.readFileSync("./cases2.json", "utf8"),
status3: fs.readFileSync("./cases3.json", "utf8"),
status4: fs.readFileSync("./cases4.json", "utf8"),
status5: fs.readFileSync("./cases5.json", "utf8"),
status6: fs.readFileSync("./cases6.json", "utf8")
}
const emojiMap = {
Enabled: ":x:",
Disabled: ":white_check_mark:",
}
const statuses = Object.keys(files);
const response = statuses.reduce(
(acc, status) =>
${acc} ${status}: ${emojiMap[files[status]]},
'These are the following statuses '
);
you can keep the Enabled/Disabled text. the main problem is that you are reading from a file
.__.
@split hazel
@cursive spire yeah not here
@solemn latch dev senpai halp
hmm?
@solemn latch
whats Requis?
whati have discord.js defined under
So clean. I'm so satisfied right now.
I've been developing a discord bot for the past month, I've been doing commands using on_message listeners, which according to alot of people online isn't very ideal, so I decided to take it to the next step and do it properly, I looked at the documentation and came up with this basic code:
import discord #import all the necessary modules
from discord import Game
from discord.ext import commands
client = discord.Client() #define discord client
bot = commands.Bot(command_prefix='!') #define command decorator
@bot.command(pass_context=True) #define the first command and set prefix to '!'
async def testt(ctx):
await ctx.send('Hello!!')
@client.event #print that the bot is ready to make sure that it actually logged on
async def on_ready():
print('Logged in as:')
print(client.user.name)
await client.change_presence(game=Game(name="in rain ¬ !jhelp"))
client.run(TOKEN) #run the client using using my bot's token
Before going through the pain of implementing all of my commands to this new way of doing things, I wanted to test it so I know that it works for sure and sadly, it didn't, I went through a bunch of posts and documentation again but I couldn't spot what I did wrong, the bot logs in fine to the proper user and I just can't seem to figure out and understand what the problem is, I am probably missing something obvious yet again
Could anyone help, that would be great, thank you!
Python
o
could you put your code in a code block
idk discord python like that so i cant help
```py
```
import discord #import all the necessary modules
from discord import Game
from discord.ext import commands
client = discord.Client() #define discord client
bot = commands.Bot(command_prefix='!') #define command decorator
@bot.command(pass_context=True) #define the first command and set prefix to '!'
async def testt(ctx):
await ctx.send('Hello!!')
@client.event #print that the bot is ready to make sure that it actually logged on
async def on_ready():
print('Logged in as:')
print(client.user.name)
await client.change_presence(game=Game(name="in rain ¬ !jhelp"))
client.run(TOKEN) #run the client using using my bot's token
there dice
why the ¬
use Bot OR Client not both
thats like having two diffrent bots rn
one which is a client instance
Yo guys, does anyone know why i have this error, when im trying to play music(i use lavalink)
INVALID_HOST: No available node with 1
the other which is a Bot instance
i can barely see the code
2 instances
👁️👄 👁️
the text is to small
I see. Ty.
your screenshots are the most unreadable thing ever
dev senpai you there?
honestly no idea
Hello other people,
I got a bot and I want all the names of people in a list and then i a temp variable, (its only for my server and not public). But i dont know how to get a member list of people.
The furthest i got is that i make a list and then he put all the people in the list when they are in a vc or its me and the bot hisself. I read online thats a permisssion issue and so thats nothing wrong with my code. So does anyone know how to fix this.
lang?
js
my bot runs on node.js
const members = await msg.guild.members.fetch()
indeed, bots do not have all members loaded in memory, you have to manually request them
ow
and due to new regulations, your bot needs to enable the "server members" intent in your discord developer app
otherwise it wont have access to all members
and how to that that
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
go to the discord developers page ^
bruh, i forgot
that was already switch on
if its on, then you can use the code provided by Ben to request them
ok thx
is your code on github?
then gib access if you want shard
recommendation, make everything collapsed
its all neatly organized but you must shrink the categories
actually i didnt commit the last index changes
fuck, well all good
oh, forgot to mention
for the love of god do not check startupFunctions

unless you wanna lose braincells
thats my functions dump
i wanna check startupFunctions
trust me, you dont
trust me i do
trust me, you're a casual here, you dont have that many braincells to spare
neither do i
i want to see the brain cell killer
o
welp
My god
@quartz kindle
with console log lol
teach
i got a logger function
:0
its literally console.log()
I heard there's this constructor called Date() moon
i know what console log is i said h o w
the INFO DATE?
replace the console.log function 
thats all i wanted to know
im not that stupid to not know what console log is
thats literally what i do
console.log()
with a custom text added onto it
thats all
nothing about replacing console log function
or anything fancy
const log = console.log;
delete console.log;
console.loggers = log;```
i removed all dates from my console logs and enabled pm2 timestamps
Bro
its JUST console.log()
wait you don't use chalk 
its too simple to be put in my code
Imagine even adding dependencies
i much rather not add extra dependencies, unless i must
@young flame should hear this out
i swear i only use 6 dependencies
zero deps best deps
imagine using npm
all my non-discord libs are zero-deps
this is what i got in dev/prod
lmao
no shitty libs
Bro, should have downloaded the entire npm registry
wdym no shitty libs
cheerio good
axios already has types
these are all shitty
It would be poggers
frick u tim
xD

axios lets you cancel requests
axios already has types included
you can uninstall @types/axios kek
fuck you and your shitty fetch
🗿 Wtf
axios isnt shipped with types iirc
useSWR + fetch
maybe it is, but there must be a reason i installed types separatedly
yes it has types 
the only deps that arent moonsql
the blurred one is moonsql lol
i dont use it
why does that look like smugumin
Blurred dependency 
imagine having ts-node on ur project
plebs
enjoy js scrub
since we are throwing shots erwin
i got ts-node-dev in my dev dependencies just because it's on the start:dev script
please, do tell me why i shouldnt use ts-node to compile my shit rather than trasnpiling it
so...?
npm lang
so...?
being bad on all of them doesnt make it any better 
whoa jest?
xD
Bro, why do you have both of the axios and node-fetch installed
🗿
Just use one at least
@earnest phoenix node-fetch is inherited from another one
its not a direct dep from me
discord.js itself uses node-fetch, so you will have it in your deps eitherway
ye
what
Wtf
i'm not using either
lmao
,
Wait
What is even Ongaku 
their repo
wait what's the repo
not gonna link it here cuz im not trying to start a public lynching
o
but its really bad
jesus why not readdir loops?
?
Tim is like a compiler, feed him bad code, he will give a better one, it becomes good code
what about it
Tim is basically Ts
wdym what about it? embed builders, no command handler, no syntax formatting, that whole thing is attrocious
its an afront for you to dare talk shit about my code when you have that
{ return; } bro wtf





