#development
1 messages · Page 1800 of 1
What does this mean?
something that's going on on the server's side
like status 500 or something
hi im getting this error and im not able to fix it, can someone help me with this pls?
Tracks is undefined
ah it works now thx
Have any of you tried GitHub copilot yet? https://copilot.github.com/
nope
I'm still on the codespaces waitlist 
iots just giving me a wierd arrow what is the probelm
error while voting!
at HTMLInputElement.<anonymous> (voting.js?13534371517:26)```
Try refreshing
no lmao 
Is learning data structures and algorithms nessary
still on wait list pain
how can I check permissions if its not a function?
Gives me this: (node:42) UnhandledPromiseRejectionWarning: TypeError: message.author.hasPermission is not a function
I got this if(!message.author.hasPermission('MANAGE_CHANNELS')) { message.channel.send('Dude, you must have manage channels perms or else what are you even thinking?') }
already got it 😎
message.author is a User, users don't have permissions
No, member
oh.
So i do
const member = message.author
and then use it or is it like already made?
no, you need to use
message.member.hasPermissions```
how does your bot have 10k users I dunno
oh so its already made. Thanks
yes
same ngl
chill lmao
small brain: showing server count
big brain: showing total user count

if you don't understand how a user is different from member it would really help to learn about relational databases and relationship types
actually just learn about relational databases regardless
I tried to install ffmpeg on mac with this brew install ffmpeg
I'm getting this error.
do I need to install python too?
yes, idk how its with the Build Tools you need on Windows and Linux
build tools is basically the xcode development tools
for anything like ffmpeg needs to have the xcode build tools installed in order to run primary audio functions
its 2021 and i cant make a ban command NICE
congrats
I wonder how many discord bots would be around if there were no huge abstraction libraries like discord.py
probably like 2% of the current amount considering how confusing the discord api is
.js is better
.js with all the any is fun
i n t r e s t i n g
When does the weekend voting start/end or is it based on the users timezone? I know it's 'Friday to Sunday' but I want to display the weekend reward status in my bot
Friday 0000 to Sunday 2359, UTC
Hah yeah. When you start adding up things like the gateway quirks and rate limiting, I think most people would lose interest.
it would not attract people like it does right now, but there will be people who would make it anyways
Yeah I guess bots started as hacks around internal APIs.
Definitely wouldn't be as popular though.
Hello
I have to say though, there is a point where you can over abstract something.
There are a couple of libraries around that have done this :)
wait rly? 👀
[root@NOVABOT2 novabotdrop]# node nova.js
internal/modules/cjs/loader.js:1057
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /root/novabotdrop/node_modules/canvas/build/Release/canvas.node)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/root/novabotdrop/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/root/novabotdrop/node_modules/canvas/lib/canvas.js:9:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
idk what does this mean
pls help
did you have the build tools installed?
git?
I have been trying to get node canvas to work on CentOS 7 yet I keep getting this error that libstdc.6.so version CXXABI 1.3.9 is not found, from checking the version with strings /lib64/libstdc++....
Anyone else encountered an issue with their bot, that suddenly it works everywhere except one server? it worked before in that server it just randomly stopped, and no error logs or anything wrong shows
Restarting the bot seems to fix the issue it, but is it a known issue or something?
already upgraded to centos 8.3
It's related to sharding.
/root/novabot/node_modules/@discordjs/opus
idk why I fail everytime installing discord opus
maybe the version is too old
git --version
git version 2.27.0
Rust, gtk, Windows
I can't for the life of me figure out how to get this error away no matter what I try to install. I've tried Google many times but nothing helped.
The error occurs when I run cargo run in my project directory.
Hey, thanks for answering 🙂
Isnt sharding only a problem that need to be handled when the bot is in a large amount of servers? i think i read somewhere, its 2000 + servers when i need to shard?
Discord can sometimes shit itself for no apparent reason
Yes you are correct
sometimes Always
Pretty much
@earnest phoenix @slender thistle i see, thanks for the answers :D, hopefully they fix that issue in 2.0
it only happened 2 times (2 month apart) so far that i know of because people reported to me, and restarting the bot solved it
np
It's not an issue with discord.py
It's an issue with Discord itself
Since Discord refuses to send you gateway events for one server, there's nothing really you can do I believe
Well they also have a stupid large bot sharding for bots with 150k guilds
ah i see :/
why I cant install discord@opus on my vps 😦
I'm gonna cry
npm install @discordjs/opus
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
@discordjs/opus@0.5.3 install /root/novabot/node_modules/@discordjs/opus
node-pre-gyp install --fallback-to-build
Looks like your npm install might be a little old/your lockfile is generated using a very old version of npm
help about this?
update your install of node.js
It is possibile that this package could not be supported by centos?
idk how to do it on a vps 
node --version
v12.22.2
npm -v
6.14.13
ah yeah, lockfileversion 2 is after 7.0
npm install -g npm@latest might do the trick?
you may have to re npm i or even npm init after that.
Hey everyone! Recently I've been learning a lot about Slash Commands and Client API. So I want to make my bot to callback with an embed. However when I try to define my embed in the content section (through a variable). It shows me this error. Can you help me please?
the embed isn't supposed to be in the content
are you responding to the slash command?
well, yea
that's the data obj structure in the response object
I need set up green discord button when any one press bot send server link
that's to me or to him?
to them
oh alright
const embed = new Discord.MessageEmbed()
.setTitle('Три полоски')
.setDescription('Адидас кроссовки')
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: 'Абибас',
components: [
{
type: 1,
object: embed
}
]
}
}
})```
i clearly have brain damage
tf
i tried doing something
all you have to do is follow the structure that's in the docs
for instance, want the message to be tts? add a tts field in the data object and set it to true
oh shit
same goes for embeds
i didn't scroll down lmao
let me try
i found tthis and tried
type: 4,
data: {
content: 'Абибас',
components: [embed]
}```
stop using components
shit.
literally read a few lines above that
didn't notice
yeah
ok thanks
does the permissions works differently on slash commands? because im responding with an embed and although i removed all permissions from my bot, he was still be able to send it? 
hello guys
i am ranveer
i am a bot dev i have a bot
i have 2 bot
Moon and Ranveer Soni Utlity
anyone can help me in development of my bot?
||i will be ur friend to XD||
What language? What does it do? What do you want someone to help you with? Don’t ask to ask read the channel topic 👌
ik
sure!
wut
read what u asked lol
i kow
does anybody has successfully made a music bot with discord.js@dev and @discordjs/voice?
Does anybody know why the bot doesnt return at this poin?
Code:
if(+max > +min) return
//max is 4 and min is 2
I also tried
if(Number(max) > Number(min)) return
But it doesnt return. Idk why
I already debugged but couldnt find out
Can you show more of the scope surrounding that block of code?
show more code
const errorLog = require('../common/errorLog.js')
exports.run = async (client, msg, args) => {
console.log("Random")
try {
let min = args[0]
let max = args[1]
if(!min) return msg.channel.send({content: "``❌ Please mention a min number``"})
if(!max) return msg.channel.send({content: "``❌ Please mention a max number``"})
if(isNaN(min)) return msg.channel.send({content:"``❌ Please mention a real number``"})
if(isNaN(max)) return msg.channel.send({content:"``❌ Please mention a real number``"})
if(Number(max) > Number(min)) return msg.channel.send({content:"``❌ Max number must be bigger than min number"})
msg.channel.send({content: "Your number is: " + Math.floor(Math.random() * (max - min) + min).toString()})
} catch (e) {
errorLog.logError(e)
msg.channel.send({ content: "``❌ There was an error``" })
}
}
show the command you ran, and what the bot replied
Wait I am soo stupid
if(Number(max) > Number(min)) return msg.channel.send({content:"``:x: Max number must be bigger than min number"})
Look at this xD
If number mx is greater it returns that the max should be bigger than min xD
I am sooo stupid
xd
const Discord = require('discord.js');
module.exports = {
name: 'resume',
description: 'pauses a song/nasheed',
async execute (client, message, args) {
if(!message.member.voice.channel) return message.reply('Pleases be in a vc to use this command.');
const queue = client.distube.getQueue(message)
if (!queue) return message.reply("Nothing in the queue!");
await client.distube.resume(message)
await message.channel.send("**Resumed Playing!**")
}
}
this does not work
ok i seem to be getting a mass amount of errors from missing permissions for setting a users nickname, however im a bit confused how
i check to make sure my role is higher than the users highest, i check that i Manage Nicknames, and i check if the user is the owner
what else is there
nah im just dumb
to satisfy typings i only checked if db.log existed and it doesnt always

What is the api refrence to send a message to a specific channel in a specific guild?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
im talking something like client.guilds.cache.get('GUILD ID HERE').send(embed)
is that it /\
then you should've noted you're using a library, you asked for the api reference
discord.js
and no, you can't send a message in a guild, you can send a message in a channel
so client.guilds.cache.get.(GUILD HERE).channels.cache.get('CHANNEL ID').send(embed)?
.find()?
if ur id is wrong or u dont have channel/cache
no, get is fine
but u should add fallbacks
like fetching the channel if its not cached
i am
or stopping if a guild isnt available
im copying the ID directly from firebase so i know its correct
thats precisely the problem
databases dont update along with discord
so if a channel is deleted
now what?
do u check for that?
you can skip getting the guild and use client.channels.cache.get()
im talking guild id
and the channel is my private server
if u dont have a channel cached, do you get that?
tell the end user they're retarded for deleting the channel
well yeah, still tho

thats a route too
GENIOUS
but at the end of the day, the errors will come on ur bot
not on the end user
so the only one negatively affected by this is u
specially if u get too many errors
cloudflare might ratelimit u
when does cloudflare come in
u have a quota per day of errors
ohhh
cloudflare is proxies for discord, it passes thru it before
i dont send errors to discord, unless disc.js does
i feel you
client.guilds.cache.get('857312635585429504').channels.cache.get('860537456020684830').send(embed2)
^
TypeError: Cannot read property 'channels' of undefined
at ReactionCollector.<anonymous> (N:\Desktop\ColdRP bot\commands\requestaccess.js:62:74)
at ReactionCollector.emit (node:events:381:22)
at ReactionCollector.handleCollect (N:\Desktop\ColdRP bot\node_modules\discord.js\src\structures\interfaces\Collector.js:100:12)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
BRUH

not like i didnt warn you
u dont have fallbacks nor any checks
Typescript would've yelled at you the moment you typed that

how do i force the bot to cache it
either a fat discord.js caching moment, or they copied the wrong id
is there anything else i can do
and again, just use client.channels.cache or even better, client.channels.fetch()
my bot is too big to switch
it aint
You don't need the guild to get the channel
no such thing
omg i forgot about fetch
then client.api.channels[id].messages.post({ data: { embed } }); or something
so my code should look like this
try{
await client.channels.fetch('860537456020684830').send("Type-script and detritus are bad")
} catch {
console.log(err)
}
<rest>.raw.post({
body: {
content: 'Hello world',
},
route: {
path: 'channels/channelId/messages',
params: {
channelId: '123456789012345',
}
}
})```

i dont like rest
why
cuz d.js doesnt add features the day they come
so you're either stuck with using the api docs, or waiting for them to add it
Dont you dare say deterius does
for the love of god
Cake adds a feature the day it releases!!!!!!!
True doe
join general so i can show you how much of a b***ch it would be to change it to detritus
wait
i cant stream
lmao
There is more as well
that's not THAT much

if you talk to Erwin he'll make you want to use detritus regardless of whether or not it's actually useful to you
can you send messages using WS
@opal plank convince me its worth it
what is WS
ok no
you need REST
coolio
just could use unless you were in a whitelisted guild
not like you could use it back then since you needed to be whitelisted
oh ok
to make a single api call or switch a library your codebase is built around and rewrite the whole thing hmm very difficult decision indeed
oh, no. I dont want that

Why cant all functions just by default be async
i have not been making discord bots long
I do minecraft server setups
For very cheap prices and i can beat the competitors
Sorry just had to plug myself there
Is there ANY WAY to make a switch statement async?
Wrap it in an async function
massive brain
My router just comitted die
Cant do that
yes you can
thats what the /s stands for
; expected
red means it worked
await async switch(var) {
async () => {
await case case1:
await break;
}
await return
callback hell v2
more async please!
Lol
await swapBotToDetritus();
async switch(true) {
await case true:
await var.forEach((any) => {
if(any === 'case1'){};
if(any === 'case2'){};
if(any === 'case3'){};
if(any === 'case4'){};
})
break;
} ```
i improved ur code @vivid fulcrum
how to properly use switches
await letPeopleUseWhatTheyWant()

await imonmobileanditstrash()
Me too
I cant do code blocks :(
You can
I tried
Exactly
‘
Thats all i have
you can still copy paste though
return see ? “I” : “can”
imagine using default keyboards tho
Hold your finger on the ‘
flesky or some other app keyboard have amazing themes n shit
plus they can have custom buttons if u want
magic
Omg
gboard >
Were on the same phone xd
11 pro here
Same here
the only thing i dont like about gboard is the fact that they removed built-in search
methods[(await Promise.resolve("managedLibsAreTrash"))]();
How do you have the prrcentages above the bars?
Jailbreak
since i may have talked to the devs quite a bit so they give me free shit
Don't use discord-buttons
Ofc
Discord.js has them natively
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Checkra1n?
detritus has buttons right?
I need to swap
Taurine
doesnt it already support the dropdown stuff?
14.3
Thx
it do
thats what ComponentSelectMenu is for
bro ur code is bad because you're not even switches broo
Hi xet
hello
thats the point 4head 
using if/else on a switch

could've await'ed the rest tho, can never have enough awaits
yandere dev moment. Use switch = codebase immediately fixed
any other website
not officeal
exactly
well, you asked for the discord website
i need soem thing
ditch forEach and use for...of = 127% performance increase
yandere dev 
i ask any discord button website
what?
like discord-buttons package?
or u want an example of someone using buttons?
i dont get it, cry sent u what u asked for
a discord button website, technically
does he mean widgets?
like guild widgets/badges?
so many questions

cannot compute, shutting down
I mean, last night he was spamming the same error message over and over
So we need more information
Is that your face in bg ?
What's wrong with learning a little ts!
...have you used it?
Personally I haven't used it
what about it?
u can use js, i told you multiple times
The documentation says otherwise
its like eating a cake, vs eating a cake with confetti , icing, and cherry ontop
its still cake
bad example, but u get the idea
you just used cake bcs of cake right?
its just that we, who use typescript, get a lot more neat shit ontop
Learning a strongly typed language is also never a bad thing
if u ever plan to switch to another language, knowing how strong typed objects/varaibles work will greatly reduce the amount of things u need to learn
@limber mica but the point stands, u dont need ts to use detritus
i dont like TS, but use it to give it a try, for now i would still prefer js over TS bcs js usually just works and dont get caught on stupid errors that are only there for the compiler
typescript catches type errors you can fix in 2 minutes instead of struggling for 2 hours to fix a type error in production js code
^^^^
there IS a bit of intial investment
but it pays off
that investment is in form of more code(aka u need to type your objects/variables) and some rare times, fighting with typescript toget shit to work
plus ts is just prettier to look at
but it saves u from having to wait days until eventually someone randomly stumbles upon a bug
I love the look of ts
ts is bae
I mean that still happens but it's more rare with ts

Just so much more structured
exactly
my blog is in js cuz there's 0 important business logic but for everything else, ts good
xet, u might be able to gimme a hand on what i was struggling with yesterday
with declarations
not only this, but it's basically early access to es next features
this basically
very nice to work with
bruh i cant add async to a switch case
some ts features actually got yoinked into node
Oh no...
a switch isnt async
the code u putting in it is
async only works for promises
How do i make the code async then, so that i can use await
oh
its like saying my console log is async
like what?
not how it works
but either way
make a function
and call ti after
its fine i got it working
seems like a classic case of classes bad
console.log(hi);
continueStuff();
async function continueStuff() {
switch(a) {
case 'a': await console.log(await 'hi');
}
}
stupid example, but u get the point
N:\Desktop\ColdRP bot\commands\requestaccess.js:62
client.channels.fetch('860537456020684830').send(embed2)
TypeError: client.channels.fetch(...).send is not a function
lost a tuff of hair doing that
fetch() is a promise
another issue where ts would tell you

stop with TS please
That does not work either ;-;
im dying
{
"resource": "/N:/Desktop/ColdRP bot/commands/requestaccess.js",
"owner": "typescript",
"code": "1359",
"severity": 8,
"message": "Identifier expected. 'switch' is a reserved word that cannot be used here.",
"source": "ts",
"startLineNumber": 42,
"startColumn": 32,
"endLineNumber": 42,
"endColumn": 38
}
it says the exact line
"startLineNumber": 42,
"startColumn": 32,
"endLineNumber": 42,
"endColumn": 38
hold on
"resource": "/N:/Desktop/ColdRP bot/commands/requestaccess.js", and where it happened
HOLD ON
so ive got progress
can u think of a way to just "make that work"?
cuz legit, changing classes at this point will be a pain
So its not erroring but the switch statement is not working with the reaction collector
thats just a small example, but changing the structure from classes will legit require a chuky rewrite
So when i react it does nothing
another great thing from vsc, a debugger
I don't really understand what you're trying to do. Update the type signature of a constructor or what?
see whats going on when you click ona button
that and the types
the end-goal is have it so whenever the library emits a <Message>, it has what i added onto the intial class
that code does the trick
it transpiles AND compiles file
however VSC does not like it one bit
and its one of those instances where ts-ignore just doesnt rid of the error
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Im dying
Like, really bad
My collector is not working
wait
ok, so i know why my first thing was not working
but im confused now
?
Just wrapping the code in async function won't make it magically work
You have to call the function later
So how would i go about that?
like
collector.on('collect', (r, u) => {
async function Blyat(){
//Put your shit here
}
Blyat()
})
On mobile rn, that’s probably why
even ts-ignore doesnt rid that
but its compiles just fine
and if i switch to implements, the it no longer has property
Hi, I have: ```js
function sendData(e) {
e.preventDefault();
const xhr = new XMLHttpRequest()
xhr.open('POST', '/guilds/<%- id %>/automod');
xhr.setRequestHeader('Content-type', 'application/json');
const ignoredChannel = document.getElementById('ignoredChannel').value;
const ignoredRole = document.getElementById('ignoredRole').value;
const blacklistedWord = document.getElementById('add-word').value
const automodModule = document.getElementById('automod-module').value
const ignoreMod = document.getElementById('ignore-mod').value
let wordsInDiv = '1';
let channelsInDiv = '1';
let rolesInDiv = '1';
if (document.getElementsByClassName('blacklistedWord').value !== '1') wordsInDiv = document.getElementsByClassName('blacklistedWord').value;
if (document.getElementsByClassName('ignoredChannels').value !== '1') channelsInDiv = document.getElementsByClassName('ignoredChannels').value;
if (document.getElementsByClassName('ignoredRoles').value !== '1') rolesInDiv = document.getElementsByClassName('ignoredRoles').value
const data = { data here }
xhr.send(JSON.stringify(data));
}
cuz its not a class, technically
codecademy still trying to teach xmlhttprequest
it's literally older than me
u kno y the page is refreshin tho?
also
you should probably switch to a SPA for something like this
you seem to have a lot of states you need to manage
Still dont work and im dying
what does it show (in console) ?
No error, its just not calling the function
In the .then statement it is triggering and firing the console.log statement but not the function
is it even calling the collector.on('collect') ?
...are you sure?
Ok, just making sure
what probleam
maybe down, or wrong website
My function is also grayed out
Then it’s not being called
i take from npm website
I don't know why the code isn't breaking
but it should break
If I was the interpreter / Compiler I'd surely break
When you did client.channels.fetch('860537456020684830').send(embed2)
From no direction this should work
IDK why it isn't showing errors
But it should
cuz client.channels.fetch('860537456020684830') will return a Promise
and you can't .send to a promise
until it's resolved
"'stroke' is declared but its value is never read"
and you didn't wait to get resolved
Because you didn't call the function?
But i did
bruh
you care for warnings ?
the whole code is breaking apart
also what is waffle ?
he is a waffle
Wait a second...
I meant what is stroke ?
the function, because im having a stroke
you know what leave async await
use .then()
it also works almost the same way
Guys, angular vs react
and why
use this
client.channels.fetch('860537456020684830').then(channel => {
channel.send('Whatever')
})
react duh
react
but like why
Cuz I can't use angular
I tried to learn and it sucks
vue is definitely the most simplistic
vue > react or no?
In some case better than react
but not overall better
hmm,
want x? do x and it works exactly like you want it to
while in angular and react you need to do y and z in order to achieve x
alright well, thanks!
vue is very good but i still prefer react
IT WORKS
But** await** better** then()**
Thank you, im not good with arrow functions so i did not think of that
You can't use await in base level
Why
cuz it's node.js not deno
alright, deal. I'm using react
You have to put await inside a async function
I also use React and it's really good.
btw, then() also helps you with error catching in a more precise manner
oh also, some really good news about react 18
they're adding automatic state batching
But using then() creates inception
so when you need to update 2 or more states, you won't spam re-renders (in hooks ofc)
like
import(`file.txt`).then(data=>{
}).catch(err=>{
console.log(err);})
Rather than
const fileData = await import(`file.txt`);
but then, there's a problem
you can't use, data outside of the .then() statement
whereas you could use fileData anywhere in the program
Yes, that's the downside.
react is a gangsta until redux enters the room
lol redux 🤡
tbh I never saw any react tutorial not ending with redux
because up until recently it was really the only decent choice for global state management
now we have react context and recoiljs
react context is native to react and most of what redux does can be replaced with react context
if you still need global state management, use recoil
it's so much more user friendly and simplistic
recoil is also designed by facebook themselves
I don't know exactly how good it is but for me "mern" is the best
There is an unrelated problem, if I remember correctly, there was a function called dispatcher.seek(ms) in v11, what happened to it?
Just ask your question pls
ahh its not a question its just that i want help in a command
Does it involve fixing an issue (e.g. a command not working as expected)?
no
its nothing like that
sorry
Hey there, I've a question
Is it possible to mass-clear reactions from all the messages in one channel in discord.js? If so, how?
Thanks
(Please ping me when responding)
technically yes
plausible? no definitely not
Why tho
because ratelimit exists
you're going to hit it constantly when clearing reactions of a whole channel
What about making a loop that'd consist on:
- Check if there's a message
- Check if the message has reactions
- If it does, clear them all. If not, pass to the next message
And loop it until there're no more messages to check in the specified channel
Or does rate limit still exist in that case?
it does
because
A - You're still fetching messages
B - You're still clearing reactions
everything regarding the api has ratelimit
Technically you could make an interval loop eg 1 second and you'd be ratelimit free, it will be alot slower tho
also, iirc, you can only fetch messages up to past 7 days
14 days I think
make "alot slower" bold 
I mean
u could do the math
how many actions u have to do a second and then check the ratelimit
and set the interval so u just about don't hit the ratelimit
how do i check a channels topic
The topic property...?
like how can i check the message channels topic (this bit)
Oh uh then it's kinda impossible I think? Those channels don't have more than +30 messages for sure, but some of them are really old...
Isn't there a way I can clear reactions in an automatized way? Those're vote channels, where people vote for their favorite stuff by reacting to the messages...
@pale vessel
TextChannel#topic
dont think so, unless u just clone the channel but you'll lose all messages
actually there's no limit
pretty sure there is no?
the 14 days limit is for deleting messages
yup
Oh then the loop idea could work? 
If the channel has only 30 messages then you should be able to fetch them all at once and iterate through them yeah
How to replace characters from JSON file in python? I tried this but doesn't work
list = json_data["players"]["list"]
list = list.replace("[", "")
list = list.replace("]", "")
list = list.replace("'", "`")
Woah that's amazing! Thanks!
you're doing something very wrong. Are you trying to parse json?
Ye
I want to remove these [ ] '
that's already a list you need to loop through them and format the names accordingly
The list is not fixed so idk how to do it
string.join probably
right, look up string.join
Ye, well I wanted to try make a bot which shows mcserver status but I have no idea how to remove these [ ] ' from players list
those [] don't exist at all
KuuHaKu ^
", ".join(list)
and this will join the list
making it an str
and put a , in between each value
so py food = ['apples, 'pears', 'potatoes'] print(food)
this here ^ prints ['apples, 'pears', 'potatoes']
food = ['apples, 'pears', 'potatoes']
print(", ".join(food))```
this here ^ prints `apples, pears, potatoes`
is that what you want?
there are actually many methods
you can also do food[0:len(food)]
Yikes, that's just gonna copy the list
yeah i realised
food[:] >>
ignore the len part
Yes, and not to be rude but I'm new to coding so can you add that to this?
List = json_data["players]["list"]
The one you send prints it but I wanna use it in embed
As a value
uh
embed = discord.Embed(title="Players online", description=f'**Players:** {", ".join(List)}')
Tysm it works
dont use list as name
I mean, they don't
oh, python is case-sensitive?
always has been
You can't do "{""}" but you can do "{''}"
f"{""}" to be exact, since it's gonna get concatenated anyway
I'm gonna add another field then
It's not gonna fix anything
f"{", ".join(...)}" is interpereted as f"{" and ".join(...)}". Use single quote so that the string continues
Also, why are you still shadowing built-in list?
can someone help?
my bot keeps crashing when someone sends a image with no message
if (!message.channel.name.includes("_rem")){
const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel && message.content && !message.attachments.first()){
const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#ae00ff')
botlog.addField("#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content + "⠀", "⠀");
channel.send(botlog).catch(()=>{ channel.send("Could not send log message")});
}
}
i have no idea what is causing it
so make wasn't found
what?
you need to install the compiling tool
... why?
aka: make
because a normal user normally doesnt have to compile anything
so they dont come bundled
you are
...
ur looking at the other guys question
I WAS LOOKING AT THE WRONG MESSAGE
replace js channel.send(botlog).catch(()=>{ channel.send("Could not send log message")}); with js channel.send(botlog).catch(e=>{ channel.send("Could not send log message\n> " + e.message)});
it should give you some info on whats wrong
thats the error
The first parameter of channel.send does not take an embed!
thats also not the error i think
Try channel.send({ embed: botlog })
Yeah, might not be, but it'll still cause problems in some cases
yup
it works but it only crashes if the message content is only an attachment
Hi, for some reason im gettin this error: TypeError: Index is not a contructor
see
and i dont know why, when Index is a class
Can you send your code for us?
ye
field name - "#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content + "⠀"
field val - "⠀"
class RandomGenerator {
// class
}
module.exports = RandomGenerator;
i will jst say discord.js is broken and leave
i mean i might just ping erwin to receive a 10 paragraphs of messages saying how detritus is better
but it REALLY looks like a d.js issue
i had it working before in a older version of my code
if(!message.content) return;
if(message.content.length <= 86){
const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#ae00ff')
botlog.addField("#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content + "⠀", "⠀");
const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel){
channel.send(botlog);
}
}
if(!message.content) return;
if(message.content.length >= 86){
const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#0xff0000')
botlog.addField(message.url + " message was over 86 characters and could not log.", "⠀");
const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel){
channel.send(botlog);
}
}
it used to look like this
thats before i tried catching errors
https://pastebin.com @graceful shore ?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
wdym why is my code flat
oh
smile to hide the pain 🥲
If you used python you wouldn't have this problem
300 lines wtf

i may use notepad instead of visual studio cuz i cant wait 3 seconds for it to load dont kill me
YOU USE VISUAL STUDIO
FOR JAVASCRIPT
i shouldnt have come here
ok ill open visual studio dont kill me XD
Use VSC instead
first its a guy who doesnt even have make
waffle, any idea on my issue?
and then some genius who uses notepad
what about emacs
never used it
saves the time of loading visual studio lol
VS is preferred for stronger stuff like C languages
Looking through it rn
VSCode
no loading time
intellisense
DEBUGGING
oh im sorry @wheat mesa i forgot to push my updated code... :/
Visual Studio and Visual Studio Code ain't the same
way too different
module.exprts is a problem probably. (unless that's a thing, never seen it written like that before)
ik ik :///
VS and VSC is like how C is JavaScript
oh okay
i forgot to push the code shit
ok im using vscode
good for you
hope you opened the folder instead of the single file you are editing
Your problem is that Index is not a class name
Your class is titled RandomGenerator
Your file is named index.js
But you cannot create an object of your index.js file, you need to create an object of the RandomGenerator class
its old code
welp
i opened the folder
wtf
im literally using if(message.attachments.size >= 1) return; and it still crashes
btw, idk what ur problem is bracket, but the if (channel && message.content) is redundant since it'll always be true
jus inefficient to have that there
i removed it
oh wait im sorry
Testing some stuff rq, I'll help in a sec
i didnt fully read it, u may need it
if(!message.content) return;
if(message.content.length >= 1){
if (!message.channel.name.includes("_rem")){
const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel){
const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#ae00ff')
botlog.addField("#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content, "⠀");
channel.send(botlog).catch(()=>{ channel.send("Could not send log message")});
}
}
}
even this doesnt work
whats not workin
i did that
just google whitespace and copy it out or something
its a invisible character
well show line 898 O_O in bot.js
the value is a invisible character that isnt a space
try the unicode
i am
thats not a unicode
this is part of working code as well
that is the loc which is causing the error
@digital ibex ```js
module.exports = class RandomGenerator {
// Code stuff
constructor() {
// Does stuff
}
TestFunc() {
return console.log("Works")
}
}
what line is that?
const Index = require("./index.js")
const Myobj = new Index()
Myobj.TestFunc()
kk ty waffle
Yet another steam scammer
// message.content = '';
message.channel.send(message.content) // Error: Cannot send empty message
if (!message.content) {
// ...
message.channel.send(message.content) // Will not send
}
u understand whats goin on here
ur checking if message.content is actually like
a thing
AFTER you send the message
so you need to check before you send it
Also why do you have that many lines in one file!
I recommend setting up command and event handlers
you was right
it was that code giving errors
i deleted it and tested and no errors
#development message
refer to this then
ima move the code cuz i know warning works before
moving the code isnt going to change anything
all you need to do is move one line
and error fixed
no error if u wanna say that
btw @wheat mesa
were u getting the errors when u first cloned
?
I didn't clone, I just set up a small test project
Line 87 of this file https://github.com/OfficiallyLost/Random-Generator/blob/7db56f1227a334ea0a0e734209d440e0014d2a7b/src/lib/index.js#L6
That's the problem
it was workin before but i changed it to module.exports = class .....
Instead of doing js module.exports = RandomGenerator do ```js
module.exports = class RandomGenerator {
// Class code here
}
Did you save it before running? Because whenever I change my test setup to this ```js
class RandomGenerator {
// Code stuff
constructor() {
// Does stuff
}
TestFunc() {
return console.log("Works")
}
}
module.exports = RandomGenerator;
Index is just an empty obj for some reason
yeah, would u be able to clone / fork my project and see whats goin on
?
Yeah, hold on






