#development

1 messages · Page 1631 of 1

midnight blaze
#

@nimble kiln ok, just for dummys(I am one, help me). You activate dhcp on your pc(client) and your router(who has a dhcp server) gives you the ip/mac/subnet, when my pc connects to it and it shows. I want to access that server somehow. There is no chance? is it just part of the firmware of my router?

nimble kiln
midnight blaze
#

no no

#

I just want to understand "how things work"

nimble kiln
#

what exactly do you want to do

midnight blaze
#

I want to understand how it works, I guess

small meteor
#

You would need to have a fair understanding of Networking, and Subnets.

#

Although, I would recommend using programs like Wirehsark, or ASA Systems to get into Networking

boreal iron
small meteor
#

Even ESXI is good, for netting VMs or vRacks.

midnight blaze
nimble kiln
#

Idk if it would help, but you can install Wireshark and filter for those DHCP packets

#

you do have to pull your ethernet cable and re-plug it, while wireshark is running, for your client to send a DHCPDISCOVER as far as I know

small meteor
#

That would be a lot to explain to someone over Discord. You should probably take classes for Certs

midnight blaze
#

yes, yes, I know, but at least one thing that I am not understand by reading all of those network subjects.. they always talk about servers

#

DMZ servers, DHCP servers, DNS servers

#

but they aint servers like a vps one, since they do not have a distro, but a firemware?

nimble kiln
#

I guess to simplify: The server knows which IP addresses are not used and assigns the client an IP within the specified DHCP range

#

the client, when you plug it in, sends out a request which gets picked up by the server

small meteor
#

^^

nimble kiln
#

the server sends you back the informations which your client will use: Your IP, subnet mask, gateway. Etc.

nimble kiln
#

your router most likely runs linux in the background

#

so it would be the linux implementation of the dhcp server

midnight blaze
#

that is closer to what I wanted to know

#

how to access that "linux" distro? all I can see is the firmeware 👀

nimble kiln
#

if you want to inspect the packets you can use the Wireshark method, but the basic functionality was explained here

nimble kiln
#

you only can access your router's webinterface with those basic settings

#

This is mine. I can only activate and deactive it through the checkbox.
Then I have to define from where to where it can assign IP addresses. In my example from 10.0.0.20 to 10.0.0.200

The IP address will be valid for 10 days ("10 Tage")
-> After 10 days the IP address will be released, so it can be used again. Your device most likely will get the same address assigned after that time, unless another device is faster.

Those settings also specify a custom DNS server (1.1.1.1) in my case

midnight blaze
#

hmm thanks for the answers

stark abyss
midnight blaze
#

I guess I found a way to understand the architecture of those servers

sudden sky
#

Hello, can someone help me? I do a help command system that allows you to select you language with reaction emojis, but I don’t know how to do that when I react for example to English, the bot replace the embed of language selection with one that says select your type of help, games, moderation etc etc, and then the help on the language that you select.
These is the code of the help.js actually. Thank us for helping me!

https://pastebin.com/eGmZQTBS

#

O can give us acces to the GitHub for the full code of the bot if you needed

umbral zealot
#

And what exactly is the issue with this code?

#

what exactly do you need help on?

pale vessel
#

We don't help you code

sudden sky
umbral zealot
#

And... what error?

fervent bronze
#

!SKIN WONDER

#

HI

sudden sky
#

I found the error, thank you very much

umbral zealot
fervent bronze
#

HI

sudden sky
#

Hi

misty crag
#

hello @sudden sky

rare cape
#

im looking for trust worthy mods ones that have good experience with bots and knows how to properly manage them

#

anyone up for it

blissful coral
#

I am using sort() on this array and I need to sort by the name variable

#

How would I do this?

#

nvm

#

actually not nvm lmao

#

nvm again LMAO

#

I finally figured it out

sudden geyser
#

You pass a function and see if the X string is greater/less than Y

blissful coral
#

Yeahhh

#

My pee brain couldn't see that

#

for some reason

crimson vapor
#

its pea brain tho

#

not pee brain

drifting shell
#

Need a mixture of JS and Java help

#

I've setup a listener and a socket connection on my java app using OkHttp

crimson vapor
#

I can maybe help for JS

#

probably not

drifting shell
#

I'm trying to use websockets to communicate between my java app and a web page

#

It connects fine (as far as I can tell, it at least doesn't say it didnt connect)

#

But JS does a fuckoboingo and says it can't connect

#
        const socket = new WebSocket("wss://tempobot.local/player");
        socket.onmessage = function(event) {
            console.log(event.data);
        }
``` that's literally all I have for the JS part
#

And for the java bit

#
this.webSocket = Bot.HTTP_CLIENT.newWebSocket(new Request.Builder().url(websocketUrl).build(), new WebPlayerListener());
crimson vapor
#

so does it connect or not? and do you require heartbeats?

drifting shell
#

It doesn't, and I don't

crimson vapor
#

what is websocketUrl?

drifting shell
#

same as in the JS

#

wss://tempobot.local/player

crimson vapor
#

do websockets support X.local?

drifting shell
#

I tried localhost too

#

Still didn't like it

#

also tried localhost with a port

#

both 80 and 443

crimson vapor
#

and 127.0.0.1 also didn't work?

#

hmmm

drifting shell
#

uhhh

#

i can try that

#

nope

crimson vapor
#

yeah thats all the debugging im good for

#

sorry I couldn't help

drifting shell
lyric mountain
#

Never had issues with it

drifting shell
#

hmmm

#

the issue is more to do with javascript than java

lyric mountain
#

For js I recommend reconnecting-websocket lib

drifting shell
lyric mountain
#

Yep

drifting shell
#

this is going on a rendered html page tho, so idk if it behaves differently? never used node on a web page lol

lyric mountain
#

No, it's always backend

snow urchin
lyric mountain
#

Frondend needs to fetch data from node backend

drifting shell
#

rightttttttt

#

no idea why i put so many t's

green kestrel
#

in permission_overwrites for a channel whats the difference between allow/deny and new_allow/new_deny

latent heron
#

it's like the before and after context

green kestrel
#

but no docs seem to mention it?

#

i was thinking new_* were 64 bit masks where they planned to put new stuff

empty vault
#

lol

earnest phoenix
copper cradle
#

make sure it's set to tabs and 4 instead of spaces and 2 or tabs and 2

#

ctrl + shift + p > indent

clever vector
#

Hello guys

#

What is the Invalid body in here

#
    for (const mod of module) {
      embed.addField(`${mod.name}`, mod.cmds.map(x => `\`${x}\``).join("** . **"));
    }
sudden geyser
#

It should tell you in the error message.

#

Maybe it's too long or doesn't have any text.

clever vector
#

@sudden geyser

sudden geyser
#

Here's the magic

#

The field value is too long.

#

Aka ```js
mod.cmds.map(x => \${x}``).join("** . **")

clever vector
#

So how to fix that

#

My bot last big problem is only that

sudden geyser
#

You'll want to cap how much content you present in the string. You could use .substring(start, end), but that could look weird in the middle of your map joining.

clever vector
#

embed.substring?

#

@sudden geyser

sudden geyser
umbral igloo
#

Are there any events for discord.js that include the member that moved the bot (ie, dragged them between voice channels)?

#

If there are no events, what would the best method be to retrieve this information? Audit logs?

autumn crystal
#

hmm

#

is there a bot that sends messages with more than 1 page

#

Like you know when you ask for help for a bot, there are sometimes pages in the documentation

#

is there a bot that can do that kind of documentation?

umbral igloo
autumn crystal
#

oh ok

umbral igloo
#

You can use the message.edit() method to "change pages" after detecting the emission of message:messageReactionAdd I believe.

#

That's probably how most do it. You could also just use the help command for your bot with an argument for the page number to display.

#

ie, !help 2

peak bough
#

Any documentation or guide about how to do image editing in python. Like canvas in js

sage bobcat
#

One message removed from a suspended account.

peak bough
#

Have tried

#

I know its pillow, but cant find relevant guides

hybrid geyser
#

could i get some help yall

hasty mulch
#
@commands.command(name='flipcoin', aliases=['coinflip'])
    async def _flip(self, ctx, side, amount):
        otcm = random.choices('heads', 'tails')
        if otcm == side:
            async with aiosqlite.connect('/home/pi/Documents/Central_Communications/database/economy.db') as db:
                cursor = await db.execute(f"SELECT money FROM economy WHERE user_id = {ctx.author.id}")
                currentbalance = await cursor.fetchone()
                await db.execute(f"UPDATE economy SET money = money + {amount} WHERE user_id = {ctx.author.id}")
                print(f'Gave {ctx.author} {amount} K-Bucks')
                await db.commit()
                print('Saved!')
                pass
            embed=discord.Embed(
                type='rich',
                colour=discord.Color.dark_green(),
                description=f'''{ctx.author.mention}'s Guess: {side}
Result: {otcm}
{ctx.author.mention} won {amount} :kbucks:K-Bucks!'''
                )
            embed.set_author(name=ctx.author, icon_url=str(ctx.author.avatar_url))
            embed.set_footer(text="Developed by LIPD Productions Inc.#1205", icon_url=str(ctx.guild.icon_url))
            embed.timestamp=datetime.datetime.utcnow()
#

Can someone tell me why the lost embed is firing even though I won?

hasty mulch
#

@earnest phoenix If you’re typing for me, I already fixed it

earnest phoenix
#

Weird, choices method returns a list, and that's not how you random choose something either. Also why was it capitalized Heads and Tails when you don't call capitalize method whatsoever?

#

Well kekw

hasty mulch
#

¯_(ツ)_/¯

umbral igloo
#

What class is it a part of?

#

additionally, does it include the user that dragged the owner of the voicestate?

old cliff
#

You can find it out

umbral igloo
#

I can't find it in the doc

#

Is it different from voiceStateUpdate?

#

I cannot find a voiceStatusChanged

old cliff
umbral igloo
#

Then that's not what I'm looking for.

old cliff
#

VoiceStatusUpdated

#

It takes place when thw bot is dragged

umbral igloo
#

voiceStateUpdate has the user that got updated in oldState.member and newState.member

#

I realize this

#

how would I know who dragged the bot though?

old cliff
#

It also happens when the bot is dragged

umbral igloo
#

mhmm

#

I've used it like that, but how would I know who dragged the bot?

old cliff
#

Wait

umbral igloo
#

if there isn't a way to find out who dragged the bot from the voiceStateUpdate event, then would I use the audit logs?

old cliff
#

Yes you can

umbral igloo
#

to which part

#

is there a way to find the user who dragged the bot using voiceStateUpdate? or are you saying I can use the audit logs?

old cliff
#

No

#

Use Audit logs

umbral igloo
#

okay

old cliff
#

You can get if the bot was disconnected using VoiceStateUpdate

umbral igloo
#

I know

old cliff
#

But why do you want to know who dragged ?

umbral igloo
#

to get the voice channel they are in

#

just the way my bot operates

old cliff
#

You can just get newState.channel

#

To get the voice channel

umbral igloo
#

no i can't

#

not what I'm using it for

old cliff
#

You can

#

What are you using it for?

umbral igloo
#

the bot isn't being dragged to the user's voice channel

old cliff
#

Using viewAuditLogs permission for a music bot is lame

umbral igloo
#

it isn't a music bot

#

thanks for the help, I think I got it now

ashen kite
#

yo has anyone used the ffmpeg library before

#

is it possible to play two tracks at once

#

in the same vc ofc

old cliff
#

Idk

#

But why ?

ashen kite
#

because i wanna add a rain overlay

#

yk

#

and maybe like

old cliff
#

Hmm

#

Search on google

ashen kite
#

"fade" the original track

#

lol true

old cliff
#

Maybe this will help

#

You can use discord-ytdl-core for custom ffmpeg arguments

ashen kite
#

oo

#

aight i'll try that thx

earnest phoenix
old cliff
#

Parse it to integer

earnest phoenix
#

d.py parses it internally if you type hint it

earnest phoenix
#
if(command === "ban") { 

if(!message.member.hasPermission("BAN_MEMBERS")) return message.reply("Sorry, you don't have permissions to use this!"); 

let member = message.mentions.members.first(); if(!member) return message.reply("Please mention a valid member of this server"); 

if(!member.bannable) return message.reply("I cannot ban this user! Do they have a higher role? Do I have ban permissions?"); 

let reason = args.slice(1).join(' '); 
if(!reason) reason = "No reason provided"; 

await member.ban(reason) .catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));

 message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`); 
}```

Can anyone help me why this code is not working for me?
latent heron
#

What part of it doesn't work?

earnest phoenix
latent heron
#

What's the response

earnest phoenix
#

Wait a min

earnest phoenix
latent heron
#

Maybe the error => part?

#

That's the only point in the code you're calling a dict type

#

Idk djs

earnest phoenix
#

Hm ok

pale vessel
#

someone had the same problem yesterday and it was a pain to help them understand what objects were

pale vessel
#

reason needs to be an object containing the reason property, not just a string

latent heron
earnest phoenix
#

Ok

let reason = args.join(" ")```
pale vessel
#

change it into an object

craggy pine
#

KannaSip lets see if this becomes the same incident as b4

pale vessel
#

miyuka are you seeing this

#

yea

craggy pine
#

I'm always watching. I was dying from the last day.

river panther
#

guys, why is this method not working

pale vessel
#

how are we supposed to know

misty sigil
earnest phoenix
#

Hey

#

I have a problem to my event

#

When my bot joins/leaves a server, I have informations to my server:

const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js')
const logsChannel = '815953311614107709'
module.exports = async (client, message) => {

client.on('guildCreate', (guild) => {
  client.channels.cache.get(logsChannel).send(
  new MessageEmbed()
    .setTitle(`Omg, je viens de rejoindre un nouveau serveur !`)
    .addField(`Serveur`, `${guild.name}`)
    .addField(`Nombre de membres`, `${guild.memberCount}`)
    .addField(`Fondateur`, `<@${guild.owner.id}>`)
    .setFooter(`Je suis actuellement sur ${client.guilds.cache.size} serveurs !`)
    .setTimestamp()
    .setColor("GREEN")
  )
})

client.on('guildDelete', (guild) => {
  client.channels.cache.get(logsChannel).send(
  new MessageEmbed()
    .setTitle(`Oh nan, je viens de quitter un serveur :/`)
    .addField(`Serveur`, `${guild.name}`)
    .addField(`Nombre de membres`, `${guild.memberCount}`)
    .addField(`Fondateur`, `<@${guild.owner.id}>`)
    .setFooter(`Je suis actuellement sur ${client.guilds.cache.size} serveurs !`)
    .setTimestamp()
    .setColor("RED")
  )
})}
#

But the bot dosen't send the embed to the channel

edgy tapir
#

errors ?

earnest phoenix
#

any error in the console

earnest phoenix
#

module.exports = async guild => {

earnest phoenix
earnest phoenix
#

Hi guys

#

why do i get this error?

#

Error: Unknown authentication strategy "discord"

#

i m using passport and passport-discord

gilded ice
#

can anyone send some syntax theory videos

#

i cant find any pandasad

oblique flax
#

How can i find a script running forever?

#

For my discord bot?

#

I have a discord.js foldier , an index.js and a package.json

#

?????

#

How can i find a script running forever?

slender thistle
#

To host a Discord bot you need a machine

#

A VPS (Virtual Private Server) is probably what you want, but it's not free

earnest phoenix
#

if you have a vps

#

you need module pm2

modest maple
#

or any process manager

earnest phoenix
#

yea

oblique flax
#

I cant let a pc open so many hours

earnest phoenix
#

that s why

#

u need a host

oblique flax
#

How can i find a free host?

earnest phoenix
#

heroku

#

i think

oblique flax
#

Heroku is a host?

modest maple
#

pay for a vps

earnest phoenix
#

but it s a bit hard to setup

modest maple
#

otherwise dont have a bot running 24/7 bloblul

dusky sundial
#

Free hosts are never good in the long run

oblique flax
#

But i want a free host running my bot forever

modest maple
modest maple
dusky sundial
#

We all want free hosts, but that doesn't mean they will exist

modest maple
#

pick one:

  • free
  • run forever
dusky sundial
#

It's either free or good

modest maple
#

servers cost like nothing

earnest phoenix
modest maple
#

litterally about $3-4 a month

earnest phoenix
#

but

#

is like a trial

#

so eh

#

if you're sure it's worth it

#

buy it

#

cuz they are not so cheap

green kestrel
#

you get what you pay for, pay $3-4 for a server, get pants amounts of ram, contention on cpu cycles and disk iops with other people, crammed onto a hosting platform with half a million other vm's, sharing a small number of ips where if someone else gets their ip banned, so do you.

modest maple
green kestrel
#

imho you have to pay at least $10 a month to start getting anything anywhere near acceptable, and that's pushing it

modest maple
#

bots in the end use basically nothing resource wise unless the bot is rather large

green kestrel
#

because some of the really cheap vps dont even give you your own ipv4

modest maple
#

kinda a shame speaking of ipv4 and ipv6

earnest phoenix
#

i am going to leak my random bots token

#

for testing

modest maple
#

idk why you're telling us this

green kestrel
#

^^ takipsizad's statement

modest maple
#

perty much

green kestrel
#

never. ever. leak. a. token.

earnest phoenix
#

Error: Unknown authentication strategy "discord"

#

y?

green kestrel
#

if youre trying to make some lame honeypot, generate a correct-looking token by pattern that isnt real

modest maple
#

pytorch updated now non of my nets work blobpain

modest maple
earnest phoenix
#

oh

#

oops

earnest phoenix
modest maple
#

again, you give us no context bloblul

#

what are you trying todo

#

what is your code

earnest phoenix
#

i just got this error

modest maple
#

what is the stack trace

earnest phoenix
#

when i go to login page

modest maple
#

what languages

#

etc...

obtuse jolt
#

@modest maple having fun in here?

earnest phoenix
#

js

#
const router = require('express').Router();
const passport = require('passport');

router.get('/', passport.authenticate('discord', {
    failureRedirect: '/',
    successRedirect: '/dashboard'
}));

module.exports = router;
#

that s the code

#

i reinstalled all my modules

#

and i got this error

modest maple
#

okay

#

well

#

discord is not a valid authentication system

earnest phoenix
#

that s why

#

i installed passport-discord

#

it worked

modest maple
#

so what are you on about

earnest phoenix
#

until I reinstalled my modules

modest maple
#

well according to passport.js there is no extension module called passport-discord that's supported

#

im assuming you have all this setup?

gilded ice
#

how do i match with "s in regex strings in rust

modest maple
#

like you would anything else?

gilded ice
#

but

#

it thinks i terminated the string

earnest phoenix
modest maple
#

if it's escaping the string just escape the quote

gilded ice
#

r"^""
~ string ends here

modest maple
#

just escape it

#

and / or just use another quote

#

'"' is valid

gilded ice
modest maple
#

remove the r

gilded ice
#

pensive

modest maple
#

or just use another quote type yano

#

'^"' bloblul

gilded ice
#

it doesnt like ''

#

i thought you would know about the rust regex crate mmLol

#

loggers bro

modest maple
#

😔 man since when did it not like '' quotes

#

let foo = "^\""; is valid though

gilded ice
#

since char

gilded ice
modest maple
#

so just pass that to the constructor....

#

it doesn't magically change the behavior of the language bloblul We aint macros

gilded ice
#

i did

#

silly

earnest phoenix
quartz kindle
#

You aint macro but yer definitely rusty

modest maple
earnest phoenix
#

oops

modest maple
#

nice client secret

earnest phoenix
#

oooops

#

miss click

#

i regenerated

#

it

#

:))

#

so

#

do you know the problem

#

?

oblique flax
modest maple
#

something has to run the code forever....

dusky sundial
#

Your bot's code needs to be running for the bot to be online. So you need a machine that runs your bot's code 24/7

oblique flax
#

What is 24/7?(sorry a
I dont now a lot at coding)

dusky sundial
#

24 hours, 7 days per week

#

it's just another way of saying forever

oblique flax
#

Is it free?

dusky sundial
#

There are free hosts, but none of them will be any good. Like we said before

oblique flax
#

Is an other free solve for this problem without a pc opened all the time?

dusky sundial
#

There is no way to keep your bot online without a machine that runs your bot's code. End of story

oblique flax
#

Can you tell me a machine??

#

@dusky sundial

dusky sundial
#

These are some recommended VPS's

oblique flax
#

Is botghost good

modest maple
#

no

oblique flax
#

?

#

Okkk

dusky sundial
#

Keep in mind that using a VPS usually requires a little knowledge with Linux. But it's not too hard to find a tutorial

oblique flax
#

Ok thnx

obtuse jolt
#

(it cuts off the bottom part of the page, signifying theres an error, but i dont have any logs of what the error is)

quartz kindle
#

Your $count

#

Starts with td and ends with th

obtuse jolt
#

still broken

quartz kindle
#

what about the long line

obtuse jolt
#

which one

quartz kindle
#

the one thats going offscreen

obtuse jolt
quartz kindle
#

verified 0

#

in the code

obtuse jolt
#

oh

quartz kindle
#

Youre echoing a very long line

obtuse jolt
#

in the code

#

those are buttons

small tangle
#

Hello all,
I am programming in Java with JDA. Have more of a refactoring question. I want to optimize my checking for permissions and have the executing class throw the MissingPermissionException and catch it in the calling class. The problem is that when I throw an exception myself, I can only pass the missing permission as a string and then messily fetch the permission as a permission object in a map with that string.
is there a better way?

quartz kindle
#

Ye but cant see if the tags are properly closed

obtuse jolt
obtuse jolt
#

i dont get it

#

it looks fine

#

@quartz kindle i fixed it

silk ingot
#

works perfectly in vscode

#

😐

quartz kindle
quartz kindle
silk ingot
#

i know, but that's all it's logging 😐

obtuse jolt
quartz kindle
#

Huh weird

#

But anyway yeah functions inside loops is a bad practice anyway

quartz kindle
#

A promise you didnt catch

silk ingot
#

i know the area, it's just weird that only the host server im using doesn't like it

#

like it works fine in vs

#

it's only in the commands that I use the Hypixel API so ill just investigate

modest maple
#

fucking

#

stop

wary pollen
#

my god

woeful drift
#

yea

modest maple
#

@sinful belfry

#

i swear kids

sinful belfry
#

ty

wary pollen
#

Savior

woeful drift
#

mhm

river thistle
#

Does anyone know how to retrieve current client's shard ID ?

earnest phoenix
#

I have a error:

#
module.exports = async (client, channel) => {
  if (channel.type !== 'text') return;
  const mutedRole = channel.guild.roles.cache.find((role) => role.name === 'Muted');
  channel.updateOverwrites(mutedRole, {
    'SEND_MESSAGES': false,
    'ADD_REACTIONS': false,
    'SPEAK': false
  });
}
``` For my event
#

Its for if a channel is created, the bot set permissions for the muted role

#

but

#

updateOverwrites is not a function

#

:/

quartz kindle
earnest phoenix
misty sigil
#

wha

delicate shore
#

Hey

#

Why this error :c

#

it's an mp3 format

quartz kindle
delicate shore
#

but, it says unsupported format

#
message: "Failed to load because no supported source was found."
name: "NotSupportedError"```
modest maple
#

and what is the format?

delicate shore
#

it's mp3

#

I am pretty sure

#

url is https://translate.google.com/translate_tts?ie=UTF-8&q=Hello.&tl=en-US&total=1&idx=0&textlen=6&client=tw-ob&prev=input&ttsspeed=1

earnest phoenix
delicate shore
delicate shore
#

wait

#

is it because of the

#

brave

quartz kindle
#

what does the network tab show

delicate shore
#

what does this mean

#

it says not found

#

doesn't work for me on w3schools either

midnight spoke
#

What is the using of Presence intent ?

delicate shore
#

oh wait

#

I think google charges

#

for the API

modest maple
#

google charge for everything

delicate shore
#

google is gay

#

anyway, any suggestions for free tts?

modest maple
#

make your own bloblul

delicate shore
#

;-;

misty sigil
#

google's gay?

delicate shore
#

yes

small tangle
#

Can the case occur that Discord fires a GuildJoinEvent and an UnavailalbleGuildJoinEvent of the identical Guild? FeelsSmartMan Because im adding the guildID on join to my DB to save the guilds prefix and would throw an error when i try to add an entry with an identical ID

boreal iron
#

Adjust your query and add the ON DUPLICATE KEY structure and your issue is gone, if it ever appears

small tangle
#

yeah i added a check for that now FeelsSmartMan even that case would be extremely unlikely, but you dont know LuL

boreal iron
#

Added a check? You mean an extra query of the db if the server already exists? That’s inefficient just to say.

small tangle
#
if (guildCollection.find(Filters.eq("_id", guildID)).first() != null) {
    return;
}

Document newGuild = new Document();
newGuild.append("_id", guildID)
        .append("prefix", Config.get("PREFIX"));

guildCollection.insertOne(newGuild);

#

i mean im using mongo with java

#

so if there is a more efficient way, sure peepoHappy

boreal iron
#

Oh ok can’t help you with that

quartz kindle
#

for sure mongo has a insertIfNotExists thing

#

much more efficient than finding then inserting

old cliff
#
const collector = this.message.createReactionCollector(condition);
collector.on('collect',(reaction,user) => this._handleReaction(reaction,user));
collector.on('remove',(reaction,user) => this._handleReaction(reaction,user));```
this is my code... the collector does not run the _handleReaction function on reaction remove
#

how can I solve this ?

#

anyone ?

cinder patio
small tangle
#

yeah i just found the upsert option but thanks

copper cradle
#

that's the kind of data we need to help you

copper cradle
#

my hands are freezing, jeez

modern granite
#

In discord.py.
When I want to add the Server name into the json file, what is the command?

I mean the id of the guild is [str(guild.id)]

And for the name is [str(guild.name)] or what?

modern granite
#

Oh, thanks

old cliff
#

yeah it works now!

quartz kindle
#

you can pass it directly if you bind it

old cliff
#

I use this.properties in the function which get broken

#

because it thinks the properties are of the ReactionCollector class

#

and not of my class

crimson vapor
#

you need to bind it

feral skiff
#

Is there any kind of guide for beginners in discord.js

umbral zealot
#

Other than the discord.js guide?

feral skiff
#

Thnx

old cliff
crimson vapor
#

if you are using as class, func.bind(className)

old cliff
#

ok
Thanks!

feral skiff
#

Is there any documentation for mongoDB

feral aspen
cinder patio
#

literally first search result

copper cradle
#

it should be common sense that things as big and known as mongo db have a documentation somewhere

feral aspen
#

Btw.

#

If I would want to mention a user in the guildMemberAdd event.

#

do I do it like this?

#
<@member.user.id>
slender thistle
#

member.mention works too

pale vessel
#

just .toString() it

#

member.mention is eris thing

slender thistle
#

or was it member.user- I feel like d.js just wants to feel extra

feral aspen
#

member.mention, I don't see that in docs.

#

Do i do my way, does that work?

pale vessel
#

use member.toString() or `${member}`

feral aspen
#

Aight!

pale vessel
#

also works for roles, channels, users, and everything that has a mention

feral aspen
#

Happy to understand documentations finally! 😂

old cliff
#

<@user.id>

#

works

#

for users and members

#

for channels

pale vessel
#

okay

old cliff
near stratus
#

How do I do this in embed ?
That thing is not an image

#

The shardID and Shard ping thing ?

earnest phoenix
#

Be unique and creative, don't copy paste designs AjitCringe

near stratus
quartz kindle
#

if its not an image then its text

#

just copy it

earnest phoenix
#

^

near stratus
earnest phoenix
#

The box is just a codeblock in embed

#
this
quartz kindle
#

with text in it

#

the text just happens to contain unicode symbols that resemble a table layout

earnest phoenix
near stratus
quartz kindle
#

Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. Box-drawing characters typically only work well with monospaced fonts. In graphical user interfaces, these characters are much less useful as it is more simple and appropriate t...

near stratus
#

thanks (already bookmarked the link)

feral aspen
#
            .setDescription(server.joinMessage
                .replace("{member}", member)
                .replace("{member_name}", member.user.username)
                .replace("{member_tag}", member.user.tag)
             )

I guess this will be pain to edit in every message. I tried putting it in json files like this.

{
    "{member}": "member"
}

But that will make me more lost.

#

Is there a faster way to do this?

#

The message server.joinMessage will contain those {} and I want to replace those with the actual code, but I don't want to do them in every single file and update them for all. Is there a way to use json for this?

copper cradle
#

short answer: yes but I don't recomment writing to a file that often, I'd rather store it in a global variable or something like that

sterile lantern
#

how would i use a reactionCollector to collect 3 emojis from 3 seperate users and then log those user IDs

#

because im pretty sure it only prints 1 user ID instead of the 3

copper cradle
#

show your code, it should log the user that reacted, so it should log all 3 users

sterile lantern
#

well nevermind its my internet

#

anyone know how to fix this

#

and btw the reaction wasnt saving for some reason

#

refreshed discord and it worked

wispy holly
#

what do ı need for publish my bot in top.gg?

sterile lantern
#

cause right now it makes the author react

#
const filter = (reaction, user) => {
    return reaction.emoji.name === 'check' && user.id === message.author.id;
};```
#

ah nevermind ill just await and have it react to msg

severe pike
#

What does the % here mean? Is it the amount of the animation that has been played?

lusty quest
#

i guess

severe pike
#

Cheers.

lament rock
#

Send help

#

(Note that I don't actually need help with development. I know what I'm doing. Just, this is painful)

severe pike
#

I can help you

#

send me your bots token and i fix! (IM JOKING DONT SEND)

rustic nova
#

even me without proper js knowledge, i can tell that looks painful

severe pike
#

im a fake dev. I do python, so anything that isn't almost plain english looks confusing to me :))

lament rock
#

Writing a postgresql orm of sorts which is just a glorified statement maker. Not actually an orm since it can't do complex statements. This just supports singular query statement making or statements from multiple calls queued in a buffer and then joined together after a timeout has been reached in order to reduce calls

sterile lantern
#
message.channel.send('Heist!').then(testmsg => {
    testmsg.react("✅");

const filter = () => true;
const collector = testmsg.createReactionCollector(filter);

    collector.on('collect', (reaction, user) => {
        console.log(`${user.id} reacted!`);
});```

how do i make it stop when the reactions hit 3, and ignoring the bot's intial reaction
#

so 4 reactions in total, 3 excluding the bot's reaction

#

max: 3 probably but i dont know how to exclude the bot's reaction

#

after i collect 3 user id's, i check each of their balances,

then they can heist a user and they each get a portion of the targeted user's bank

opal oasis
#

who knows python3? I have Linux mints, I want to make a bot for my server in discord

lament rock
#

look into the filter options on the docs. It comes with the ability to filter with the reaction and also the user in order to affect the max

opal oasis
earnest phoenix
#

yesnt

#

i have debian wsl

opal oasis
#

what version of python3

earnest phoenix
#

default

opal oasis
sterile lantern
lament rock
#

When the collector ends, it's done. There is no more collection

sterile lantern
#

Yeah, that's the point

#

When it ends,

#

I want it to remove the bot's user ID from an array

lament rock
#

Array.splice

sterile lantern
#

o

#

lemme test

lament rock
#

splice is mutative

sterile lantern
#

how would i splice it

#

array.splice('id')

lament rock
#

Array.splice(element, deleteCount)

#

set deleteCount to 1

sterile lantern
#

oh

#

i forgot 1

#

alr

#

i did if(array.includes('id'))

#

then the splice

#

but it doesnt seem to work

#

nvm

#

ty

frigid spoke
#

hi

haughty mirage
#

kinda development related - does the topgg api count under this question?

river panther
#

@quartz kindle hello sir, need help

#

how do i take user from the interaction

gilded ice
#

when i try and run resize2fs on the root mounted partition, it says that my filesystem is already x blocks long

#

however i have a large unassigned partition that i need to merge with my fs

#

not sure what to do, i cant resize root in gparted or fdisk

gilded ice
knotty steeple
#

Hi can anybody help me with that?
i want to get the access token with the following code but...

let data = {
        'client_id': 'secret',
        'client_secret': 'secret',
        'grant_type': 'authorization_code',
        'code': req.query.code,
        'redirect_uri': "http://localhost:3000/redirect",
        'scope': 'identify'
    }

    request('https://discordapp.com/api/oauth2/token', {
        method: 'POST',
        json: true,
        body: JSON.stringify(data),
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    }, (err, data, body) => {
        if (err) { return console.log(err); }
        console.log(body);
    })```

It's return :
```js

{
  error: 'unsupported_grant_type',
  error_description: 'Grant type None is not supported'
}

But it's all correct...

river panther
gilded ice
#

oh right

river panther
#

what do?

gilded ice
#

try interaction.user i guess

river panther
#

ok ok

#

no

gilded ice
#

remember that you can always look at the discord API docs and discord.js docs for help

river panther
#

doesn't work

gilded ice
#

what library are you using?

river panther
river panther
gilded ice
#

interaction.member.user?

river panther
#

let me try

gilded ice
river panther
#

doesn't work

gilded ice
#

does it say undefined?

river panther
#

yes

gilded ice
#

try console logging interaction

latent heron
#

that's something different dice

river panther
#

i am doing that only

latent heron
#

that's solely for slash commands

river panther
#

console logging

gilded ice
#

i thought they were doing slash commands

latent heron
#

slash interactions and regular interactions are diff

#

nah

gilded ice
#

but its under slash commands

#

why would discord do this

frigid mirage
#

Hello, how do you configure that of the webhoock?

latent heron
#

correct

#

which means

#

its for slash commands lol

gilded ice
#

yes

#

so

latent heron
#

that doesn't mean

#

it is slash commands

gilded ice
#

we are talking about slash commands

latent heron
#

no

#

Discord have 2 interaction types

gilded ice
#

poopy

river panther
#

i tried interaction.author too

#

says undefined

river panther
#

ok

latent heron
#

so

#

what are you trying to do?

latent heron
#

oh boy

old cliff
#

first time using ts just to make types xD... does this look correct ?

latent heron
#

okay so

#

you're doing your interaction wrong

gilded ice
latent heron
#

interface

old cliff
#

meaning ?

#

I have never used ts

latent heron
#

wait

#

why are you

gilded ice
#

i thought you needed to use the lowercase types

old cliff
#

just to make types for my package

river panther
#

YES

#

I DID IT

latent heron
#

nah

river panther
#

YEEEEEEEE

latent heron
#

if he's defining types then

river panther
#

ITS .INTERACTION.ISER

#

USER*

latent heron
#

good job

river panther
#

oh back to small

#

thank you

#

👍

gilded ice
#

weird

#

anyway

#

the more you know

latent heron
#

oh this is rust

old cliff
#

btw are the types correct ?

latent heron
#

tias

old cliff
ebon ibex
#

Hi, how can i do my bot's status like this ; Racing On ~blabla~ race

old cliff
#

U can't set it to racing

ebon ibex
copper cradle
#

what lang and what lib, and, yes, u can't set a custom activity type

#

Idk if custom statuses are available for bots

old cliff
gilded ice
#

try it and see goosey

ebon ibex
#

@iron raft

#

How can i do this

gilded ice
#

@pale vessel nerd help

umbral zealot
#

using custom status. What programming language are you writing your bot in?

umbral zealot
#

great, are you using discord.js?

ebon ibex
#

yes

ebon ibex
#

thanks 🙏

umbral zealot
#

needs to be inside an event like ready() or a message event or whatever

old cliff
#

Evie can you rate my types ?

#

and will these work 😂

pale vessel
#

uh

#

Boolean?

#

why

#

it's boolean

old cliff
#

uh

#

can't it be capital ?

umbral zealot
pale vessel
#

i don't think those types are valid

#

no, capitalized refers to the class

old cliff
#

I needed to make types for a js module 😛

#

or should I not?

ebon ibex
#

@umbral zealot I didnt understand how can i do it.

umbral zealot
#

the page is pretty clear on that?

#

what part of it do you not get?

old cliff
#

bah who cares about types... I am ditching those

ebon ibex
#

I did cant understand the page

umbral zealot
#

ok well that's... not a thing I can help you with

#

¯_(ツ)_/¯

ebon ibex
#

🥳

#

what should i type to, .setActivity("?")

pale vessel
#

She. literally. gave. you. the. docs.

umbral zealot
#

client.user.setActivity() and inside that, the options. The options are documented.

umbral zealot
#

literally what I linked earlier.

ebon ibex
#

I did cant find it

umbral zealot
#

It even has an example

ebon ibex
#

can u take a ss?

umbral zealot
#

You can't find what?

#

the thing I linked to is this...

gilded ice
#

pensive

ebon ibex
#

type : 'WATCHING'
I want this type;

#

what can i do

#

i am so new.

earnest phoenix
#

Hey, I have a problem

#

I have this command:

ebon ibex
earnest phoenix
#

a giveaway command but when I want to launch the giveaway

umbral zealot
#

ok so type it in

earnest phoenix
#

I have errors to giveawaysmanager.start

umbral zealot
#

I'm not going to spoonfeed you an answer, meshy, it's super easy to understand, considering there's literally an example right there on the page

ebon ibex
#

:(

#

Page is a bit complicated for me

umbral zealot
#

I do'nt think the problem is the page.

ebon ibex
#

Thanks.

umbral zealot
gilded ice
#

damn thats quite some hindsight

#

im really sorry

#

ill see myself to the door

#

so i ask again because nobody responded:
when i try and run resize2fs on the root mounted partition (uwuntu), it says that my filesystem is already x blocks long

#

i wanna make it bigger because i have a large unused partition that i want to merge with root

#

or just expand root which i currently cant do in gparted

#

ive checked through everything online but nothing seems to work

#

pain

ebon ibex
#

I did find, but You could just say I had to write

pale vessel
#

No, she couldn't

#

You wouldn't be able to find things yourself otherwise

ebon ibex
#

what is this meaning? how can i receive

earnest phoenix
#

Hey, I have a problem
I have this command:
https://hatebin.com/tmaeykjshd
a giveaway command but when I want to launch the giveaway, I have errors to giveawaysmanager.start

pale vessel
#

They're saying that CUSTOM_STATUS is only used for users' presences

gilded ice
#

god

pale vessel
#

Dice ignored?

umbral zealot
#

Well this isn't #operatingsystems it's #programming , it's not like we Windows users can help a linux user that doesn't know how to use their OS 😛

#

Aren't Linux users supposed to be the geekiest of geeks that can google anything? lol

pale vessel
#

based

#

but true

umbral zealot
#

or show us

latent heron
#

i would've helped dice if i knew the answer to their problem

opal plank
small tangle
#

I don't have a problem directly, but would like to post a code snippet to maybe spot bad code practices or get comments on how to implement something better, is this channel for something like this too?

lapis geode
#

go on lad

umbral zealot
#

Maybe. Maybe not. can't guarantee it but there's no harm in trying, Timme

sudden geyser
#

In Discord's Developer ToS section 2 part a, it states that I need a privacy policy that "clearly and accurately describes to users of your API Client what user information you collect and how you use and share such information with Discord and third parties."

What does "collect" and "user information" mean in this context? Does user information mean any kind of information I obtain (for example, the user running a message) and does it have to be information that's stored to be counted as "collected"?

umbral zealot
#

Though, by experience, the best you'll get is "Your code is shit, bruh"

opal plank
lapis geode
#

I'll help if its JS FlushedBruh

opal plank
#

ids, basically

umbral zealot
opal plank
#

message ids, guild ids, channel ids, user ids, all that isnt collected

umbral zealot
#

Yeah basically discsord's IDs and timestamps are the only thing that's not user information KEKW

sudden geyser
#

Okay, but what would "collect" also mean in this context?

opal plank
#

message content, nicknames, guild names, channel names, all that is user data

#

those should be noted if you're saving them

umbral zealot
#

saving or storing in any way.

#

logs, database, files, whatever.

opal plank
#

THOUGH

#

theres a loophole

gilded ice
lapis geode
#

Say your bot requires you to store a Discord ID linked to some other information, you need to tell the user you are storing it and for what purpose

opal plank
#

technically memory isnt permanent, so, if you dont restart ur bot, technically bypasses the required for "storing" it

gilded ice
#

also i already have a bot thing i just need to delete all the commands mmLol

opal plank
#

so console logs for example dont fall into storing

umbral zealot
lapis geode
#

oh bet

small tangle
#
@Override
public void execute(CommandContext ctx) throws PermissionException {
    if (!IDatabase.INSTANCE.isUserInDB(ctx.getAuthorID())) {
        ctx.getChannel().sendMessage("![RedCross](https://cdn.discordapp.com/emojis/782229279312314368.webp?size=128 "RedCross") You don't own an alpaca, use **" + ctx.getPrefix() + "init** first").queue();
        return;
    }

    final long sleepCooldown = IDatabase.INSTANCE.getCooldown(ctx.getAuthorID(), "sleep") - System.currentTimeMillis();
    if (sleepCooldown > 0) {
        ctx.getChannel().sendMessage("![RedCross](https://cdn.discordapp.com/emojis/782229279312314368.webp?size=128 "RedCross") Your alpaca already sleeps").queue();
        return;
    }

    final int energy = IDatabase.INSTANCE.getAlpacaValues(ctx.getAuthorID(), "energy");
    if (energy == 100) {
        ctx.getChannel().sendMessage("![RedCross](https://cdn.discordapp.com/emojis/782229279312314368.webp?size=128 "RedCross") The energy of your alpaca is already at the maximum").queue();
        return;
    }

    try {
        final int duration = Integer.parseInt(ctx.getArgs().get(0));
        if (duration > 120) {
            ctx.getChannel().sendMessage("The sleep duration must not exceed 120 minutes").queue();
                        return;
        }

        final int newEnergy = energy + duration / 2 > 100 ? 100 - energy : duration / 2;
        final long cooldown = System.currentTimeMillis() + 1000L * 60 * 2 * newEnergy;

        IDatabase.INSTANCE.setAlpacaValues(ctx.getAuthorID(), "energy", newEnergy);
        IDatabase.INSTANCE.setCooldown(ctx.getAuthorID(), "sleep", cooldown);

        ctx.getChannel().sendMessage("\uD83D\uDCA4 Your alpaca goes to bed for **" + newEnergy * 2 + "** minutes and rests well **Energy + " + newEnergy + "**").queue();
    } catch (IndexOutOfBoundsException | NumberFormatException error) {
        ctx.getChannel().sendMessage(":x: Couldn't resolve the sleep duration").queue();
    }
}
#

so this is my typical approach FeelsSmartMan

opal plank
#

doesnt look like js

#

at all

umbral zealot
#

Count me out that's not javascript. though it sure as hell looks close enough to it. LOL

sudden geyser
#

Thank you guys for the explanation :)

small tangle
#

because it is java tfkHide

opal plank
#

ik

latent heron
lapis geode
#

java

opal plank
#

i meant as in: i cant tell you if its bad or not

lapis geode
sudden geyser
#

jaca

opal plank
#

cuz i dont juva

gilded ice
opal plank
gilded ice
#

my lang

#

headass

sudden geyser
#

syntax pls

gilded ice
#

im writing a tokenizer rn

#

uh

#

not a lot of syntax rn

sudden geyser
#

one bit

gilded ice
#

let foo<Type> = Bar;

small tangle
#

yeah i try to avoid deeply nested functions

gilded ice
#

fn foo<Type>(args<T>,) -> T {}

cinder patio
#

I literally wasted an hour investigating why my API doesn't work when I reverse-proxy it via nginx

gilded ice
#

need help?

lapis geode
#

Nothing is more fun than trying to find an error 5 functions deep

small tangle
#

:o

gilded ice
#

oh also i stole am using the pipe operator

cinder patio
#

turns out I hadn't whitelisted the domain in my google devs console cause I'm using google captcha... half of my endpoints depend on it

gilded ice
#

"Foo" |> upper

cinder patio
#

I hate myself

gilded ice
#

we all make dumb mistakes

latent heron
#

same

gilded ice
#

especially me

#

let iden = &input[..len]; this one line was why my entire lexer wasnt working

opal plank
#

too dark? sorry

gilded ice
#

not me yet

opal plank
#

basically how i coded my bot, just a mush of mistakes that somehow got popular

gilded ice
#

mine is not popular!!!!!!!!!!

latent heron
#

i feel that

#

@gilded ice tried making a lexer before in python

#

pepeMeltdown it was not worth it

cinder patio
#

is it for a programming language or what

#

I find lexer/parser generators easier than writing my own

latent heron
#

programming language

#

i wrote a very bare bones programming language in python

#

it was for me to understand how a lang is different than an interpreter

gilded ice
#

im writing my lexer in rust because its a dream

cinder patio
#

sounds like pain tbh

latent heron
#

everything in rust sounds like pain

sudden geyser
#

Rust is fun

crimson vapor
opal plank
crimson vapor
#

scratch is poggers

lyric mountain
sudden geyser
#

Is a bot required to have a Terms of Service (like how a privacy policy is required) or is it just optional (since I don't see anything in the legal or policy document yet we can still set a terms of service link on the app)?

umbral zealot
#

that sounds like a good question for Discord, Inc. or a lawyer ¯_(ツ)_/¯

crimson vapor
#

yea

#

they would respond in an email

lusty quest
#

would say depends also on your local laws, but for a verified bot you need one way to handle it

crimson vapor
sudden geyser
#

I'll go ask there or contact Discord if it fails

haughty sorrel
#

Hi, how do I make a command force a user to vote for the bot?

sudden geyser
#

You should persistently store a list of users who've voted for your bot. You can then run a query to see if the user has voted or not. There's some documentation on how to receive vote updates: https://docs.top.gg/resources/voting/

Top.gg documentation

Voting guidelines for bot developers

toxic jolt
#

let guildid = "675030984722350092";
client.shard.broadcastEval(`this.guilds.cache.get(${guildid}).name`)
    .then(results => {
        return message.channel.send(`Guild Name: ${results}`);
    })
    .catch(console.error);``` i make it this code but its not working help me pls
lusty quest
#

does it error out?

toxic jolt
#

not have a error log

#

dont send any message

lusty quest
#

where is message defined?

toxic jolt
#

yes Object Promise

#

getting

earnest phoenix
#

hi

lusty quest
#

does the promise contain the message object?

outer perch
#

fast question, does anyone know which programming language was used for gartic.io?

merry grove
#

No

outer perch
#

cuz I'd like to get introduced in web-based game apps

lyric mountain
#

well, you can make web games in pretty much any lang

#

I've made a pixelcanvas-like game with react

outer perch
#

😮

#

tysm

sterile lantern
#
if (chance >= 0.3) {```
this means 70% right
#

chance is Math.random()

cinder patio
#

eh I guess it's 70%

#

yeah it;s 70% I

sterile lantern
#

alright

earnest phoenix
#

I have a problem

#

I have errors to giveawaysmanager.start :/

quartz kindle
#

this is your problem
const client = new Discord.Client()

earnest phoenix
umbral zealot
#

lol

#

remove it

latent heron
#

oh my

quartz kindle
#

you are creating a new discord client

#

like if you wanted to run 2 bots at once

latent heron
#

no no tim

#

i want him to learn

umbral zealot
#

Yeah he'll learn if he reads what Tim is saying

latent heron
#

this isn't even ignorance it's a basic lack of understanding for how the wrapper even works

umbral zealot
#

He just doesn't know how to access the client

edgy tapir
#

how to overwrite a photo ? like to make a "rip" command for example, to add the member avatar on the grave

umbral zealot
#

You'd need something like canvas or some other image manipulation software.

quartz kindle
#

^

#

you can also use stuff like jimp, sharp, gm, image magick, etc

#

for something simple like composition

latent heron
#

image magick hollow

earnest phoenix
#

does anyone know how to make a repo-name.js.org domain in github?

latent heron
#

as in github.io?

earnest phoenix
#

ye

latent heron
quartz kindle
#

well, they have pretty good docs about it no?

earnest phoenix
umbral zealot
quartz kindle
#

ye ^

umbral zealot
umbral zealot
#

did you find a code that had a giveaway manager and you thought you could just steal copy the command but not the rest of the bot?

quartz kindle
#

you can do so in 2 ways: either pass it along the function, like execute(client,message,args,etc) or you can get it from any discord structure, like message.client

earnest phoenix
#

I test the message.client

umbral zealot
#

message.client would definitely be the real client, yes.

earnest phoenix
#

yes but

#

works then

#

xD

#

thx

umbral zealot
#

there's 4 steps here to follow

#

@earnest phoenix My DMs are not the appropriate location to continue the conversation

#

follow the instructions

earnest phoenix
#

i followed

boreal iron
earnest phoenix
#

but i dont know where and how to make a pull request and with which branches

viscid gale
#

lawl

modern granite
#

so uh, yeah a strange question, but still. I am using repl.it and UpTime robot for keeping the bot online 24/7 but after like 1 hour the repl.it turns off

#

it was not so before

#

any suggestions?

umbral zealot
#

the uptimerobot should Definitely keep it alive

modern granite
#

yes