#development
1 messages · Page 1874 of 1
fork
saw alr and im not gonna have problems with law cause i know that danny copyrighted dpy
sorry
lmao. n00b here
im not gonna use it, sorry, i heard about even a little more but for the now dpy smh work so i use it yet
anyways.
why this part doesnt work?
if ctx.guild.role(name="muted") in ctx.guild.roles :
await ctx.author.add_roles("muted")
else:
await ctx.guild.create_role(name="muted")
await ctx.author.add_roles("muted")
(specially cutted for you to not see event listener, cause it works to this moment)
Erm... Read the dpy license. You are free to use it and modify it.
forks are also legal and i wont have problems after use? i heard that some apis had this problem...
It's open source. It's not illegal to fork and use an open source repo with a license like dpy's MIT license.
ikr? but some forks had law problems
Read the license and you'll know what you're allowed and not allowed to do.
ikr? i just didnt yet read lic of this and even if. why were talking bout law where question was bout code?
That's why
ehh. i would get answer to my code faster even on tweeer than here :/
Well that person tried to help you and you called them a noob for actually having a valid point. If that's the way you treat people who are trying to help you what do you expect?
not bout it but i asked for help bout managing roles in discord.py and y'all woke up with switching apis more than helping....
sorry, i'll get answer on tweeter (cause got beaned on overflow and its my only place)
That's a lib not an api
anyways - you moved topics. im away
question was this. not what is license of dpy and/or alternatives of that :/
Are you banned everywhere except here? 
What have you done?
One message removed from a suspended account.
nope, from a few places im not
One message removed from a suspended account.
here, one server and mine i made
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
What's the suggested amount of time that I should have a domain registered
nope, spams, raids and mentioning mods
One message removed from a suspended account.
As long as you want
One message removed from a suspended account.
One message removed from a suspended account.
Mhmm
One message removed from a suspended account.
What happens after registry ends?
One message removed from a suspended account.
You can renew it
One message removed from a suspended account.
One message removed from a suspended account.
Or let it go
One message removed from a suspended account.
How much is the renewal fee
One message removed from a suspended account.
One message removed from a suspended account.
What's the average
Depends on your broker and the tld
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
There is no average
What if you use a registrar instead of a broker
Same thing different word
One message removed from a suspended account.
Namecheap is good too
One message removed from a suspended account.
I'm deciding between name cheap and pork bun
One message removed from a suspended account.
I'd go with namecheap tbh
One message removed from a suspended account.

ill investigate both and see which is better
Just compare the price
One message removed from a suspended account.
They're all the same thing
One message removed from a suspended account.
alright
i said alr
and sorry for late answer but i have some people next to me and it makes me to do some other tasks than talking
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
It really doesn't make a difference which registrar you use. I use like 5 different ones depending on the TLD I want
Why 3?
One message removed from a suspended account.
One message removed from a suspended account.
why would you need many different registrar's for a single domain
Just shop around for the best price for your chosen domain
It does, the bigger the better, the quicker usually is a DNS change
One message removed from a suspended account.
Woah, pork bun is so much cheaper than name cheap
One message removed from a suspended account.
Even renewal
One message removed from a suspended account.
One message removed from a suspended account.
Less than 10 dollar renewal, wow
One message removed from a suspended account.
Also why would I need more than 1 registrar
One message removed from a suspended account.
but in what situation would one use many different registrars
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
If you want a TLD you can't get with porkbun like .ie then you'd need to register that one with a different registrar.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I just need a .xyz
One message removed from a suspended account.
I have to use a different registra for .rs
One message removed from a suspended account.
Then find a registrar that has that TLD
cuz yay for country codes
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I saw .xyz on porkbun
Then get it there
Invalid interaction application command
what could be a reason for me to get this error, it's kinda confusing
trying slash commands
can i came back with my question or not?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i have to
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
cuz big project
One message removed from a suspended account.
¯-¯
Also how do you make a rich presence
these slash commands are really confusing ffs
Dbl ask2ask
@brave garnet
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
and if i ask i wont again have a pseudo-answer with "switch api" and/or "read license of dpy and forks"?
Is this some sort of an attention deficit or a hyperactivity disorder? Is it to hard to fucking ask what you wanna need help with?
i asked but last time i asked i was asked to change api, and not got real answer, so im asking if i wont have it again
dpy...
(;⌣̀_⌣́)
anyways - bye. ttyl. i go sleep
what the fuck happened here
Nothing. Bye. To tomorrow!
perhaps if you just ask your question, followed by "please don't tell me to switch libraries, I just need a solution", then you'd get a real answer
asking to ask is essentially saying this
Then go to sleep already
10th bye of today, dude GO
Nobody's forcing you to be here
Unbelivable he hasn't got banned yet
She
Doesn't matter, and I can pretend to be a he/she/it, too or a tree
Doesn't change the fact of this annoying attitude
Women
/s
More context please
Are you just sending a webhook or replying to an interaction for example?
Lord god, Please he-
I am tryna reply to a interaction yeah
You can do that within a few seconds only or defer the reply
Wait what do you mean?
How to see mongodb connection ping?
Do you send that reply immediately after receiving the interaction?
Yes basically as soon as it recieves it
Like how long is the max delay?
Maybe code too slow?
A few seconds only unless the webhook ID isn’t valid anymore
Think it was like 4 or 5
Guess I will time it
You’re using djs?
Yessir
Well timed it and it is roughly like 3 seconds in between
But I just tried it in another guild and the command doesn't show up there yet even though I am sure I set most things to global so it should show up there too, Wait we also got the cooldown, Maybe that is the issue?
You can use this to “delay” your reply
Get the webhook ID of your interaction and use it to send replies after
Or simply using editReply() on the interaction
deferReply() will cause a "I’m thinking…" note before your message appears
How I can play a audio in a exact time (multiple times) with https://github.com/fluent-ffmpeg/node-fluent-ffmpeg ?
A fluent API to FFMPEG (http://www.ffmpeg.org). Contribute to fluent-ffmpeg/node-fluent-ffmpeg development by creating an account on GitHub.
Does anybody know of any way to get your slash commands from Discord? I make a call to the API and get them but I get an undefined return I think, I’ll double check rq
I get an object promise.
Which lib, djs?
await
V13 yes.
client.application.commands.fetch
And yeah await the promo
*promise
Damn auto correct!
Yeah
I’m looking to fetch all of them.
I have one global command to delete, two in testing.
Hoping to get ID’s. I think I have a solution.
The collection contains the IDs
And names?
Okay then I’ll forEach it and grab all of it
I used forEach when doing my punishments list, and I don’t usually mess with for of either so I’d need a small walk through
It’s a lot faster at least in JS
I mean it worked I got my global command
Not that micro optimization is important but looping through bigger objects will be faster, noticeably
Yeah it’s just a recommendation
I know. Well since I’m here and kinda talking about it, I’ve been trying to get certain commands in a certain category, like a dynamic help command, but I’m only looking to get a single category such as my administration commands
for(const [id, command] of <commands>)
I’ll keep that in mind.
id is the key of the element and command it’s values (as object)
Right.
Currently, I’m trying to filter through my clients loaded commands for any ‘administration’ commands, and I want to put them inside a message and then send it to the user, I’ve figured out the sending to a user I just can’t figure out how to get the specific commands
Command categories don’t exist yet, there’s no sort of nesting for sub commands
You shouldn’t
facepalm lemme try again.
They will be obsolete in a few months
I explained it badly anyway.
Oh.
Didn’t read your second block yet
I still wanna try and explain and achieve a goal rq.
Need to concentrate a little not to hit a tree 
Say I have 3 commands in one folder,
Restart, Reload, ReloadModule, these are administrator specific commands that only approved users can run (Defined in an administrators array),
I'm looking to go into the cache, get the names and aliases, based on them being in a certain category marked as 'Administration'.
Feel that lmao
Nah I’m driving 
Oh.
You mean showing them using the help command for example but only for whitelisted users?
Yes, exactly. I know how to whitelist it, but I just don't want to write out all of the commands like I used to do and have a file that was thousands of lines long.
You’re trying to display them dynamically and to display the privileged ones for your whitelisted users only?
I think? The priveledged commands are backend access to the bot that allow administrators/developers to restart, or reload commands as need be, allowing them to blacklist users and servers, and remove the bot from servers without needing permissions as deemed fit. These commands should only be definable to bot administrators
I would define an array, let’s say let help_fields = [];
Loop though your client’s commands and add them to the array.
If they need a specific permission you basically don’t add them to the array.
At the end you use that array as your embed fields
Okay....
Inside your command loop add objects to the array in the valid form the embed supports
For example:
let admin_cmds = [];
client.commands.forEach((cmd) => {
if(cmd.category == 'Administration') {
admin_cmds.push(`${cmd.name}, ${cmd.aliases}`);
};
});
My thoughts?
loop(commands)
{
help_fields.push({ name: command.name, description: command.description});
}
Well yeah if you create multiple array for any category that will work as well
Check if your admin_cmds is empty after the loop and if so don’t include it in your embed
if(!admin_cmds) return;
Makes sense.
The array exist but it’s length is zero
And if it’s empty you don’t put in your existing embed or message or however you send it to the user
Oh I see you’re using embed fields as the categories, aren’t you?
I don't think so.
Huh I don’t know how it looks at the end.
Don’t you send an embed?
Alright first try and nothing happens lol.
I have customizable behavior so it sends either as a message or an embed, it is based on server settings.
Ah alright
No data went to the array.
const admin_cmds = [];
client.commands.forEach((cmd) => {
if(cmd.category === 'Administration') {
admin_cmds.push({ name: cmd.name, aliases: cmd.aliases, description: cmd.description });
}
});
client.logger.log('X', 'debug');
Is the category using a capital letter? 
Sun Sep 12 2021 22:29:36 GMT+0200 (Central European Summer Time)
commands/test2.js:12```how do i ever only get the time?
Yes.
hmm
Just log the cmd at the beginning of the loop
So im trying to find a message by ID and react to it. In discord.js v12
Just to make sure
object Object
Use JS date() to create a timestamp and then use it to get the time
Well use the console log
How’s your client.commands structure?
Can someone help meh ^^
Explain.
Sun Sep 12 2021 22:29:36 GMT+0200 (Central European Summer Time)
commands/test2.js:12```
how do i ever only extract the time from message.createdAt
Errr it’s a map of your commands?
const directories = await readdir('./commands/');
client.logger.log(`Loading a total of ${directories.length} categories.`, 'log');
directories.forEach(async (dir) => {
const commands = await readdir('./commands/' + dir + '/');
commands.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
const response = client.loadCommand('./commands/' + dir, cmd);
if(response) {
client.logger.log(response, 'error');
}
});
client.logger.log(`Loading a total of ${commands.length} commands in ${dir}.`, 'ready');
});
This?
Or am I just missing something completely?
Err not was I was looking for lol
Leaving the highway in a few seconds, gonna head back to you later, sorry
how do you check if a site is using Let's Encrypt or DigiCert?!?!1
how do i get the same thing as message.createdAt, but then when a user reacted to an emoji?
just check the issuer of the SSL cert
checked on a site and it says lets encrypt
but am using digicert
in js, can i just .toString() on an AsyncFunction prototype? unlike Function prototypes, running .toString() on an AsyncFunction will return a promise. how can i convert it to a string?
Hi, I don't seem to be able to understand this error I've got, any ideas?
uh well first thing that i see is that discord.com isn't resolving
it's probably a DNS issue
So it's not really my fault actually?
try changing your dns resolver to something more reliable than default
I didn't even know I had a DNS resolver set to default 
const str = beeps.map(x => `-itsoffset ${parseInt(x) / 18} -i ${path.join(__dirname, 'beep.mp3')}`)
await execa(
"ffmpeg",
[
"-y",
"-framerate",
String(fps),
"-i",
`frame-%0${frameLength}d.png`,
'-i',
path.join(__dirname, 'beep.mp3'),
...str.map(x => x.split(' ')).flat(),
`-filter_complex`,
`amix=inputs=${beeps.length}`,
"-c:v",
"libx264",
"-pix_fmt",
"yuv420p",
output,
],
{ cwd: outputDir }
)
I am trying to play beep.mp3 7 times per second (the variable beeps has an array of the frames in which it is needed), but it only sounds once
has Discord said anything official about when the on("message") event listener is going to go away or not give us the message context?
april 2022
event won't go away, you'll just not get message content
it'll make bots blind not deaf
did they post that somewhere?
is there a guide on how to use JsDoc?
Official documentation for JSDoc 3.
ah thx
is there a tool like jsdoc that makes slash command docs out of configs? ```json
{
"name": "vote",
"description": "Vote.",
"options": [
{
"name": "up",
"description": "Upvote another player to increase their reputation.",
"type": 1,
"options": [
{
"name": "player",
"description": "The awesome player.",
"type": 6,
"required": true
}
]
},
{
"name": "down",
"description": "Downvote another player to decrease their reputation.",
"type": 1,
"options": [
{
"name": "player",
"description": "The horrible player.",
"type": 6,
"required": true
}
]
}
]
}
yeah, like jsdocs. someone will make it at some point
the polish is what is hard
jsdocs look nice
that's what i'll be making nextr
i guess i could make the site to host slash command docs and then put my slash commands there
instead of just doing it for my own website
describe web development in one picture

you could always use constructor names instead of typeof xD
I can't use constructor names to check for object literals tho
you kinda can

Isn't Object the common ancestor of everything?
I just want pattern matching like a real language.. is this too much to ask for
yes but constructor names take the most recent class name
Ik, I'm talking abt [] instanceof Object
yes
instanceof checks all extensions
also, a null prototype object breaks everything
I was rewriting this stupid script in rust but I realized the js ICU parser and rust ICU parser don't match up properly so I just threw away 1000 lines of code
so back to this shitty language
One message removed from a suspended account.
F# maybe
Guys is this channel can help me in css , html design ?
I programming my bot dashboard buy my design is 💩
So if i want help in design can i come here?
You want feedback abt ur design?
No i want help
Like if i want to get button in left nav bar and another in right .... Like this
if you want help solving issues no problem, but don't expect whole coding help
dont fight js. just write good js.
Google Tech Talks
Web Exponents
presented by Doug Crockford
February 27, 2009
blog post: http://google-code-updates.blogspot.com/2009/03/doug-crockford-javascript-good-parts.html
JavaScript is a language with more than its share of bad parts. It went from non-existence to global adoption in an alarmingly short period of time. It never h...
Yes i know
I mean helping me when i designing :/.
With slash commands, is sharding still necessary?
the INTERACTIONS ENDPOINT URL api wont, but the bot listener stuff will still need it
Gotcha - assuming the discordjs client will require it even if I'm only going to be using slash commands?
yea, and i dont think you'll want to use the discordjs in the INTERACTIONS ENDPOINT URL api code
im using aws api gateway + 2 aws lambdas for hosting my slash command api
my bot client code is hosted on a vps
That's neat - I definitely could not do that for my use case though.
On that note, how do you guarantee responses within 3 seconds?
Or is that not a requirement?
that's why i have 2 lambdas
One to respond back immediately? One to edit? haha
the first one acks and then the second one does a patch api request
nope, once the response is sent it stops the lambda
Right - but can't you send a response back to discord explicitly without resolving the lambda to a return? If you follow what I'm saying?
I've used them professionally for about 2 years now - would love to understand your troubles with them.
Also, do you not have any problems with cold start times on the lambdas? And, on that note, I would imagine it would become super expensive if your bot scales. Although you have a free 1,000,000 invocations each month ... if the bot is in 1,000,000 servers (yikes)
$0.20 per 1M requests
$0.0000166667 for every GB-second
it works great
I bet - I was thinking about doing it as well when they first came out
Unfortunately, my bot sometimes has long-running commands that may go for longer than 15 minutes (games)
see how i resolve the response and then do stuff after?
the stuff after the resolve wont be guaranteed to run
Any VPS should be sufficient to handle everything you need it to. If you're already leveraging it for other things, that's a better use of resources. Even if you don't want one machine to handle slash commands, you can either have them sent down the socket or reverse proxy to shards
my vps has 1gb and 6 CPU Credits/hr
whatever that means
its always good to keep things separate
i think you get 20 minutes to follow up after the ack so that should still work
also you could split the work into multiple smaller lambdas and chain them together. the max running time for a lambda is 15 minutes so that would be cutting it close.
if you had 1 million servers that each made 1,000 requests per month then you would pay ~$200 for the requests
can anyone help
Have you tried unplugging it and plugging it back in?
found the docs
https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html#runtimes-lifecycle-shutdown
Background processes or callbacks that were initiated by your Lambda function and did not complete when the function ended resume if Lambda reuses the execution environment. Make sure that any background processes or callbacks in your code are complete before the code exits.
How can i test that it's working from visual studio code?
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("your webhook auth")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)
put something like this in your package.json
and then do npm run start from the terminal in VSC
why isn't is writing the error to the file
i purposely changed the API url to the wrong one so it would write the error and it still is not writing the error.
const Discord = require('discord.js');
const fetch = require("node-fetch");
const fs = require('fs')
module.exports = {
name: 'kiss',
description: "Gives you a kiss OR the person you mention a kiss",
async execute(message, args) {
let kissedUser =
message.guild.member(message.mentions.users.first()) ||
message.guild.members.cache.get(args[1]) ||
message.author
embed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setDescription(`${message.author} kissed ${kissedUser}!`)
.setFooter(`Kiss sent by: ${message.author.tag}`, message.author.avatarURL({ dynamic: true }))
.setTimestamp();
const {url} = await fetch('https://neko-love.xyz/api/v1/kiss')
.then(response => response.json())
.catch(error => {
message.reply(`**Kiss API** is not responding!`)
fs.writeFile("./error.txt", error) //why isn't this writing to the 'error.txt' file?
return;
})
embed.setImage(url)
message.channel.send(embed)
},
}
writeFile requires a callback
You were probably looking for writeFileSync
Unless you wanna use the callback method which you can easily do by reading the documentation for writeFile
I keep getting the error "Unexpected End of Input" Where did I miss?
const ytdl = require('ytdl-core');
const ytSearch = require('yt-search');
const { joinVoiceChannel } = require('@discordjs/voice');
module.exports = {
name: 'play',
description: 'Joins and plays a video from youtube',
async execute(message, args) {
let voiceChannel = message.member.voice.channel;
if (!voiceChannel) return message.channel.send('You need to be in a channel to execute this command!');
const permissions = voiceChannel.permissionsFor(message.client.user);
if (!permissions.has('CONNECT')) return message.channel.send('You dont have the correct permissins');
if (!permissions.has('SPEAK')) return message.channel.send('You dont have the correct permissins');
if (!args.length) return message.channel.send('You need to send the second argument!');
const validURL = (str) =>{
var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
if(!regex.test(str)){
return false;
} else {
return true;
}
}
if(validURL(args[0])){
const connection = await joinVoiceChannel;
const stream = ytdl(args[0], {filter: 'audioonly'});
connection.play(stream, {seek: 0, volume: 1})
.on('finish', () =>{
voiceChannel.leave();
message.channel.send('leaving channel');
});
await message.reply(`:thumbsup: Now Playing ***Your Link!***`)
return
}
const {
joinVoiceChannel,
createAudioPlayer,
createAudioResource
} = require('@discordjs/voice');
const connection = joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator,
});
const videoFinder = async (query) => {
const videoResult = await ytSearch(query);
return (videoResult.videos.length > 1) ? videoResult.videos[0] : null;
const video = await videoFinder(args.join(' '));
const stream = ytdl(video.url, {
filter: "audioonly"
});
const player = createAudioPlayer();
const resource = createAudioResource(stream);
async function play() {
await player.play(resource);
connection.subscribe(player);
};```
play.js:62
};
SyntaxError: Unexpected end of input
←[90m at Object.compileFunction (node:vm:352:18)←[39m
←[90m at wrapSafe (node:internal/modules/cjs/loader:1031:15)←[39m
←[90m at Module._compile (node:internal/modules/cjs/loader:1065:27)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:94:18)←[39m
at Object.<anonymous> (C:\Users\scott\Desktop\DiscordMusicBot\main.js:15:21)
←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
is the error.
Can we get the full error please
No I prefer having ambiguous errors, sorry misty
Nice username, haha
Did you write your bot in Golang?
Indeed
I actually had done the same - but converted it to TypeScript 
I am done with ts
It worked fine, there were just several more open source libraries for typescript that I could leverage for various purposes
go better
Not disagreeing, lol
I work with golang professionally as well - love it 👍
bruh
Typescript is good at handling all the issues it introduces with types
there is a good explanation about why strong typing is bad
https://youtu.be/hQVTIJBZook?t=568
Google Tech Talks
Web Exponents
presented by Doug Crockford
February 27, 2009
blog post: http://google-code-updates.blogspot.com/2009/03/doug-crockford-javascript-good-parts.html
JavaScript is a language with more than its share of bad parts. It went from non-existence to global adoption in an alarmingly short period of time. It never h...
what do you think about this organization?
i have too many commands
i'd shorten configurations to config, keeps it simple
the organization itself looks good
^^
I dislike js cause it has no type safety
type safety hurts more than it helps
not to me
TS is noice but I don't really use it anymore
I love ts
type systems are like training wheels on a bike. it helps you learn
though you could also say ts takes away the total power of js
since it sacrifices some aspects of performance to provide you these dynamically typed features such as arrays and you don't even use them
mostly memory usage
yep, it forces you to write a bunch of useless code
DiscordAPIError: Unknown interaction
The slash command works, but yields that error in the console 🤔
what endpoint? is that all the error says?
DiscordAPIError: Unknown interaction
...{
method: 'post',
path: '/interactions/.../.../callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 4, data: [Object] }, files: [] }
It doesn't error out on the first command, but it does the rest after. BUT they all still work and send the correct message
Also, one more question, does the registering of the REST need to happen outside of the sharding file? I'm assuming so? Does it harm anything to leave it spawned from the ShardManager ?
im not sure how it would work inside the sharding. you'd only want one endpoint
setup a loadbalancer if you want to do sharding with the api
shouldn't the method for the interaciton callback be patch?
this is what my responses look like
are you making a post request to a discord api endpoint anywhere in the code?
how do you fetch the option that was clicked on a select menu from a component collector?
discord.js btw
interaction.values[0]
Anyone have some good new alternatives to QuickDB?
QuickDB was simple as hell but seems to be broken on newest node release
keyv?
though the author seems to have abandoned it so be careful
but as long as the adapters are maintained it'll be fine
How do the adapters work?
anyways code time
so im making a verification command thing
theres 3 parts
its for our school server
1st part is to choose what campus you are from
then batch
then a checkmark to verify that they read the rules n stuff
i already have the 1st part, which is the campus picker
i already setted up the collectors and stuff
but how can i make it so it fits into one commmand?
So what fits in 1 command?
the verification system lmao
part 1 is a select menu to choose what campus
Like I am confused
Have it send the collection menu-
yes i already have the select menu collector setted up
but how do i fit the other 2 parts into it?
Make a collector to await the response, Then take the response and send another reply to the interaction with the next part with another collector to catch a button on there that would await the button press shite for the interaction and when that happens go to the next part etc
import os as yodada
import discord as santa
from santa.ext import commands as yomama
from dotenv import load_dotenv as you
you()
TOKEN = yodada.getenv("TOKEN")
discord = yomama.Bot(command_prefix = "🎅")
@discord.event
async def on_ready():
print(f"Logged in as {discord.user}")
discord.run(TOKEN)
```run this
what happens if it times out tho, bot would just
theres a collector timeout right
then it would just
go to the next one
why these vars bro
then go to the next one
xD
then nothiing
You run a new collecter after each one breh
Eh any other things in Keyv that can just easily have a local db? Since I just need a small local db
sqlite adapter
Is here someone who has made a bot dashboard with ExpressJS and ReactJS?
for fun
pay up for a vps
so uh
i have like
16 different options
that is hard coded
yes i need it to be hard coded
in a select menu
and its spaghetti code
how can i like put it down to a few lines of code?
from like 90
Yeah
bc i have the setup like this
.addOptions([
{
label: "1st",
description: "1st",
value: "first"
},
{
label: "second",
description: "secpnd",
value: "second"
},
//repeat for like 14 more times
guys
i need help
how to make my bot stay online
without money
it stays in call only but online dont
Short answer: you can't reliably
wdym
Long answer ^
When it comes to web hosting you get what you pay for. A free service will always make you their lowest priority.
There's a list of providers here ☝️ (or in the pins) and I also recommend Pulseheberg
You can get a cheap VPS and that'll keep you going for a while
Otherwise you're stuck with Replit or Heroku. Google also offer a free tier on their cloud plans but it's limited to one year and better than Replit or Heroku.
Since my bot is just a personal project and is very small, I’m using Oracle’s free tier of hosting until I need to upgrade
The best thing is that they’ll never charge you for an overage on anything, because your account has to be upgraded to be used for paid transactions
So you don’t have to worry about getting slapped with a random bill you didn’t expect
downside u do need a cc to sign up
Don't you need a CC for Heroku anyway?
Yeah but I think you need those extra hours for it to be a viable option
It's still free though
Otherwise it’s only up 23/24 days a month
It’s ok if you’re not willing to spend money and if you don’t have many users
yay discord bot in 6.7mb
going to be rolling out premade .deb files with the compiled library in for raspberry pi armhf soon 🙂
so people dont even have to build it, just dpkg it
seggsy 👀
Cool
Hello
Might have to try out dpp 
Heyy can some help with the ping command
help with?
sup
if (!message.guild.members.cache.get(UserGet.user.id)) return console.log('ok')
let arr = message.guild.members.cache.array().sort((a, b) => a.joinedAt - b.joinedAt);
for (let i = 0; i < arr.length; i++) {
if (arr[i].id == UserGet.user.id) return console.log(i);
}```
``` let arr = message.guild.members.cache.array().sort((a, b) => a.joinedAt - b.joinedAt);
^
TypeError: message.guild.members.cache.array is not a function```
They removed caching methods
Use [...message.guild.members.cache.values()].sort(...)
it works but how do I do it for my for()?
Just do js for (const member of message.guild.members.cache.values()) { if (member.id == UserGet.user.id) return console.log(i); } then
isn't values() an array already?
weird but ic
what I want is to have the position to arrive x)
Map.prototype.values(): IterableIterator<V>;
weird af lul
like, if arrays are iterables, why not just return an array?
nerds
Array extends Iterable
ik, that's why I said "weird"
Because I may want my function to work with an iterable, but not necessarily an array
Sets are also iterables, and maps
ik
might be with how the memory would be allocated to the Array. If the sets are large enough, would be chomk. I'm not sure how the iterables work in the cases of Map and Sets, but possibly not allocating the entire entry set to an Array
in java it also returns a Collection, which is the superclass of List and Set
you can iterate and use stream methods on it
what I find weird is not being able to do <Iterable>.sort(...)
or any other methods like that
is conversation ended? im back with yesterday question (just got pc)
I want to make that if we mention the bot it returns the prefix of the bot
You can use a message event and use a regex or smth of the sorts (I think this is a way to do it can't remember). And just return the bots prefix
ok thanks
is it against Contabo's TOS to change the VPS's OS?
If it is, surely it will be on their tos
btw
@ripe dune no ads please
okay, busy, so i'll just go play some slitherio...
const Topgg = require("@top-gg/sdk")
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook("auth")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)
the code not working
Have you done port forwarding on port 80?
I didn't do anything like that
the bot token on visual studio code for another bot for testing
setTimeout(() => {
console.log('Loading... 0%')
}, 3000);
setTimeout(() => {
console.log('Loading... 10%')
}, 3000);
setTimeout(() => {
console.log('Loading... 20%')
}, 3000);
Any faster way to do this? (I know this isn't how loading things work, but I'm new)
Why would you need to port forward
Just make sure port 80 is open
and not being used by another application
const prog = 0;
const oldProg = prog;
setInterval(_ => {
if (prog === oldProg) return:
console.log(prog);
oldProg = prog;
}, 1000);
i wouldn't mind if the progress bar is off by a second
let progress = 0;
const X = setInterval(() => {
progress += 10;
console.log(`Loading... ${progress}%`);
if (progress === 100) clearInterval(X);
}, 3000);
you could also check before adding to the progress so you don't get Loading... 100%
process.stdout.write(`Loading... ${progress}%\r`);
so it edits the last line instead of add a new one
11 mins of inactivity means free channel or no?
Yea,but the eaiser question get priortized
so channel isnt free, ok, gonna go plaing some slither...
What's your issue again?
same as yesterday =p
I mean, we have said multiple times that you should just ask your question instead of asking to ask
bye, i go play something
Not everyone knows what you were asking yesterday, so it’s best to just repeat your question
if ctx.guild.role(name="muted") in ctx.guild.roles :
await ctx.author.add_roles("muted")
else:
await ctx.guild.create_role(name="muted")
await ctx.author.add_roles("muted")
this was
with crash.
but if you want to have lib a war. have it. im afd now
I don’t understand what the question is
why code doesnt work? lol
Did you get an error?
Ah.. now I did do this.. and re-did it in my own way too. I have this issue..
const loading = setInterval(() => {
console.log(`Loading... ${progress}%`);
if (progress === (0 || 67)) progress += 33;
else progress += 34;
if (progress >= 100) clearInterval(loading);
}, 1000);
Exits at 0%.
yea, different with different configs
(I don’t know python, but it’s useful to provide an error for those that do)
huh? it requires a list for giving roles and i forgot what. continue discussion with @feral aspen , im going play slither. ping me if ya want stream
?????
you might want to ask on a forum rather than discord if you are going to keep going afk every time someone tries to help.
progress === (0 || 67)
does not work the way you think it does
if bout forums - im banned from stackoverfolw for a long time so i dont have any good place to ask :/
Oh.. yikes. My bad.
how do you get banned from stackoverflow lmao
not enough votes
:|
sadly
for 2 months or more
to the now i didnt even opened that. lmao
even if - answers i can post. i just cant ask
Lastly.. is it possible to wait for the setInterval function to finish?
you can use promises
Like instead of it running in the background while the other code executes.
How am I supposed to apply that, here, though?
let pr = new Promise<Void>();
setInterval(() => {
pr.resolve(null);
}, 10_000);
await pr;
The code after that will execute after it's done
something like this
although you're better off using sleep instead
oh, js has no sleep
I hold true that "js has no sleep"
I mean
Never said you were wrong. 😊
you can essentially use sleep
timers/promises
you can simulate it with promises
function sleep(ms) {
await new Promise<Void>(r -> setTimeout(r, ms));
}
Yea
Just about to post that same thing
kekw
Also what is up with the Promise<Void>
unless they are using ts its useless here
idk, I'm used to always state generics' types
OH.. I've been searching this in google.. dammit.
const promise = new Promise();
const loading = setInterval(() => {
promise.reolve(null);
if (progress >= 100) clearInterval(loading) && console.log("Hi");
console.log(`Loading... ${progress}%`);
if (progress === 0 || progress === 67) progress += 33;
else progress += 34;
}, 1000)
await promise;
Did I do this, right?
Is && even needed?
I thought you could separate stuff with ; in a one line if statement
Just testing...
if you resolve the promise on the first pass it'll stop awaiting loading
it should be ```js
if (progress >= 100) {
clearInterval(loading);
console.log("hi");
promise.resolve(null);
}
Just did that. 👍
const promise = new Promise();
^
TypeError: Promise resolver undefined is not a function
hm, you can't have empty promises?
// progress is an event emitter
progress.on("step", prog => prog === 100 ? console.log("Finished!") : console.log(`Loading...${prog}`));
I dont think so
Thank you. 👍 😀
rounding errors be like: "I'm gonna end this man's whole career"
I was going for cleaner rather than efficient
I wasn't responding to you
I was responding to KuuHaKu
how do i fix this bug
errr...where tf is that?
🤌
let progress = 0
const promise = new Promise((resolve, reject) => {
if (progress === 100) {
resolve("Successfull.")
} else {
const loading = setInterval(() => {
if (progress >= 100) clearInterval(loading) && console.log("Hi");
console.log(`Loading... ${progress}%`);
if (progress === 0 || progress === 67) progress += 33;
else progress += 34;
}, 1000);
};
});
await promise;
Redone.
redstone
Oh damn..
programmer: writes 200 lines of code for a progress bar
client: man this progress bar is so slow and terrible
Moment..
progress += 34 be aware, it'll never be progress === 100
progress >= 100
if (progress === 0 || progress === 67) progress += 33;
else progress += 34;
works even when the code goes too far and does too much progress
Huh. Moment...
why don't u just use increments of 1?
like, 3 steps, start at 1 and end in 3
1 to 100?
you don't need to use 100 to represent percentages
if you REALLY need 100 just do current / max * 100 and you'll get a value between 0 and 100
well, that as long as 0 >= current <= max
Yup..
Kind-of looking for something that gives a random number between 0 to 100 till it reaches 100.
let progress = 0
const promise = new Promise((resolve, reject) => {
if (progress === 100) {
resolve("Successfull.")
} else {
const loading = setInterval(() => {
if (progress >= 100) {
resolve("Successfull.");
clearInterval(loading) && console.log("Hi");
};
console.log(`Loading... ${progress}%`);
if (progress === 0 || progress === 67) progress += 33;
else progress += 34;
}, 1000);
};
});
await promise;
console.log("YAY")
I did this..
YAY was logged but successfull wasn't. 👀
bcuz ur not logging promise result
OH
My god.. my knowledge.
I logged it after awaiting the promise outside the Promise.
.. not sure why it didn't console.log the Hi.
also I'm not sure, but if arrow functions affect this you might be able to do clearInterval(this)
removing the need to assign it to a variable
I'll try.
put the log above it
Didn't work...
and use return to prevent further code execution
Yup, did so.
Using this doesn't work.. 😐
It kept executing..
stay using variable then
It is used in classes, iirc, but for a different reason..
it is, to represent enclosing class
Yes.
I asked that because in java using this inside lambdas will reference the lambda itself instead of the parent class
I don't have much knowledge in Java, so I may take time to understand what you are talking about.
using this in js refers to the function so the arrow function not the interval
it refers to the function inside the interval
Ah.. that's why.
lambda is equivelent to an anonymous function like: () => {}
lambda is literally the slim brother of arrow func
I have create the little script for detect if an message has 7 or plus capitals letters ( const getCount = message.content.split('').filter(e => e.toLowerCase() !== e).length; ) but how can i detect in plus if capitals letters are together and not separate ?
Oh.. now I understood.
You wanna use regex for that I suppose
yes but i don't know how to use regex :/
He did say the same thing until you talked about how it is about the function inside the set interval.. so yeah. 👌🏼
Me neither lol
play a bit with it there
put your testing text on the bottom field and start fiddling with regex on the top
who invented regex
A grooving cat
How do i edit button
b1.edit(setDisabled()) i want something like that
just recreate all the buttons with this one disabled
regular explorers
expressionist art
someone know how to fix this error :
I assume that is similar to a non null constraint error in an sql db
sell art as nfts and get lots of angry emails saying that art should be free
also i bought solana today
Just don't try and save something that already exists
i dont
@wooden kindle the message component type is invalid?
why bother hiding ids tho
but well, duplicate key issue
what db lib are u using?
yo
@lyric mountain do u have any idea why my bot mustve not responded
cause the code is like this
lemme rephrase that: "is there any good and freely available bot dashboard code that I can shamelessly copypaste and call it mine?"
no
which means it should send help and then console.log
breh
maybe an error during fetch
did u try those exact words xiuh tried?
How did you make yours?
at all like legit
yes of course
idk look
That doesn't give you the right to steal someone's work, especially if you got it by stalking my obfuscated public repls
i even gave it like 10 commands in like 3 seconds so it was not even a ping problem
???
react + websockets + java + spring
can u explain this a bit more
Well there is always network errors and the website can reject your request
but like dont it console log that?
like, maybe the fetch failed resulting in it stopping before sending it
wait are we talking about http
node fetch isn't supposed to throw a promise rejection for anything other than network error, not even 4xx status code
so what happened
got it
@urban slate the console.log runs before message.channel.send
because message.channel.send returns a promise
promises will finish always after at least the next line of code runs
because discord rejected your request
soo thats not a bot error right?
it is
oh
your embed is wrong probably
how?
maybe the image was too big
cause this has happened for the first time
maybe you tried to upload your mom
no it like didnt respond to anything after the help command
but it was only in the test serve
stuck runtime maybe
cause i did test it then and there in my server and it did respond
add a .catch(console.error) to the end of message.channel.send(stuff).putItHere
whats your full code?
im sure it's an issue with the embed
its hard to give suggestions without seeing the full thing
@urban slate can you show the code for the embed
no error console logged after adding that btw
one sec
wut
someone star this
damn
xiuh exposed
quadruple starboard
question: why add those commands in the first place
I swear it was for context abt his issue, they're just sussy bakas
had to censor some stuff
the entry on starboard is now there 6 times lmao
sry about that
@urban slate embed is empty
they are just strings though
ill come back from the toilet and explain
what
no its not
it does respond to -help
huh
yea
embed.anything should return a new object instead of setting the embed object
ur formatting is weird
it works mate lmao it has worked for like 4 other discord bot lists
the first command they do is -help
no way my bot went through all of those without working
maybe it's a situational error
even i have tested it for like 2-3 weeks
?
not all errors happen on a fixed rate
i still dont get it
like, sometimes there are errors which happen on an extremely specific case
My discord broke brb
those are the hardest to find until you figure out the exact steps to reach it
@oak cliff can i get the that channels perms that my bot had
that would help me get till the error
i guess it's one of:
- guild command run in dm
- no send message perms
- message content intent is here
thank you soo much
Channel perms are the same
its not dm
it does have send message perms ig
whats the third thing?
what do you me by is here?
message content isn't here yet
ohh
he meant the newest intent discord will add
AH
but its there right?
that'd not even let it compile
not necessarily
yea
tim said the () is only needed if you wanna run the constructor
could u show gif command?
even if it's not causing the error you should add it

