#development

1 messages ยท Page 1497 of 1

halcyon kite
#

even if

#

let no = db.fetch(`haha_${message.author.id}`)
if(no === 1) return message.channel.send("ok uhhhh submit ur quest in order to get here boi!")

#

is on and you have 1

#

of the thing

#

ill just say that]

earnest phoenix
#

Why would the db part restrict

halcyon kite
#

bc its checking

earnest phoenix
#

The command

halcyon kite
#

bc its checking if you have 1 of the db.fetch number

#

basicly 1

#

if you have 1

#

then u cant use that command

#

hmmmm

#

wait

earnest phoenix
#

Hm idk

halcyon kite
#

nvm that did not work

low skiff
#

Does anyone know why my redirect url for my bot is not working? I am trying to make the oauth2 redirect to my website once the bot has been added to the server instead of the confirmation page, but instead nothing happens.

halcyon kite
#

wait there is another way

#

hmmm

#

its gonna be harder to code tho

#

sad

halcyon kite
#

and all it is

drifting wedge
#

whats the name for the css thing when something is clicked but not hled

halcyon kite
#

so confused

drifting wedge
#

like if a textbox is selected

halcyon kite
#

i dont get it why does it keep adding 7880

#

to the number

#

send help fast

dire wave
#

i installed the module and received this error
Error: Cannot find module '@top-gg/sdk'

#

not sure what to do

drifting wedge
#

nah but whatever

#

i removed it

lost isle
#

hi

#

how do i remove

#

undefined

#

@earnest phoenix

#

??

#

ok

hidden lynx
#

\u200b

lost isle
#

@hidden lynx i dont understand

#

is it possible to type there

#

is there a way put text in undefined

earnest phoenix
#

.addField("text", "") ._.

silver lintel
#

no

#

because wouldnt there be an error saying embed fields cant be empty

lost isle
#

i got an error

rose fulcrum
#

do you have a youtube api to get information about the video?

silver lintel
#

how else are you supposed to do it

pearl trail
#

add \u200b

solemn latch
#

or if you want it to say something, put text there

pearl trail
#

.addField('\u200b', 'Text here')

craggy pine
#

Question: How would this be written when 0 stars are clicked to do the hover effect too all of the stars?
I have the css for each star depending on what rating is checked, but not when the page is loaded and 0 is selected by default

.comment-stars-parent[data-stars="1"] .selectable:nth-child(-n+1) svg .svg-star:hover {
    fill: white;
    cursor: pointer;
    stroke: #d78088; !important;
    stroke-width: 1px !important; 
    transition: 0.3s !important;
}

https://scs.twilightgamez.net/g/r8sfD.gif

crystal wigeon
#

hey guys

#

umm quick question

#

so, my bot approved, but i still dont see a tick on it

solemn latch
#

top.gg has nothing to do with discord verification.

crystal wigeon
#

i see, so whats the game here? how do i get that? and the developer badge ofc

#

btw i forgot what im supposed to do to give rewards to my bot voters

#

dlb something?

solemn latch
#

developer badge is no longer possible to get, discord doesnt allow anyone to get it.

crystal wigeon
#

;-;

#

sed

solemn latch
#

rewards for votes can be anything you want as long as #rules-and-info isnt broken.

crystal wigeon
#

i know that

#

but how do i get the event?

#

i mean how do i know someone voted

#

i checked the rules before for that

solemn latch
crystal wigeon
#

thanks!!

#

but i really wanted the badge xD oof

solemn latch
#

discord doesnt give it anymore, too many people made bots just to get it.

#

which ruins the point of it.

twilit dagger
#

lol

crystal wigeon
#

(im one of those people)

#

but my bot is like an RPG so xD

misty sigil
#

congrats. you're annoying as fuck!

cinder stratus
#

some tips to sclale up my discord bot it's written in djs and I'm having hard time

misty sigil
#

how far are you scaling @cinder stratus

cinder stratus
misty sigil
#

how far are you scaling?

earnest phoenix
#

how far do you want to expand that shit

misty sigil
#

thats literally a simple question

earnest phoenix
#

@crystal wigeon are you coding with python or js?

stark abyss
#

since he using djs i would guess js

misty sigil
#

they're replying

#

to a different message

stark abyss
#

oh

earnest phoenix
#

nah hes emulating djs in a py engine @stark abyss

misty sigil
#

@cinder stratus how much servers

#

are you scaling for

stark abyss
#

I should just shut up. Sorry. Continue.

cinder stratus
#

2.3K sounds funny but it's true

earnest phoenix
#

I need help too simp

misty sigil
#

2.3k

#

you need to shard.

cinder stratus
#

I'm already sharding

misty sigil
#

ah. i see.

cinder stratus
#

using Kurasuta

earnest phoenix
#

then just make shard count bigger

misty sigil
#

there shouldn't really be any scaling necessary

#

apart from changing shard count from 2 to 3

#

or somethin like that

cinder stratus
#

mine is one

#

2500 Guilds per shard

misty sigil
#

no.

#

1000/shard

cinder stratus
#

Hmm I was using that earlier

#

but same issue

misty sigil
#

use 3 shards

cinder stratus
#

Hmm okay

misty sigil
#

that should be as much scaling as you need rn

cinder stratus
#

But my responds after 10 seconds

misty sigil
#

where is your bot hosted

cinder stratus
#

Azure

misty sigil
#

what specs

cinder stratus
#

4gb ram 2cpu

misty sigil
#

where is it located?

cinder stratus
#

us east

misty sigil
#

huh weird

#

is ram or cpu being fully utilised?

cinder stratus
#

but once I switched the code of my Bot with my friends one and my bot was working really fast with sharding

cinder stratus
delicate shore
#

Hey there

#
fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
    .then(res => res.buffer())

Will this return me a buffer ?
using node-fetch

cinder stratus
#

currently I'm using my friends code for my bot

misty sigil
#

tias

#

@cinder stratus does it still run the same bot?

cinder stratus
#

yeah it's same bot but different code

misty sigil
#

you could use that code

delicate shore
misty sigil
#

yes

#

try it and see

delicate shore
#

Ok

cinder stratus
misty sigil
#

the code that works

cinder stratus
#

both of the code is fine but mine one is making the Bot slow like very slow

misty sigil
#

you could just use the fast code

#

and develop on that

cinder stratus
#

I just made some changes in the new code using some code from the previous code and it made the new code also slow

#

idk what's really the issue

#

with my code

misty sigil
#

what changes did you make

cinder stratus
#

like I added some functions in my client file like log and fetch command and use those in my message event added a mention Prefix feature so you could mention the Bot and use the command, added Owner only boolean value in commands and small things like that

earnest phoenix
#

๐Ÿ˜ญ

misty sigil
#

i don't know

#

maybe the fetch command might've done that

cinder stratus
#

no it's just commands.get

misty sigil
#

do some debugging

delicate shore
#

Hey @quartz kindle
It doesn't allow buffer either
(node:8521) UnhandledPromiseRejectionWarning: Error: pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was Buffer

misty sigil
#

console.log shit

#

and see what happens

#

are you trying to canvas @delicate shore

delicate shore
#

idk wtf i am doing

misty sigil
#

what?

earnest phoenix
#
import discord
from discord.ext import commands
from discord import Embed, File, DMChannel

intents = discord.Intents.all()
client = commands.Bot(command_prefix = '!', intents = intents)
guilds = client.get_guild


    
@client.event
async def on_ready():
  print("The bot started!")





client.run("")
#

this is the bot i sumbitted ๐Ÿ˜

misty sigil
#

what are you doing @delicate shore

earnest phoenix
#

and

#

ugh

#

idk if this gonna get approved

misty sigil
#

its not

delicate shore
misty sigil
#

if its literally useless

crystal wigeon
#

lol

delicate shore
#

in discord

solemn latch
#

bots need a function to be accepted

earnest phoenix
#

It does function

#

It says

delicate shore
#

umm

#

wtf

earnest phoenix
#

oh wait

solemn latch
#

a function bot reviewers can see

opal plank
earnest phoenix
#

It does

opal plank
#

it doesnt

earnest phoenix
#

okay

crystal wigeon
#

yeah

earnest phoenix
#

okay

#

so I need a command?

#

bett

fervent hornet
#

You need it to be useful.

delicate shore
#

How can I turn the attachment into something out of the following things

opal plank
#

that code you sent does nothing but tell you in console "The Bot started"

solemn latch
#

doesnt have to be a command, it just needs to do something

crystal wigeon
#

hey woo, it says dblapi.js has deprecated

solemn latch
#

yeah

opal plank
#

use the new node-sdk

crystal wigeon
#

yeah

fervent hornet
#

Creating a Discord bot doesn't start with it being on top.gg

crystal wigeon
#

node-sdk?

opal plank
#

^^

#

yes

crystal wigeon
#

for votes?

earnest phoenix
#

it does somethign tho

#

๐Ÿ˜

#

lemmee make a commmand rq

opal plank
solemn latch
#

we bot reviewers cant see that @earnest phoenix

earnest phoenix
#

Alright

delicate shore
#

Ok so I will wait till this query is finished because my question is a damn long one

earnest phoenix
#

lemem

#

ugh

#

do it better i guess

fervent hornet
#

Creating a bot doesn't start with it being on top.gg.

opal plank
#

^^

solemn latch
#

^

dusky sundial
#

Make the bot fairly useful, upload it to top.gg when you think people would want to add it to their server

fervent hornet
#

Create a bot, finish it, polish it, then submit it.

crystal wigeon
#

ahh

fervent hornet
#

Don't just quickly try to create a bot to be on top.gg.

crystal wigeon
#

thanks a lot!!

opal plank
earnest phoenix
#

guys

#

is this better?

crystal wigeon
#

any weebs wanna try rpg bot? xD (jk not advertising)

fervent hornet
#

Token leak

earnest phoenix
#

oops

#

I leaked

#

my token

#

time to reset

crystal wigeon
#

i saw

#

that

solemn latch
#

lol

opal plank
#

reset it

fervent hornet
#

We aren't going to help you build your bot.

crystal wigeon
#

your token gone

opal plank
#

reset that token rn

#

people might have message loggers here

fervent hornet
#

Don't create a bot just for it to be on top.gg. Find something you're actually interested in, and then create it.

dusky sundial
#

One command won't be enough to deem it "useful" I don't think.

crystal wigeon
#

yes im firing my botnets

fervent hornet
#

It looks like you're trying to get on top.gg.

#

Not create a bot for the sake of creating one.

earnest phoenix
#

yeah

#

cause i need to

crystal wigeon
#

simp you gonna be flooded (hentai reference)

earnest phoenix
#

unless it won't work

fervent hornet
#

You don't create a bot just to have it on top.gg.

#

I keep telling you.

crystal wigeon
#

yeah

fervent hornet
#

Think of an idea.

earnest phoenix
#

it does

fervent hornet
#

An idea that hasn't been done before.

crystal wigeon
#

cmon man i wanted that discord bot dev badge

earnest phoenix
#

or I can't test webhook

fervent hornet
#

Then code to it.

earnest phoenix
#

I am

#

but I can't

opal plank
earnest phoenix
#

unless it's on topgg

fervent hornet
#

Why?

dusky sundial
#

The bot shouldn't rely on being on top.gg

delicate shore
fervent hornet
#

No bot has to be on top.gg to be coded lol

opal plank
#

for votes

fervent hornet
#

The API comes after you're aproved.

#

First finish your bot

earnest phoenix
#

I can't

solemn latch
#

top.gg webhooks shouldnt be the main feature of your bot.

earnest phoenix
#

I gotta test out the votes ๐Ÿ˜ญ

crystal wigeon
#

yeah

fervent hornet
#

You can push an update once it's approved.

solemn latch
#

your bot cant be approved if it is.

fervent hornet
opal plank
#

you cant upload a bot to be approved that does nothing

earnest phoenix
#

wym?

fervent hornet
#

Create your bot.

opal plank
#

like

fervent hornet
#

Make it work.

earnest phoenix
#

Bro

#

like

opal plank
#

"oh, approve my bot, it cant work until you guys aprove it so i can use ur API"

earnest phoenix
#

I won't be able to make the bot, unless I know what I can test it blob_eyeROLLL

#

isn't programmming trial and error

#

like

opal plank
#

and that wont work

earnest phoenix
#

How am I suppose to know if it works or not ๐Ÿ˜ญ

misty sigil
#

woo made me sad

fervent hornet
#

For the millionth time, the top.gg API isn't essential.

crystal wigeon
#

next thing i need to learn is sharding

earnest phoenix
#

So

opal plank
#

you simply cant do it the way you want

fervent hornet
#

You don't need your bot to have voting webhooks.

#

Create your bot.

opal plank
#

to get approved you need to have your bot do SOMETHING first

fervent hornet
#

Then focus on the API once it's approved. But first create the bot.

earnest phoenix
#

So

#

I should

opal plank
#

if you bot CANT work without the api, it wont even get approved

fervent hornet
#

Implimenting the API comes later on.

earnest phoenix
#

so I gotta use requests?

fervent hornet
#

Oh my god

misty sigil
#

no

earnest phoenix
#

dang

opal plank
#

you're asking them to approve a bot that does absolutely nothing

fervent hornet
#

You aren't getting the point.

#

Use the API AFTER YOU'VE FINISHED THE BOT

#

You don't need a voting API until your bot is on top.gg.

#

You can push an update once it's on top.gg.

dusky sundial
#

A bot who's main purpose is to use the voting webhook is not a good bot. Have it do something other than using the top.gg API

fervent hornet
#

No bot requires the top.gg API to function lol

earnest phoenix
#

I mean

misty sigil
#

one of my bot's main purpose is to use the voting webhooks

earnest phoenix
#

Honestly, I was making it for my server

#

and just to practice too

#

working with apis

solemn latch
#

private bots shouldnt be listed on top.gg

fervent hornet
#

If it's just for your server, you shouldn't put it on a bot list.

delicate shore
#

I am trying to use https://npmjs.org/package/nsfwjs with Discord
I get the Image URL using attachment
But I can't directly use it
I need it to be either of these -
HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}
So how Can I use any one of these
Please help Thanks in advance

misty sigil
opal plank
#

what is it even going to do after you get the API working?

have a command that says if you voted or not? thats it? Vote api is just for votes, it isnt something useful for the user

earnest phoenix
#

It's just for testing

#

but

#

ugh

#

@opal plank I was gonna

opal plank
#

all 3 of us are telling you, it wont work the way you are going at right now

misty sigil
fervent hornet
#

Exactly.

misty sigil
#

for server webhooks

earnest phoenix
#

make it say if someone voted

#

create a leadebroard

#

then

misty sigil
#

if thats what you're aiming for

opal plank
#

you need something BEFORE it gets approved

fervent hornet
#

You don't need that on a private bot.

#

You also don't need that before it's approved.

#

For the billionth time. Add that feature after it's approved.

earnest phoenix
#

I'm just trying to make a voting bot tho ๐Ÿ˜ญ

opal plank
#

the point of being in topgg is to be used in other servers, private bots, as i mentioned, SHOULD NOT BE ADDED ON TOP.GG

fervent hornet
fervent hornet
#

Then what's it for?

fervent hornet
#

If it has any other purpose, code the commands first.

misty sigil
#

no?

earnest phoenix
#

but they don't work well

#

yea

dusky sundial
#

I think you know by now that your bot won't get approved unless it actually does something without the API

fervent hornet
#

Bots that post messages when other people vote don't require an API key.

earnest phoenix
fervent hornet
#

Yep

misty sigil
#

bEO

#

THATS MINE

fervent hornet
#

Doesn't require API.

misty sigil
#

THATS FUCKING MINE

earnest phoenix
#

THAT"'S YOURS

#

?

#

WTF

#

NO WAY

misty sigil
#

ITS MINE

fervent hornet
#

Basically

earnest phoenix
#

BRO

fervent hornet
#

You tell them to set a URL.

earnest phoenix
#

ARE YOU SERIOUS?

fervent hornet
#

And auth

misty sigil
#

YES

fervent hornet
#

And code the webhook.

misty sigil
#

IM 100% SERIOUS

fervent hornet
#

You don't need anything else.

earnest phoenix
#

NO WAY

fervent hornet
#

It's not hard lol

earnest phoenix
#

BRO

#

WHAT

#

I used it

opal plank
#

your best option is get some basic commands working and some basic functions. like !avatar, !help, !meme or some random shit like that to get it approved, THEN you can test it @earnest phoenix

earnest phoenix
#

and I got like

misty sigil
#

need help with it?

earnest phoenix
#

rank 4 or sum on your website

#

lol

misty sigil
#

oh lol

earnest phoenix
#

It's not big

#

but

#

it works

#

but it could use a lot of stuff

misty sigil
#

yea i know

earnest phoenix
#

logo is ugly ๐Ÿ˜ญ

misty sigil
#

i know

fervent hornet
#

@earnest phoenix You don't need an API key for that.

misty sigil
#

but it works

earnest phoenix
#

Yea

fervent hornet
#

You tell users to set a webhook URL that you manage.

fervent hornet
#

And an auth key you generate.

#

And then it'll send a POST request to your API.

#

You then find the auth token

earnest phoenix
#

i have no idea how to do that ๐Ÿ˜ญ

fervent hornet
#

Check the DB

misty sigil
#

damn this sounds too much like my bot

fervent hornet
#

@earnest phoenix The API wouldn't help with that lol

opal plank
#

wait what the heck?

earnest phoenix
fervent hornet
#

You basically create an API.

opal plank
#

that bot doesnt ask for ANY permission?

fervent hornet
#

Yourself

#

The API has nothing to do with checking other peoples votes.

solemn latch
#

bots who ask for perms, ew ;p

fervent hornet
#

What you do is you create an API.

opal plank
fervent hornet
#

So learn Flask.

earnest phoenix
#

Oh

#

I was doing that earlier

#

lol

fervent hornet
#

Then from there, give users a token.

earnest phoenix
#

token?

fervent hornet
#

Tell them to set the voting webhook to that

earnest phoenix
#

wym?

#

can you give me an example?

fervent hornet
#

Tell them to set the URL to your API, and the auth token

#

I'm not giving you the code.

earnest phoenix
#

noo

#

lmaoo

fervent hornet
#

This is just how you'd do it.

#

It's not too difficult lol

#

Just learn Flask

#

And learn pymongo

#

Then ddone

earnest phoenix
#

igj

#

ugh

fervent hornet
#

The API has nothing to do with this lol

earnest phoenix
#

Ima spam ping you when you need help

#

hold up

fervent hornet
#

Please don't spam ping me lol

solemn latch
#

please dont spam ping anyone, or ping anyone without their permission really.

earnest phoenix
#

when I nee help*

fervent hornet
#

Here's a basic flow of how it would work no code lol:

User runs a command like -link {ping bot}

You create an auth token for them in a DB.

Tell them to set the webhook URL for votes to that, and the auth to the auth token.

Then tell them to click on "test". If you get a request sent, confirm everything.

All the data you store under them like role to add should be under that auth token, as it would be unique to the bot.

When someone votes, find the auth token, then search the DB for the channel to send the message in from that auth token.

Send the message.

#

There are tons of bots that do this already, if you think this is too complicated, maybe try another idea?

I honestly suck at Flask (like can't do a single line), so I can't really help you lol

delicate shore
#

I am trying to use https://npmjs.org/package/nsfwjs with Discord
I get the Image URL using attachment
But I can't directly use it
I need it to be either of these -
HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}
So how Can I use any one of these
Please help Thanks in advance

umbral zealot
#

I do believe ImageData or the Uint32Array would be something you get from Discord

#

though you might have to convert it as it start off as a buffer

delicate shore
#

how can I

umbral zealot
#

Since you're server side the first thing to do is to fetch() the image itself

delicate shore
#

ok

umbral zealot
#

then figure out how to convert the return of that fetch operation to the format you want

delicate shore
#

I tried

#

that's what I couldn't

vale garden
#

hi

#
@staticmethod
def user_join(access_token, userr):

    #user_json = Oauth.get_user_json(access_token)

    url = Oauth.discord_api_url + f"/guilds/768019392596017164/members/{userr}"

    headers = {
      "Authorization": "Bot {}" .format(access_token)
    }

    user_object = requests.get(url = url, headers = headers)
    user_json = user_object.json()

    return user_json
#

shouldnt this function work?

#

for joining a user to a server

#

on oauth2

delicate shore
#

didnt work either

umbral zealot
#

you don't need Canvas

solemn latch
#

they have a nodejs example with urls.

delicate shore
#

Yes

solemn latch
#

they have an express and an axios example

delicate shore
#

Ohhh

#

I need to make a web server

#

Alright

solemn latch
#

well, the express example is receiving the image via a request

crimson vapor
#

no you don't

delicate shore
#
const axios = require('axios') //you can use any http client
const tf = require('@tensorflow/tfjs-node')
const nsfw = require('nsfwjs')
async function fn() {
  const pic = await axios.get(`link-to-picture`, {
    responseType: 'arraybuffer',
  })
  const model = await nsfw.load() // To load a local model, nsfw.load('file://./path/to/model/')
  // Image must be in tf.tensor3d format
  // you can convert image to tf.tensor3d with tf.node.decodeImage(Uint8Array,channels)
  const image = await tf.node.decodeImage(pic.data,3)
  const predictions = await model.classify(image)
  image.dispose() // Tensor memory must be managed explicitly (it is not sufficient to let a tf.Tensor go out of scope for its memory to be released).
  console.log(predictions)
}
fn()```
crimson vapor
#

that is what you need

solemn latch
#

the axios example is fetching

#

not a webserver

crimson vapor
#

should be simple enough to just change to node-fetch

delicate shore
#

Ok

crimson vapor
#

which comes with d.js

delicate shore
#

But do I get img as img variable

#

oh wait

#

nvm

crimson vapor
#

wdym?

delicate shore
#

Thanks

vale garden
#

yo can someone help me

delicate shore
#

nothing

vale garden
#

plz

delicate shore
#

no

crimson vapor
#

whats your issue?

delicate shore
vale garden
#

stop linking that all the time

#

i literally asked the question above

solemn latch
#

where ๐Ÿค”

crimson vapor
#

above

#

in py

vale garden
#

here

#

lol

#

ye

delicate shore
#

Hey there

#

@solemn latch Thanks for help

solemn latch
#

npnp

delicate shore
#
[
  { className: 'Neutral', probability: 0.9698688387870789 },
  { className: 'Porn', probability: 0.015575909987092018 },
  { className: 'Drawing', probability: 0.009302130900323391 },
  { className: 'Hentai', probability: 0.003626859514042735 },
  { className: 'Sexy', probability: 0.00162628130055964 }
]
#

It logs this

#

Now

solemn latch
#

'Sexy', probability: 0.00162628130055964 how did you get an image of me

delicate shore
pale vessel
#

๐Ÿ˜ณ

gilded olive
#

aiohttp

vale garden
#

then what do i use

#

lol

#

but anyways shouldnt that work

#

@gilded olive

pale vessel
#

but blocking best

delicate shore
#

ok so I have a question

#

Promise is a collection of objects

#
  { className: 'Neutral', probability: 0.9698688387870789 },
  { className: 'Porn', probability: 0.015575909987092018 },
  { className: 'Drawing', probability: 0.009302130900323391 },
  { className: 'Hentai', probability: 0.003626859514042735 },
  { className: 'Sexy', probability: 0.00162628130055964 }
]```
pale vessel
#

that's an array

delicate shore
#

oh

#

i didn't notice the []

#

dumb me

#

thanks

grizzled raven
#

with using aggregation in mongoose, what's the best way to add up values from each document (a document like { stat: 57 } - add together stat from every document)

#

aggregate returns something like [ { stat: 61 }, { stat: 96 }, // ... ]

lucid owl
#

which library shud i use for guild_create feature?

#

someone help!

lyric mountain
#

What?

#

Like, there's no lib for only that feature

#

You'll use fully featured libs, like djs, dpy or jda

earnest phoenix
#

help

lyric mountain
#

With?

earnest phoenix
lucid owl
earnest phoenix
lucid owl
earnest phoenix
#

what language

lucid owl
#

discord.js

#

js basically

mellow kelp
#

Ah yes

#

Well

#

Wdym by guild_create?

lucid owl
#

i mean

lyric mountain
#

Wrong path

mellow kelp
#

I think you want the guildCreate event

lucid owl
earnest phoenix
lyric mountain
#

Idk, where you're calling that path

lucid owl
#

@lyric mountain can u help?

earnest phoenix
mellow kelp
lucid owl
mellow kelp
#

Um

lucid owl
lyric mountain
mellow kelp
#

Just like any other event

lucid owl
lyric mountain
#

Read second line of the error for the path

#

Your doing scandir at that path

#

And it doesn't exist

earnest phoenix
#

it doesnt say any file in where should i change

mellow kelp
earnest phoenix
# lucid owl i m new to this stuff
bot.on("guildCreate", guild => {
  
let defaultChannel = "";
guild.channels.cache.forEach((channel) => {
  if(channel.type == "text" && defaultChannel == "") {
    if(channel.permissionsFor(guild.me).has("SEND_MESSAGES")) {
      defaultChannel = channel;
    }
  }
})
//defaultChannel will be the channel object that the bot first finds permissions for
defaultChannel.send('Hello, Im a Bot!')
    
   
});```
mellow kelp
#

Why

lucid owl
#

thnx

mellow kelp
#

You just spoonfed

lyric mountain
lyric mountain
mellow kelp
#

Wait yes

earnest phoenix
vale garden
#

hi

#
@staticmethod
def user_join(access_token, userr):

    #user_json = Oauth.get_user_json(access_token)

    url = Oauth.discord_api_url + f"/guilds/768019392596017164/members/{userr}"

    headers = {
      "Authorization": "Bot {}" .format(access_token)
    }

    user_object = requests.get(url = url, headers = headers)
    user_json = user_object.json()

    return user_json
mellow kelp
#

My bad KEKW

vale garden
#

is there anything wrong in this

mellow kelp
#

Cellphone sucks

lyric mountain
#

Yes, find hotkey

vale garden
#

{'message': '401: Unauthorized', 'code': 0} im getting this error

lyric mountain
#

Yes, you can't access it

vale garden
#

does anyone know why that is

earnest phoenix
lyric mountain
#

Probably

mellow kelp
#

Maybe the token isnt being formatted

mellow kelp
#

I mean the authorization

lyric mountain
#

Package.json is not code

earnest phoenix
vale garden
earnest phoenix
#

E

lyric mountain
vale garden
#

its supposed to be correct ig

lyric mountain
#

Egg

vale garden
#

you have to use Bot: for guilds.join right?

lyric mountain
#

Is that code yours?

vale garden
#

yea

earnest phoenix
#

How to access to Discord API ?

vale garden
#

wht

mellow kelp
#

What do you mean

earnest phoenix
vale garden
#

lol

earnest phoenix
#

I am a beginner and I want to learn JavaScript but the problem I can't because I don't know how does anyone have any online course for JavaScript

vale garden
#

yo @lyric mountain

#

you have to use Bot: for guilds.join right?

#

lol

lyric mountain
#

Or u copypasted?

earnest phoenix
lyric mountain
mellow kelp
#

Doubt

earnest phoenix
#

it appears when i run the bot

lyric mountain
#

You'd know where you're using it

pale vessel
#

I learned js by making bots

#

somehow worked for me

mellow kelp
#

Did you have coding experience before?

earnest phoenix
pale vessel
#

Not really, all I knew was php lmao

mellow kelp
#

Ah yes

#

Php

pale vessel
#

Never done vanilla js either

lyric mountain
#

Like, it's ok if u manage to start with bots, but 99.9999NaN% can't get the fundamentals tgat way

pale vessel
lyric mountain
#

They become lost af

mellow kelp
#

Most bot tutorials show bad or old practices

#

Some even use var

vale garden
#

same

lyric mountain
#

Dot dot dot

amber thistle
#
<html>
<embed type="text/html" src="https://islabot.tk" width="500" height="200">
</html>

i added this but nothing has changed

lyric mountain
#

Oh my

#

Where do I start?

#

Nvm, I'll leave those 3 issues to the other dudes

lucid owl
pale vessel
#

...embed?

#

is that a real tag

#

Oh it is

lucid owl
pale vessel
#

You should use <iframe>

pale vessel
crystal wigeon
#

idk how i learnt js, i just learnt ;-;

#

casually

#

it became something you learn as a baby

stuck pike
#
module.exports = {
  name: "color",
  description: "info",

  async run (client, message, args){


    let color = args.join(" ");
    if(!color) return message.channel.send('Command code to get the color role, use -colorlist for colorlist')
const user = message.author




    if(color=== 'c1' || 'C1'){
      
      let role = message.guild.roles.cache.find(role => role.name  === 'Cyan')
     message.author.roles.add(role.id)
message.channel.send('Done')
    }


pale vessel
#

message.author is a User

#

You can't add roles to a User

#

Also, you defined user but you never used it

#

and use message.member instead since you need a Member, not a User

pearl trail
#

it's a path but why it think that it's a module

#

Id? phmm

jaunty trout
#

The stroke

pearl trail
#

stroke?

pale vessel
#

sorry

#

my fucking pc just

pearl trail
ivory seal
pale vessel
#

@pearl trail try __dirname + "/../../handlers/nessageHandler"

ivory seal
#

isn't error 500 a internal server error?

pearl trail
pale vessel
#

yes

ivory seal
#

wait is something wrong with discord api?

autumn bolt
#

Ello

pearl trail
#

or is it wrong thonk

pale vessel
sacred trout
#

hello

#

how can i check if the member is kicked or not?

#

like my bot sends the kick message even if the user is not kicked so please hgelp

#

help

#

@pale vessel you there?

pale vessel
#

check if the member is in the cache

sacred trout
#

bruh

pale vessel
#

bruh

sacred trout
#

how tho i kinda sucl

#

@kick.check async def kick_check(ctx,kick): if discord.Member in ctx.guild: await ctx.send("loal")

#

i tried this

pale vessel
#

try ctx.guild.members

#

never mind

#

no

sacred trout
#

klol

#

lol

pearl trail
#

@pale vessel oohh yes, thanks for helping me. the problem is all about capitalization Champ

pale vessel
#

discord.Member is a class is it not

sacred trout
#

umm

pale vessel
#

where do you get the member to kick

#

can you show your kick code

sacred trout
#

@client.command() @commands.has_permissions(kick_members=True) async def kick( ctx,member: discord.Member,*, reason=None): try: embed = discord.Embed(title=f"User Kicked!",colour=discord.Colour.green()) embed.set_thumbnail(url=member.avatar_url) embed.add_field(name="**user Kicked**",value=f"**{member}**", inline=False) embed.add_field(name="**Kicked by**" ,value=f"**{ctx.author}**", inline=False) embed.add_field(name="**Reason:**",value=f"**{reason}**", inline=False) await ctx.send(embed=embed) await member.send(embed=embed) except: pass await member.kick(reason=reason)

#
@commands.has_permissions(kick_members=True)
async def kick( ctx,member: discord.Member,*, reason=None):
    try:
        embed = discord.Embed(title=f"User Kicked!",colour=discord.Colour.green())
        embed.set_thumbnail(url=member.avatar_url)
        embed.add_field(name="**user Kicked**",value=f"**{member}**", inline=False)
        embed.add_field(name="**Kicked by**" ,value=f"**{ctx.author}**", inline=False)
        embed.add_field(name="**Reason:**",value=f"**{reason}**", inline=False)         
        await ctx.send(embed=embed)
        await member.send(embed=embed)
    except:
        pass
    await member.kick(reason=reason)```
pearl trail
pale vessel
sacred trout
#

@pale vessel ?

pearl trail
sacred trout
#

talking to yourself be like

sacred trout
#

plox someone help

terse berry
#

Hello, so I have made per server prefix for my bot with mongodb, and it works perfectly, I have one problem though.

#

I connect to mongodb on the ready event, and in the message event, I've done

const data = await prefix.findOne({
        GuildID: message.guild.id,
    });

and then I check if data exists, and if it does, then it uses the database prefix, but if not, then it uses the defaultprefix

#

This sometimes takes a lot of time for the bot to send the message, the response time has become too slow

#

any help with this?

#

How can I lower the response time

cinder patio
#

Start caching the data you receive from the database

opal plank
#

^^^^^

cinder patio
#

fetching a guild object every time a message is sent is obviously going to slow your bot down

cinder patio
#

for example:

const guildCache = new Map();

// When you want to get the guild:
let guildObject;
if (guildCache.has(guildId)) guildObject = guildCache.get(guildId);
else {
  guildObject = fetchGuildFromDb();
  guildCache.set(guildID, guildObject);
}
#

use a map to store guild objects so you get them from memory

terse berry
#

hmm

#

Ok I'll try

#

Thx

#

@cinder patio and what would I do in the if(data) line? where it directly checks if the prefix is in the db

cinder patio
#

if the prefix is in the db, put it in the map so you don't get it from the database again

#

btw, when you update the guild data in the database, you will also have to update them in the map

terse berry
#

hmm

terse berry
cinder patio
#

Well, you store the guild objects in the database, and you put the guild ID as the key

#

map.get(guildId) this is how you get a guild object

terse berry
#

Ok I did that

cinder patio
#

You get the guild object from the map and set the prefix

#

but first make sure it's in the map

silver lintel
#

how to generate an invite link of the server in djs?

terse berry
cinder patio
#

you should probably attach the map to your discord client

terse berry
#

oof this is confusing

earnest phoenix
#

let conversion = Number(amount)/100; i am trying to convert 100point to 1coin. I want to prevent user from giving decimal number and less than hundred

#

hi hi

#

I'm attempting to make my own bot

#

and get topgg recieve something to my webhook

#

can anyone help

#

I'm using python flask to host the webhook

earnest phoenix
sacred aurora
#
if(Number(amount) % 1 == 0 && Number(amount) > 100){
  /// code here
}else{
  /// code here
}
#

try that

earnest phoenix
#

kk

sacred aurora
#

store the Number(amount) as variable so its more simple

#

eh wait :v

earnest phoenix
#
               let conversion =  Number(amount)/100;
                await Promise.all([
                   memberSchemaDB.updateOne(```
#

1 coins = 100point

tribal siren
#

how to get a member's custom status?

sacred aurora
#
let total = Number(amount);
if(total % 1 == 0 && total >= 100){
  if(data.bankbalance > 0 && amount <= data.bankbalance){
    let conversion =  total/100;
    await Promise.all([
      memberSchemaDB.updateOne(
         .........
}else{
  message.reply('The provided amount is a decimal or your balance is not enough');
}
earnest phoenix
#

thnaks

tribal siren
#

i meant javascript

earnest phoenix
#

i used switch base

#

for (const activity of member.presence.activities.values())

#

activity.state

#

will return you custom status of user @tribal siren

tribal siren
#

so it's activity.state right?

earnest phoenix
#

right

tribal siren
#

aight let's test

earnest phoenix
#

dude wait

#
for (const activity of member.presence.activities.values()) {
              switch (activity.type) {
   case 'CUSTOM_STATUS':
                  customStatus = activity.state;
                  break;
              }
}

//Your embed - **customStatus** : customStatus ```
#

@tribal siren

tribal siren
#

is that javascript

#

cause it looks like it isn't

earnest phoenix
earnest phoenix
craggy pine
#

It is JS.

tribal siren
#

ok let's try

earnest phoenix
tribal siren
#

ey it worked

#

thanks

#

now last question

#

how to get the emoji?

sacred aurora
#

yea sure

peak cosmos
#

I think this is the right channel

#

Can anyone help

earnest phoenix
#

/opt/watcher/app-types/node/start.sh: line 30: wait_for: No record of process 19509
I got a error like this in my glitch project

tight plinth
#

so i installed node 15 and updated my discord.js version to the latest one in the git repo (the one with GuildMember#pending) and i get this error in pm2, any reason why?

#

node . works fine tho

#

node -v returns 15.5.0, aka the one i installed

earnest phoenix
#

someone was bugging me begging me to tell them how to do a command and they really pissed me off so i spoonfed them

but the code i gave them is purposely full of errors, that should keep them entertained for a few hours KEK

silver lintel
#

is sharp image manip any good?

pale vessel
#

Yes

#

It's faster than canvas

#

but I think it lacks some features

silver lintel
#

hmm what does it lack

#

jimp or sharp?

pale vessel
#

Jimp has a bad font support, it only supports bitmap fonts and it's relatively slow since it's vanilla js

#

I've never used sharp before but I think it doesn't have text manipulation

silver lintel
#

oof

tight plinth
#

fixed

#

now yes

digital kiln
#

ok

tight plinth
#

just had some problems wish shitty pm2, reinstalling it completely fixed it

digital kiln
#

ok good

earnest phoenix
#

can anyone help me simp

near stratus
earnest phoenix
#

Alright

#

so I just made ugh

#

a webhoook

#

I don't know if it works

near stratus
#

k

earnest phoenix
#

and I'm trying to connect it with topgg

#

idk how to tho

#

I'm new

near stratus
#

Which webhook ?
Top or Discord

#

nvm

earnest phoenix
#

does this mean it's working?

near stratus
#

probably

earnest phoenix
#

the webhook

near stratus
#

If the server is up that means it's working
but to see if it's functioning or not you'll have to check it

earnest phoenix
near stratus
#

Now try making a request with curl or something

earnest phoenix
#

How do i do that?

near stratus
#

hold on a second

earnest phoenix
#

idk even know what curl is ๐Ÿ˜ญ

near stratus
#

curl -d "name=Poop&password=lololol" http://localhost:8080/api/login/
like this ๐Ÿ”ผ

earnest phoenix
#

what is that?

#

is that js?

near stratus
#

a cURL post request

#

In your terminal

#

no codework needed

#

install curl with sudo apt then do that

earnest phoenix
#

It doesn't let me

#

๐Ÿ˜ฆ

#

I'm on windows btw ๐Ÿ˜

near stratus
#

bruh

#

Then just write a code to make a POST request

earnest phoenix
#

I don't know what htat means

#

๐Ÿ‘๏ธ๐Ÿ‘๏ธ

#

๐Ÿ˜

#

like

#

what happens after the request?

marble juniper
#

u get the response

#

kek

molten yarrow
near stratus
#
import requests
url = 'https://hsgsgsgdhdgg.hj/webhook'
llo = {'poop': 'isGood'}

requests.post(url, data = llo)
#

do this @earnest phoenix

earnest phoenix
#

"poop: "isgood"

#

ok

near stratus
#

just put your URL there

earnest phoenix
#

Can you tell me what that does

#

like if I understood

near stratus
#

it makes a POST request

earnest phoenix
#

Ugh

#

can you like explain it in a simpler term?

near stratus
earnest phoenix
#

I thought

near stratus
#

See your line 7

earnest phoenix
#

i was making a webhook

#

that recieves request

near stratus
#

Requests are 2 type

#

GET and POST

earnest phoenix
#

uhuh

near stratus
#

GET is literally public
POST is more secure
So we use POST for webhooks

earnest phoenix
#

ALright

near stratus
#

And so do you

earnest phoenix
#

It's just that

#

ugh

near stratus
#

So of your code is handling POST then you have to make POST request

earnest phoenix
#

I don't know how it works step by step you know

#

liek

#

what does what

#

I know basic of python

#

but this is my first time doing https

#

and webhooks and etc

near stratus
#

I tooo it from here

earnest phoenix
#

wait

#

you use python to code too?

near stratus
#

I only use python for AI

earnest phoenix
#

OH

near stratus
#

and ML

#

so code explanation

earnest phoenix
#

Alright

#

Give me a second

#

Im tryna to understad

#

the code

timber fractal
#

if i use a .then() after a .then() do it needs to be like this

.then(.then())```
or like this
```js
.then().then()```
near stratus
# earnest phoenix Im tryna to understad

in line 1 you're importing request module
in line 2 you're defining the uri or URL
in line 3 you're defining the data you're passing through the request
in line 4 you're making the request

near stratus
timber fractal
earnest phoenix
#

url as in my webhook

pale vessel
#

yes it's the second one

earnest phoenix
#

or the website topgg?

#

@near stratus

#

Sorry

#

I haven't slept and i"m kinda brain dead

near stratus
earnest phoenix
#

Oh

#

wait

near stratus
#

waiting

earnest phoenix
#

llo = {'poop': 'isGood'}

#

what is that?

#

suppose to mean/

#

llo?

near stratus
#

that's the value you're passing

pale vessel
#

Poop is good

earnest phoenix
#

Value I'm passing?

#

like the username?

#

of the perosn who voted?

near stratus
earnest phoenix
#

lmaoo

near stratus
earnest phoenix
#

this mans helpin me while takin a dump

#

OH

crimson vapor
#

time for some learning

earnest phoenix
#

akio

#

do you know what it's calleed

#

like the placeholder or what ever

#

for discord user who voted?

near stratus
#

@earnest phoenix you can pass anything you want through that

earnest phoenix
#

Can you give me a example?

crimson vapor
#

the only reason its .then().then() is if the first .then() returns a promise

earnest phoenix
#

from topgg?

#

like for example username?

crimson vapor
#

otherwise it would only be one .then

near stratus
earnest phoenix
#

Alright

#

โค๏ธ

timber fractal
near stratus
#

@earnest phoenix I found this on GitHub

earnest phoenix
#

I saw that earlier

#

stinky py

#

I can't read their code ๐Ÿ˜ญ

#

i'm to oretarded

near stratus
earnest phoenix
#

I am retarded

near stratus
#

bruh

earnest phoenix
#

akio

near stratus
#

yeah

earnest phoenix
#

do I need to have a database

#

to just send the server

near stratus
#

no

earnest phoenix
#

alright

#

lemme try

near stratus
#

You don't even need a webhook to send the serverCount

earnest phoenix
#

Oh i don't care about the server count

#

I just wanna see who voted

#

lol

#

n the chat

near stratus
#

We use webhook mostly to catch the voted users

earnest phoenix
#

Yeah

#

So I don't neeed a database?

#

๐Ÿ‘๏ธ

near stratus
#

actually no
If you don't wanna store the data of who voted

earnest phoenix
#

Alright

#

for now

#

I just wanan send

#

it in chat

near stratus
#

waaiitt

#

to send it in chat you'll also need a application on Discord (bot/webhook-discord)

earnest phoenix
#

Wym?

#

now i'm confused ๐Ÿ˜ญ

#

even more

#

๐Ÿ˜ญ

near stratus
#

Do you want to send the data of the user who voted in a discord chat ?

#

or just console.log it

#

sorry I mean print ()

earnest phoenix
#

yeah

#

like

#

ctx.send()

near stratus
#

what's CTX ?

pale vessel
#

context

crimson vapor
#

message but for py iirc

near stratus
#

oh

#

I coded JavaScript for too long

pale vessel
#

it's not message but message

near stratus
#

now I'm confused

earnest phoenix
#

like

#

in discord

#

to send something in chat

crimson vapor
#

hmm

earnest phoenix
#

rght

pale vessel
#

it has message method and properties but ctx itself isn't message

earnest phoenix
#

you can do

#

ctx.send()

crimson vapor
#

right

#

ctx weird

earnest phoenix
#

and it'll send something in chat

#

so

#

I can choose a channel to send

#

in

pale vessel
#

like there's ctx.message

earnest phoenix
#

as long as I know when someone voted

#

and i need a request

near stratus
earnest phoenix
#

Yea

earnest phoenix