#development
1 messages · Page 1830 of 1
and so will message.channel.send(client.token)
in many cases flaze has evaled eval ctx.worker which shows the token
so it's really just a safety precaution
in the idea it works but if I add some example text! embed $ {message.author.name} hey! there's only the Tony Kun
message.channel.send(`${eval(message.content.split('${')[1].split('}')[0]) }${message.content.split('}')[1]}`)
(still not using regex)
also it'll break if the user makes a simple mistake
this is not for an order I have been saying that since a while ago because it is easier to explain like that do not worry you
No I can't do that without regex
thank you
if you use regex it would work?
def __init__(self,bot):
self.bot = bot
self.token = 'x'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.command()
async def on_dbl_vote(self, data):
await self.bot.get_channel(871778583339753502).send(f'{data}')
``` firstly , dblwebhook what should i put secondly is the code correct ? im getting no errors
but its not sending'
anyone free?
tag me pls
One message removed from a suspended account.
One message removed from a suspended account.
@wicked pivot use this regex then eval
wait don't
all backslash got removed when copying
/\$\{[a-zA-Z0-9\.\(\)\{\}]{1,99}\}/g
use this
One message removed from a suspended account.
L ?
let array = 'string'.split(' ')
let send = ""
for (texte of array) {
if (texte.includes('${')) {
send = send + eval(texte.split('${')[1].split('}')[0]) + ' '
} else {
send = send + texte + ' '
}
}```
probably very little optimized but it works as I want it thank you
When I'm registrating interactions I'm receiving a DiscordAPIError: Missing Access
What access am I missing?
The app has the intents GUILDS as well as GUILD_INTEGRATIONS
are you registering to the guilds themselves?
yeah to the guilds, not global yet
they might not have the slashcommands scope
I might be blind but I can't find it... lol
in the invite link put application.commands or something
do it again
Anyone know how to make a Custom Application Bot, are there any Bot Developers I can Hire or talk too ?
You may be interested in Fiber Fiverr
you can learn and do it yourself
Yeah somehow didn't work out the first time, it does now

Don't got time to do it myself
weird
You can try posting a request (with desired modey) and description on Fiverr or Upwork and someone will do it for you
Looking to hire someone, Already paying people to set up 2 discords, my DayZ Nitrado Server and Emblem/Logo. But the community I was in disbanded and the owner blocked everyone, so now I am trying to find out the application bot he used so I can use it for my community, or make a fresh custom bot
I was in a Wavez Factions DayZ Discord Server a while back and they had a system I liked.
- Read the Discord Rules
- Click an Emjoi that would lock you from seeing the rules
- Bot would send you an application based on those rules
- An Admin would confirm or deny your application
If your application was Accepted, you'd get access to the discord as a member with limited access too channels
If not accepted, you would be kicked from the discord
Trying to get the same system set up
If I wanted to hire a thief, I'd go to the cartel, thx though

Not advertising
||MEE6, YAGPDB, CURL bot already have those features||
It's the same here, full of incompetent developers
fiverr at least gives you buyer protection
WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest".
console say that but when i try to run this command the warning remains the same...
what's your ytdl-core version ?
4.9.0
strange,
that's the latest tho
maybe any of your packages are using an older version
Are you using any third party package ?
like Discord-music,
music-boost etc ?
maybe, I try to delte them
Does the WS event interactionCreate require a specific intent?
Weird... my interaction doesn't show up
(╯°□°)╯︵ ┻━┻
global interactions can take upto an hour to register
nah it's a guild interaction
I'm pretty sure there's just an extension you add in VSCode?
Yes
perhaps you added it through discord and its overwriting the custom presence
Check your Discord settings
Why the fuck does the (guild) slash command don't show up
god damn new trash
Registrating the guild interaction has been logged succesful.
Linux: Discord versions installed using flatpak or snap need modifications in order to support IPC
It says this for Linux
But I don't know the command to run?
Have you tried Googling it?
yes
the token is wrong

Gonna ask once again...
You may have an idea why the interaction (slash command) doesn't show up?
Registrations for guilds should happen in real time, hmm?
// ready event
const interactions =
[
{
name: 'pong',
description: 'Replies with Ping!'
}
];
for(const [id, guild] of client.guilds.cache)
{
for(const command of interactions)
{
await client.application.commands.create(command, id).then(console.log);
}
}
client.on('interactionCreate', (interaction) =>
{
console.log(interaction);
}
check dms quick
it may be because you / the bot doesn’t have perms
I had that issue.
Since I'm the owner of the test guild, I have enough "power"
im not sure tbh
Other interactions like buttons etc. will trigger the interactionCreate event successfully
But the registered slash commands somehow not even show up

If nothing helps anymore... let's call @quartz kindle
@_@
U you got any clue why the registered (guild) slash commands don't show up?
They should update immediately.
did you by any chance add a webhook url for interactions in your discord application page?
the command shows up on discord right? just when you run it you dont receive anything?
The command doesn't show up in Discord.
oh
That's the issue
does your bot have the application commands scope?
what does the .then() log return?
The ApplicationCommand obj
ApplicationCommand {
id: 'xxx',
applicationId: 'xxx',
guild: <ref *1> Guild {
id: 'xxx',
name: '12345',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
...
emojis: GuildEmojiManager { guild: [Circular *1] },
stickers: GuildStickerManager { guild: [Circular *1] }
},
...
name: 'pong',
description: 'Replies with Pong!',
options: [],
defaultPermission: true
}
try logging guild.commands.fetch()
Was just about to ask if they logged the commands
It's registered.
Collection(1) [Map] {
'xxx' => ApplicationCommand {
id: 'xxx',
applicationId: 'xxx',
guild: Guild {
id: 'xxx',
name: '12345',
icon: null,
features: [],
commands: [GuildApplicationCommandManager],
...
},
guildId: 'xxx',
permissions: ApplicationCommandPermissionsManager {
manager: [Circular *1],
guild: [Guild],
guildId: 'xxx',
commandId: '871814885850353685'
},
name: 'ping',
description: 'Replies with Pong!',
options: [],
defaultPermission: true
}
}
so the slash command isn't showing in guild
or
the interaction isn't triggering ?
The slash command isn't showing up, which also means the event isn't get triggered
are you trying on mobile smh
Creating a new guild real quick, inviting the bot with the correct scope -> same result
wut? no, not on mobile
sure, need to generate it again, one sec
It was the browser cache's fault
who would have thought of this lmao
Lol
this wouldn't happen if it wasn't for slash commands 
god damn caching
in Java, is Stringbuilder or Stream API better regarding String operations?
How would one make sure that user input (&str) would not overflow in u128? Do I have to use conversions or is there another way?
depends
StringBuilder has constant concatenation time, so it is better over loops but bad on single operations
sometimes using Stream is overkill and might be worse than a simple loop (like if all you're gonna do is concat)
stream is only good if you have many processes for the input
private String getCommandNamesAsString(Set<String> cmdNames) {
return cmdNames
.stream()
.sorted()
.map(cmdName -> "`" + cmdName + "`")
.collect(Collectors.joining(" "));
}
e.g in this case
like filtering, mapping, reducing, etc etc
yes, in that case it's better
however you don't really need .map
nor joining
use reduce
oh oke lemme see 
never used reduce that much
private String getCommandNamesAsString(Set<String> cmdNames) {
return cmdNames
.stream()
.sorted()
.reduce("", (total, element) -> total + " `" + element + "`");
}
have it
thanks for the input! didnt think of reduce
Hi, I was thinking about maintaining one of my bots, but I forgot where I hosted it... Is there a way to find that out ?
...you forgot where you hosted your own bot?
what 
all hope was lost
I found it on glitch & heroku, I removed it from both to check if it was not somewhere else. The bot is still online so I guess I forgot
lmao
Yeah it's been a while
what? hosted on multiple platforms at the same time?
well, another advantage of paid hosts. you wont ever forget it, since you're paying for it
:^)
Yeah I think I archived it on glitch, then hosted it on heroku. But I checked & the app on heroku was down
true that
There's no way someone else can host it without my token right ?
it doesn't
rip
fn validate_partial_input(&self, input: &str, _sel: &Selection) -> Validation {
let number = u128::from_str_radix(input, 10);
if number.is_err() {
return Validation::failure(Error::default());
}
let digit_chars = input.chars().all(|c| c.is_digit(10)) && number.unwrap() <= u128::MAX;
if digit_chars {
Validation::success()
} else {
Validation::failure(Error::default())
}
}
Relying on errors to handle user input let's gooooooo
I could create a new token & re-host it with that one I guess ?
well yes
but your old bot will be invalidated, likely crash because of it, and if you have something that autorestarts it, it will keep crashing forever
lmao
well, most auto-restarters have a limit to how many restarts in a short time
when you get the time someone joined a server and the time the account was created is there a way to compare them to see how long the time difference is? because as far as i know the api only returns a date and not a number and i have no idea how to compare dates in a simple way
using javascript forgot to add
The time should be in milliseconds. So now - then = duration (in millisec)
yes but that doesnt tell me how long the account was around brfor joining the server
wait i could just use how old the account is regardless of the date
I thought you had those informations ?
yeah im just being dumb
Sounds like asking made it clearer for you
just trying to make an anti bot thing for my server so i dont have to keep banning user bots made seconds before joining manually
yeah it takes a while for me to think of stuff in another perspective
but thx for the help
just as a note, you can use StringBuilder there
it performs considerably better over large datasets
I didn't know you could get the user account age with the discord api
yeah you can just go on a server with the bot dyno and do the command ?userinfo and it says
I'm looking at the doc rn for Node. Is it from ClientUser.createdAt ?
createdAt would be an instance of Date
yeah, there's createdTimestamp
possibly i haven't done much discord bot related stuff in just over a year
If you want the timestamp in milliseconds that would be createdTimestamp
millis?
but that's since the person created their account ?
I'm pretty sure discord timestamps are seconds
yeah
Milliseconds
the lib converts to millis?
Ye
why
Well timestamps are officially in ISO date format
Would make sense, timestamps are always like that
I mean, the <t:timestamp> thing is in seconds
i thought ISO was in secconds
And some structure don't have them so the library extracts the timestamp from the ID/snowflake
But anyway, even if it was seconds, you could get createdAt & get the millisec value of the Date() object
yeah thats all i need
just want to make my bot insta ban anyone with an account younger than 5 minutes old
or atleast kick and send a msg to rejoin later in the slim chance its not a bot
eh, bots can be detected by user.bot
no i mean self bots
the ones that join spam all the chats with a csgo phishing link and then leave
?
Aye
what do you mean
Happens here as well
it happens every where
but anyway, that isn't a reliable way of preventing that
just add a two-step join
like
yeah but an unreliable way is better than no way
member joins -> has to react somewhere to get a role
One way is to search the message content for Steam trade links
my server isnt that big its not worth it to do that the user bots only really affect me cuz i have to clear it up
they evolve too fast, hard to track it
but...the two-step thing is by far the easiest
And keep track all the possible redirect sites to ban them as well
or just key phrases like "free nitro"
stearncommunity
Yeah additionally not or
authough that is abit clunky though but eh
- deny
MESSAGE_WRITEto everyone - create a "Member" role, which has
MESSAGE_WRITEperm - add a reaction button somewhere you like (like in the rules) to get the role
- ???
- profit
0 selfbots attacking ur server
yeah but every bot under the sun does that
Isn’t that already possible with the rules channels?
well, that's the meta for a reason
indeed
ye but...do you trust discord with that?

lol
Trust discord with nothing
Already took me weeks to get over the verification process
Didn’t wanna share my personal data to Discord but I couldn’t go on kicking small guilds if they invite the bot or inactive ones
Tried to resist as long as i could but finally failed 
well, if it conforts you, ID is somewhat a public data
@livid jackal
hey i need help
Fontconfig error: Cannot load default config file this error comes up while i run my bot
const config = require("./config.json"); and this is my code
@wooden kindle can u help me?
so u have it like this
yea
Try delete ,
ye
still same error
const client = new Discord.Client();
const config = require("./config.json");
client.on("ready", ()=>console.log("READY"));
const welcome = require("./welcome");
welcome(client);
client.login("token");```
this is my index.js
erm
any fix?
it is welcome.js
const client = new Discord.Client();
const config = require("./config.json");
client.on("ready", ()=>console.log("READY"));
const welcome = require("./welcome.js");
welcome(client);
client.login("token");```
try that
and is the welcome file in a folder or no
okay
try this one
still same error
Remove the comma as this is no valid JSON format
im making a command that lets you see how many votes a person has, my issue is that therse an error attached saying it can't read property execute of undefined, it’s probably something super simple and i’m overthinking it because i’ve never interacted with a website before https://srcshare.io/?id=610872e0d568299bcc398fd8
can you give the full error?
you have env file?
wait i cut it out?
ohhhh
the error is for main.js, not this command.
C:\Users\gabri\Desktop\Cressida\main.js:100:40
on line 100
hmm i wonder why that is, it looks like any other of my commands
I'm getting a CORS error when doing a post request with axios but have no idea why
this.$astroAPI.post('/chargebee/hostedPage', {
userID: user.id,
yearly: this.yearly,
quantity: this.quantity
})
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:11000/api/v1/chargebee/hostedPage. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:11000/api/v1/chargebee/hostedPage. (Reason: CORS request did not succeed).
While get request work just fine
Here is my backend cors policy (using KTOR)
// Cors
install(CORS) {
method(HttpMethod.Post)
method(HttpMethod.Options)
method(HttpMethod.Get)
method(HttpMethod.Put)
method(HttpMethod.Delete)
header(HttpHeaders.AccessControlAllowOrigin)
header(HttpHeaders.Authorization)
host("localhost:3000", schemes = listOf("http", "https")) // just for testing
host("astro-bot.space", subDomains = listOf("www", "docs"), schemes = listOf("https"))
}
if (command === 'vote') {
client.commands.get('vote').execute(message, args, client);
}
seems you named the command execute not vote.
are you setting the commands map by the name parameter or the file name?
I'm fairly certain the issue rise because of 3rd line, visual studio code auto add it
the error doesnt point there though.
Does you have any file name boodro at same folder?
oh that’s probably it, i have no idea why that’s there?
visual studio auto add it sometime when the autotyping pop up
oh same error though
i dont really understand what’s wrong, i added it to my command handler like any other one
wait
did i name it execute?…
yeah
name: 'execute',
yeah i didn’t realise what you meant at first because i looked at the file name
also how do i use the token to use the webhook?
eek i worded that poorly
oh so the authorization part?
and then i just make a normal webhook?
pretty much(normal being any webhook, not discord).
https://docs.top.gg/resources/webhooks/
^ everything needed related to webhooks.
or just the js lib
https://docs.top.gg/libraries/javascript/
how would i time how many seconds passed between a user sending two messages?
so would i do config.webhooks.mytoken?
that would depend on your config.
how can i get the response from an api to send it in a discord command
you can just subtract the timestamps, as timestamps should be in seconds.
but how would i get the timestamp from the previous message though?
depends, how are you tracking the other message?
ie, how do you know about the previous message.
im just trying to detect spam where a user bot spams a massage in every channel
and i just whanna make it so if someone sends two messages withing 5 seconds they get kicked
youll want to track messages sent then, probably with something custom.
tryed making it so everytime a msg is sent it starts a timer that will only stop if some one sends a msg within five seconds or it runs out at 6
but that just feels clunky and unscalable
what are all the ways to log into it?
cuz it starts a timer after every msg
"log in"
your receiving webhooks, you are the one being accessed.
or well your code is
uh, other way around then haha?
and would probably break if two people ar msging at the same time thinking about it lol
i’m not rlly sure how to word it
interacting with API’s that aren’t just like image scrapers is kinda scary lol
Honestly, not sure whats the most efficient.
You could use Redis with TTL on each new message, redis having huge throughput on sets and gets(all your really doing).
Or just map them like a basic cooldown system and use intervals like your doing.
I would expect Redis to be faster, and more efficient, but ive not really worked with this.
Using intervals like what's currently being done can be bad because of how many ticking timers could be theoretically reached. That would consume more cpu time
ideally, using intervals youd batch message groups together.
a single clock could be implemented
I do think redis is probably the solution here though.
Anything with a TTY is subject to more cpu time imo
oh i just read the doc, how would i set up that webhook?
unless redis does optimizations and batching TTYs
👀 tty?
what does tty mean?
how can i get the response from an api to send it in a discord command
redis will never be faster than arrays and objects in memory
👀 so youd make timer for each message sent?
or how would you handle it
are we allowed to cross post? i think i asked my question in the wrong channel
should’ve been #topgg-api i think
when a user sends a message, store an array for that user somewhere, and put a timer on it for 5-10 seconds to delete the array
i can help you there. sorry i think i missed the question.
oh alrighty
Have a single interval and sweep a Map keyed by user ID with the V being an Array of Message references each duration
for every message sent, if there is an array, add to it
if it exceeds a certain size, do something
actually you dont even need an array, just a counter
oh so timers are efficient in that kind of volume?
if counter doesnt exist or is 0, set to 1 and start a timer that resets it, then keep adding messages until its reset
if the counter ever grows bigger than whatever, then its spam
honestly timers dont mean much, you could probably have a million timers without an issue
but yeah, a few timers on users is more efficient than timers on messages
open your package.json
it has "main": "index.js"
your file its called "main.js"
either rename your file to index.js or rename the "index.js" entry in the package.json to "main.js"
the file name has to have the same name as the "main" key in the package.json
fair enough thx for the info idk really what to do atm think I'll just sleep on it and think about it tomorrow
It is running to errors but when i start to do .ping i am getting this wacky console
startsWith, not startWith
Fixed that and now still doing it..
show error
you did startst
TYSM
hey
I made a profile command in Canvas, so I decided to put several "a" and it turned out that I can't make the letter smaller
decrease the letters to fit right.
client.db.user.findOne({_id: message.author.id}, function(e,d) {
Canvas.registerFont('./font.ttf', { family:'lilita' })
const canvas = Canvas.createCanvas(1078, 243)
const ctx = canvas.getContext('2d');
let context = ctx;
Canvas.loadImage('./assets/profile.png').then(async(image) => {
ctx.drawImage(image, 0, 0, 1078,243)
context.font = "50px lilita"
context.fillStyle = '#ffffff';
context.fillText("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", canvas.width / 7, canvas.height / 2.90);
message.reply({files: [{attachment: await canvas.toBuffer(), name: "file.png"}]})
})
})```
Ye but, you can only decrease so much before it becomes unreadable
That font is not really suited for small sizes
no, I wanted it to automatically decrease.
Are you even reading what I'm saying?


actually there is
CanvasRenderingContext2D.fillText(text, x, y [, maxWidth]);
maxWidth Optional
The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text. However, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width.
@rustic nova
-ub 593383699706281994
🔓 Unbanned Gaute#0559 (@loud ingot)
Wut
Ah fuck too late
Lol
Ffs
what
-b 593383699706281994
Banned Gaute#0559 (@loud ingot)
LOL
Fuckin discord
LMAO
Did you just un-unban?
just add the 4th parameter lol
I returned
I couldn't do a thing
(Jimp)
ignore the proportions
and the things
which is bizarre
the "Dev Note" is to be all user badges
Well uee
But that's not what those events are typically reading
guildCreate could mean it joiner a guild and guildDelete could mean it left one
Wdym
Yea
Or log that it joined a server
It’s an event getting triggered, for example if your bot joins a guild GUILD_CREATED is being fired
You can "listen to“ that event in your code
Well ofc you can
But ye, it can create and delete guilds it created
Exactly like you listen to the message event which fires if a message was send in Discord
Although that only works on first 10 guilds iirc
Yes
As long as you have the right intents
It can't create more then 10 guilds iirx
Not only that
Or no it can do it if it's in more then 10
It can only create as long as it's below 10 guilds
Yea that's what I meant
So like, if you already joined 4 you can only create 6 guilds
Are you sure that's v12
Or even v13
That's not a thing in v12 even
You gotta go through the channel manager iirx
mag.guild.channels.creae() iirc
create*
Mag
lmao
Locked and loaded
*takes screenshot of screen with phone*

Alright I’m tired, you can handle this, I believe in you! 
Of course right in the moment you create it
1x code is less than 2x code
lol
Just a random example found in the 'net:
message.guild.channels.create(channelName, {
type: "text", //This create a text channel, you can make a voice one too, by changing "text" to "voice"
permissionOverwrites: [
{
id: message.guild.roles.everyone, //To make it be seen by a certain role, user an ID instead
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], //Allow permissions
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] //Deny permissions
}
],
})```
written on mobile - call me god
I call you dog

Tell your cat I said pspspsps
Damn don’t have this evil eye emoji Erwin used quite often
kinky
Fuck I can’t use emojis so take this!
Sorry need to sleep Wass…
Just continuesly ping Kuuhaku, he will help you

Message.guild.roles.everyone is the @everyone role
What's the matter then?
Not really
The permission chain is
User > role > everyone
just use a role or a user
hm
So user perms override role perms which override everyone perms
452ms
1000+ 
DO was slow at the time it happened
Highest I ever had was around 16k
what happened to do that 
Good times on le olde contabo
Before the rework they had hdd plans
Which were really cheap
But well, let's say you suffered a lot with high STs
has anyone transfered there normal commands to slash commands yet
I use both
I use both
My command handler kinda translates slash to normal and vice versa, so I'm pretty fine
Huh I was pinged?
lel
Stop tj
no
my command handler auto deletes a slash command if the command's file got deleted 
do some work with the slash command handler @earnest phoenix
I have been
good job
no enjoyment wtf
Like u ur on vacation
smh
Alright then get the fuck back here
no more vacation
I mean, I can still work
i only take a break if my battery is on low percent/jk
I take breaks when I want to take breaks
I'm on my laptop but PC's better
That's no ping
not that kind of ping
good thing for me i dont use vc(unless i want to listen to music)

groovy is my jam smh
im not changing music bots anyways #general
this isnt development related anymore
const client = require('../index')
const arrayOfStatus = [
'HI',
'nice',
`${client.guilds.cache.size}`,
'haha'
]
let i = 0
const index = Math.floor(i);
client.on('ready', () => {
console.log(`${client.user.tag} is now online!`)
setInterval(() => {
//client.user.setPresence({ activities: [{ name: arrayOfStatus[index], type: "WATCHING" }] })
client.user.setPresence({ activity: [{ name: arrayOfStatus[index] }], status: 'dnd', type: "WATCHING" });
i = i + 1;
console.log(i);
if (i === arrayOfStatus.length) i = i - arrayOfStatus.length;
}, 10000)
})```
It doesnt show the status only.. dnd, no errors...
v13
bc u rnt randomizing what item u want to pick from the array
ur only doing Math.floor(num)
const arrayOfStatus = [
'HI',
'nice',
`${client.guilds.cache.size}`,
'haha'
]
client.user.setPresence({ activity: [{ name: arrayOfStatus[Math.floor(Math.random() * arrayOfStatus.length)] }], status: 'dnd', type: "WATCHING" })
ez
Probably spoon feeding but 
@pale vessel if its bad code show me how its done

Actually is activity even supposed to be an array?
I can't remember I haven't touched presences in ages
- const arrayOfStatus = [
- 'HI',
- 'nice',
- `${client.guilds.cache.size}`,
- 'haha'
- ]
- client.user.setPresence({ activity: [{ name: arrayOfStatus[Math.floor(Math.random() * arrayOfStatus.length)] }], status: 'dnd', type: "WATCHING" })
+ const arrayOfStatus = [
+ 'HI',
+ 'nice',
+ `${client.guilds.cache.size}`,
+ 'haha'
+ ]
+ client.user.setPresence({ activities: [{ name: arrayOfStatus[Math.floor(Math.random() * arrayOfStatus.length)] }], status: 'dnd', type: "WATCHING" })```
?
uh that looks like the exact same code but twice lmao
?
Mom get out my room im playing FTB presents Stoneblock 2 minecraft
I have only died once
to a chicken

Apparently if you attack a chicken with a stick it goes super sayun on ya
Its a fact
did you test it
it did 4 hearts of damage per attack with full diamond armor

and i had to kill it with a stick else I wouldn't get the amazing drop
what's the drop
Chicken stick

which is used to fight the end chicken
ender chicken
to get a dragon egg
One message removed from a suspended account.
I mean true
We're talking about chicken stick development
Nah lets move
Hi
Someone can explain me how I can do a now playing command with a bar with the duration of the song ?
With distube pls . I been searching for a long time 😔
it is in master
Ah makes sense
another useless thing
Is it possible for a server to send data back to the client in real time without an always connected websocket?
Server-sent events
does anyone know html because I have a question. is there a way to have more then one style change? I wont the color to be white and the font to be different but it does not tell me how to have two style changes and this does not work <h1 style="color:white;" style="font-family:verdana;">Websites and apps with DarkMode</h1> I'm a noob and it prob is very easy
Use commas
<h1 style="color:white;", style="font-family:verdana;">Websites and apps with DarkMode</h1>?
<h1 style="color:white;, font-family:verdana;">Websites and apps with DarkMode</h1>```
ok
You don't
<h1 style="color:white; font-family:verdana;">Websites and apps with DarkMode</h1>```
thanks it works with no comma
ye
You have to put it inside a wrapper. You can't center a link on it's own. Try putting it inside a div element and putting the text-align property on that instead.
ok
Sound like a challenge
Or do display:block; margin: 0 auto on the link if you want to leave it without the wrapper.
thanks
I'd delete this if I were you
k
I 'd join it later... Nuuu got deleted
lol
I have not gotten to this stage yet so i will do this maybe some other time
Use CSS animations
cringe
ive been working extremely hard on my bot's website, and, tonight ive released the leaderboard! what do you guys think about it? next few days we will implement discord api to get your userid and display more information and even show vote history for the last 7 days with graphs made by the bot! cool! https://ranks.eternaltesting.xyz
uh hello
everything's cringe at this point
hi
Hey
is it kinda ad?
just looking for comments/suggestions
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
at async GuildMember.edit (/home/container/node_modules/discord.js/src/structures/GuildMember.js:312:5)
(node:25) 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: 24)
can anyone tell why this is comming
;-;
uh
missing permission...?
That "latest votes" section is kinda a privacy breach. Tells you what servers people are in.
idk
actually this is a music bot
And if it's not opt-in that's also not great
add permission to join voice channels
well perms then
uh
not the same as voice perm I think
;-;
Looks like it encountered the error when trying to edit a guild member. If the guild member is the server owner or has a role higher than the bot that's probably the reason behind the error.
oh
but bot is unable to join stage
)-:
how do i compare ApplicationCommandData and ApplicationCommand??
;-;
;-;
hi, ive been trying to get vote rewards like this
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)```
but it doesnt seem to do anything
how do i get on vote?
you need to set up an webhook for that
refer to https://dblpy.readthedocs.io/en/latest/api.html#webhooks
btw wrong channel
move to #topgg-api
oh ok
There's the end event for collectors
<MessageCollector>.on("end",(collected,reason)=>{
//code
})
Collected param is a collection of Messages
Reason param is the reason why the collector stop (i think its undefined when it ends automatically)
I've made a command to edit a value in a JSON file, however, when successfully writing to it, the data ends up becoming one whole line.
How can I fix this?
Use JSON.stringify(obj, null, spaces)
Spaces is amount of spaces for indentation or you could also put a value like \t
thanks
strange i had discordutils package installed, and then when i wake up to check on my bot, the bot is offline and the packge decided to uninstall itself
same with asyncpraw wtf
ghosts
you send to the message from before you created the collector?
yes
and you should still have the original message where you received the command from
or where do you want to send it to?
message.channel.send() ?
outside of the collector
where did you create the collector?
show code
see? you have message
collector = message.channel.createMessageCollector()
collector.on("end", collected => {
message.channel.send(collected.size)
})
variables declared outside the scope still exist inside the scope
as long as you dont override them
oh god djsv12 looks weird
how do we log server-votes?
Use the webhook
like i need to make my bot log votes and give a role on voting i dont want to use other bots like vote-logger which has some bugs
#topgg-api is prob a better place to ask
use the webhook
Hello, I have in my bot a giveaway command and the embed changes currently every 5 seconds the timer which is api abusing but what would be ok? I read on the dev portal every 20 sec would be ok.
It depends how many giveaways are set up in the same channel.
Well, what would be the best way to find a fix for that issue?
Well obviously respecting the rate limts (to not get banned).
You may think about to generally change your system to not require that many edits of the message so quickly.
like every minute?
TypeError: AutoPoster is not a function:
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('mytoken', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})```
isn't this exactly what i did tho
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('', client)
ap.on('posted', (stats) => {
console.log('Posted stats to Top.gg!')
})```
owh wait, that message: "posted top top.gg"etc is optional
can't i just remove that and simplify to: ```js
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('', client)```
I guess
sure. thanks
I can't seem to send a DM to the owners of servers when my bot joins them.
module.exports = (Discord, client, settings, unirest, guild, shard) => {
guild.members.fetch(guild.ownerID).then(owner => {
var embed = new Discord.MessageEmbed()
.setTitle("Thanks for inviting me!")
.setDescription(`You invited me to **${guild.name}**.`)
.addField("Getting Started", "You can use the **$help** command to see a list of commands that you can use to help you setup your role store.")
.addField("Links", `**[Invite](${settings.links.invite}) - [Support](${settings.links.support}) - [Premium](${settings.links.premium}) - [Upvote](${settings.links.upvote})**`)
.setImage(`http://${settings.server.host}:${settings.server.port}/api/assets/shopcord-banner.png`)
.setColor(settings.bot.embed_colour)
owner.send(embed)
.then(() => { console.log(`[Shard ${shard}][Function][guild-join-dm] Successfully sent server join message to ${guild.owner.user.tag}.`) })
.catch(error => { console.error(`[Shard ${shard}][Function][guild-join-dm] ${JSON.stringify(error, null, 2)}`) });
}).catch(error => { console.error(`[Shard ${shard}][Function][guild-join-dm] Could not fetch the owner of the server.`) });
}
It says [Shard ${shard}][Function][guild-join-dm] Could not fetch the owner of the server. yet I know the owner can be fetched, because it's meee
Don't think it's supported just yet
There are two types
GUILD_PUBLIC_THREAD
and
GUILD_PRIVATE_THREAD
with channel type 11 and 12 respectfully
normally they look like this
{
"id": "41771983423143937",
"guild_id": "41771983423143937",
"parent_id": "41771983423143937",
"owner_id": "41771983423143937",
"name": "don't buy dota-2",
"type": 11,
"last_message_id": "155117677105512449",
"message_count": 1,
"member_count": 5,
"rate_limit_per_user": 2,
"thread_metadata": {
"archived": false,
"auto_archive_duration": 1440,
"archive_timestamp": "2021-04-12T2339.855793+00:00",
"locked": false
}
}
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Sad Already did like 2 / 3 years ago
yes
If you can do something with your account (user)
you can probably do that in bot api too
discord.js ?
np
hey, i have a question about json,i want to get the value of the key, i tried ${jsonFile.key}, the key having another value, but it returns undefined
const jsonFile = require('../../json.json')
Does it exist?
Can you log jsonFile?
but the point is that key has the value test, and doing jsonFile.key doesnt seem to log as jsonFile.test
yes
Then use jsonFile[key]
Np
i never really understood json 
so requiring a json file makes an array?
I am running no errors running this code but i am not getting my Embed with this command:
module.exports = {
name: 'command',
description: "Embeds!",
execute(message, args, Discord){
const newEmbed = new Discord.MessageEmbed()
.setColor('#ff249d')
.setTitle('Rules')
.setURL('https://www.youtube.com/channel/UC_PubN0fYwvhuse982q1sgA')
.setDescription('This is an embed for the server rules.')
.addFields(
{name: 'Rule 1', value: 'Be Nice'},
{name: 'Rule 2', value: 'Testing Nice'},
{name: 'Rule 3', value: 'Be Cool'}
)
.setImage('https://i.imgur.com/AfFp7pu.png')
.setFooter('Yo!');
message.channel.send(newEmbed);
}
} ```
No, and object
This is in the Command Folder.
I can snip if you guys need
Yes.
so u did <prefix>command?
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster(mytoken', client)
```I still get the same autoposter is not a function error
Yes.
Are u sure the command is being ran?
can i see your message event?
I ran the command and this is what it looks like now.
and use a console.log() right after execute
Can you put console.log(1) in the top of your execute method?
where? I am now so confused
can you show the index.js, without token if its there
The full command at the end (the client):
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'ping') {
client.commands.get('ping').execute(message, args);
} else if (command === 'youtube') {
client.commands.get('youtube').execute(message, args);
}
});```
The full Ping is there
bruh
???
you need to add
client.commands.get('command').execute(message, args);
}```
E'ry one codes diffrent
since thats what u did there
Anyone know what can cause this?
ik?
whats the point of creating a command handler if you're not using it?
???
Just add if(client.commands.has(command)) client.commans.get(command).execute(message, args)
^
Instead of the if(command === …) bullshit
the point of a command handler is avoid having to check every single command individually
so instead of "if command is test - do something" "if command is a - do something" "if command is b - do something"
you simply do "if command exists in commands - run command"
one line for all commands, no matter how many you have
What do i do to fix my error?
man, use
const Discord = require('discord.js')
you cant add it into params
.-.
you can lol, but its useleless
Have that.
Very top.
you need to require Discord in all files where you want to use Discord
;-;
@north jewel said to do this:
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'ping') {
client.commands.get('ping').execute(message, args);
} else if (command === 'youtube') {
client.commands.get('youtube').execute(message, args);
} else if (command === 'command') {
client.commands.get('command').execute(message, args);
}
});```
I had to do this:
```js
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'ping') {
client.commands.get('ping').execute(message, args);
} else if (command === 'youtube') {
client.commands.get('youtube').execute(message, args);
} else if (command === 'command') {
client.commands.get('command').execute(message, args, Discord);
}
}); ```
- thats not needed and thats not what he said to do
- you're still not using the command handler properly
What a horrible solution… just pass it as argument 
hey guys, my trivia command constantly gives me "& in the questions.
Any ways on how to remove those
passing it as an argument is the horrible solution lmao
i know it's an api issue, but can't i filer it out somehow?
how is it less work less code lel
Those are htmlentities you can parse
Ssshhshh stop make things worse
Object.defineProperty(global, "Discord", {
value: require("discord.js")
});
how do i edit a role's permission in djs master branch
@jolly vale what lang are you using #support message
help?
no
python
Use datetime
i am
try and except
no thats not the problem the problem is checking if its a valid city in the api
It'd return an error if it's not
ye and how do i make the bot send a message in that case
try:
check for city and stuff
except:
send message saying city isn't valid```
Try would run the code normally, however if there's an error it'll switch to except, and there you can display an error message for the user.
oh ok so i just put the api where city is?
hey guys, how do i remove tje "& words from a string like this?
ok got it thanks
replaceall woul;d do the job right
yeah if "& is constant then it should
ready.replaceAll is not a function
const ready = easy.results[0].question
const klaar = ready.replaceAll(""&", "");```
replaceAll requires node.js v15+
you can use replace with regex instead
yeah i just read that. i will just use regex
yeah exactly
which btw is faster than replaceAll
for that funny characters, decodeURI is more appropriate
decodeURI doesnt handle html entities
const { decode } = require('html-entities'); 
ye thats an option xd
https://opentdb.com/api_config.php I'm assuming s/he use this
They 

How does bot hosting service handle ratelimits/ip bans?
the service doesnt
the users have to respect limits, if the user gets the hosting ip banned, the hosting service can ban the user
ip bans are usually temporary anyway, and the hosting service has many ips to chose from
Can you still hit ratelimit ,if you use discord.js ,since it handles internal
discord.js does not allow you to hit the discord rate limits, but its not 100% ratelimit-proof
some endpoints are difficult to deal with because of undocumented sublimits
and also the sharding manager does not share limits between shards
if one shard hits the limit, the other shards are not aware of this, and can try to go beyond limits
Tim is poggers
no u

<3
Pog
it worked tysm

How do u do this?
Generate a sitemap and then read the data from it
Now in english pls
Is it gitbook?
it is git gud
do what
make a list of all the documentation pages
then just use the data to see the previous and next pages
if you're using smth like astro it automatically generates it for you
don't use inline
I wanna know how to make the buttons
css bro
border border-radius box-shadow
hey
I got rich presence working
yay got context menu actions working on D++ 😄
wonder how long before they reach general availability
are you sure @client.event is the right way to do it?
my intention of it is when the bot starts or is ready it prints that it is online and sets its status to how many servers it is in with how many members that can use it
I know but, the error says @client.event doesn't exist
check the docs to see how it has to be done
okay
Why did you from discord import client
client in that context is a discord.Client instance
oh
yeah i found out why
i had two client.event with on_ready running
now it works fine
hi, why is this not working
const filter = m => m.content.includes("test");
const collector = ch.createMessageCollector({filter, time: 15000});
collector.on("collect", m => {
ch.send(m.content)
});
It gives me this error: TypeError: Function.prototype.apply was called on #<Object>, which is a object and not a function
its (filter, { time: 15000 })
not ({filter, time: 15000})
oh it worked, thanks a lot
How do I turn off firewalls ?
in windows 10
sothat it starts to accept external http requests
and so that I can test top.gg webhooks
@quartz kindle do you know a better way to format permissions?
I want to transform an array of permissions from this
['SEND_MESSAGES', 'EMBED_LINKS']
to
['Send Messages', 'Embed Links']
what I have currently
lol
the array it makes though is kinda like this
['Send', 'Messages', 'Embed', 'Links']
any idea how else I could format them lol
function decapitalize(string) {
return string.charAt(0) + string.slice(1).toLowerCase();
}
const permissions = ["SEND_MESSAGES", "VIEW_CHANNEL"];
const newPerms = [];
for (const permission of permissions) {
const [first, second] = permission.split("_");
newPerms.push(`${decapitalize(first)} ${decapitalize(second)}`);
}
const cmds = await client.api.applications(client.user.id).commands.get();
for (const cmd of cmds) {
client.api.applications(cmd.id).delete().then(console.log);
}```
can anybody tell me why this doesn't delete all (global) commands?
i would do something like this ```js
permissions.map(perm => perm.toLowerCase().split("_").map(word => word[0].toUpperCase() + word.slice(1)).join(" "))
lemme try that
lol
im the exact opposite of tim
I like to overcomplicate stuff
xD
edit: forgot a toLowerCase
google makes a good point tho, you can simply tolowercase the rest instead
permissions.map(perm => perm.split("_").map(word => word[0] + word.slice(1).toLowerCase()).join(" "))
yee works perfectly ty tim uwu
select the correct scope on the developer portal and have a redirect URI
What do I put as the redirect url
send http request to https://discordapp.com/api/users/@me
with header Authorization: Bearer ${ACCESS_TOKEN}
If your access token allows email then you'll also get the email in the response
Do I need the message intent to fetch messages and delete them afterwards?
My bots page?
yes after 9 weeks
Welp
I don’t know how to make an http request 😔 do I use XLMHttpRequest?
Do you know how Oauth2 works ?
Sorry I can't give a full tutorial rn
Maybe someone else can help
A URI where you have access to the data returned. For example, the URL to your web server.
Alright. I’ll just look it up
Ohh alright
When they user invites my bot and gives permission to that stuff does it just console.log() it?
Or no
well, arrow 1 should be pointing to discord api actually
there, fixed it
1 - user access discord authorization page
2 - discord sends token to your server
3 - your server exchanges that token for desired info from discord
4 - discord sends the requested data
5 - your server process the data and return some result to user
You know you're explaining this to someone who literally asked if s/he should use XMLHttpRequest
¯_(ツ)_/¯
reference
I mean, I did my oauth2 thing using raw http requests and endpoints
that before I found out there are libs for that
Oh,
I use fetch() still
the discord-oauth2 package is kinda dum
oauth isn't hard at all once you have a webserver setup
yea
the hardest part for me was understanding why tf the body json was invalid
until I read closer discord docs and found out they actually want urlencoded data not json
You make me feel stupid 👀
lol
you know the best part
I even forgot that I wrote this code
lul
oh you feel stupid ?
I asked how to set embed color when I first came gere
*here
There’s a full discord embed example in the docs 👀
I still find stupid that "embed color" is actually the "1px thin and almost irrelevant line to the left of the embed"
Like I used to read docs
Lmao
I know I’m gonna get some hate for this and ppl are gonna say I should rlly know js before anything but when I first started all I would do is look at the docs and try to put stuff together when trying to make commands until it would work. I had to prior knowledge of any coding language when I first started making bots
you what?
Nothing…
but ye, you're supposed to practice the language before attempting bigger projects
Yes ik
I learned React before HTML
you wont get hated for that, many people learn like that, but it gets troublesome when they are not very interested in learning, and just keep asking for people to fix it for them
ye







