#development
1 messages · Page 1858 of 1
changing "name": "url" gives same error
please tell me you are actually putting your application ID where it says to put it in the url
you options name is uppercase
so it doesnt want uppercase
ah
Is there a doc on where how you can change one permission just one instead of changing the entire permission in a channel? (js)
updateOverwrite
So in this server when you say the word "hacks" or "cheats" it automatically deletes the message, copies the content and creates a webhook with your name and profile picture and sends the same message with the word being replaced with "gaming chair" I was wondering where to even start with this type of system?
You'd need to use/create webhooks
They're fairly simple to work with
Look up on how to create or update webhooks in your library's documentation
dblbots @hushed plank
Can I join my clash royal clan 😞😖💔💔💔😣😣😣😪
i don't know, can you?
Hey Guys my server just got nuked does anyone know any Anti Nuke bots?
try {
newMember.roles.remove(changedRole, ["User already has another role tree role- giving them a second would cause conflict."]);
} catch (error) {
if (error.code === 50001 || error.code === 50013) {
console.log('Role too high or I cannot remove roles.');
} else {
console.log(error);
};
};```
im testing my error handling
if the bot isnt higher than the role its trying to remove, i want it to fail silently (with a console.log)
but its crashing the whole bot lmao
(discord.js v13)
it throws a new discordAPIerror "missing permissions"
which is what i thought i was handling with the error.code parts
well seems like it doesn't really catch the error
you could try to put a try catch around your command handler
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Permissions
at RequestHandler.execute (C:\Users\17656\Desktop\unabotalpha\.yarn\cache\discord.js-npm-13.1.0-8440b31213-90f629be62.zip\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\17656\Desktop\unabotalpha\.yarn\cache\discord.js-npm-13.1.0-8440b31213-90f629be62.zip\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async GuildMemberRoleManager.remove (C:\Users\17656\Desktop\unabotalpha\.yarn\cache\discord.js-npm-13.1.0-8440b31213-90f629be62.zip\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:144:7) {
method: 'delete',
path: '/guilds/880582524554842162/members/214541243818967040/roles/880582524567441443',
code: 50013,
httpStatus: 403,
requestData: { json: undefined, files: [] }
}```
@oak cliff okay so remove returns a promise
try this
newMember.roles.remove(changedRole, ["User already has another role tree role- giving them a second would cause conflict."]).then(member=> {}).catch(err=> }console.log(err)})
for some reason i thought i couldnt put an await in a try/catch
ty for your help
np
my mongodb UserSchema is some like this: js { _id: String, a: Number, b: Number }
What I want to do is sort the db by (a+b) in descending order.
All I could figure out till now is how to use sorting on one field: js UserSchema.find().sort({a: -1, b: -1}).limit(10).then(a=>console.log(a))
Can anyone help me with it?
Is there a VPS that supports payment via crypto
Which crypto
lmfao lemme just
bro istg imma get a new hack for valorant
bro istg imma get a new hacks for valorant
bruh
Just ask here
does anyone know how to use the latest version of node on an aws vps?
it only appears node 14
nevermind lol
Can you help me please the bot does not respond to the command
const Discord = require('discord.js')
const { Snake } = require("weky")
module.exports = {
name: 'snek',
aliases: ["snake"],
category: "fun",
execute(message, args, client) {
const game = new Snake({
message: message,
embed: {
title: 'Snake',
color: message.guild.me.displayHexColor,
gameOverTitle: "Game Over",
},
emojis: {
empty: '⬛',
snakeBody: '🐍',
food: '🍕',
//controls
up: '⬆️',
right: '➡️',
down: '⬇️',
left: '⬅️'
}
})
game.start()
}
}
Snake is not a constructor (not a class)
Check if it's a function or something like that
I have not found
It's a function
uhh
(node:32100) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
at RequestHandler.execute (C:\Users\HP\node_modules\discord.js\src\rest\RequestHandler.js:172:15)
at RequestHandler.execute (C:\Users\HP\node_modules\discord.js\src\rest\RequestHandler.js:176:19)
at RequestHandler.push (C:\Users\HP\node_modules\discord.js\src\rest\RequestHandler.js:50:25)
at async WebSocketManager.connect (C:\Users\HP\node_modules\discord.js\src\client\websocket\WebSocketManager.js:128:9)
at async Client.login (C:\Users\HP\node_modules\discord.js\src\client\Client.js:245:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:32100) 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: 2)
(node:32100) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
it shows this when i run my index.js file
index.js
const {Client, Intents} = require('discord.js');
const fs = require('fs');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const config = require('./config.json');
const path = require('path');
const token = config.discord_client.token;
client.on('ready', async () => {
console.log('I\'m online!');
const commandBase = require(`./Commands/command_base.js`);
const readCommands = dir => {
const files = fs.readdirSync(path.join(__dirname, dir));
for(const file of files){
const stat = fs.lstatSync(path.join(__dirname, file, dir))
if(stat.isDirectory()){
readCommands(path.join(__dirname, file));
} else if(file !== commandBase){
const option = require(path.join(__dirname, dir, file));
console.log(file, option)
commandBase(client, option);
}
}
}
readCommands('Commands');
});
client.login(`${token}`);
command_base.js:
update your node version
already did
updated discord version too
i dont know why this aids is showing up
are you sure you're running a newer node version though
what does node -v output
cause i did npm v node version
16.6.1
that's... weird, i'm even on an older version and it's here
tried uninstalling and reinstalling djs?
sure lemme check
where is your bot hosted?
do console.log(process.version) from inside the code
on my pc
k
@quartz kindle v14.16.0
this is what it shows when i dp
do*
using node index.js?
node .
when i do: npm v node version, it shows 16.6.1
and when i do npm -v node, it shows 16
14.16.0
thats your problem
so what should i do?
you didnt update node
i did it
how did you try to update it?
using npm
first get rid of the package you installed
npm uninstall node
then go to the node.js website and download the latest version
and install it
aah alr
the same way you install any windows program
How to make a discord bot
Step 1: Find a good pc or hosting
Step 2: dont find a good pc or hosting
Step 3: Mental Problem
how to make a discord bot
step 1: don't

how do i fetch an embed by id so that i can later on delete it, v12 btw
yeah.
you can fetch a message by id using await channel.messages.fetch(id)
can i do message.channel.messages.fetch(id)?
yes
thanks
@vivid fulcrum i rember 😀
Yikes..
Kinda lost.
I have a string as the following.
"@feral aspen"
How can I get the user object from that?
uhh-
how do u check perms for again in v12?
27.08 06:27:03 [Bot] Startup (node:83) UnhandledPromiseRejectionWarning: TypeError: message.member.hasPermissions is not a function
is what I get..
hasPermission
yea
oh
no s
alr
and umm... how do u check for mentions?
I got...
message.members.mentions.first()```
and gives error
```27.08 06:30:22 [Bot] Startup (node:83) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'mentions' of undefined```
ping in replies
Read the docs

It's message.mentions
😐
🥴
?!
well... now it says its not a function..
fine im going to the docs
Yoo.
For this.
Should I create a regex as /\d/
Ah.. forgot the +
It's not working.. did I do something wrong.
const blindfoldRegex = /\d+/;
const blindfoldUser = args.match(blindfoldRegex);
let user = interaction.guild.members.cache.get(blindfoldUser);
console.log(user);
Should I add [0]?
It worked. 🎉
uh.. I kinda did lots of stuff and tries..
the docs say to check if user is a bot, they did message.author.bot, but I have a mention..
I tryed this after mentionedMember: member, user, member.user, and then adding .bot at the end of it... non work, alwyas says cant udnerstand the property of undefined...
const mentionedMember = message.mentions.users.first() || message.guild.members.cache.get(args[0])
if(!mentionedMember) return message.channel.send('Your either did not specifie the member, or the member is not in the server!')
if(mentionedMember.member.user.bot) return message.channel.send('You can do anything to bots...')```
pInG in replies.
Well in the first part of the OR opperation you're getting a user and in the second part you're getting a member. I'd suggest turning one of those to user or member so you get 2 members or 2 users then act accordingly
oh, alr ill try 👍
Also, if the user doesn't mention anyone and gives up an ID instead and the member isn't cached it will also give undefined
o....
without the cache
oh alr
and change it to users so you get ...users.first() || ...users.fetch()
show code
mentionedUser.user.bot
user is already a user
^^
there us no user.user
if(mentionedMember.user.bot) return message.channel.send('You can\'t do anything to bots...')
You're fetching a user
oh so just mentionedMember.bot
yes
And probably change the variable name to mentionedUser
as it might be confusing
👍 true
so if I need to fetch id, I also just put mentionedUser.id, without the user since its already a user... right?
yes
Hey.. did I do something wrong?
const duration = ms => {
const sec = Math.floor((ms / 1000) % 60).toString();
const min = Math.floor((ms / (1000 * 60)) % 60).toString();
const hrs = Math.floor((ms / (1000 * 60 * 60)) % 60).toString();
const day = Math.floor((ms / (1000 * 60 * 60 * 24)) % 60).toString();
return `${day != 0 ? `**${day.padStart(1, '0')} days** ` : ""}${hrs != 0 ? `**${hrs.padStart(2, '0')} hours** ` : ""}${min != 0 ? `**${min.padStart(2, '0')} minutes** ` : ""}${sec != 0 ? `**${sec.padStart(1, '0')} seconds**` : "0 seconds"}!`;
};
I have never been so confused since it's returning 1 day 38 hours. 👀
Because you have % 60
At const day
Doesn 't it have to be % 24 or am I being retarded
Wait.. its hrs % 24, I think.
Wait.. uh.
👍
i found a way to upgrade your nodejs version on repl!
just run npx node@VERSION file.js instead of node file.js
It will take a longer time to run though
does that download node on every single run or does it cache it for a while?
considering that npm != deno install, maybe it downloads on every run
so the bash and nix methods should be better, but its good to have a 3rd option
The bash and nix methods would break once you reload your webpage
what does npx means?
only because replit hates packagers from the console
I'll add premium features to my bot then use (ads) to host my bot by buying a vps with bitcoin
lmao
npx is like npm execute
It's actually a lot better than paypal
it downloads a package and runs it directly, without installing
wut
do my binance kyc 
why cant you kyc tho
i dont need to use their api for donations so no kyc
18-
oh lel
well at least can you verify h bot on discord for me
not that it needs it
¯\_(ツ)_/¯
so that will install the latest version of node?
:isee:
You could redirect your donations to me
whatever version you put
it wont install it, just download it and run it
you got a profile pic
I’m gonna pay you after I promise
you have a binance pay merchant account?
Yeah after like idk many years

oh so i can just input node@16.7?
probably
i should try this out :monkaHmm-2:
if you want v13 then try it
whats the other 2?
all break unless you force replit to do it
whats with bash?
Looks like I’m turning into such a modern geek, once a beautiful day I will say bruh and coral
nixos is replit's own language right
when code escapes your computer and becomes a reality
ok
whats the latest version of node currently?
idk
16.8
Is there any difference between 16.8 and 16.8.0
no
ok
lemme see whats its latest version rn
nodejs which has never been updated
and node which is always up to date
ahh
tfw npm updates itself and nodejs
idk
latest*
ditch replit?
using npm i n n latest
i think the cleanest way is the BASH method
people like to use nvm
oh in replit
nevermind
ye no, im on mobile my laptop ded
nvm works on linux
ill try that out
if I do n it gives me all commands for n
its where node is saved
if it doesnt exist, its automatically created and downloaded
if you change the node version in the sh file, it automatically deletes the old one and creates a new one
incredible
I aspire to be as good as Tim one day
its ok if i deleted the node folder right?
seriously tho, im a pretty average dev, there are tons of people out there who are actual gods
itll just reinstall itself
yes
Don’t play with the fire 
ill probably use this for my smol projects
Tim do you have any experience with Laravel?
now i wont need to rely on the npm package "node"
I haven't seen you not be able to answer a single question here since I first joined this server which I think is like 2 years ago?
nope
I've just been looking into the best stack for a saas project I'm working on
And I'm familiar with PHP already
if i want to add this to my repl ill just need to copy run.sh and .replit?
because i only answer when i can help, if i dont know the answer i dont answer xD
uhuh, smart
Was thinking Laravel for backend and React for frontend but I've never used either 
react is fun
im just being a man of culture
?
doesnt react kinda depend on a node.js backend for a lot of things?
or do they have a front-end only mode
I haven't looked too much into it but I've seen people using Laravel for backend and React / Vue.js for frontend
well im on the same boat as you, havent used either of them
does the version of npm rlly matters to dependencies?
no
it does matter if you install native addons tho
but you can just add them to your package.json and the script will auto install them
It's all good. Just looking for people who might have used them to see what they thought or had any pain points
wat does this mean
how do you unlock the package lock
you delete it lmao
fair enough
fair enough
fair enough
fair enough
@boreal iron can you help me test binance pay?
||i broke the fair enough chain||
fuck you

i will vote you each time i see you in among us
i just got f ed by an ex mod
?
show code
# node.js version to download
# examples:
# VERSION="v16.7.0"
VERSION="v16.8.0"
# source to download from
# examples:
# MIRROR="https://nodejs.org/download/release"
# MIRROR="https://unofficial-builds.nodejs.org/download/release"
MIRROR="https://unofficial-builds.nodejs.org/download/release"
# file to download (without extension, must be linux x64)
# examples:
# FILE="node-$VERSION-linux-x64"
# FILE="node-$VERSION-linux-x64-pointer-compression"
FILE="node-$VERSION-linux-x64-pointer-compression"
##### Begin script
find -maxdepth 1 -type d -regex .*node-.*-linux-x64.* -not -regex .*${FILE} -exec rm -r {} \;
PATH=./$FILE/bin:${PATH}
if [ -d "./$FILE" ]
then ./${FILE}/bin/npm install ./${FILE}/bin/node . if [ $? -eq 139 ] then rm -r ${FILE} echo "Environment changed" echo "Redownloading $FILE" wget -O- ${MIRROR}/${VERSION}/${FILE}.tar.xz | tar -xJf- --one-top-level=./ ./${FILE}/bin/npm install ./${FILE}/bin/node . fi
else echo "Downloading $FILE" wget -O- ${MIRROR}/${VERSION}/${FILE}.tar.xz | tar -xJf- --one-top-level=./ ./${FILE}/bin/npm install ./${FILE}/bin/node .
fi
oh replit is so shitty when pasting code in mobile
./${FILE}/bin/npm install ./${FILE}/bin/node . fi
remove that fi
at the end
on line 21
ah
# node.js version to download
# examples:
# VERSION="v16.7.0"
VERSION="v16.8.0"
# source to download from
# examples:
# MIRROR="https://nodejs.org/download/release"
# MIRROR="https://unofficial-builds.nodejs.org/download/release"
MIRROR="https://unofficial-builds.nodejs.org/download/release"
# file to download (without extension, must be linux x64)
# examples:
# FILE="node-$VERSION-linux-x64"
# FILE="node-$VERSION-linux-x64-pointer-compression"
FILE="node-$VERSION-linux-x64-pointer-compression"
##### Begin script
find -maxdepth 1 -type d -regex .*node-.*-linux-x64.* -not -regex .*${FILE} -exec rm -r {} \;
PATH=./$FILE/bin:${PATH}
if [ -d "./$FILE" ]
then ./${FILE}/bin/npm install ./${FILE}/bin/node . if [ $? -eq 139 ] then rm -r ${FILE} echo "Environment changed" echo "Redownloading $FILE" wget -O- ${MIRROR}/${VERSION}/${FILE}.tar.xz | tar -xJf- --one-top-level=./ ./${FILE}/bin/npm install ./${FILE}/bin/node . fi
else echo "Downloading $FILE" wget -O- ${MIRROR}/${VERSION}/${FILE}.tar.xz | tar -xJf- --one-top-level=./ ./${FILE}/bin/npm install ./${FILE}/bin/node .
unexpected end of file
i cant see it im on mobile
wdym?
this fi
wait no
I just realised
there's another if statement
it needs to be there
?
well I have no clue what was wrong with the original code then
i think its the formatting??
when you outsmart tim
the formatting is the prob?
i downloaded the file
then upload it to my repl
then it works 
weird
the name of the file?
did you update it in the .replit file?
yep
then its fine
ye
ehh i kept the file in my phone so i can just upload it
@drowsy crag ^
also what would happen if i deleted the package.json file?
it will complain that a package file is missing
also what does package-lock.json do?
ahh ok
package-lock is used to check if everything is installed
one more thing when theres a new version of node will it be able to download it with the script?
yes
you can check the MIRROR urls
open them in your browser and you'll see the available versions
the urls r always up to date right 
Hey everyone, where can i find info about editing and adding css to the bot page?
Is there a guide to it or somewhere i can find info
Inspect element + normal css
how can i make sure that a role that is being created, only can see the verification channel.
and not any ot the other channels
if(!unverifiedrole){
await message.guild.roles.create({
data: {
name: 'unverified',
color: 'RED',
},
reason: 'we needed a role for unverified peeps',
})```
i mean where do i put the css code?
inside the description
like
<style>
.entity-wrapper {
background-color: black;
}
</style>
<h1>Luca</h1>
<br>
<h2>The best discord moderation bot</h2>
np
yes they are official urls
Do something like this on the channel not the role
message.guild.channels.create(channelName, {
type: "text",
permissionOverwrites: [
{
id: role.id, //The role you were talking about
allow: ['VIEW_CHANNEL']
}, {
id: administratorRole.id, //For admin
allow: ['VIEW_CHANNEL']
}, {
id: role2.id, //Other roles
deny: ['VIEW_CHANNEL']
}
]
})
It was from v12 so I'm not sure if it's the same in v13
Err wut?
You want to send cash to me? No problem. I accept any donations 
I'll take some too if u have left over
tax evasion? for no reason at all
Shh 🤫
@boreal iron nah i needed to test recieving payments through binance pay
someone already helped me do it but if you want im ready to accept donations
I don’t use binance pay.
Did I say something else anywhere?
Damn… can’t remember 
Just coded automated systems using the PayPal API or Klarna for donations or reoccurring payments.
That won’t help you I guess
Yeah
Hey, I want to make a command, that is clearing (amount) of messages, that' contained a link.
How to do this?
Filter through the channel messages and delete those that have links
yeah, that's what I know, but idk how to start exactlly.
start by fetching messages from a certain channel
oh okay, I'll do it like that.
^
TypeError: Cannot read property 'fetchMessage' of undefined```
I'm getting this error, when I'm trying to fetch the message.
the channel wasn't found
.channels.cache.get() takes a channel ID
instead of fetchMessages use messages.fetch
okay

okay, I've fetched the messages now, what's next?
const messages = //The message array
let urlPattern = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g
let withLink = messages.filter(m => urlPattern.test(m.content))
if(!withLink.length){ return "Nothing" }
// Now delete every message that is in withLink
Why do people invite a bot and kick it immediately?
Because that’s happening to me so many times
Guys how do I make the bot update the slash command instead of adding duplicate slash commands when the bot boots up?
in case there are more languages supported maybe
await getApp().commands.post({
data: {
name: 'language',
description: "Changes the language for your experience",
options: [{
name: "Language",
description: "Pick the target language to switch",
required: true,
type: 3,
choices: [
{
"name": "English",
"value": "EN"
}
]
}]
}
})
It was so bad they couldn't bear it being in the server
They kick it as soon as they invite it. They probably don’t even try it out. How could it be a bad bot?
it happens. maybe they try to get how to use them
Oh ok
but they couldn't use it so they kick it
that's one of the reasons tho
Ok
you are welcome
Hello guys
I wanted to know why my bot starts himself twice?
I have trouble shooted this problem for a while but didn't find anything
This is the error the bot gives. I see him log the commands twice an then after kills and gives this.
I have changed the port several times but that is not the case
The port is already in use, exactly what the error says
select a different port eg 6969
Are you starting your express server every time a command goes through or something?
I know that.
I mean, the bot starts himself twice. Which means he is using the same port twice
Kind of hard to understand what’s wrong without some code
Then kill a process
Even if I remove the express server, the bot will look for something else that requires a port. Like a dashboard port
I mean, after the bot has fully loaded, the express server will laod at the end
Are you perhaps doing it in an event?
load*
no
But I am saying, even if I remove the express server, it will look for another port
The problem isn't the port. It is the fact that he starts himself twice right after he loaded the first time.
But then again, it might be a glitch.
I have edited the package.json and package-lock.json regarding the names. Right after that the problem came.
Okay so, nevermind that. The reason for the problem was because My main bot is currently being hosted. But both my bots use the same dbl api key
Can someone help me in this redeem script? I really want to know how to configure, but I don't know how to change or add the code
so you don't know what it does?
Yes, you enter a code and it redeems a premium or coins
but I want to configure to earn coins
If you want the user to gain coins when redeeming, you'll just need to modify your database to have that new data. For example, if you stored an array of objects in your database and each object has a coins property that was an integer. You could increase that amount by whatever you want with a db.push (or whatever).
You probably want to read the documentation for quick.db: https://quickdb.js.org/
ty
One question, is there a api to get application info of other bots like how topgg gets whether a bot application is private?
kinda curious as to how topgg gets this info since it isnt documented on the discord dev documentation
There isn't
Top.gg just uses the /users/:id endpoint for getting basic user info
Or through the authorized user's OAuth, I'm not entirely sure
which info?
I wanna do this: js a.map(userId => `name is ${client.users.fetch(userId).tag}`)
How should I do this?
fetch all the users first and then map them
you could use Promise.all to resolve all the user IDs into user
map the resolved promise which is an array of API users to their name
use for loop with await, to prevent rate limits
any way to override this?
declare module "discord.js" {
export interface Base {
client: WhateverYouWant
}
}
I'm trying to get an user based on their ID and then set their nickname. How would I do this?
What library are you using
discord.js v13
<Guild>.members.fetch(...) to get the user by their ID. Returns a promise resolving into a GuildMember.
<GuildMember>.setNickname(...) to set the nickname. https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=setNickname
didn't work,
man
so uhh.. hey. I am looking for website hosting recommendations... I tried buy pebble hosts plan but...
Their panel was too confusing, wayy to hard to transfer from one account to onather, and was hard to edit code.
Digital ocean does not specifie spefic pricing... :/
Vultr same...
I need a simple one that has a simple plan like 5 G per month is like $3 and stuff, not the ones that depends on ur data and settings stuff...
Hetzner (EU) also starts by around 3€
Flexible and up- & downscalable
As well as nice KVM UI and pretty modern server administration tools
it's always the German hosting companies that offer the cheapest
they must be doing something sus over there
brixly.uk, ionos, tsohost etc if you want non confusing easy web hosting
If its static, use DigitalOcean which is free for static sites
ah ok
what's an eig-
trying to remember the site i used to use
its a company
how many companies do they own and why not lol
Endurance International Group (EIG)
Hmm that’s their business concept and hardware prices aren’t that high in the EU
they own like 100+ hosting companies
sus
basically they look for successful hosting companies
Ionos is just trash
buy them out
fire everyone
replace all their administration systems with a cheaper alternative
hire cheap admins
profit
They can be good
that's not a nice business
Just collocation in other datacenters with a max bandwidth of only 400gbit//
Trash, trash, trash
Dump support also
if its static, DigitalOcean all the way
https://garybot.xyz (shit website design im aware) is fast and is hosted on DigitalOcean for free
by the way does anyone know a good way to solve hash table collisions
linked lists or robin hood hashing
increasing the size works but the thing is the index doesn't stay the same for existing elements which complicates things
ah actually
resizing changes all indexes usually
all have to be rehashed
fair enough
the easiest way to solve collisions is with linked lists
until you reach the resize threshold
you dont wanna resize on the first collision since it can happen any time
robin hood is more efficient, but more complicated to set up
linear probing is the fastest, but has very bad efficiency if the table is more than 75% occupied
robinhood can maintain performance up to 98% occupation
linked lists, aka separate chaining, have no occupation limits, they can do beyond 100% and still work, just they get slower the more collisions there are, and are also less memory efficient
DigitalOciean is trash, too and got already blocked by a lot of providers and data centers in our country
The reason is the massive amount of crawlers and hijacked bot servers
I'll probably go with robin hood, more work but worth it
cool
how does it work exactly i saw it just moves keys around but in what justification
i have a half finished project that has a robin hood implementation in js
not for hosting a bot, but hosting a site
it moves them to reduce the travel time of the probe
And if you go on investigate you will find out lots of IP ranged are blacklisted by spamassasin and similar service providers DigitalOcran owned
Damn auto correct
by moving the keys around, it kinda averages the probing times and makes them all more consistent
i host Blacklister on Digital Ocean. I will be moving to Contabo soon as its great value with good ram.
they also serve as an identifier to see when the probe should stop for example
But for now, DigitalOcean with my $100 free credits is fine.
probing is how many times it has to manually search for the key right
ye
you get the hash index, then test each key linearly
and at the same time keep a counter of how many keys were tested
and store the counter together with the key
If you have the chance always look for a provider owning their own data centers
Collocation and shared hosters are trash and their support doesn’t cover all you need
what is Contabo like?
MVPS is also good, use them for my VPN
quite good
Dunno that name tbh
contabo used to have cpu steal issues, but didn't have it again since they reworked the service
contabo is stupid cheap for what they offer, its not even funny
£5.13 a month for 8gb ram, 4vcores and an ssd with 200gb storage/nvme ssd 50gb
and nobody knows how or why
Hmm 10000 server… a very small player
alright I see nice
there's always that one guy who simply does magic somehow
sus
I would be more worried about the available peerings and connections in terms of outtake
i'd totally move all my shit to contabo but im afraid of having everything in the same place, and then if something happens to it im screwed
what is rest api?
a normal api
well for now, DigitalOcean is fine as I already launched the bot 3 days ago. But bearing in mind the bot joined 50 servers a today alone, I might look into a better value and resource VPS.
representational state transfer application programming interface @steep condor
I'd imagine with robin hood it's more costly to insert in a nearly full list than it is to fetch a key from it
aka a normal api 
does anyone know how i can get data from a html form and use it in the submit button?
document.getElementById
inserting can have a little more complexity, but should be nearly the same
i'm making a simple bot lookup and i have a working page which which gets a bots info
replace 866364881917837312 with another bot id, it only shows a valid bots id
not a user id
that's...a botlist
well yeah, on insert you have to move the existing item forward if its probe count is lower than the inserted item's
(i know they are the same, i just made it check if user is a bot
its not a bot list, it just displays a bots details
so the owner doesn't have to sign up etc, it just displays a basic page
dot dot dot
its my website
it shows the bots me and my friend work on
ah so it's a portfolio
i'm just experimenting with python Quart and the Discord API
basically
is there a specific algorithm to probing or can it literally be anything including iterating from start to finish
which also gives the option to let anyone look up any bot
and even if they haven't setup a bot description etc, it will give a basic page with an invite link etc for the bot
btw robin hood is currently the fastest and one of the most efficient hash table implementations in c++
https://martin.ankerl.com/2019/04/01/hashmap-benchmarks-01-overview/
i'm doing python and Flask/Quart in school so I'm expanding my knowledge using API's etc further 🙂
you start at the hashing index. if that index is occupied you move and increase the probe count, then if the next slot is also occupied, you compare its probe to your current probe, until you reach either an unoccupied slot, or an occupied slot whose probe is smaller than yours
yeah I get it now after I saw a diagram lol
How can the discord client drop messages if I’m offline for 2 minutes
basically the probes act as a range limit to all linear searches
so the actual search is usually very short
did you see the one with the animates gifs?
that one's awesome
if you reach the end of a list would you start from index 0 or go from the left hand side of the element
yes
start from index 0 i guess
I originally answered I did choose multiple locations across the same provider for exactly this reason
Additionally rented 2 external providers EU/US for my DNS servers in cases the provider fucks up his whole network again
(happened already 2 times in the last 13y)
rip
btw is there any free solution for a backup dns thing?
like you have your dns pointing to an ip address, is there a way to give it a backup ip address if the first one goes down?
Hmm what do mean?
and this thing can work until 100% capacity right
i know there are services that provide this, but they are usually paid
Yes failover IP or using the DNS weight
95-98% is a reasonable limit
Weight and priorities
then you need to resize+rehash
just a failover
but in a sense if you ignored performance it would work to 100% right
Automated failover initiated via monitoring
since an element could still find an empty spot
yes but the last 1% is gonna be O(n) complexity
lmao
with linear and robinhood there is a certain luck factor
My mail servers have different backup dns records
In cases one is down the record with the next lower weight will be contacted
so most things are measured in best case/worst case/average case scenarios
if you get horrible hashes, you will get o(n) performance lul
lol
but is there a way to do this without requiring a paid third party service?
one of those days where you get a bad list
which hashing algo are you using?
djb2 is decent and stupid simple, like 5 lines of code
fnv1a is also good, a bit slower than djb2 but better hashing quality
Well setting up the DNS records is free, isn’t it for you?
You just need the backup servers.
The DNS records are cached by any global resolver anyway
i mean, theres no option to set a backup ip address in the dns record
I was also thinking if the mean probing amount is quite high it should try and switch probing tactics to try reduce it
like going from index right, to left and right etc
you can use organ pipe search
it requires keeping track of average probe lengths across the table tho
organ pi-
for example, if your average probe count is 5 across the board
instead of starting at the hash index, you start at hash index + 5 for example
then you search 1 up, 1 down, 2 up, 2 down, etc
interesting
actually this one is called "smart search"
Of course you can define multiple targets for the same hostname
But it requires to add multiple records (just with different targets)
Working with weight and priorities will tell your requester which target it’s supposed to contact
do A records support that?
now I just need to figure out how to get the ascii code for a character
I'm going with fnv1a
Do you guys write plain CSS or use a library/framework like Tailwind
i think you can cast a char to an int, which is basically its ascii code
plain
well, i use LESS for nesting css but thats it
all records do
that's easier than expected
I forget you can cast things like that
some languages wouldn't forgive you
so i can just do A: xxx.xxx.xxx.xxx, yyy.yyy.yyy.yyy ?
It just depends on your service if he’s capable of resending the request if your main IP is unavailable
Nope it requires two records, one record can only have one target
But multiple records with the same hostname are no problem
ah
so i make multiple A records for the same host with different ips
but how to prioritize the first one for example
so that the second one is only used if the first one goes down
or does it do that by record order?
test.xyz IN A 50 10 1.1.1.1
test.xyz IN A 25 5 1.1.2.2
yeah that works wonders
The order doesn’t matter but the records WEIGHT and PRIORITY
oh? i thought only SRV records supported that
lol I actually wrote A
And mx as well
My bad totally confused myself
SRV records and MX
Sry shouldn’t drive and write 
Eww money money you know
anyways, afaik SRV doesnt support websites/browsers
its mostly for non-web protocols
idk if it works with rest apis
Damn I’m doing this for so many years and was just spreading bullshit
It’s embarrassing sometimes
If it necessary needs to be an A(AAA) record you will have to work with a failover service as well as monitoring in order to automatically active the failover address
Doesn’t work with DNS in this case
Only if you have the ability to update the DNS record in case of of a outage
(assuming to use a damn slow TTL)
*small not slow
(assuming the DNS service has an API endpoint)
And my internet is gone again… great
Will my messages be send?!
Hello?
lmao are you driving
a tech discussion would be my last course of action during driving
proceeds to crash
Yeah and having no network every 2 minutes
yeah thats what i thought, thats why i asked if there is any such service for free lul
i found several paid tho
Those interesting discussions ALWAYS happen if I’m driving dunno why
Not if I’m at home, no no
And there we go again…
Fuck this country
🤦♂️
lmao
Is there a lot of traffic to expect?
I mean the failover IP of Hetzner costs just 1€ but you need to activate it yourself
Using your own monitoring system for example
The server administration panel supports API access to control your server as well as the network
It will probably be the best choice and a small scale
i'll think about it
i mean, currently the scale is zero, and my api is not even finished, because i've been procrastinating and delaying it by working on less important projects for over a year lol
lmao
but considering its something im planning to charge for in the future, then it should at least have decent uptime
not that any of my vps's ever had issues, but still... you never know
what if another datacenter fire happens lol
You’re technically not wrong tho but it might be to early to think about it
In your case the API just needs only a few or none adjustments if a backup system goes online
Depends if you run a database etc.
You can control the requests also using a load balancer
Not sure if they can check if the target is available before redirecting you
yeah im probably overthinking rn
But will cost money as well
database is another issue, since im planning on going with sqlite
so even if i have a failover ip, i wont have the same database access in the backup
Hmm I have moved to a centralized database on one of my servers
And a backup database within my home network
yeah i dont want a remote database right now
But syncing is complicated
remote db latency 🤮
< 1 ms
exactly lel
that must be right next door then
what if its hosted in a different vps, in a different company, in a different continent xD
As long as it’s the same provider or root server
I don’t see an issue running the database at the same provider
I mean another location (within the same country) is a good idea tho
can you guarantee they won't relocate your server though to another area lmao
If your provider has a few
if the provider is big enough to support multiple regions, they will let you select the region
Yeah to 100% as it’s part of the contract
mostly the bigger providers
the smaller only let you select a general area of a country
maybe not even the area
I never again go to a small or collocation provider only, as I mentioned before
but costs can get steep quick depending on the company
That’s why I rent my servers in Germany
At least by a German country
They aren’t located there only
Cheap and damn reliable the past 13-14y
you're with hetzner rn?
i heard they were ip blocked by discord's voice servers, not sure if thats still a thing
not that i use voice anyway
i got a vps from kamatera, located in germany
not using it for anything atm
but im planning to put my api there soon
the specs are really good, specially disk i/o performance
$4 for 800-1000MB/s
Hmm the cloud servers are hosted on NvME storage only
ye but they are severely performance limited usually
Yeah
thats good
i asked someone to test in contabo and it was like 100MB/s there
i only get 50mb/s max at home so i'm not going to be hosting my bot on my own server
well a discord bot doesnt need disk performance
my api does because it reads a lot of files
the bigger companies want you to pay extra or use a dedicated service for better performance in an aspect
my ISP doesn't even offer static ip addresses thats how shit it is
to anyone in the UK: DO NOT USE EE
I mean if you can pay the price a dedicated server has a better performance in any case anyways
most isp's dont, unless you pay extra
ipv4 ips are about to go extinct anyways
- better reviews
- better service
- actual customer support?!?!
mine has no option at all
they cant, at least not yet
if they gone, 80% of the internet goes down with it
just a little closer
actually a lot of devices/servers still don't support ipv6 lol
cloudflare provides a compatibility layer for them
i don't get ipv6 lol
i only really understand ipv4
same shit but bigger
yup
350-400 on my DNS server
Tested it real quick
nice
like my galaxygate
Not bad for ~ 6€
i'm getting 115mb/s on digitalocean
rip
Network bandwidth?
using digitalocean
Huh what
lmao
Is that a browser on your server?
did you install a de on it
i had to download a browser just for that 😢
yup
lmao
the lightest one possible
what distro
most lightweight*
fair enough
pretty sure every person here has at least once installed a de onto a server
out of curiosity
i never did
i only do it as I'm still learning lol
you missing out tim
But a Linux server with graphical GUI is something I don’t see often
i know fuck all about non graphical guis
i like it
what do you use for remote access? vnc?
as i can quickly edit/adjust code
RDC
ah
remote desktop connection
fair enough
I would but i cba to do it like that lol
i like quickly adjusting using a gui
Haha imagine editing a few hundred lines
Would take like 10 hours
i mean, for that i use vsc locally and upload later
Ah lol
dayum u discovered kamatera 😮
Spoken like a true God
I mean can be uploaded via curl too
good cheap host
ye
Or nftp etc
Nano is fine if you're editing a line or two on a file but I'd never be able to put up with it long enough to make a 50 line bot 
i have a vps there for like 8 months now for very smol stuff, no regrets
i have looked into them befor
brb
I use MVPS for my VPN hosting (£3.08 a month)
speedtest-cli
Hmm pretty good tho
I mean lots of providers limit their servers to 100 mbit/s
Even for dedicated ones
dude this site is broken af lmao
Or mostly claiming 1 gbit/s but only guarantee 200 Mbit/s max
i was only trying to find best rated vps hosts
what the fuck lmao
yup
well i definitely recommend kamatera
i'll have a look thanks 🙂
Whats IBM like?
OH
expensive
how much you paying for a dedicated?
all the big ones are stupidly expensive
google amazon ibm microsoft etc
except google compute engine f1-micro
which is free
:^)
Depends strongly on the server, the AMD ones around 100 bucks
The intel 9900ks around 70
tfw amd is more expensive even though their cpus are cheaper
Because of the cores and other hardware
Using this for virtualization
Running proxmox
ye but like, amd's cpus are usually cheaper than intel's, especially at higher ends, so techincally running amd is cheaper for hosting companies
but they are selling amd as "premium" and more expensive instead
The intel ones are older with lot of less hardware tho
xd
Take a look at the NVME drives
Can anyone help me out? I'm trying to get https://www.npmjs.com/package/captcha-generator-alphanumeric to send the captcha.JPEGStream as the .setImage in my embed, but when I do it responds with errors. It will only let me attach it as an attachment but not as the image inside the embed
show code
attachments//name.ext
attach as attachment then reference it using that
2x 3,8 hardware raid
0
WHY does auto correct my 1 to a 0
awesome
Wtf
Lol
What’s wrong with iOS
Trash
Oh lol I see it didn’t I clicked the suggestion accidentally
lmao ^2
@quartz kindle Python discord lib when /s
Anyway the hardware specs are quite good
nevah
Sadge
hey is there a way to change an invite link after your bot has been verified on top.gg?
i've been trying to add the slash commands scope to my invite link but it doesnt seem to update
oh wait i didn't see the support channel
can you give me an example?
client.on('guildMemberAdd', async member => {
let captcha = new Captcha();
try {
member.send(captcha.value)
const embed1 = new MessageEmbed()
.setAuthor('Error Lounge', "https://cdn.discordapp.com/attachments/877308243083395113/879200325209313290/errorpic.png")
.setTitle("Anti-Flood Verification")
.setFooter("Error Lounge Verification | discord.gg/", "https://cdn.discordapp.com/attachments/877308243083395113/879200325209313290/errorpic.png")
.setImage(captcha.JPEGStream)
.setColor("12ACB2")
const msg = await member.send(embed1, {
/*files: [{
attachment: captcha.JPEGStream,
name: `captcha.jpeg`
}]*/
});
try {
const filter = m => {
if(m.author.bot) return;
if(m.author.id === member.id && m.content === captcha.value) return true;
else {
m.channel.send('You entered the captcha incorrectly.');
return false;
}
};
const response = await msg.channel.awaitMessages(filter, { max: 1, time: 20000, errors: ['time']});
if(response) {
await msg.channel.send('You have verified yourself!');
}
}
catch(err) {
console.log(err);
await msg.channel.send('You did not solve the captcha correctly on time.');
await member.kick();
}
}
catch(err) {
console.log(err);
}
});``` is my entire code skeleton
Or could you fix mine?



