#development

1 messages · Page 1710 of 1

lusty quest
#

what would be the point to add the bot to a botlist then?

#

patreon got a API

#

sure its deprecated but works

earnest phoenix
#

Or can you do that without adding it to top.gg

lusty quest
#

nope you have to add it to get a API key

earnest phoenix
#

ok

lusty quest
#

but you could use the key on a different bot i guess to test stuff

earnest phoenix
#

What

lusty quest
#

you have a green name so you have a bot listed.

earnest phoenix
#

I have 2 bots. One that people use and another that only i use and i stop and start constantly. I am new to the top.gg api and so far i haven't gotten it to work yet

lusty quest
#

you could use the API key from the Bot on a Dev Bot to test stuff

earnest phoenix
#

OHhhh

#

that's so good

lusty quest
#

well this is APIs work usually, the key is for authentification

weary socket
lusty quest
#

setting it up should be similar to how top.gg Webhooks work

weary socket
#

Puls I get Discord Account IDS over That?

weary socket
lusty quest
#

then you just have to listen for the stuff and work out what it sends

#

for discord IDs, you have to manage this yourself i guess

#

the API doesnt send them

weary socket
#

Ok

#

Thx

slender wagon
#

what are some kind of encryption forms i could use in js browser other than base64

marble juniper
#

crypto

#

oh wait

#

thats node.js

#

lol

snow ravine
#

the node_modules is not installing on my linux ubuntu machine, it throws this error: Error: Missing required argument #1

#

idk why can anyone help im new to linux soo

lusty quest
#

did you have permissions to write into the folder?

snow ravine
#

yes

lusty quest
#

what command did you use?

snow ravine
#

npm install

#

to install the files from my package.json

lusty quest
#

did you ran npm init to generate the package.json?

vivid fulcrum
#

what is the full stacktrace of the error

snow ravine
#

its already there

snow ravine
# vivid fulcrum what is the full stacktrace of the error
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>
lusty quest
#

i like that discord now offers previews of files

snow ravine
#

yeah

lusty quest
#

no more sketchy .txt files

snow ravine
lusty quest
snow ravine
#

yea

#

somone sent me a file named sexy n**s

#

i blocked him

#

no malware for me

feral perch
#

has anyone done custom channels using mongo db here?

snow ravine
#

idk

lusty quest
#

what you mean by custom channels?

feral perch
zealous egret
#

Can somebody help me how to do economy in my python discord bot??

#

If you can help me with it ping me I will be back in 10 minutes

lusty quest
feral perch
#

database works fine

lusty quest
#

and?

feral perch
#

i have a issue while using it with chatbot

lusty quest
#

why?

#

did you use stuff like cleverbot?

feral perch
#

wait i'll send the code

#

nopes

#

using monkedev api

feral perch
#

check the code

#

if i do return after checking if the channel is there or not on the db

lusty quest
#

do you send the correct stuff to the api?

lavish bramble
#

My bot is not starting and nothing error

feral perch
#

it does not respond

feral perch
#

chatbot works fine

#

its not taking in the channel

lusty quest
#

the channel you have in the database?

#

you never get the channel object from it

feral perch
#

i have the channel in database

#

but the bot just takes input from all the channels

lusty quest
#

yes but you have to get or fetch the channel object from it to be able to send stuff in the channel

feral perch
#

message.content

#

thats why its there

lusty quest
#

i suggest the following:
fetch the channelid you have in the database.
then check if the message channel is the one you just fetched, if true send it to the api if not just silently return

zealous egret
#

Can someone help me with economy in my python bot I used every tutorial and every git hub code I saw and nothing happened

umbral zealot
#

nothing? You used every tutorial and nothing happened?

zealous egret
#

I don t know how to make database and how to setup it because when I tryied to it doesn t wor

zealous egret
umbral zealot
#

So you ran every code you could find, and you had no message, no error, no actual action happen in the face of many lines of code... ?

zealous egret
#

No because

#

I don t have database adn don t know how to create it in python to my bot because every tutorial was on .js

umbral zealot
snow ravine
#

well i think i fixed the problem ubuntu comes with NodeJs 8.10.0 and im updating it rn

umbral zealot
#

Your googling sucks ass, man.

zealous egret
pale vessel
zealous egret
#

for me

umbral zealot
#

Well ok that's a step above "nothing happened"

#

So how didn't it work?

#

would you mind maybe actually getting some of that code and, like, describing the problem, the errors, the difficulties you ran into?

zealous egret
#

I can t create and I don t know why I changed my computer language for that to english and again it doesn t worked

umbral zealot
#

how the hell does your PC language have to do with coding a python bot?

zealous egret
umbral zealot
#

Well here's the thing though

#

You have the information you need

#

you just aren't making the effort to go through it

#

all economy bots will require a database. It's a requirement. you can't get around that.

zealous egret
#

but I can t creaet database and I don t know where is problem

umbral zealot
#

Ok so, good. From "NOTHING HAPPENED", we've progressed to, you're having trouble setting up a database.
more progress

umbral zealot
#

What problem are you facing attempting to create a database?

zealous egret
#

I use command what he used in video and database didn t create

#

I going to watc that video again and try it again and I will be right back after test it

umbral zealot
#

It sounds to me like you have no idea how to write python or code at all and you're hiding behind vague problem definitions to avoid admitting you don't actually know programming.

#

You might want to actually learn the language before attempting to make bots.

zealous egret
#

?

#

I am beginner, no more

#

and no tutorial helped me

umbral zealot
zealous egret
umbral zealot
#

There are tons of resources to help you learn

quartz kindle
#

tons of damage

zealous egret
snow ravine
#

i used to use py but i switched to js and its honestly easier

quartz kindle
#

doing bitwise with bigint is so painfully slow its hilarious

#

you can literally make your own bitwising functions for numbers bigger than 32bit and its 50x faster

rustic nova
#

thanky

quartz kindle
#

<3

modest maple
#

or arbitary?

#

eitherway

#

thats a yikes

quartz kindle
#

js's bigint is arbitrary

#

int is 53 bit max because its based on 64bit double

#

but bitwise operations internally use int32

#

so numbers between 32bit and 53bit cannot use bitwise in js

#

but bigint can use arbitrary bitwise

#

so many people use bigint for 32-53 range

#

which is panifully slow and not needed

#

you can rollout your own functions for bitwise in the 32-53 range that dont require bigints

modest maple
#

yikes

earnest phoenix
#

let arg = abcde

How to get the list of the number of times letters of arg return?

copper pond
#

@zealous egret what is your problem?

earnest phoenix
#

example:

a: 1
b: 1
c: 1
d: 1

quartz kindle
#

loop over the characters and add them into an object

modest maple
#

@quartz kindle What time is that? ms, s?

quartz kindle
#

ms

zealous egret
copper pond
quartz kindle
#

imagine 600 seconds lmfao

modest maple
#

for me python does that in about 300ms with arbitrary ints

#

PyPy does it in 20ms

quartz kindle
#

nice

#

pypy likely has an optimization where it converts to int64 if it fits

modest maple
#

it doesnt iirc

quartz kindle
#

would be the sensible thing to do

earnest phoenix
#

@quartz kindle


for (const count in object) {
  console.log(`${object[count]} : ${count}`);
}```
He log the place and not number of time
#

my console: a: 0

quartz kindle
#

for of

#

not for in

modest maple
#

[1323333333333333333333333333333333333333333333333333333333333333333333333333333333 & 2342385223633333333333333333333333333333333 for _ in range(99992222222222222222222999)]

earnest phoenix
#

of

modest maple
#

30ms

quartz kindle
#

oh cool

modest maple
#

i cant go any bigger though

#

i run out of memory

earnest phoenix
#

undefined @quartz kindle

tidal nymph
#

is Typescript good for functional programming?

#

just asking for researching purpose 🤔

quartz kindle
#

dafuq

earnest phoenix
#

for(const count of arg) {
  console.log(`${count} : ${arg[count]}`);
}```
quartz kindle
earnest phoenix
#

thx

lusty quest
#

(a eval discord bot)

quartz kindle
#

what lang?

lusty quest
#

py

quartz kindle
#

rip

lusty quest
#

or did you mean the bot?

quartz kindle
#

the eval

sonic swallow
#

hi

lusty quest
#

the bot iself idk i didnt write it it uses some code execution engine

quartz kindle
#

what lang is the interpreter trying to eval that with

lusty quest
#

but it tryed to eval it in py

quartz kindle
#

so arbitrary ints in py are fast but cost tons of memory?

lusty quest
umbral zealot
#

god I wanna use that but it's a pain in the ass to setup

lusty quest
#

just use the API

umbral zealot
#

I can't for performance reasons

lusty quest
#

well then rip

umbral zealot
#

I mean it's also that the project I need this for isn't a thing I'd want to use an API for, with its limits

#

I haven't even looked at just getting a docker image I bet there's one kek

lusty quest
#

docker is to slow for it, they use LXC container

umbral zealot
#

no I mean, a docker image to run piston itself so it runs all its things

#

that thing needs a lot of dependencies >.<

lusty quest
#

virtualisation inside virtualisation?

earnest phoenix
#

i have try this:


function count(string,char) {
 var re = new RegExp(char,"gi");
 return string.match(re).length;
}

var str = 'ab';
console.log(count(str, "a"));```

but now how can i displays a and b times ?
pale vessel
#

do you really need regex for that

earnest phoenix
#

yes

#

i think?

pale vessel
#
function count(string, char) {
    return string.split("").filter(x => x === char).length;
}
console.log(count("ab", "a"));```
#

you can use array.filter()

earnest phoenix
slender thistle
#
    @command(description="Test command lol.")
    async def test(self, ctx: CommandContext):
        kwargs = {
            "content"         : "Message.",
            "allowed_mentions": {"parse": []},
            "embeds"          : [
                shortcuts.create_embed(title="Test", description="Test haha", footer={
                    "text": "My footer!"
                }),
                shortcuts.create_embed(title="My title.", description="This is a description.", fields=[
                    dict(name="Field name 1.", value="Field value 1.", inline=True),
                    dict(name="Field name 2.", value="Field value 2.", inline=True)
                ])]
        }
        print(await ctx.send(**kwargs))
#

Looks prettier, more or less

pale vessel
#

I despise it

#

It's just too much for me

slender thistle
#

Oh yeah

#
    @command(description="Test command lol.")
    async def test(self, ctx: CommandContext):
        kwargs = {
            "content"         : "Message.",
            "allowed_mentions": {"parse": []},
            "embeds"          : [
                shortcuts.create_embed(title="Test", description="Test haha", footer={
                    "text": "My footer!"
                }),
                shortcuts.create_embed(title="My title.", description="This is a description.", fields=[
                    {
                        'name'  : "Field name 1.",
                        'value' : "Field value 1.",
                        'inline': True
                    },
                    {
                        "name"  : "Field name 2.",
                        "value" : "Field value 2.",
                        "inline": True
                    }
                ])]
        }
        print(await ctx.send(**kwargs))

this looks more like it

#

better than this

lavish bramble
#
client.on("message",  async (message) => {
if(message.content === "!ruk") {
message.channel.send('Restarting...').then(m => {
        client.destroy().then(() => {
          client.login(client.config.discord.token);
        });
      })
}
})
#

My restart command is not working

umbral zealot
#

I wouldn't rely on that working

#

just do process.exit() and have a process manager restart the app instead

lavish bramble
#

Error:- then is not defined

lavish bramble
umbral zealot
#

you already do... in your main index file

lavish bramble
#

Ok

#

Oh it will restart all system

umbral zealot
#

process.exit(0) will just close the process, but if you have something like forever, nodemon or pm2 running it, it will restart it automatically

lavish bramble
#
module.exports = {
	name: "restart",
	run: async (client, message, args) => {
		
		message.channel.send("ruk rha.... sabar kar!")
		await process.exit(0)
		
	}
}
lusty quest
#

did you need to run it async?

lavish bramble
#

Can I remove

near stratus
#

mesaage.member is returning undefined. Can anyone tell why

#

message is defined and looks like an ordinary message

#

message.user is also defined

sudden geyser
#

was the message sent in a guild

pale vessel
#

it shouldn't be undefined

#

it should be null

#

are you sure message is valid

#

it could be something else

near stratus
#

it's in a guild

near stratus
pale vessel
#

what discord.js version?

near stratus
#

12.x

#

Oh sorry it's a typo

#

i mistook spelling member

#

sorry

waxen snow
#

Can anyone fix this

#

There was err while playing music

lusty quest
#

check Google API docs what 429 error code mean

waxen snow
#

Ok

jovial nexus
#

how can i chech if the vc the bot is in is empty?

pale vessel
#

!(<VoiceChannel>.members.size - 1)

#

forgot to ask the library but oh well lmao

waxen snow
#

I'm hosting it on heroku

#

Or I should restart all dynos

quartz kindle
#

if you're getting 429 on a play command, then you're being rate limited by youtube

opal plank
#

Imagine not having all ur music locally

quartz kindle
#

imagine imagining an imagination

sudden geyser
#

brain

lusty quest
marble juniper
#

don't use heroku

#

for discord bots

waxen snow
lusty quest
#

even worse

waxen snow
#

Then what hosting?

woeful pike
waxen snow
#

Scaleway?

woeful pike
#

any vps provider works

#

digitalocean, scaleway, linode, contabo etc

waxen snow
#

Ok

quartz kindle
#

ovh, galaxygate, compute engine, aws, vultr

#

hundreds to chose from

woeful pike
#

monkaShake aws

woeful pike
#

but yeah the list is endless

woeful pike
#

which seems interesting

waxen snow
#

Well ovh building burned

quartz kindle
#

lmao

woeful pike
#

where do you see that

quartz kindle
woeful pike
#

their cloud foundry which seems like a heroku clone lets you use 256mb per month

#

oh u have to go on lite

quartz kindle
#

cloud foundry is their version of google's app engine?

#

like heroku/repl.it/glitch

earnest phoenix
#

how can i make a avatar url?

woeful pike
#

I think so. I haven't looked into it because I don't use free hosts obviously but it it looked like an alternative

quartz kindle
#

their cheapest classic vps is 13 bucks per month

#

1 cpu 2gb ram

woeful pike
#

yeah it's probably a heroku clone where they give you the generous free tier and hope you pay out the nose for the lowest paid tier

#

like drug dealers idktbhprollyanod

quartz kindle
#

xd

#

these internet giants have very weird business models

#

google ibm and amazon

#

783653875 different services with fancy names and no information on what they actually do or offer

waxen snow
#

Ok NVM I fixed it by restarting all dynos

quartz kindle
#

billed in ways that make them look cheap

#

but in the end its all expensive af

#

its one big marketing scam

earnest phoenix
#
User {
  id: '683630053686378498',
  username: 'RAKE',
  bot: false,
  discriminator: '6882',
  avatar: 'a611246958d2280e501ee52c5cf8bf2f',
}```
How can i make avatar out of this
quartz kindle
#

https://cdn.discordapp.com/avatars/<userid>/<avatarcode>.png

cinder patio
#

avatar is the user's avatar hash you have to fetch the actual image using it but idk the url

#

well there you go

earnest phoenix
quartz kindle
#

then you did something wrong

#

works fine for me

umbral zealot
#

bots or users there's no difference in the URL

earnest phoenix
#

okay

#

thx

#

i am trying to make my bot string a random server from all the servers its in but rn it only sends 'm', '=', 'd' and not a full name. how do i make it work?

dusky sundial
#

You're turning the whole client.guilds collection into a string, and then random.choice picks a random letter from that string

earnest phoenix
#

yea thats what i thought happened

dusky sundial
#

So move the string conversion to surround the random.choice(guilds) instead

earnest phoenix
#

oohh

#

so now i have this but it does the same thing

pale vessel
#

Move that str() to ctx.send(str(guild))

dusky sundial
#

Yeah, you're still converting the collection to a string

earnest phoenix
#

ohh

umbral zealot
#

what did you think str() did?

vocal trellis
ebon rose
#

Can someone help me by setting up the invite tracker bot in my server ?

vocal trellis
#

how to make this good

sudden geyser
#

This channel is for programming

earnest phoenix
lyric mountain
#

That ain't errors so it'll not pop in the console

#

Those are missing unicodes

#

check what you're trying to write and verify if the chosen font has matching chars

#

Could you show what that text was supposed to be?

#

The text not the code

#

No, that's the code retrieving some users username

#

I wanna see the username itself

#

Oh my

#

The error is not in the code for gods sake

#

Show tge actual text you're trying to print, not the code

#

Idk if you're joking or what

#

But I'm out

tribal siren
#

if(!message.member.voice.channelID !== '775589180654485504') return message.delete();

#

this doesn't work

#

e

#

help please

#

bruh chat ded

zealous egret
#

Do you guys know what is wrong? I can t use .lb command

earnest phoenix
#

@zealous egret add_field doesn't have a name attribute

tribal siren
#

it says

earnest phoenix
#

Try title

tribal siren
#

object has no attribute "name"

#

so logically, you gotta add a name attribute

earnest phoenix
#

Oh wait no it isn't that, it's in the first for loop

zealous egret
earnest phoenix
#

Debug it. There are a few places that could come from. But it seems like it's coming from line 372

sudden geyser
#

Remove the leading !

tribal siren
#

oh

#

oooooooh

#

dam didn't see that

sudden geyser
#

That'll convert it to if (false !== 'id') {...}

tribal siren
#

thank you

dusky sundial
tribal siren
earnest phoenix
#

whe i can make it with .invites?

lyric mountain
#

Yes, it's supposed to be hex

lyric mountain
lean pike
#

hi guys i have problom how i can fix it this my problom

earnest phoenix
#

how can i do that with .invites

#

@lyric mountain

lyric mountain
#

That what?

earnest phoenix
#

so code

lyric mountain
lean pike
#

im make like that

earnest phoenix
#

how can i do that

#

if(!message.member.channelID !== '775589180654485504') return message.delete();

lyric mountain
earnest phoenix
#

code for visual studio code for check invites

lyric mountain
#

Vscode is not a language

#

You can't have a code for it

earnest phoenix
#

why

#

wha

lyric mountain
#

Vscode is a text editor

earnest phoenix
#

i will code for check invites

lyric mountain
#

Fetch the invites from the guild object

slender wagon
lyric mountain
#

You can't run jsfuck on the console

slender wagon
#

yes i can but i can't run this one

lyric mountain
#

So, what do you expect for us to do?

slender wagon
#

see if it works

lyric mountain
#

Why?

#

It's your "code"

slender wagon
#

ok

pale vessel
vivid fulcrum
#

windows ooga booga edition

earnest phoenix
#

lol

tribal siren
#

long before time had a naame

thick nexus
#

Is json or csv better for storing stuff

dusky sundial
#

What kind of stuff do you want to store?

near igloo
near igloo
silk wadi
#

C# is pog

earnest phoenix
#

Hi!

Sorry for bothering you, I made a little script to retrieve the invitation used when a member joins my server, but it returns me undefined.
I tried other techniques but the same, undefined ...

If you could help me please?

#

module.exports = async (client, member) => {
    const invites = {};
    client.guilds.cache.forEach(g => {
        g.fetchInvites().then(guildInvites => {
            invites[g.id] = guildInvites;
        })
    });
    
    member.guild.fetchInvites().then(guildInvites => {
        const ei = invites[member.guild.id];
        invites[member.guild.id] = guildInvites;
        const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
        console.log("Used invite :", invite)
    });
};```
eternal osprey
#
const vip = await guild.roles.create({
        data: {
          name: 'MB10',
          color: 'BLUE',
        },
        reason: 'role for the game attenders',
      })```so this first gave me a guild undefined error, so i defined it. Then it gave me the error(node:11064) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
#

why is that?

#

because it needs cache?

old cliff
#

Is tsconfig.json available when downloading a ts npm package which compiles into js after install from github?

stiff radish
#

How long does it usually take for mods to approve/decline a bot? I have my bot on my local computer because I can't afford a VPS at the moment, but I still want to be sure my bot's online when it gets reviewed.

earnest phoenix
stiff radish
#

k

earnest phoenix
#

mine took 2-3 weeks but it was like 4 months ago

opal plank
#

also use a for loop

#

by the time the promises finish, that code is long gone

near igloo
opal plank
#

instead of forEach() use for( of)
instead of fetch.then()
use await fetch

same for the stuff below that

#

@earnest phoenix

near igloo
#

im too stupid to know what went wrong here as it looks apropriate for what i saw in online forums, but uh what is it trying to do?

near igloo
#

oh duh

#

🤦‍♂️

quartz kindle
#

or just add using namespace std

#

so you dont need to add std everywhere

near igloo
#

i keep forgetting that the linux compiler is diffrent than the windows compiler

near igloo
#

vscode moment

quartz kindle
#

xd

#

well it would also remove the need for std in all the cin and cout

near igloo
#

eh true

quartz kindle
#

but honestly better keep it

#

to avoid possible namespace conflicts

near igloo
#

yeah cuz then i have to go through it and remove them all XD

quartz kindle
#

xD

near igloo
#

help me out here @quartz kindle its erroring on a commented out line XD

quartz kindle
#

lmao

#

honestly i still dont understand what exactly are you trying to do

#

why declare a function as a pointer?

near igloo
#

that error on the commented line made my day tho

quartz kindle
#

so if the input is 1, run function1, if input is 2, run function2?

#

always different functions?

near igloo
#

calculate very diffrent things

#

also i used a while true loop so if you dont run it on cli it just sorta kills your pc and somehow writes random data to disk till its full?

quartz kindle
#

Lol

near igloo
#

yea shit dev moment

#

imma probs make it where if the first cin it recieves gets nothing it just backs out immediatley

#
return (0)```
#

stfu google

fallen spindle
#

if I have

client.on(eventName, event.bind(null, client));

how can do client.off() ?

I need refresh cache of event 'message'

quartz kindle
#

wat

sterile lantern
#

for oauth, how do we print the guilds the user's in

#

i already have the guild scope but idk how to print their guilds

quartz kindle
fallen spindle
last tapir
#

hi

#
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];
console.log(a, b);
console.log(arr);

What does this mean As in, you cannot use the rest parameter to catch a subarray that leaves out the last element of the original array.

#

does it mean that you cannot do something like this?

#

[...arr, a, b]

crimson vapor
#

Correct

last tapir
crimson vapor
#

if you use a linter and put something after ...arr it will scream

sterile lantern
#

o wait nvm found it

last tapir
#

my test says Use destructuring assignment with the rest parameter to perform an effective Array.prototype.slice() so that arr is a sub-array of the original array source with the first two elements omitted.

last tapir
earnest phoenix
#

how do i use commands.BadArgument correctly? discord.py

near igloo
#

2008 moment

quartz kindle
#

lmao

copper cradle
#

you can just do [,, ...arr]

#

I think

sterile lantern
#

TypeError: Class constructor Snekfetch cannot be invoked without 'new'

#

const get = require("snekfetch")

copper cradle
last tapir
copper cradle
#

alr

near igloo
#

c++ mustve been the hot shit back then

quartz kindle
#

xd

copper cradle
#

well most people weren't asking "why does my bot not work?!?" back in 2008

near igloo
#

also probably only the people who wanted to delve deep into programming were asking for help online XD

quartz kindle
#

the actual slice function is faster anyway

near igloo
#

lmao the slice function is much simple

copper cradle
#

they're probably showing them different approaches

#

but still

quartz kindle
#

maybe their teacher is teaching "stupid ways to use js"

#

:^)

copper cradle
#

I'd rather use the slice function

#

or what not to do

quartz kindle
#

well if its an in depth lesson about the spread operator it makes sense i guess

#

to show all possibilities

near igloo
#

yo nice you call a vector the same way as an array

#

XD

quartz kindle
#

xd

wicked crown
quartz kindle
#

im using array of pairs to store function error strings

wicked crown
#

can someone help me?

#

oh wait

quartz kindle
#

help with what? what is the problem?

near igloo
#

mmm yes the crisp of konqueror

quartz kindle
#

adblock

#

:^)

wicked crown
near igloo
wicked crown
#

var list = message.client.queue.get(message.guild.id);

quartz kindle
#

message.client.queue is undefined

wicked crown
#

the error is there

wicked crown
quartz kindle
#

you copied that code from somewhere?

near igloo
quartz kindle
#

the code you copied depends on other things that are not in there, which are missing

#

in this case, a queue property is missing from the client

#

it should probably be a Map object

wicked crown
#

oh yea

#

lemme change

#

@quartz kindle still same error

#

hm

near igloo
#

tim what is the sleep function in c++ again? (i can google i just thought you might know off the top of your head)

wicked crown
#

@near igloo can u help me out with this issue?

near igloo
#

i dont get what your trying to get

#

tbh ive never heard of client.queue

rough current
#

Do I need Privileged Gateway Intents to use client.servers

sudden geyser
#

I don't think so

rough current
#

Okay ty

near igloo
#

but no you wouldnt

#

thats a necesary client thing

sudden geyser
#

depends on the library, but it's probably guilds

copper cradle
#

I've never seen a library where they're called servers

rough current
#

It just posts how meany servers it is in right?

sudden geyser
rough current
#

same just saw it (on stack overflow lmfao) bc I could not find the library for it

near igloo
#

holy shit @quartz kindle

#

hes fucking deveoping on mobile

copper cradle
#

that's a fucking crime

misty sigil
#

yo it’s voltrex 2

modest maple
copper cradle
#

their pfp

near igloo
earnest phoenix
#

so i am making this announcements command, but it says 'a Nonetype has no attribute to send'

#

how do i fix it?

umbral zealot
#

I'm no expert but it sure as heck looks like channel1 is null because it wasn't found

sand field
#

hi guys anyone have good filters for music bot?

umbral zealot
#

"filters"?

sand field
#

yes like bassboost , 8D

umbral zealot
#

So you mean literally you want all the filters that 80% of the music bots I reviewed had?

#

all of 'em have them all. lol.

sand field
#

i mean like an npm package

umbral zealot
#

they're not going to use npm packages.

sand field
#

oh ok

umbral zealot
#

you need filters on the sound module you're using

#

which I presume is what they're all using

sand field
#

im using discord-ytdl-core

umbral zealot
#

¯_(ツ)_/¯

sudden geyser
#

@earnest phoenix In your first loop, you iterate over the current user's guild's text channels to find the last channel where the names match. You then iterate over every guild's channels to find a channel that matches with the name and sending a message to channel1.

There are two issues in that logic:

  • channel.name is going to be a str, but you're comparing it with a GuildChannel.
  • You're only sending it to channel1 rather than each channel. In fact, I don't think you should be doing this in general.
umbral zealot
#

clearly what it's doing is what you want

sand field
#

ty dude i hav a look 🙂

sudden geyser
#

You compare a string with a string (channel1.name) and you send it in the appropriate channel (so it isn't sending the same message in channel1 instead of the channels that should match).

#

Also, discord.py provides a decorator for labeling a command as owner-only (@commands.is_owner())

sudden geyser
#

channel1 is a GuildChannel, but channel.name is a str. But you also need to handle cases where channel1 is None, which is the source of your error (Nonetype has no attribute to send).

quartz kindle
# near igloo

a lot of people do (and most likely than not they have tons of issues because of it)

near igloo
#

tbh phone screens make me claustrofobic

#

even my laptop screen is small

quartz kindle
#

and the patience to type on a touch screen

near igloo
#

i just use my laptop cuz windows on my desktop isnt as good as linux on c++ imo

near igloo
quartz kindle
#

autocowrecks

near igloo
#

yes

quartz kindle
#

i hate autocorrect

#

i always have mine disabled

#

but then when i type fast i type really funny things

near igloo
#

lmao im too lazy ngl

quartz kindle
#

xD

near igloo
#

i get things like (hold on imma go find it)

#

Ehhh temhey all way ting verification

#

thats me typing fast with autocorrect

quartz kindle
#

lmao

near igloo
#

alright its time to purposely try and brick my pc hoping that my code's error catching will catch it

quartz kindle
#

this is me without autocorrect

Nginx rev?rse prpxy?
Im on the pgone without autocoreect
Phone

near igloo
#

@quartz kindle no idea what its saying

sudden geyser
#

You're missing a " before solution

cosmic forum
sudden geyser
#

Also I'm not sure about the reliability of providing a raw string as JSON

#

Over JSON parsing an object to be converted to a string

near igloo
quartz kindle
#

where are you defining strictProbabilty?

near igloo
#
 probabilityProcessor _probabilityFunctions [1] = {strictProbability};
                                                   ^~~~~~~~~~~~~~~~~```yea thats a yikes
near igloo
quartz kindle
#

define it on the top maybe

near igloo
#

made teh error go away

quartz kindle
#

btw you dont need the spaces around the <> anymore lmao

near igloo
#

lmao is that just a 2008 thing? kek

quartz kindle
#

ye

#

lmao

near igloo
#

uhhhhh vscode wyd

#

@quartz kindle lmfao i got a segmentation fault by putting fd into an int

quartz kindle
#

lmao

near igloo
#

imma go try and overwrite my ram with this brb

earnest phoenix
#

it looks like ubuntu of some sort

near igloo
#

its debian with kde plasma

earnest phoenix
#

Ooo Sounds interesting

#

i was installing kali on my ssd but it gave me this insatll errror

still ferry
#

hi does anybody know how to make a youtube statistics bot? if you could sent a tut then that would b great!

earnest phoenix
#

anyone know how to host a js bot on a vps as my python bot runs fine on vps

still ferry
sudden geyser
earnest phoenix
#

100up

earnest phoenix
#

i got my python bot on there simple but it wont work with js

still ferry
#

what do u wanna host ur bot 24/7?

earnest phoenix
#

Just a giveaway bot

#

js

still ferry
#

ok

#

if u wanna host it 24/7 use heroku

cursive dagger
#

@earnest phoenix uh so basically: git clone it, fill out env cars and install dependencies then run?

earnest phoenix
#

ok i shall try

cursive dagger
earnest phoenix
#

Yeah i got a 100up

still ferry
sudden geyser
#

A virtual private server (VPS) is a virtual machine sold as a service by an Internet hosting service. The virtual dedicated server (VDS) also has a similar meaning.
A virtual private server runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost an...

still ferry
#

yh so baisically a hosting?

#

@earnest phoenix u can host with heroku

earnest phoenix
#

mkay

sudden geyser
#

Heroku may not be a good service to host a Discord bot

earnest phoenix
#

its a bit complicated

still ferry
still ferry
#

add the folder to git hub

earnest phoenix
#
let invites = new Map();
module.exports = async (client, member) => {
    
    member.guild.fetchInvites().then(guildInvites => {
        const ei = invites.get(member.guild.id)
        guildInvites = invites.set(guildInvites, member.guild.id);
        console.log(guildInvites)
        const invite = guildInvites.get(i => ei.get(i.code).uses < i.uses);
        console.log("Used invite :", invite)
    });
}; ```

why invite return undefined
sudden geyser
#

.get doesn't take a function

#

You're probably looking for .find

#

no wait I lied

earnest phoenix
#

yes but when i set .find he say me … is not a function

still ferry
# earnest phoenix its a bit complicated

and then u have to make a heroku application. connect the main branch and deploy. boom your bot will be hosted! the vid explains everything a bit better though

steady hazel
#

heroku is "read only" as far i know

sturdy dock
sudden geyser
# earnest phoenix yes but when i set `.find` he say me … is not a function

You could use a raw loop and iterate over the map to find the invite, but I recommend you use Discord.js's Collection class, which has a number of useful methods for maps. But even then, you're handling your collection in a weird way.

You call .get with the guild ID for the ei variable, but you try setting guildInvites (which is definitely not a guild ID) as the key and the guild ID as a value.

wheat mesa
#

How can I tell if a user is online in discord.js, and how can I send a dm to a specific user when that person comes online? My current code is as follows, but it doesn't work. It doesn't throw any errors, it just doesn't do anything and I'm not sure why

client.on('presenceUpdate', (oldPresence, newPresence) => {
    let member = newPresence.member;
   
    if (member.id === '173489654144696320') {
        if (oldPresence.member.status !== newPresence.member.status) {
            if (newPresence.member.status === "online" || newPresence.member.status === "dnd" || newPresence.member.status === "idle") {
                let text = "User is online"
                client.users.cache.get("173489654144696320").send("User is online, bot is working")
            }
        }
    }
})
near igloo
#

me just vibing here trying to segment fault my entire 8gb of ram

sudden geyser
wheat mesa
#

uhhh, no... how would I go about doing that?

fervent holly
#

In the dev dashboard

#

In Settings -> Bot

sudden geyser
#

You also need to enable them on the dashboard like retro said

wheat mesa
#

thank you, I'll try that now

fervent holly
#

Yes

onyx steeple
wheat mesa
#

Alright, so I enabled privileged gateway intents, and it works now, but for some reason it's sending 4 dms

sudden geyser
knotty obsidian
#

how can i get the deleted message from the message delete event? (java (not script))

sudden geyser
#

JDA?

knotty obsidian
#

4.2.1

sudden geyser
knotty obsidian
#

oh

#

rip

#

tried to make a delete logger

near igloo
knotty obsidian
#

nah

sudden geyser
#

Java syntax is quite different.

earnest phoenix
#

Does anyone know how to use botghost to make a more anvanced commands like commands that do more then reply

umbral zealot
#

I'm pretty sure the only way to do that is to actually pay for the premium whatever feature they have.

earnest phoenix
#

Ok

#

stupid question. can I still call await on something that I do .then on?

#

Does anyone code with bot designer?

#

no

#

that isn't "coding"

#

There is somewhat coding

near igloo
earnest phoenix
#

Lol

wheat mesa
#
client.on('presenceUpdate', (oldPresence, newPresence) => {
    let member = newPresence.member;
    if (member.id === '173489654144696320') {
        if (oldPresence.status !== newPresence.status) {
            if (newPresence.status === "online" || newPresence.status === "dnd" || newPresence.status === "idle") {
                client.users.cache.get("173489654144696320").send("User is online, bot is working")
            }
        }
    }
})
``` anyone know how to get this to not send 4 dms? not entirely sure why it's doing that
knotty obsidian
#

tryna make a leave logger, how can i get the time of an user leaving the guild? (java (not script))

earnest phoenix
#

Idk

#

I code on bot designer

near igloo
earnest phoenix
#

Ik

#

Close enough some just do reply’s

sudden geyser
#

It sort of is, but isn't held to a high enough standard to be considered coding/programming

near igloo
#

||kinda offensive to us who do proper coding||

earnest phoenix
#

Lol

wheat mesa
#

yeah I wouldn't call that coding by almost any means lol

earnest phoenix
#

Does anyone know how to check how many servers your bot is in

sudden geyser
#

What library are you using?

earnest phoenix
#

I got it

umbral zealot
earnest phoenix
#

Yes ma'am @umbral zealot

#

It's been a few seconds since I've used js so I wasn't sure

#

Thanks

quartz kindle
#

you guys wanna see how to make a bitwise NOT operation (~) with pure math?

#
function not(n) {
    return -n - 1;
}
#

:^)

modest maple
#

mmLul doesnt that defeat the whole point of bitwise

quartz kindle
#

jenious

modest maple
#

Js moment

pale vessel
#

I just realized chrome allows redeclaration of let in the console

#

I don't think they allowed it before

#

still need to refresh to redeclare const though

quartz kindle
#

wait wat

near igloo
quartz kindle
#

since when does chrome allow that

#

i've been replacing all my lets with vars every time i copy code to test in the console

#

With the release of Chrome 80 version, now developers can redeclare with let and class in the console.

#

nice

opal plank
#

and thats a good indicator i shouldnt be awake rn[

pale vessel
#

Same @quartz kindle

vernal moth
#
client.users.cache.find(user => user.id === ID).permissions.has("ADMINISTRATOR")```
it says that it couldn't read the .permissions
#

and yes slash command interactions doesn't give me user's permissions so i can't do anything about changing it into message.author.perms

opal plank
#

erm you gonna have to give more detail cuz author does not having permissions

#

the payload it sends is a member

#

not a user

vernal moth
#

like

#

im tryna check if the author has the admin perms

opal plank
#

<author>.perms doesnt exist natively

#

thats what im trying to say

#

author is a user

#

not a member

vernal moth
#

okay

opal plank
#

users dont have permissions

#

a member does, which is part of a guild

vernal moth
#

how do i check if the person who typed the command has the perms. from slash commands?

opal plank
#

again, the payload should contain a member object

#

just member.permissions

vernal moth
#

hmm

#

let me see.

#

thank you so much :)

opal plank
#

ngl the 25 limit for slash commands kinda fucking me up

#

for choices i mean

vernal moth
#

also slash commands are really difficult to code on discord.js like omg

opal plank
#

its quite easy in detritus

#

its basically 2 requests

#

1 to register the commands

#

and the other to run the execute/run() function with the payload

#

thats it

#

register

#

run command

#

thats it

vernal moth
#

nice :)

#

oh

opal plank
#

it runs the commands like you would any other

vernal moth
#

also the member.permissions gave me this

opal plank
#

thats a bigInt

#

you need to decode it

vernal moth
#

;-;

#

never tried that before

opal plank
#

fairly certain d.js has a toString() or toArray() method

vernal moth
#

;-;;

opal plank
#

how so?

#

its just that number .toArray()

vernal moth
#

oh

#

wait

opal plank
#

though it would probably be better to get the channel

vernal moth
#

dammit

opal plank
#

<member>.permissionsIn(<channel>).has(<perm>)

#

this way you check for overrides

vernal moth
#

Perms is member.permissions btw

opal plank
#

such a nuincence tbh

#

having to check for both

vernal moth
#

;-;

#

both for standard commands

#

and slash commands

opal plank
#

unfortunately its not d.js

#

this check for both

vernal moth
#

do you mean channel as in channel id or the whole channel data?

opal plank
#

i think d.js is <permissions>.toString()

vernal moth
opal plank
#

channel

#

not id

vernal moth
#

:(

#

this makes my coding experience a lot more difficult

opal plank
#

use detritus for an easier time

vernal moth
#

welllll
TypeError: interaction.member.permissionsIn is not a function

opal plank
#

oh my bad

#

other way around

#

no

#

nono

#

that shuold work

#

wtf

vernal moth
#

:/

opal plank
#

you can try <channel>.permissionsFor(<member>)

vernal moth
#

ohhhh

opal plank
#

but it says <member>.permissionsIn(<channel>) works

opal plank
#

that doesnt check for overrides

vernal moth
#

hmm

near igloo
opal plank
#

people actually have overrides

#

not checking for it is dumb

vernal moth
opal plank
#

blame d.js shitty lib

#

their docs clearly says it should work

umbral zealot
#

no they don't

#

users don't have permissions

opal plank
#

its a member

#

not a user

umbral zealot
#

What is the current code they're using though

opal plank
#

interactions

#

slash commands

vernal moth
opal plank
umbral zealot
#

right ok but that wasn't my question lol

opal plank
#

discord itself sends a member payload

umbral zealot
#

discord doesn't send a GuildMember class though

#

dicsord sends an object

opal plank
#

which is the job of the lib to parse it

umbral zealot
#

Right, but, are they actually using the branch of the library that supports slash commands? Because I don't recall that was actually released on master, no?

vernal moth
#
client.channels.cache.get(interaction.channel_id).permissionsFor(interaction.member)```
umbral zealot
#

try interaction.member.id instead

opal plank
#

it asks for a <member>

#

not an id

umbral zealot
#

It's asking for a RESOLVABLE

vernal moth
#

im tryna get if they have ADMIN permissions

umbral zealot
#

which this custom interaction object is not

#

guild member resolvables are usually either a GuildMember object coming from discord.js, or an ID.

opal plank
umbral zealot
#

yes, Erwin, I know how to read the djs docs, I've been using the lib for 4 years

opal plank
#

been using it for 2

vernal moth
#

been using it for 4 months :/

umbral zealot
#

So, actually it doesn't even say it takes IDs at all

opal plank
#

oh it does have a snowflake

umbral zealot
#

yes

#

So, again, interaction.member.id

vernal moth
#

then?

opal plank
#

yeah that should work

vernal moth
umbral zealot
#

just literally add .id

vernal moth
#

oh

#

wait

#

im trying

vernal moth
umbral zealot
#

Are you even sure that member has permissions in that channel

vernal moth
#

I'm the owner

#

in that channel

umbral zealot
#

no I mean specific channel overrides

vernal moth
#

there are no channel overrides

vernal moth
umbral zealot
#

this works fine here

opal plank
#

d.js moment

umbral zealot
#

ok actually hold up

#

obviously

#

smh people not understanding basic object structures and needing to be spoonfed exact code

opal plank
umbral zealot
#

no

#

Erwin

vernal moth
umbral zealot
#

it's not a guildmember

opal plank
#

NOW i now

#

but the lib SHOULD have parsed it

umbral zealot
#

No, it shouldn't

#

This payload does not come from the lib

opal plank
#

how so?

#

they havent shown it afaik

#

im assuming they are on the new branch

umbral zealot
#

It's clearly a raw payload

#

On a branch that's not completely done yet

opal plank
umbral zealot
#

if it were, it would be released already

opal plank
#

wait they havent updated yet?

umbral zealot
vernal moth
#

yeah

#

discord.js still hasn't got updated

vernal moth
#

:/

umbral zealot
#

¯_(ツ)_/¯

#

you wanna go there and fix it for them? lol

opal plank
#

no thanks, already ditched that a while ago lmao

sudden geyser
#

Stage channels have been in Discord.js's master branch for 3 days now

umbral zealot
#

yeah ok but isn't that like for v13 at this point

vernal moth
#

;-;

opal plank
#

i keep telling people, nobody listens

sudden geyser
#

A library ain't gonna implement itself :^)

opal plank
#

doesnt d.js have like 50 contributors?

vernal moth
#

i typed interaction.member and this happened

umbral zealot
#

50? imagine the bickering

opal plank
crimson vapor
umbral zealot
#

Yes, YT. That's an object

opal plank
#

lol

umbral zealot
#

do you know what an object is

vernal moth
#

yes

crimson vapor
#

I thought djs had like fucking 400

umbral zealot
#

do you know how to access the properties of an object?

crimson vapor
opal plank
#

im kinda surprised to see detritus ahead of d.js

umbral zealot
#

Ok good so why are you showing us an object as if you were wondering what it was or expecting some answer from us?

opal plank
#

with that little devs

vernal moth
#

idk why there's no perms list tho

crimson vapor
#

@opal plank imagine using a library with voice support smfh

vernal moth
#

it has a formula

opal plank
#

@crimson vapor also make ur name capital again

umbral zealot
#

ok so completely ignore interactions for a second

#

Like, that object, it doesn't exist

vernal moth
#

okay

opal plank
crimson vapor
#

EZPZ

umbral zealot
#

Imagine you only have your own user ID

#

"454813469892411392"

vernal moth
#

yes

umbral zealot
#

How do you get permissions for a channel with only this information

vernal moth
#

we get the channel info?

umbral zealot
#

are you saying you don't know?

crimson vapor
vernal moth
umbral zealot
opal plank
crimson vapor
#

yeah and drose has no interactions support tbh

opal plank
#

yet again my fav lib shines

crimson vapor
#

:loli_dance:

opal plank
#

for real tho

#

wasnt there a very lightweight lib for discord?

#

snow or something?

#

like

#

im talking REALLY crude barebones stuff

#

more than drose

crimson vapor
#

how can you be supporting detritus and mushoku at the same time

vernal moth
#

hmm

#

every way i try returns "null"

umbral zealot
#

show us the code you have now

cosmic forum
#

Hi, so I'm making an api using nodejs and express, and every time they visit a certain URL, it gives them a json response. Anyone know any services, or method I can use to track the number of requests my api recieves daily?

quaint wasp
#

umm

#

I putted a random thing here

#

But I am not sure what to put exactly

#

Idk the port

opal plank
quaint wasp
#

that it should run at..

opal plank
#

its up to you hoister

quartz kindle
#

where are you hosting?

opal plank
#

you could run it at 9999 if you want to