#development
1 messages · Page 1820 of 1
Huh. Show the code
const Discord = require("discord.js");
module.exports = {
name: "ticket",
aliases: ['t'],
description: "Abrir un ticket de soporte.",
async execute(message, args, client) {
const channel = await message.guild.channels.create(`ticket: ${message.author.tag}`);
channel.setParent("820276801652916270");
channel.updateOverwrite(message.guild.id, {
SEND_MESSAGE: false,
VIEW_CHANNEL: false,
});
channel.updateOverwrite(message.author, {
SEND_MESSAGE: true,
VIEW_CHANNEL: true,
});
const reactionMessage = await channel.send("Gracias por contactar con el soporte");
try {
await reactionMessage.react(":lock:");
await reactionMessage.react(":no_entry:");
} catch (err) {
channel.send("Error enviando emojis!");
throw err;
}
const collector = reactionMessage.createReactionCollector(
(reaction, user) => message.guild.members.cache.find((member) => member.id === user.id).hasPermission("ADMINISTRATOR"),
{ dispose: true }
);
collector.on("collect", (reaction, user) => {
switch (reaction.emoji.name) {
case ":lock:":
channel.updateOverwrite(message.author, { SEND_MESSAGES: false });
break;
case ":no_entry:":
channel.send(":white_check_mark: Borrando este canal en 5 segundos!");
setTimeout(() => channel.delete(), 5000);
break;
}
});
message.channel
.send(`Ahora estaremos contigo! ${channel}`)
.then((msg) => {
setTimeout(() => msg.delete(), 7000);
setTimeout(() => message.delete(), 3000);
})
.catch((err) => {
throw err;
});
},
};
I assume it’s throwing an error at the message.guild.channels.create() line?
yeah
Then message.guild is undefined
You’re using the command in a guild, right?
yes
I want to initialize mute_data as {} but I can't
mongoose.model("guilds", new mongoose.Schema({
guild_id: { type: String },
ephemeral: { type: Boolean, default: false },
mute_data: { type: Object, default: {} },
moderation_logs: { type: String, default: null },
capslock_protection: {
type: Object, default: {
enabled: false,
warn_count: 3,
mute_time: 5,
}
}
}))
When I do this it returns me
{
ephemeral: false,
moderation_logs: null,
capslock_protection: { enabled: false, warn_count: 3, mute_time: 5 },
_id: 60fc82af851bf71bd43e5d6b,
guild_id: '813453118997528647',
__v: 0
}
I was testing my commands to see if it works or not bcus it been a while Senes I tested the muted command
What should I do
And no response and no errs
Can It be a problem in the future?
Idk what happened and for all my commands it was not formatted
There was extra spaces extra indent
yea
You gotta look them up by yourself
Well I doubt it would be an issue cause it still technically exists.
It just isn't returned
At least I assume it still exists not sure how mongoose works
Okey thank you
@mental furnace I just don't understand wtf is wrong... ```● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Sat 2021-07-24 17:03:04 EDT; 1h 21min ago
Docs: https://docs.mongodb.org/manual
Main PID: 4521 (code=dumped, signal=ILL)
Jul 24 17:03:03 CodeBook systemd[1]: Started MongoDB Database Server.
Jul 24 17:03:04 CodeBook systemd[1]: mongod.service: Main process exited, code=dumped, status=4/ILL
Jul 24 17:03:04 CodeBook systemd[1]: mongod.service: Failed with result 'core-dump'.
core dump?
looks something way unrelated to config and log files
SIGILL 4 Illegal instruction. The ILL signal is sent to a process when it attempts to execute a malformed, unknown, or privileged instruction.
@pliant needle try reinstalling ig?
I have, and I still get the same result. My best guess is that I must have installed it incorrectly, so I'm going through the walkthrough with a fine-tooth comb, but still...
Java… we need an exorcist in here now! 
nope
wow
but you can just use something like```java
public static <T> T getOr(T get, T or) {
return get == null ? or : get;
}
what about current versions?
I'm talking from version 16
it'll probably never have something like that
BUT you can just use groovy if you like
it's just vanilla java + QoL stuff
kotlin ftw
does anyone know why i am not receiving any event data? payload.d
this is my code: https://pastebin.com/e58JM7KR i am trying to connect to discords ws
btw
You got proper intents?
Are you making a lib?
yes
Cool, hope you have fun
Did you receive any opcode, at least?
yeah, 10
I don't think you need it but try adding GUILDS intent, so 513
i meant 513, whoops
not 512
this is what im getting if this helps: js { t: null, s: null, op: 10, d: { heartbeat_interval: 41250, _trace: [ '["gateway-prd-main-c894",{"micros":0.0}]' ] } }
No it means hello
yeah its connected, but im not recieving
and imma say it
i aint recieving the d
lol, payload.d should be the event name
But you do get something if you were to log payload correct
payload.d is the data
payload.t is the event name
Mmmm
I am confused what you are wanting now
Are you wanting the data or the event name
they're not getting message events
yeah
that's the problem, no?
im not doing that in opcode 10
you use the heartbeat interval to consistently send a heart beat to stay connected
they did that
Well when they said earlier that their having problems logging the data
I assumed that was the issue
Now they are saying its the event name so I am confused what they wanted
i meant t instead of d
Are you sure message create is even being fired.
?
Ah I see
I was under the assumption you were using a discord bot to test this all out or smth
what
Then I must be confused
Thus I will refrain from trying to help you further so I don't confuse you.
Sorry if I caused any confusion, I don't have a ton of experience with the discord api on this level
na all good
I hope you get the help you need
and when you finish it I would love to check it out
some of the code is already public
well by "some" i mean all the code minus the stuff i've done today
Oh nice
hi
imma push the updated code so if anyone knows how 2 fix, lmk pls
How do I put my bot online?

What?
??
How do I put my bot online?
How am I suppose to know
Im trying to convert to kurasuta yet i get an options.clusterCount is undefined

Or rather
this.clusterCount = Number((_a = options.clusterCount) !== null && _a !== void 0 ? _a : os_1.cpus().length);
^
TypeError: Cannot read property 'clusterCount' of undefined
at new ShardingManager (N:\Desktop\ColdRP bot\node_modules\kurasuta\dist\Sharding\ShardingManager.js:41:50)
at Object.<anonymous> (N:\Desktop\ColdRP bot\main.js:5:17)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
;-;
why use axios 0.19? axios already 0.21.x iirc
This is complicated
what?
im big dumb dumb
Your repo you showed earlier, "homepage": "https://github.com/OfficiallyLost/LostCord#readme", "dependencies": { "axios": "^0.19.2" } }
how in the hell do i use kurasuta
.... i know, how has this got anythin to do with my issue tho
no idea either...
https://pastebin.com/e58JM7KR this his issue
what
this has nothing to do with anything related to my issue
i dont get it
no
no it wont
Lol? NOT MY ISSUE. wtf are you saying
what the fuck is going on
Did you fix it?
nah
Well, yeah tagging me? How am I suppose to know you talking to another person
alr, imma get around to doing it now. hopefully dis works den
just bc its blue doesnt means it can harm u(most of the time)
Its blue cause its a link

Someone would have to try hard to mask a IP logger as a discord link
alr, so, same thing :///```js
case constants.OPCODES.HELLO:
this.heartbeatInterval = payload.d.heartbeat_interval;
this.send(payload);
setInterval(() => {
this.heartbeat(this.heartbeatInterval);
this.send(payload);
console.log('sent heartbeat and op 1');
}, this.heartbeatInterval);
}```
Doubt Cakes would really care
and intents have been moved out of properties
payload here is the received payload
Rename your identify payload
Or just provide it directly w/e
Also your heartbeat method already has a setInterval()
And include ws in your package.json
yeah i done that by accident cuz i was cleaning the code up a bit
How finish is this? I can help with fluff stuff, not into raw stuff that much. Consider using this package too https://www.npmjs.com/package/discord-api-types
They're using JS, no?
They don't really have a need for discord-api-types if they are using JS
Unless they wanna JSDoc everything

jsconfig.json go Brrrr
By using the post method on the stats endpoint
or using the modules they have for posting your stats
Check out the api tab on the page
okay, same thing is happening
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.
how dumb am i being?
wait one sec
edited pastebin btw
Can you get rid of this and try again?
the setInterval ?
Also, maybe paste the full code
Yeah
heres the full code: https://pastebin.com/ets0hrCE
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.
Err, intents is outside d now
five seconds later you give them a tabnine link that is totally unrelated to their issue 🧠
how can I set a svg (created using the tag), to a background image of div?
@wheat mesa help
"initialized" as in given a value
... because one of the if statements gets executed, but if none do, then it's not going to have a value and you'll get an error
bruh
like if for example you set ti to 700000, then your code is going to error
{
"name": "wafflebot-detritus",
"version": "1.0.0",
"description": "",
"main": "out/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "ts-node -T -P ./tsconfig.json ./src", // Don't worry about these scripts right now
"start": "node -r ts-node/register/transpile-only ./src/index.ts"
},
"author": "",
"license": "ISC",
"dependencies": {
"dependency-name": "dependency-version", // EX: "discord.js": "^12.5.3"
},
}
Your package.json file structure should look something similar to this
Alr
ok wtf
@wheat mesa can u just tell me where the terminal is?
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"rootDir": "./src",
"outDir": "./dist",
"removeComments": true,
"strict": true,
"experimentalDecorators": true
},
}
Perfectly valid JSON and yet JSON.parse is screaming
const options = JSON.parse(fs.readFileSync(pathToOptions, "utf-8"));
SyntaxError: Unexpected token } in JSON at position 266
Makes sense.
wht>
The error
👀
I have a feeling it doesn't think it is valid json.
Well i'd help but I am way too tired
@cinder patio where is terminal
I found the issue it was the comma
but my editor said it's fine
trailing commas in json are a bitch
Using vscode?
If so I don't think vscode recognizes trailing commas as an error
Yea
Didn't press escape
vscode doesn't recognize trailing commas as an error
unless you have a linter maybe?
iirc a linter could catch that no?
I don’t know. I don’t use replit.
Owh
Your curly brackets in your package.json file are wrong
Owh
Remove the second curly bracket on line 18. That should fix the issue.
If it doesn’t, then I’ve overlooked something. It’s 2:30am and my brain is fried
So I did this:
const thatGuild = message.guild.id;
const list = client.guilds.cache.get(thatGuild);
list.members.cache.forEach(member => {
const memberID = member.id
if(memberID !== globalBanned) {
const embedGOOD = new Discord.MessageEmbed()
.setTitle('Scanner')
.setColor('GREEN')
.setDescription('We did not find any blacklisted users!')
.addField('Your server is safe.', 'We only blacklist users that do not follow the most obvius rules, such as bulling, hurshing, and more.')
message.channel.send(embedGOOD)
}
if(memberID === globalBanned) {
const embed = new Discord.MessageEmbed()
.setTitle('Scanner')
.setColor('RED')
.setDescription('We found a blacklisted user in this server!')
.addField(`‼️ WARNING ‼️', 'We found a blacklisted user! Please check your server for these IDS: \n ${globalBanned} \n To search up an ID type ++user-info <ID>`)
message.channel.send(embed)
}
});
And now it spams the server, because it is running this procceses for each single member.
How do I scan them all at ones and send only one embed?
Alr
Other than that, I don’t see anything wrong with that json
@wheat mesa sorry but why is it showing this new error
what the...
I've put the correct token
I recommend learning Javascript before making a bot
Uhh ok
When it says “invalid or unexpected token” it is not talking about your bot token, it’s talking about an incorrect character in your syntax
I suggest practesing on the bot tho.
You use ' to start off your string, but then end it with `
Like trying out things and learning form em
Which is incorrect
Ok
Learning javascript BEFORE making a bot is far easier
You’ll get very confused with the basics such as what’s happening here
Nah, I mean I did that, and it was trash, then moved on to making a bot and learned wayyy more from making it for a week then I did while passing the W3School javascript lessons for like a month or so
Well thats how people learn
People learn in many different ways, but that doesn’t mean it’s a good way to learn
whoa
Good idea!
Ty for helping
Idk... If you watch one vd you get addicted to it and then cant code unless theres a tutoreal for that...
Knowing how to read error messages is very important
Thats pretty much how 3 of my friends ended up after watching that whole guid of wornoff keys
Wait you guys can read?
indeed.
you can't?!
Logically debugging one step at a time is one of the fundamentals of development in general
No I have text to speech on
agreed.
o....
Then I guest learning
alright idk if this is the right support channel for this
alright.
👍
so can someone help me with the thing I need help with?
My brain is too fried to look at all of that atm, but I can see that you’re using forEach which is slow compared to a for(const blah in blahblah)
what font is closest to Agency FB preinstalled on mac?
idk
ok...
Just general advice
not going to switch to that
I’m not sure if this is the best way to do this, but you could have a variable called something like foundBanned and set it to true if a member is found to be banned, then after your loop finishes iterating over each member, you can check the value of foundBanned and send an embed accordingly
The problem is that you’re sending an embed for each user it iterates over
ya.. ik
ah alright... Ill try 😅
so smth like this: ?
var foundBanned;
foundBanned = true
if(memberID !== globalBanned) {
foundBanned = false
}```
Yeah something like that
Idk what to put after the foundbanned variable lol
Except make sure to declare foundBanned outside of your forEach scope so that you can use it outside of the forEach
I’m sure you’ll figure it out, I’m headed to bed
3am is far too late for me to be awake at
hey, guys, such a problem, I'm making a rank card, and as I understand in PIL, you can only use one font for a nickname, I use DejaVuSans.ttf, as you can see, not all characters are supported here, what should I do?
Example: ⭕⃤ᶠo𝕆𝕤𝕖𝕋🔥𝕣𝕚ℕ𝕜𝔸😂
discord.py
change font
yyya...
for example, which one?
also limit the text length
Does it not support fallback fonts?
it's arial 😂
How does one loop through every document in a collection (JavaScript) (MongoDB)?
Can someone show me a tutorial of JavaScript
@gusty kestrel
you can also try this
Ty
for document in collection.find()
I thought that was a sentence at first
first do .find({}) it'll fetch all documents in an array
then do .toArray() It'll convert it to an array
after that use .then(dt => {
here dt is an array of all documents in that collection.
So finally
collection
.find({})
.sort({ _id: 1 }) //Optional + useless in this case
.toArray()
.then(dt => {
dt.forEach(console.log)
})
.catch(console.error) //Optional
I recommend using .forEach directly instead of .toArray
.toArray loads all elements in-memory all at once while forEach doesn't
it depends on what you need
Can esbuild parse .xml file imports?
Example: import anime from "./marco.xml"
so im making a comments section for my bot list, and i have a array of user ids, i would need their username and avatar to display at the comments section so i was wondering is there anyway to fetch a array of user ids without getting rate limited
cache them in your db right when they login
only if they are all from the same guild, otherwise no
well i was thinking of storing their name and avatar in the db but if they were to update their username/avatar, i would have to loop through all comments that ever existed in the db and update it
no
oh
afaik the browser will fetch the image again from the link your js provides unless it's cached
oh yea i forgot they need to login to comment lmfao
brain fart moment
why not just pull their name and profile from the db on comment rendering?
once its updated, the next time the page is loaded, it would be rendered with the updated links
how do you store the comments?
probably in a database table containing user id and comment text no?
in a schema
const botComments = mongoose.model("bot comments",
new mongoose.Schema({
_id: String,
comments: Array
})
)
each object going into comments looks like
user: user id
content: comment content
u mean when the page is rendering
and for each user id from the list, you fetch their username and profile from another schema
yes
hm is there a way to make next.js render faster
you cache it
it takes like 2-3 seconds per page rendering and theres not many elements
wdym by that?
idk how next.js works as i never used it. does it use server side rendering?
the method im using rn is fetching everytime it loads
getStaticProps for the profile picture component
i think its server side
it should display the cache if the props are the same
yes
the page should be rendered once, and then kept in memory for a while, so next page visit does not rerender
Yeah
front end is hard
this is backend tho
You can set how long it is cached
backend for frontend is hard
xD
doesn't next/image already use caching tho?
also why aren't you just using disqus for the comments section
you wont have to handle XSS too
No! No one needs caching! 
And no one wants caching! The kids want techno, not caching.
anyways
why do we have to use external libs for parsing xml when json has native support?
what uses xml?
who uses xml?
me trying to scrape html and converting to json so i can use it for my shitty stuff
json has native support because its a native feature of the language lul
xml is not a native feature of any language
why
Because it's a markup language
xml is basically offline html
Strict brother of HTML
but its used to store data which is basically what jason does
using xml to store json 
jason
Things always going crazy in this channel
The design goals of XML include, "It shall be easy to write programs which process XML documents."[6] Despite this, the XML specification contains almost no information about how programmers might go about doing such processing. The XML Infoset specification provides a vocabulary to refer to the constructs within an XML document, but does not provide any guidance on how to access this information.
maybe im just doing the xy problem
here's my original problem:
HTML SUX i have some html
<ul class="smth">
<li></li>
<li></li>
...
</ul>
and i need to convert it to json so i can use it to do shit
You can see where this is going
||ofc i used an xml file to store the stuff||
||and now i need help trying to import xml in esbuild because im using it for react anyways||
write raw html files, not xml
then parse them with html processing tools
example?
Who can help me with the drop down menu
How helpful is Tabnine even
sometimws
idk what you're trying to do and which language you're using, but there are plenty of libraries for reading html, accessing elements and classes, reading contents, writing content, etc
"hey i think you spelles sometimes wrong, did you mean potato"
he say react so js
i never use anything other than js because js is terrible and i love yelling at stuff
...
Maybe some of us can, but we don't know what to help you with
If only you told us what's wrong...
Or tell what languange, what lib you using
And/or provide any code
provide ip
WsWebService.ApplyPayout;
(interval here)
WsWebService.ApplyPayout;
this is c# and i am not good at it, how do i add 1 second intervals between these two
Task.Delay?
do i have to install any module
Nope
congrats, but this isn't the place to talk about queue time
i have this: js if (payload.d.type === 0) payload.d.type = { raw: 0, easy: 'Text' }; if (payload.d.type === 2) payload.d.type = { raw: 2, easy: 'Voice Channel' }; if (payload.d.type === 4) payload.d.type = { raw: 4, easy: 'Category' };
is there a better way to get rid of all these if statements?
and there r gonna be a bit more, 2 i think. it doesnt really look nice if ygim
Switch case?
er, not really what im looking for. im trying to make it in a 1-2 liner kinda thing
i dont think its possible but was just wondering
its kinda the same thing lol. i'd have to repeat it
Doubt there's any way tbh
Other than making a Map and getting payload.d.type key from it and doing different stuff then, probably via separate functions

hell yes
@grim sundial
Make a Map called PayloadTypes and set the type for every number
If payload.d.type is a number, set it to PayloadTypes.get(payload.d.type)
list = ["Text", , "Voice Channel", , "Category"];
payload.d.type = { raw: payload.d.type, easy: list[payload.d.type] }
But they go as 0-2-4
why when I spawn 2 shards the bot responds twice? I use pm2 for startup
well... are these actually shards, or are you just telling pm2 to start two instances
nope 2 shards 1 start instance
so does list :^)
show code
ok
const { ShardingManager } = require('discord.js');
const config = require("./botconfig/config.json");
const manager = new ShardingManager('./bot.js', { token: config.token, autoSpawn: true, respawn: true });
const shardcount = 1
manager.on("shardCreate", shard => {
console.log(I've launched shard ${shard.id}.)
})
manager.spawn(shardcount, 10000);
and your bot.js?
yikes
thats all?
yes
pog its fine now thanks
👍
Bot no work
slap it
btw do you know how to put shard id on bot's status
Does anyone have code of the servers your bot is in using embeds i can use event as soon as somone adds my bot and itll send a notification in that channel
i had an aneurysm reading that
just set your status normally, using the current shard id, it will update for each shard as they have separate statuses
client.shard.ids[0]
anyone know a good way to get payments for like paid features because i wanna do for my vote requird command i wanna make it so someone can do a 1 time payment to let them not have to vote and just be able to use the command, if that makes sense
patreon and using their api is good
since you can tie a discord account to it, it can all be done automagically.
could also use their role bot which gives donors a role.
a bit less easy imo, but works
Doesnt help that patreon just dont maintain their api anymore
How do i obtain the ID of a slashcommand without having to execute it first and then print the ID? i dont find a solution. Im using JDA
what doesnt work?
It doesnt edit channel names
get isn't a promise
it's a cache lookup
returns T | undefined
there's no catch method on it
step through your code
debug it
try catch it
and do proper async/await
also that code is running on every single message
you can only update a channel name 2 times every 10 minutes
your code is filled with bugs from the very first line of the run func
you're not granted to get the actual @everyone role iirc
also theres guild.roles.everyone
slightly relevant: the actual everyone role always has the same id as the guild
never do name lookups in cases where the id is known
This is for modify channel perms
no difference
My problem is with channel name update not with get everyone role
When i solve that ill look for this ok
did you fix what cry told you to fix?
tim
fl0w
tim fl0w
fl0w tim misty
fl0w
no grainger
II would like to add an automatic role when a member reaches a certain number of invitations
if you can help me
i don't really know how to do it
you want a code
a code ?
js , py
what
i don't understand 😅
what lang
i'm french si i'v got a bad english lol
He’s asking what programming language you’re using
me too but i am from iraq
thank you
I just want to add roles automatically when a member has for example 5 invites
ok i am leaving
...
I’ve only done the smallest amount of python, so I can’t really help you
You'd have to make a invite tracker i'd assume
No idea how to do it in python
ok thanks
@digital sonnet can you add me temporary?
uhh... I got this:
const guild = client.guilds.cache.get(supportID)
const memberchannel = guild.channels.get(memberStatsChannel);
``` and it says guild.channels.get is not a function.
cause its not
notice how you usec cache.get on guilds
you have to do the same on channels
Indeed
also to shorten it you could do it all in one variable
const memberchannel = client.guilds.cache.get(supportID).channels.cache.get(memberStatsChannel)
Though it doesn't look that nice
nah I got more stuff like serverChannel and Channel Channel lol so theres no need
why are some of my votes not getting logged
it says i had 40 votes today but only 18 were logged
So, with some actions within my database, it has to be db.mycollectionname., what is db suppose to equal? (Javascript) (MongoDB).
db = DataBase
also go read there docs its like the first thiing they litilery teach you.
Well, is there suppose to be like a variable named db? If so, what is it's value suppose to be?
Ok.
nah its a const
hmm.. I saw these errors before. Maybe ask in support but check pins first, maybe its in the know issues.
ok
Just made another small project, feeling good
👍
client.connect(err => {
const collection = client.db("test").collection("devices");
console.log("Success!")
client.close();
});``` -_-
hi
Hey
Does someone know how can i connect server stat codes to ready i need it bc of if bot crush
poor godzilla
@woeful pike How much of a good idea would you consider creating a Discord bot in Rust in terms of getting practice with the language?
in terms of getting practice? Probably pretty good, in terms of practical application? Terrible
U know? I did similar thing with python. Bot even got accepted... Do it ;)
unless your bot is already popular and in hundreds of thousands of servers where you need to minmax throughput
and you're comfortable with rust
It's mostly just for fun, but I could probably rewrite my bot into Rust (since it's not used much in my server) to gain some more practice working with Rust
(Like Discord bots are good in terms of practical application, generally speaking 😛)
If u wont try u wont know...
Mhm
Bots can theoretically be proof of work.
Depending on how large, you might employ different techniques which are interesting to possible employers
I have some software which is Discord related I'm proud of to show off
errr...that's private ig
and you aren't supposed to interact with the reviewer during testing by using the bot, that'd be privacy breach
My two cents: you can gain Rust experience this way, but I feel creating the same project in the same problem domain doesn't yield much success since people usually don't employ good strategies for their paradigms. I don't see anything wrong with using Rust even if you don't need the low-level fast performance because Rust can (and has) been used as both a high-level and low-level programming language.
@rustic nova
-verification
@lusty falcon
The only guilds we might invite your bot to regarding Top.gg-related things such as verification or polls are:
333949691962195969- Top.gg Verification Center264445053596991498- Top.gg- any guild owned by a user with the role <@&767389896133443625> in this server.
Any other guild claiming to be affiliated with Top.gg's verification is very likely false.
Thanks
It's more of a "just for fun" project in any case, I'm not solving any problem domain here other than my server's occasional need for a bot. It's still somewhat of practice to me and I got time to burn away, so yeah
First fail in trynna create my own code
client.on("message", async message => {
if(message.content.startsWith('-WYR')){
const { WouldYouRather } = require('gamer-discord-utils')
await WouldYouRather(message)
}
}
```
Someone told me it was wrong but I never got the reason as to why can someone explain what did I do wrong
bro require it at the top of your code
also you forgot a bracket i think
at the end
const { WouldYouRather } = require('gamer-discord-utils')
client.on("message", async message => {
if (message.content.startsWith('-WYR')) {
const w = await WouldYouRather(message)
}
})```
I haven't used that package before so I might be wrong as I'm unsure what it does
tbf it's a veeeery dangerous pitfall to depend on packages to serve as pre-made commands
yeah for a simple would you rather command it'd be easy to just make it yourself
i've never heard of this
i bet these packages are made by newbie node developers
theres no way someone experienced in their right mind would make a package like this

I guess you’re not wrong though, the dev on the GitHub page for it said he made it as he was learning programming back in 2014...
this isn't even as bad
with the utils package you're just gonna effortlessly use someone else's command that looks exactly the same
because not many people know modulus exists
True
and they've learnt to look at npm if they dont know how to make something
it took me like a year into js to realise modulus was a thing
A comp sci class I took in high school taught modulus in the first 2 weeks
I started before then too
Never knew about modulus until my computer science class taught us
Granted it’s kind of a niche thing that most people don’t use
Good evening I was certified at top.gg today GG 🙂 I would like to place an order that allows to know who has voted for my bot we could help me please
An... order?
I would like to ensure that if a user vote for my bot sends it to me in a defined channel
thanks
that'll be 2.99 is there anything else you would like to order?
Why this do not give role ```js
client.on("messageReactionAdd", async (reaction, user) => {
const emoji = "👍";
const channel = client.channels.cache.get("867207482514341918")
const m = await channel.messages.fetch("868277595249213480");
if (reaction.emoji.name == emoji && reaction.message.id == m.id) {
const member = await reaction.message.guild.members.fetch(user.id)
member.roles.add("847142688737329193");
};
});
best way to get last 2 indexes of an array? Array can be any size from empty to like 200
.slice ? assuming this is js/ts
yw
You could use the .length property of the array and subtract from that
Ex: myArray[myArray.length-1]
Etc
I know that but that wouldn't be "nice" code
Why not?
As you'd have [ array[array.length-1], array[array.length-2] ]
and array.slice(-2) is way nicer
i've jus been workin on something, and im a bit confused with something
wait one sec..
my vscode is just freezing
okay
wait nvm
how to re-apply with the same descriptions and details? I didn't save/copy the details that I wrote in the website
cant
what do i get for boosting this server?
how can i get a message by id i sent?
yes unnecessary extra lines of code
let member = message.mentions.members.first();
let role = message.guild.roles.cache.find(role => role.name === "Muted");
if(!member) return message.channel.send("Pls Tag a User to **Unmute**!");
if(!role) return message.channel.send("This Server Doesnt has a Muted Role!");
if (!member.roles.cache.has(role.id)) return message.channel.send("This User Already **Unmuted**!")
if(!reason) reason = "No Reason Specified!"
member.roles.remove(role)
and then add embed msg
On many servers the muted role is called "Muted"
I pasted mute codes lemme edit it
This is should work
You can add
member.send("you muted in guild.name")
is it good practice to make a temporary timed data with setInterval 
ye that will just say:
you muted in guild.name
u need to make it template literal or something
i typed it on phone was lazy to add ${guild.name}
how do i make a command, that only works if you have a certain role in my discord server
@earnest phoenix
try:
self.config.read("data/access.ini")
for section in self.config.sections():
if section == "API":
val = self.config[section][key]
if val not in ["", 0, False]:
return val
else:
raise FeederError(message=f"{self.err}: Given key '{key}' does not exist or nothing found.")
except FeederError as error:
return error
i'm insane
also
.ini > .env
this is irrefutable
In index.jsjs const args = message.content.slice(prefix.length).trim().split(/ +/g);
then this args gets exported to another file where I used it as: js let cmd = args[0]
It works that way... But when I use toLowerCase(), i.e: js let cmd = args[0].toLowerCase()
it gives me an error: Cannot read property 'toLowerCase' of undefined
then args is undefined
You are actually exporting it, correct?
Try logging the value of args[0]
C
Oh, logging the value helped me understand the issue.
Didn't thought about logging it. (I just code for hobby)
Thank You!
the error makes the value obvious
it just is
sus
still going to use .env since thats the only thing i can set my environmental variables
in heroku
const { Util } = require('discord.js-light');
Topgg = require("@top-gg/sdk");
const topgg = new Topgg.Api(``);
const config = require("../config.json");
module.exports = {
name: '.',
aliases: ['add'],
description: ".",
async execute(client, message, args, command, Discord) {
let voted = await topgg.hasVoted(message.author.id);
if(voted || config.patreonids.includes (message.author.id)) {
if (message.member.guild.me.hasPermission("MANAGE_EMOJIS", "ADMINISTRATOR")) {
if (!message.member.hasPermission("MANAGE_EMOJIS", "ADMINISTRATOR")) return message.channel.send("You need `ADMINISTRATOR` or `MANAGE_EMOJIS` to use this command.");
if (!args.length) return message.reply ("Please Specify some emoji's");
for (const rawEmoji of args) {
const parsedEmoji = Util.parseEmoji(rawEmoji);
if(parsedEmoji.id){
const extenstion = parsedEmoji.animated ? ".gif" : ".png";
const url = `https://cdn.discordapp.com/emojis/${parsedEmoji.id + extenstion}`;
message.guild.emojis.create(url, parsedEmoji.name)
.then((emoji) => {
const yeet = client.emojis.cache.get(`${emoji.id}`)
const complete = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle(`Complete \`${parsedEmoji.name}\` added`)
.setDescription(`Url: \`${emoji.url}\``)
.addField("Emoji:", `${yeet}`)
return message.reply(complete)
})
.catch(() => {
const failed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle(`Failed`)
.setDescription('Failed to add because you are at max emotes')
.setImage(url)
return message.reply(failed);
})
}
}
} else{
const novote = new Discord.MessageEmbed()
.setColor('#FFE082')
.setTitle('You need to vote to use this command')
.setDescription(`[Top.gg Vote](https://top.gg/bot/ /vote)`)
.setTimestamp()
return message.channel.send(novote)
}
}
}
}
HOW

is it error-ing at config.patreonids.includes
its just an array
like
of user id's
but config.json is a json
yes
if(voted || config.patreonids.includes (message.author.id)) {
ty qt
property patreonids does not exist on config (ts2032)
look at your config file then
check if spelling is correct

@quiet pawn config.patreonids is undefined

i did
have you inspected the config
then go to property patreonids
yes
if the property did exist then it should call
the error is on main bot
your main bot doesn't contain
^
check your main bot
look at patreonids on ur main bot
i have
whats happening here
then copy the same config.json from the test bot to the main bot
i cant
why
why
i-
that main bots config has
bruh
that other doesnt
stoopid
?
who stores token in json files
store it in a .env file dummy
ye
not practial
its a test bot for a reason
as that kind of data may be dynamic
and use process.env.TOKEN or token
in the env it should be TOKEN="(token)" or token=
are you really sure that patreonids is out of any
make sure that all data structures are identical
and i mean ANY other properties
1 sec
@quiet pawn console log config.patronize then
ill just copy my config.json from test and change the stuff i needa change
or config
config.patreonids

same dw
Me
lol
dugger
dugger
no
imma just copy my test bots config then edit the roken and stuff
roken
make sure that
data structures on both bots are identical
i hope you didnt forgot to do ctrl s
i have auto save and i do ctrl s
and its actually an issue
imagine typescript smh
any
static alrd loaded from json
imagine keyof typeof
guys im still finding how to host my bot in heroku
can anyone help
rn using it on replit.com 
so
i use js every time because i only know js
what happened was i moved the config to the vps before it saved

what do you need help with?
lol
hosting my bot in heroku
not using dat
replit is better because heroku only gives 550 hours
make a Procfilc and put worker: npm start in it
procfilc
heroku is 
Procfile*
what
then ima use replit then
but yes, it will help you write safer code
yeah
There's an article online that walks you through the whole process. Just Google "hosting discord bot on heroku" and you'll probably find it.
ok nodejs12 coder
repl gud ( guess my friend gave me a boosted repl)
why replit
they give free postgre just in case
glitch
But yes. Heroku is bad.
glitch bad
want a yt video?
i mean its not bad
F R E E
nop
its not for bots
No external pings so can't keep the bot alive
they litterally dont want discord bots(or pingers)
cause i guess replit is fast for me
The project is fast now because boosted replit
and 12hour-active time
dont use glitch lol
the fastest one should be your pc
glitch aint having express
noone uses glitch anymore
Using glitch for a discord bot is against glitch tos
your account can get banned for pinging the project
no
my pc sucks
actually its for pinging
they updated their ToS?
testing the bot etc is fine
Yeah and as a result you have to break tos to host your bot.
i didnt use glitch since it blocked uptime bot and freshping
Get a VPS
i now use replit + rpi zero
if me have muni me will
pi zero ?512mb ram ?
ye
yeah or use mongodb if ur more experienced with that
There are cheap / free vps options out there. Better than hosting on heroku, replit and glitch imo.
its fine lol
also mongodb compass 
google cloud free tier

i will check them out when i'm done, thanks
actually Postgre is better than MongoDB
i wish i had something like rpi 3 or rpi 4
i wish
i actually have a domain acc but google cloud aint working
and i wish i had stable power
i do have it kekw
I do
But rpi 4 heats up like hell if you keep it running overnight
yeah ofc it will
you need to have cooling™
fun
Or just a minor underclock and undervolt
store your rpi in the fridge
the thing is
should i upgrade to rpi with backup power (incase my power dies)
guess my parents wont doe
my rpi got to 50c before
get a powerbank and use it + charge it at the same time
ez
my pc goes to 90c everyday
luL
i had a old powerbank
but its broken
and i cant fix
:(
Why not host it on your parent pc?
more power usage
rpi doesnt use that much
Plus running hardware 24/7 causes more wear and tear over time
just buy a UPS and connect the rpi and router to is for free "24/7"
lul
ups wont last long
It a myth
lol rpi and router have like low power usage
My powerbank supports dual charging so It's an UPS by itself
But I don't trust my internet provider
they succ
andf the thing is im not deciding to use rpi yet
i dont have an internet connection (router)
No? Heat = hardware damage, even if it's slow/minimal
using my mob data for doin stuff
whats the prob
does anyone have verified bot here pls dm me
I mean, you can search it on internet for youself
i wonder if my rpi can get hw dmg with 50c heat on it
lol
Why not just ask your question here?
not dat much verified bots
if it can then 
ok ill ask i thought i would disturb chat
ask here
Well I'm not sure about rpi's, but 50c isn't that high in general
first question what to fill in these
I mean... I think it's fairly straighforward
Use your brain and answer them
whatcha doin
verify...
Do you use your bot to store any information in relation to discord?
.....
um does serverinfo count
oh.......
then use ur brain then why ask ppl who verified bots
I believe so
i speedran and came back so 80c and under is fine
what? isnt that not related to the intents?
you are whitelisting for intents correct?
80c and under is pretty fine yeah
Just don't want it running at like 80c for days at a time
"yes be like my laptop and have max fans on and have it running on an air conditioned room"
oof
i got only one fan
and my ac sus
same
ur account sussy



