#development

1 messages Β· Page 1334 of 1

toxic acorn
#

yes i do, and alright thank you, i'll play around with it

dawn harbor
normal sage
#

thanks!

dawn harbor
#

πŸ˜„

boreal iron
#

In theory it is going to work
@random maple Well not really complicated to create an array including your command and adding entries with new commands to it

#

With a command

carmine summit
#
if(Math.floor(Math.random() * 10000) == 1) //do stuff

@chilly bison 0.01% chance wtf

chilly bison
#

what?

#

1/10000 chance lol

boreal iron
#

Actually better than the lottery

random maple
#

yeah
even better chance

haughty bough
#

Hello. I'm having problems when I add my bot on other servers, because they are sharing the same code and giving problems when people from both servers execute the commands. How do I solve this? Any api resources? any programming practice? I'm really stuck on it :/

boreal iron
#

Just assuming he’s doing something like this, yikes

chilly bison
#

Hello. I'm having problems when I add my bot on other servers, because they are sharing the same code and giving problems when people from both servers execute the commands. How do I solve this? Any api resources? any programming practice? I'm really stuck on it :/
@haughty bough ReadTheDocs

#

Just assuming he’s doing something like this, yikes
@boreal iron ablobshrug

boreal iron
#

huh πŸ€”

#

A lottery bot what else would you need such a chance for?

chilly bison
#

idk, I 'm guesssing randomly spawns

#

for coins / nitro

boreal iron
#

Hmm also possible

random maple
#

Hello. I'm having problems when I add my bot on other servers, because they are sharing the same code and giving problems when people from both servers execute the commands. How do I solve this? Any api resources? any programming practice? I'm really stuck on it :/
@haughty bough I never had that kind of problem. Let's start with the basics: try to turn off and on your bot

ionic dawn
#

where are my '0' tho xD

boreal iron
#

@chilly bison imagine creating an administration command with a chance of 1/10 to kick/ban the author instead of the target

#

That would be fun tho

random maple
#

Life is not funny If there is no risk, right?

boreal iron
#

Aye

random maple
#

Hm, a good idea what to add to my bot...

boreal iron
#

lmao

haughty bough
#

@haughty bough I never had that kind of problem. Let's start with the basics: try to turn off and on your bot
@random maple I'll give you an example: A command that puts the music in a queue and to play in the future, but that list ends up being shared on all servers, but I don't want that. I think programming techniques are lacking to make each server have its list, but I really don't know how to do that

boreal iron
#

Just create an array including the guild id

thick gull
#

assign a guild value

boreal iron
#

For example:

thick gull
#

like a collection

#

<blah>.collection.get(guild)

#

idk bad at explaining

#

also might be better ways depending on what your doing

boreal iron
#

queue[guild_id][] = song1,
queue[guild_id][] = song2 etc

random maple
#

Maybe use server variables? idk I'm working on moderation bot and I have never tried to do something with voice chats.

boreal iron
#

Just a simple array you can push or shift entries to

lament heath
#

Does anyone want to 2v2 in Fortnite

boreal iron
#

Wrong channel or we’re not 12, so nope

drifting wedge
#

how do i run code on button press html?

lament heath
#

What channel do I go to

thick gull
#

@drifting wedge you can literally google that one despair

drifting wedge
#

i couldnt find anything

boreal iron
#

JS?

drifting wedge
#

yea should be

thick gull
#

??

haughty bough
#

Interesting, I will do that. One last doubt: Is there a pattern for creating bots in the discord that you recommend? Techniques to make the code better, for example

thick gull
#

comment your code

drifting wedge
#

js function?

thick gull
#

so you don’t end up like me

boreal iron
#

Easiest example is using onclick=β€œjs_function()”

thick gull
drifting wedge
#

specified in html?

thick gull
#

yea?

boreal iron
#

Works on submit elements

#

For example

thick gull
#

if you scroll down

#

you can see other stuff

boreal iron
#

lmao

drifting wedge
#

but like how would i show an html thing with js?

thick gull
#

what do you mean

#

click a button and run js?

boreal iron
#

Guess he means document.write()

#

Or element.write() where ever you like it

thick gull
#

I’ve been getting into jquery and stuff

#

slightly more fun that djs because it’s something to learn

#

B)

boreal iron
#

Aye

#

jQuery is a really nice framework

#

Or people wanna call it library

#

Modern society shit...

#

Really nice to build own fancy site with it

#

If you wanna do it with your own hands not using bootstrap or templates etc

thick gull
#

templates look more complicated

#

😎

boreal iron
#

Well gonna get some sleep now. See ya

quartz kindle
#

@drifting wedge there are many ways to do that, depends exactly what you want to do

#

you can create/remove elements from html, or you can hide/show elements by changing the css from js

#

you can edit the content of elements with js as well

digital ibex
#

jQuery is a really nice framework
lmao

drifting wedge
#

I use flask lol

compact echo
digital ibex
#

no need to send all ur code btw

compact echo
#

@digital ibex Just incase you have to see the rest of the code so I don't have to send like 10 sourceb.in links πŸ™‚

sudden geyser
#

@compact echo the value of msg isn't parsable to JSON. You could log what msg is beforehand.

compact echo
#

Ok

#

Returned this

#
{"t":null,"s":null,"op":10,"d":{"heartbeat_interval":41250,"_trace":["[\"gateway-prd-main-9540\",{\"micros\":0.0}]"]}}
{ code: 4004, reason: "Authentication failed." }```
#

oh maybe my discord bot token isn't valid

earnest phoenix
#

anyone has an image api for me

#

thas free

compact echo
#

Search online ig?

earnest phoenix
#

i tried nothing free

#

google doesnt understand free

compact echo
#

lmao

#

Oh lol

#

My discord bot token was invalid πŸ€¦β€β™‚οΈ

#

anyone has an image api for me
@earnest phoenix wdym image api? Like cat image or dog image?

#

or like meme or smth

earnest phoenix
#

preferly dog/cat but mostly just images of an whole host of subjects

compact echo
#

Ok

#

For dog^^^

earnest phoenix
#

oh

compact echo
#

If you need any tutorials on how to use them just ping or dm me and I can give you some πŸ™‚

earnest phoenix
#

well i do need to know how to grab json from the web and make it an json object

compact echo
#

Ok

#

I suggest watching this video due to the person explaining it super well and stuff. Just tell me if you need help! https://www.youtube.com/watch?v=LjbUq4RzWvg&t=44s

Check out these awesome videos for this week! Hope you're enjoying this weeks pretty much daily content!

Read description for links!

----------------------------------------Β­Β­---------------------------------------Β­-Β­--

Need Help?
Require help with your code? Why not head o...

β–Ά Play video
vale cedar
#

some-random-api has cat, dog and meme apis

agile lance
#

I get a error saying manager is not ready when running !start 30m #deleted-channel 1 TEST

Manager code:

const { GiveawaysManager } = require('discord-giveaways');
client.giveawaysManager = new GiveawaysManager(client, {
    storage: "./database.json",
    updateCountdownEvery: 3000,
    default: {
        botsCanWin: false,
        embedColor: "#FF0000",
        reaction: "πŸŽ‰"
    }
});

Start Manager Code:

client.giveawaysManager.start(giveawayChannel, {
        time: ms(giveawayDuration),
        prize: giveawayPrize,
        winnerCount: giveawayNumberWinners,
        hostedBy: client.config.hostedBy ? message.author : null,
        messages: {
            giveaway: (client.config.everyoneMention ? "@everyone\n\n" : "")+"πŸŽ‰πŸŽ‰ **GIVEAWAY** πŸŽ‰πŸŽ‰",
            giveawayEnded: (client.config.everyoneMention ? "@everyone\n\n" : "")+"πŸŽ‰πŸŽ‰ **GIVEAWAY ENDED** πŸŽ‰πŸŽ‰",
            timeRemaining: "Time remaining: **{duration}**!",
            inviteToParticipate: "React with πŸŽ‰ to participate!",
            winMessage: "Congratulations, {winners}! You won **{prize}**!",
            embedFooter: "Giveaways",
            noWinner: "Giveaway cancelled, no valid participations.",
            hostedBy: "Hosted by: {user}",
            winners: "winner(s)",
            endedAt: "Ended at",
            units: {
                seconds: "seconds",
                minutes: "minutes",
                hours: "hours",
                days: "days",
                pluralS: false
            }
        }
sick fable
#
async def enlarge(ctx, emoji):
	embed = discord.Embed(title = f"Enlarged Emoji!" , description = f"**Emoji Name** : ``{emoji}" , colour = discord.Colour.red())
	embed.set_image(url = f"{emoji_url}")
	embed.set_footer(text = f"Requested by {ctx.author.name}")
	await ctx.send(embed=embed)```
#

What's wrong in this code

#

The error came out as Name "emoji_url" is not defined

sudden geyser
#

Where did you define emoji_url?

sick fable
#

I didn't defined it. 😦

sudden geyser
#

Then that's the root of your problem.

solemn latch
#

is there a selfbot here

#

πŸ€”

#

whats with the random reactions

#

kek

#

sorry, just sciencin

sudden geyser
sick fable
#

Kk

next flax
#
const client = require('alexflipnote.js');
const alexclient = new client();


 module.exports = {
  name: "phlogo",
  category: "image",
  description: "PornHub Logo",
  run: async (bot, message, args) => {
      let text = args.join(" ").slice(" | ")
      let text2 =  args.slice(1).join(" ")
      let image = await alexclient.image.pornhub(text, text2)
      let attachment = new Discord.MessageAttachment(image)
      message.channel.send(attachment)
  }
}```
#

whats the problem?

still cliff
#

Bad request made to the host.

next flax
#

hm

#

is their something i can do

#

to solve this

solemn latch
#

should look at the docs for the library you are using

still cliff
#

^

next flax
#

their is nothing related to host in the docs

solemn latch
#

whatcha mean

next flax
solemn latch
#

okay, did you look at the docs to make sure you are performing your requests correctly?

next flax
#

i think yes

#

@solemn latch u have any suggestion?

still cliff
#

The requests are being made incorrectly is the reason it throws HTTP Error 400. It will be best if you read the docs again and try making a burner application to test it.

next flax
#

burner application ?

still cliff
#

An application made specifically for one task only.

next flax
#

k

solemn latch
next flax
#

me?

solemn latch
#

yeah

next flax
#

i think its fine

solemn latch
#

really?

#

even me showing a screenshot of it clearly not doing anything

faint prism
#

An application made specifically for one task only.
@still cliff burner would imply it is no longer useful after being used or temporary. Right?

solemn latch
#

yeah, just something you throw together to quickly test a library

#

or anything

#

and then when you understand it throw it away

#

or move what you tested into your main code.

mental furnace
#

I wish there was a way to know who declined your bot, so he could see this

#

(or she)

sudden geyser
#

@mental furnace search for your bot in modlogs with the search bar (enter the ID)

#

You'll see who denied it and when.

mental furnace
#

Ye lemme get the id

solemn latch
#

cmds is a non obvious command

#

a new user who doesnt know your bot might not know to do cmds

mental furnace
#

It literally says it in the status every 10 seconds

solemn latch
#

changing status?

mental furnace
#

Ye

#

my other bot also has it

#

And I think &help also works

solemn latch
#

πŸ€·β€β™‚οΈ whens the last time you looked at a bots status for more than 10 seconds

#

if &help works then im on your side ;p

mental furnace
#

K

#

Lemme check

glad charm
#

Yo

mental furnace
#

@glad charm I looked at the logs, you didn't give him webhook permissions

#

Sorry for second ping

#

Lemme fix that in my bot page

glad charm
#

The bot didn't say anything about perms nor did the page.

#

Right so the bot didn't error or anything.

mental furnace
#

Ik i should really add that to my bots

#

Lmao

glad charm
#

Xd

mental furnace
#

Could you rename me to "sbot50"

still cliff
#

Exactly, @faint prism.

mental furnace
#

I gotta rewrite the whole page

#

Yayyyyyyy

still cliff
#

I use them all the time to test packages and extract useful code. 😹

mental furnace
#

Anyway I'll submit again and wait another 3 months

#

Anyway I'll submit again and wait another 3 months
@mental furnace nvm, 8 months

solemn latch
#

maybe by the time your bots accepted all the new bot reviewers will be trained and reviewing

mental furnace
#

Ye I also submitted, so I may even be doing that

solemn latch
#

just review your own bot 4head

mental furnace
#

No

#

I don't think that's allowed

#

And I also don't think I would even get my own bots in a list of bots to accept

still cliff
#

The average review time is ridiculous but I can say it's worth the wait.

mental furnace
#

Not if it gets denied because the reviewer forgot a perm because I forgot a perm

still cliff
#

My bot achieved like 15 servers in 3-5 days once it got approved...

mental furnace
#

I'll make a new page later today, it's 7am

solemn latch
#

bots are reviewed with 0 perms

still cliff
#

Shitpost much. I'll stop.

solemn latch
#

its not forgotten, its intentionally that way

mental furnace
#

bots are reviewed with 0 perms
@solemn latch no, they are reviewed with the provided bot link

solemn latch
#

thats not true

mental furnace
#

If that's not true, then how was my other bott accepted

#

It uses embeds

#

And those are also a perm

solemn latch
#

embed links are default user permissions

#

which is in 0 permissions

sonic lodge
mental furnace
#

Weird

#

My other bot also doesn't function without perms.... /Shrug

solemn latch
#

then you should fix that

#

since users often disable perms

mental furnace
#

Bruh then the bots can't function

solemn latch
#

all bots i invite i give 0 permissions for

mental furnace
#

Well they can

#

But it would look bad

solemn latch
#

if they cant function they need to error and if i choose to add it i do πŸ€·β€β™‚οΈ

mental furnace
#

all bots i invite i give 0 permissions for
@solemn latch invites moderation bot with 0 perms WhY DoEsN'T It FuNcTiOn

solemn latch
#

it should properly send an error message

#

if it doesnt function

#

not that hard πŸ€”

mental furnace
#

True but the user should use the intended link

#

Also not that hard

solemn latch
#

not at all

#

give bots as few perms as you need

mental furnace
#

I do

solemn latch
#

if i need a bot with mute perms and thats it, i shouldnt give it admin

#

just the perm it needs

mental furnace
#

I have a mod bot and the only perms it needs is mΓ©nage messages and kick/ban

#

Also

#

Kick/ban aren't needed if you don't set it up to do that

solemn latch
#

and does it properly inform the mod when it tries kicking someone but the bot doesnt have perms?

mental furnace
#

No since it's not out yet

solemn latch
#

didnt you submit it for review πŸ€”

#

you shouldnt submit until its ready to be public

#

or almost ready to be public

#

for most bots, the first few weeks after acceptation on top.gg is where they make it or die.

mental furnace
#

didnt you submit it for review πŸ€”
@solemn latch no?

solemn latch
#

then how was it denied

mental furnace
#

No

#

The mod bot isn't even out yet

#

No since it's not out yet
@mental furnace

#

then how was it denied
@solemn latch it wasnt

#

It's not out

sacred cypress
#

Response from API

{
  ret: 'OK',
  pow: '0', 
  mode: '3',
  adv: '',
  stemp: '22.5',
  shum: '0',
  dt1: '21.0',
  dt2: 'M',
  dt3: '22.5',
  dt4: '21.5',
  dt5: '21.5',
  dt7: '21.0',
  dh1: '0',
  dh2: '0',
  dh3: '0',
  dh4: '0',
  dh5: '0',
  dh7: '0',
  dhh: '50',
  b_mode: '3',
  b_stemp: '22.5',
  b_shum: '0',
  alert: '255',
  f_rate: 'A',
  f_dir: '0',
  b_f_rate: 'A',
  b_f_dir: '0',
  dfr1: 'A',
  dfr2: 'A',
  dfr3: 'A',
  dfr4: 'A',
  dfr5: 'A',
  dfr6: 'A',
  dfr7: 'A',
  dfrh: '5',
  dfd1: '0',
  dfd2: '0',
  dfd3: '0',
  dfd4: '0',
  dfd5: '0',
  dfd6: '0',
  dfd7: '0',
  dfdh: '0',
  dmnd_run: '0',
  en_demand: '0'
}
#

Only data I need

interface controlInfo {
  ret: string;
  pow: string;
  mode: string;
  stemp: string;
  shum: string;
  f_rate: string;
  f_dir: string;
  alert: string;
}
#

Is it possible to automatically strip JSON objects if the property isn't typed?

#

I can't find anything about it on da web

#

Some sort of serialization

opal plank
#

you could simply destructure it

#

and then filter

sacred cypress
#

Yeah, I could, but that feels redundant

opal plank
#
let final = [..Object.entries(response)].filter(key, val => key == ret || pow || mode ||...)```
#

thats the shortest one liner i can thinkof

sacred cypress
#

Hmm

silver lintel
#
let embed = new $()
    .setTitle(`${message.author.username}'s Inventory`)
    .setColor(config.color)
    .setThumbnail(message.author.displayAvatarURL({ dynamic: true, size: 512 }));
 
    Money.findOne({
      userID: message.author.id
    }, (err, money) => {
      if (err) console.log(err);
      if (!money) {
        const newMoney = new Money({
          userID: message.author.id,
          money: 0
        });
        
        newMoney.save().catch(err => console.log(err));
        embed.addField("Account Balance", '0');
      } else {
        embed.addField("Account Balance", money.money);
      }

not adding fields. it jsut ends an empty embeds

opal plank
#

one liner

#

like i said, thats the best i can think of to make it short

#

just assign an array with the keys you need

#

and then restructure the array back into an object

drifting wedge
#

Wut do you guys use for premium for your bots?

#

Ping with responses pls

stable snow
#

wdym

drifting wedge
#

Like patreon, etc

stable snow
#

oh

#

a lot of bots use patreon

drifting wedge
#

And how much is like average?

stable snow
#

idk

sacred cypress
#

PayPal API is what me and Xig are prob gonna use, I recommend it if youre above 18

drifting wedge
#

PayPal API is what me and Xig are prob gonna use, I recommend it if youre above 18
@sacred cypress u and xig have a bot? Cool

sacred cypress
#

Working on something

#

Ye

#

elian.app

drifting wedge
#

@sacred cypress js? And also how will payment work? Like literally PayPal, or u have some interface?

sacred cypress
#

Paypal has a beautiful sucky api

#

That works pretty well once u understand it

drifting wedge
#

My pfp all wonky

#

Is there some like subscription interface?

sacred cypress
#

Oh boy

#

It has fucking everything

#

Its just, not easy to get working

drifting wedge
#

But 18+?

sacred cypress
#

And that

drifting wedge
#

Is patreon any good?

sacred cypress
#

Their API hard as fuck, some say the worst one a professional payment gateway can make

#

Patreon takes a big piece of the cake

#

But yeah, I guess...

drifting wedge
#

What my team thought of doing is like have patreon give you a role, and one of our bots detecting it and adding it to db

#

But that’s terribly inefficient

sacred cypress
#

Patr must have an api or a webhook, right?

#

Try looking into that

drifting wedge
#

API

#

It’s discontinued

sacred cypress
#

Lmfao

drifting wedge
#

So It works

#

But just badly

sacred cypress
#

Are you 18+?

drifting wedge
#

Byeeeeee

sacred cypress
#

So paypal isnt an option

#

:/

drifting wedge
#

I never said anything about that

sacred cypress
#

You said bye

tame kestrel
#

stripe? stripe has such a good api

drifting wedge
#

Yes, that is not a yes or no

sacred cypress
#

Stripe is officialy 18+ too

#

And stripe isnt very friendly cuz cc only

#

Or btc

drifting wedge
#

I mean the thing is stripe is like u put ur credit card in my website?

#

Ppl won’t really trust it

sacred cypress
#

Like 40% maybe has a credit card

#

Not really user friendly

tame kestrel
#

What's the rest that paypal can provide?

drifting wedge
#

What is user friendly ?

tame kestrel
#

Bank transfer?

drifting wedge
#

Lolll

sacred cypress
#

Yeah, local per country

#

So literally everyone can use it

#

Owh and their fees low as shit

drifting wedge
#

Wait wut?

sacred cypress
#

My relationship with pp is love and hate though

drifting wedge
#

Wut is good

#

?

sacred cypress
#

6 blocked accounts

#

😬

#

7th one finally got verified

drifting wedge
#

Can I detect webhooks?

sacred cypress
#

Yes. It has everything

drifting wedge
#

Like, can I like read webhooks?

sacred cypress
#

Yeah

drifting wedge
#

Pog

sacred cypress
#

U can even scan if someone refunds

drifting wedge
#

I mean for patreon?

sacred cypress
#

So u can revoke their purchase

drifting wedge
#

Pp might come later

sacred cypress
#

Idk about patreon

#

Google it

#

:D

tame kestrel
#

Patreon stopping webhook apis but allowing endpoints and related it seems

drifting wedge
#

So no webhooks?

#

Like what is a simple way I can do premium?

tame kestrel
#

wait just kidding

drifting wedge
#

Can I like run a bot that reads webhook content? Basically?

tame kestrel
#

idk

drifting wedge
#

Can I read webhook content, like is it even possible?

tame kestrel
#

when you're hosting a webhook, they send data to you

#

so in the patreon panel, just yeet your webhook uri into there and they'll post u with data whenever something happens

drifting wedge
#

Yea

#

That’s my idea

#

But how would I get the user’s ID

#

Like discord Id?

tame kestrel
#

oh hm good point

drifting wedge
#

Can I put an input form?

tame kestrel
#

I mean, if you are fine with doing it manually, most people would be happy to join your support server after buying premium, and patreon has a discord bot that will role them with connected discord accounts

drifting wedge
#

I mean, if you are fine with doing it manually, most people would be happy to join your support server after buying premium, and patreon has a discord bot that will role them with connected discord accounts
@tame kestrel true

#

I’ll do webhooks

#

Can I like make a input form?

#

Cuz like idk how I would identify the buyer

tame kestrel
#

Β―_(ツ)_/Β―

drifting wedge
#

Hmmm

tame kestrel
#

Patreon allows subs to dm u

#

there's always that

#

It looks like their api allows u to see if they have a discord attached

#

so like when they sub, you at the very least get their patreon user id

#

and can use that to fetch the discord profile information

drifting wedge
#

I have an idea

#

So in webhook, bot gets webhook patreon id and adds to db

#

Then user can go into bots website and put their ID, and get premium?

tame kestrel
#

no, because how would an average user know their own id?

How about when someone subscribes, if you dont get discord info off the bat, you fetch their profile, and end up with their user id, as well as their discord user id.

#

so if they had discord to begin with connected, you know it off the bat

drifting wedge
#

But what if they don’t have their discord connected.

#

?

#

Tire

#

True

tame kestrel
#

if they don't and they try activating it later on in a server right or trying a premium feature

#

just be like, believe this is an error? join support server

#

and you can like, do something about it

drifting wedge
#

Ok I’ll prob do that

tame kestrel
#

@drifting wedge looks like they have a "member update" webhook, maybe that could tell you when they change their profile?

drifting wedge
#

Yea

#

Def

#

Gtg tho

#

It’s late AF

tame kestrel
#

Alright, have a nice night

ivory seal
#
        console.log(userid);
         let member = client.users.cache.find(user=>user.id===userid);
         console.log(member);
         member.send("Verify Success");```
This returns ``TypeError: Cannot read property 'send' of undefined``
#

also userid returns the correct user id

#

any help y'all?

pale vessel
#

why not just user.send

ivory seal
#

one sec

pale vessel
#

why are you trying to find a "member" and then send to them

#

it's not a member anyway, it's a user

#

since it's from client.users

ivory seal
#

when i do user.send

#

it returns TypeError: user.send is not a function

pale vessel
#

what is user?

ivory seal
#

its the object user

pale vessel
#

that's the dapi docs

#

you're using a library

#

the user object has a structure and methods attached to it

#
ivory seal
#

ah ok thanks will see this

pale vessel
#

where did you get user?

#

since send() isn't a method for it (for you that is)

ivory seal
#
        const client = new Discord.Client();
        const DiscordOauth2 = require("discord-oauth2");
         const oauth = new DiscordOauth2()
     
oauth.tokenRequest({
    clientId: "000",
    clientSecret: "000",

    code: accessCode,
    scope: "identify guilds guilds.join",
    grantType: "authorization_code",
    
    redirectUri: "http://localhost:5500",
}).then(m=>{
    const access_token = m.access_token;
    
    oauth.getUser(access_token).then(user=>{
        console.log("Hi");
        const refreshtoken = m.refresh_token;
        db.set(`${user.id}`,access_token);
        db.set(`${user.id}_refresh`,refreshtoken);
        user.send("Verif");
    })
})```
#

this is my entire code

pale vessel
#

oh you mean literally raw user

ivory seal
#

ye

pale vessel
#

then the user you're trying to get is not cached

ivory seal
pale vessel
#

try client.users.fetch(user.id).then(user => user.send("test"))

ivory seal
#

one sec

pale vessel
#

fetch gets it from the cache if exists, if not, the api

#

it's a promise so you have to await it or use .then()

#

it gives either a user or an error

ivory seal
#

one sec just trying what u told

#

TypeError: Cannot read property 'id' of null

#

thats the error i get

pale vessel
#

ah, sorry, userid

ivory seal
#

ah ok

pale vessel
#

whichever one that's defined

#

not sure

ivory seal
#

it still gives me TypeError: Cannot read property 'id' of null error

pale vessel
#

also userid returns the correct user id
@ivory seal

#

idk man

#

sounds like it's a you problem

ivory seal
#

?

pale vessel
#

you said it returned the correct id

#

now it doesn't

ivory seal
#

@pale vessel the userid returns the userid const returns with the userid

#

client.users.fetch(userid).then(user =>console.log(user)); returns my user raw

#

but user.send() doesn't work it returns TypeError: Cannot read property 'id' of null

silver lintel
#
let bal;
    
    Money.findOne({
      userID: message.author.id
    }, (err, money) => {
      if (err) console.log(err);
      
      if (!money) {
        const newMoney = new Money({
          userID: message.author.id,
          money: 0
        });
        
        newMoney.save().catch(err => console.log(err));
        bal = 0;
      } else {
        bal = money.money;
      }
    });   
    
    console.log(bal) //undefined
```why undefined :((
cinder patio
#

Because the callback in findOne executes after the console.log

ivory seal
#

pls help me too

silver lintel
#

Because the callback in findOne executes after the console.log
@cinder patio howe do i make it before

cinder patio
#

You put everything that uses bal inside the callback.

#

Or use promises

ivory seal
#

client.users.fetch(userid).then(user =>console.log(user)); returns my user raw
but user.send() doesn't work it returns TypeError: Cannot read property 'id' of null

#

plz help

earnest phoenix
#

@ivory seal show what it logs in the console

ivory seal
#

one sec @earnest phoenix

earnest phoenix
#

@earnest phoenix User.findOne is not a function duh

#

are you sure User is a mongodb collection

#

yup

ivory seal
#

it consoles my userid
then says TypeError: Cannot read property 'id' of null

earnest phoenix
#

and that the spelling and capitalization is correcr

#

it consoles my userid
then says TypeError: Cannot read property 'id' of null
@ivory seal screenshot what it logs

#

yep its right. User and User from collections are both right. the typo is just here in questions

ivory seal
#
732563712136970290
(node:5204) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
    at User.createDM (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\User.js:250:63)
    at User.send (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:158:19)
    at C:\Users\user\Desktop\Advanced\index.js:53:47
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:5204) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, 
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:5204) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
earnest phoenix
#

where did you define the collection

ivory seal
#

thats wat it logs

earnest phoenix
#

@ivory seal that means you passed the wrong id

#

client.users.fetch("wrong id here");

#

it says Cannot read property id of null which means whoever guy's id you're passing is not a real guy

ivory seal
#

the id is correct cause i checked it by copying my id and referencing

#

tat id is mine

earnest phoenix
#

is it a string

ivory seal
#

yes

earnest phoenix
#

send the whole code

#

we cant just help with one line

ivory seal
#

one sec

#
        const client = new Discord.Client();
        const DiscordOauth2 = require("discord-oauth2");
         const oauth = new DiscordOauth2()
     
oauth.tokenRequest({
    clientId: "000",
    clientSecret: "000",

    code: accessCode,
    scope: "identify guilds guilds.join",
    grantType: "authorization_code",
    
    redirectUri: "http://localhost:5500",
}).then(m=>{
    const access_token = m.access_token;
    
    oauth.getUser(access_token).then(user=>{
        console.log("Hi");
        const refreshtoken = m.refresh_token;
        db.set(`${user.id}`,access_token);
        db.set(`${user.id}_refresh`,refreshtoken);
         const userid=user.id;
        console.log(userid);
        client.users.fetch(userid).then(user =>user.send("hi"));
        
    })


})```
earnest phoenix
#

@ivory seal oauth.getUser(access_token) might be wrong so it's returning null as the user

ivory seal
#

if it was null then userid won't return right

#

but userid returns

earnest phoenix
#

thonk

#

i got it

acoustic veldt
earnest phoenix
#

client.users.fetch(userid).then(user => user.send("hi"));
the error is originating here

#

where did you define the collection
@earnest phoenix const User = require('../cardgame/collections/user')

#

why is user defined twice

ivory seal
#

ah ok so i should jsut change user to somethign else?

earnest phoenix
#

@earnest phoenix that's not how you do mongodb collections iirc

#

ah ok so i should jsut change user to somethign else?
@ivory seal make it fetchedUser ig

#

nvm thank you.

ivory seal
#

one sec

#
(node:10412) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
    at User.createDM (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\User.js:250:63)
    at User.send (C:\Users\user\Desktop\Advanced\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:158:19)
    at C:\Users\user\Desktop\Advanced\index.js:53:46
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:10412) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:10412) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

still an error

#

client.users.fetch(userid).then(mem => mem.send("Hi"))

#

wat i did

earnest phoenix
#

@earnest phoenix try doing this:
(I'm not very experienced with mongodb don't expect this to fully work)

const User = <mongodb client>.db("db name").collection("collection name");
#

@ivory seal what's on line 53

#

the error says it's on that line

ivory seal
#

client.users.fetch(userid).then(mem => mem.send("Hi"))
@ivory seal this is on line 53

earnest phoenix
#

change it to this just for temporary testing:

client.users.fetch(userid).then(mem => console.log);
acoustic veldt
#

this is node.js ??

earnest phoenix
#

@acoustic veldt yes

acoustic veldt
#

kk

earnest phoenix
#

you can ask for anything bot development related here

ivory seal
#

it doesn't return anything

acoustic veldt
#

I am looking for peeps who know discord.py so that I can get some help

earnest phoenix
#

check console

ivory seal
#

wait shouldn;t it be console.log(mem)

tame kestrel
#

@acoustic veldt Don't ask to ask, just post your question here and someone may help you

acoustic veldt
#

Ok kg_salute

earnest phoenix
#

wait shouldn;t it be console.log(mem)
@ivory seal yeah my bad

ivory seal
#

cause if i do that

  id: '732563712136970290',
  username: 'The_Real_Sahhas',
  bot: false,
  discriminator: '0001',
  avatar: 'a_1286b555a379309632951c8d4c5e3e90',
  flags: UserFlags { bitfield: 64 },
  lastMessageID: null,
  lastMessageChannelID: null
}``` i get the user object
tardy hornet
ivory seal
#

.username

tardy hornet
#

or message.author.username

earnest phoenix
#

username

tardy hornet
#

k

earnest phoenix
#

also there is no username for GuildMember(s) there is only nickname

tardy hornet
#

and for his logo its:
message.author.iconURL()
?

earnest phoenix
#

no

ivory seal
#

avatar

tardy hornet
#

k

earnest phoenix
#

avatarURL()

#

avatarURL for users and iconURL for guilds

ivory seal
#

mhm

#

well it reutrns my user object but the ```

user.send()``` doesn't work

earnest phoenix
#

@ivory seal change the console.log(mem); to console.log(mem.send);

ivory seal
#

i did

earnest phoenix
#

(don't put brackets around send)

ivory seal
#

oh ok one sec

earnest phoenix
#

also you renamed it to mem so user.send(); shouldn't work anyways

ivory seal
#

[AsyncFunction: send]

#

sorry its mem.send

#

i wrote user.send by mistake

earnest phoenix
#

try doing mem.send(); now

ivory seal
#

client.users.fetch(userid).then(mem => console.log(mem.send("hi"));
like this or
client.users.fetch(userid).then(mem => mem.send("Hi'))l

earnest phoenix
#

second one

#

the console log stuff were just for testing

#

Pro debugging tip: If you don't put () around a function it will just return the whole function which you can console log to see what it does

ivory seal
#

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null still returns this

#

ah oakay

earnest phoenix
#

@quartz kindle master please help

#

i gtg

#

ask tim the saviour for help now

ivory seal
#

idt tim is online

earnest phoenix
ivory seal
#

ok

silver lintel
#

How do I tell someone why Json db is bad?

tardy hornet
#

any one here is really good at reaction collector and want to make a deal?
command for command

misty sigil
slender thistle
#

or carry on and let them do their own thing

misty sigil
#

yea it’s not our fault if their database is fucked and their bot is absolutely fucking destroyed with errors and everyone’s mad that they lost all their data and the bot’s offline and basically just use a different database

slender thistle
#

I'd rather people worry about their business than someone else's catshrug

earnest phoenix
#

I'd rather people worry about their business than someone else's :catshrug:
@slender thistle so you're basically telling us not to help other people since it's not our business

#

and you guys shitted on me like fuck to make me a good programmer which i probably wouldn't have been if you guys didn't do that

slender thistle
#

Helping is one thing, insisting on why X is very dependent on the case, especially seeing how mad people get when they see a JSON db

#

Main point is, if you are going to insist on why X is bad, be civil about it, thanks

earnest phoenix
#

ok

slender thistle
#

(P.S. helping can also be bad in some cases, so all I can say is it depends on how good you are at helping and explaining)

earnest phoenix
#

(shivaco is a god)

tardy hornet
#

someone here that know reaction collector DM me please

misty sigil
#

someone here that know reaction collector DM me please
@tardy hornet just ask here please

ivory seal
#

well Plexi development didn't help me either lolz

hasty mulch
#
import discord
from discord.ext import commands
import asyncio

bot = commands.Bot

class DMCog(commands.Cog, name="DM Webhook Set-up"):

    def __init__(self, bot):
        self.bot = bot
        
    @commands.Cog.listener()
    async def on_message(self, message):
        if message.content.startswith('nya!dm'):
            await message.author.remove_roles(message.guild.get_role(767654541541244970), reason="DM Webhook created")
            print('Role removed successfully!')
            pass

def setup(bot):
    bot.add_cog(DMCog(bot))
```Outputs nothing in Python
shrewd parrot
#

Maybe print what the message.content contains and check that the bot is receiving the message

tardy hornet
shrewd parrot
#

message.react isn't valid in discord.py could you send your whole code @tardy hornet

tardy hornet
#

im using js

shrewd parrot
#

ah

#

sorry my bad (was looking at the message above for language xD)

#

discord.js or other?

hasty mulch
#

Maybe print what the message.content contains and check that the bot is receiving the message
@shrewd parrot Huh?

shrewd parrot
#
@commands.Cog.listener()
    async def on_message(self, message):
        if message.content.startswith('nya!dm'):
            print(message.content)
            await message.author.remove_roles(message.guild.get_role(767654541541244970), reason="DM Webhook created")
            print('Role removed successfully!')
            pass
tardy hornet
#

sorry my bad (was looking at the message above for language xD)
@shrewd parrot
its ok i have new question,
how do i make that a embed will get more then 1 reaction,
like that?

.then(msg => reactEmojies(msg, ['id'], ['id'], ['id'], ['id'], ['id']))
?

shrewd parrot
#

.then(msg=> msg.react(emoji))

#

then I'm pretty sure you have to loop that to add multiple reactions

hasty mulch
#

@shrewd parrot We have determined that the cog does not run past the if statement and the on_message event in the core does not run

shrewd parrot
#

are you loading the cog in the main file?

hasty mulch
#

I can try that

tardy hornet
#

i fixed that,

hasty mulch
#

@shrewd parrot I was loading in via a command

tardy hornet
#

now i want that if they react to red it will edit the message to something else

#
            
                        const start = message.createdTimestamp;
                        const end = pingMessage.createdTimestamp;
                        const subtraction = end - start;
                        
                        pingMessage.edit(`you lost! red was not an impostor!`)
                        })```
#

like that?

shrewd parrot
#

message.react.id isn't valid in d.js

#

unless your getting message from somewhere that I don't know

random forum
#

Do someone know how I can stop running a bot even if I never launched it ? I'm using VSC and did run and stop the debugger, yet the bot is launched by another way but I do not know how.

hasty mulch
#

Reset your token

#

@random forum

#

Unless you haven’t waited 2 minutes

random forum
#

I waited many hours.

hasty mulch
#

Then yeah, reset your token

random forum
#

And it is not the first time I have this problem, also I would like to do not often reset the token.

tardy hornet
#

message.react.id isn't valid in d.js
@shrewd parrot
ik. then how to i make that if they react to this emoji then

shrewd parrot
#

@hasty mulch I'm having to go so someone in the d.py server might be able to help you load the cog/get the listener working

#

@tardy hornet you can check what emojinis reacted with. Check the docs they contain a good amount of help

hasty mulch
#

And it is not the first time I have this problem, also I would like to do not often reset the token.
@random forum I would make sure the entire bot is shutdown, and don’t run it inside the program. Run it in Console/Terminal

random forum
#

Why to do not run it with debugger ?

hasty mulch
#

Because if your program stops responding, so does your bot

#

And it’s simpler

random forum
#

The debugger is better to debug. ;_;

hasty mulch
#

But not to run the bot

shrewd parrot
#

I find I can do more debugging with console.logs/their equivalents than a debugger

hasty mulch
#

^

next flax
#

why

tepid imp
#

How I can make bot command?

serene sandal
#

when will u aprove my bot

next flax
spiral crag
#

hello, if i want to host a discord python bot on my own computer instead of a server, can i do that?

zealous sable
#

@spiral crag yes, you can do that. I would suggest not doing it because I presume you turn your computer off when not using it which would turn the bot off too.

spiral crag
#

some people said using a cron job but i am not sure what is it

zealous sable
#

You will have to do some searching

#

But you can’t host it on your computer and expect 24/7 uptime if you turn your computer off.

spiral crag
#

also, if i make a google cloud account and use the free tier, can i set it in a mode where it will stop providing me the service if i go past free tier instead of charging me

earnest phoenix
#

also, if i make a google cloud account and use the free tier, can i set it in a mode where it will stop providing me the service if i go past free tier instead of charging me
@spiral crag no

#

I don't think they will allow this

spiral crag
#

is there any other linux virtual machine provider with a free tier which would do that

zealous sable
#

You can just cancel it before it ends

#

I don’t know a lot of free hosts, but I know some cheap ones

#

Like 10 dollars a month

spiral crag
#

i am not an adult so that is why it is a problem

zealous sable
#

I know one that’s 5 dollars a month?

earnest phoenix
#

Frankly I don't think anyone will do it for free

zealous sable
#

It costs to provide hosting so you charge people to use it

earnest phoenix
#

5 dollars is too much in our country

spiral crag
#

i heard that aws has a free tier as well can i use it in a way i will not go past free tier

zealous sable
#

You can use free services but they expire after the free trial

slender thistle
#

-faq 1 @earnest phoenix if you want to submit your bot to top.gg. Please don't send invites in this server

gilded plankBOT
#

@earnest phoenix

Frequently Asked Questions πŸ“œ
tight plinth
#

how to make the messagereactionadd trigger if a reaction is added to a uncached message in djs?

mighty sierra
#
 } else if (message.content.startsWith(`${PREFIX}lyrics`)) {
        const genius = require("genius-lyrics")
        const G = new genius.Client(process.env.GENIUS)

        G.tracks.search(message.content.split(' ').slice(1).join(' '), {limit: 1})
        .then(results => {
            const song = results[0]
            message.channel.send(`**${song.artist.name} - ${song.title}**\n<${song.url}>`)
        })
            .catch(err => message.reply(err))
    }
})

currently making a lyrics command with Genius's api, everytime i run the command, it keeps returning the error 'Cannot read property 'search' of undefined'

tight plinth
#

g.tracks is not defined

#

duh

pale vessel
#

@tight plinth it's not documented but it's client.on("raw", fn). this event sends raw web socket data. you can check for message reaction add event for example:js client.on("raw", data => { if (data.t === "MESSAGE_REACTION_ADD") { data.d // { user_id, message_id, ... } } });

tight plinth
#

ohk, thanks ^^

pale vessel
tight plinth
#

@lament meteor ^ do that for me i have to go k thx

lament meteor
#

ok

quartz kindle
#

@tight plinth use discord.js partials

#

they are made for that

tight plinth
#

last time i used partials for a bot i had to rewrite 99% of the code, so no thanks

quartz kindle
#

lmao

tight plinth
#

ok so

misty sigil
#

yes

tight plinth
#

@pale vessel the raw event triggers, but this code doesnt:

  switch (p.t) {
        case "MESSAGE_REACTION_ADD":
            radd({ message: p.d.message_id, guild: p.d.guild_id, emoji: p.d.emoji }, c.users.cache.get(p.d.user_id))
            break;
        case "MESSAGE_REACTION_REMOVE":
            rrem({ message: p.d.message_id, guild: p.d.guild_id, emoji: p.d.emoji }, c.users.cache.get(p.d.user_id))
            break;
    }```p being the data. Any idea why?
#

the console.log line before that works

#

but not the code after

pale vessel
#

can you show both of the functions (radd and rrem)?

misty sigil
#

put console log in functions

tight plinth
#

its basically the code i have in my messageReactionAdd and messageReactionRemove events, and these two works

pale vessel
#

can we see it?

misty sigil
#

no

tight plinth
#

as ur wish

#
function radd(reaction, user) {
    let r = c.db.get(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}.${reaction.emoji.id || reaction.emoji.name}`)
    if (!r) return;
    if (user.bot) return;
    let member = reaction.message.guild.members.cache.get(user.id)
    member.roles.add(r)
}

function rrem(reaction, user) {
    let r = c.db.get(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}.${reaction.emoji.id || reaction.emoji.name}`)
    if (!r) return;
    if (!reaction.me) {
        c.db.set(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}`, undefined)
    } else {
        let member = reaction.message.guild.members.cache.get(user.id) || c.guilds.cache.get(reaction.guild).members.cache.get(user.id)
        member.roles.remove(r)
    }
}```
#

i also tried to do a client.emit thing but it never triggered

#

yeah ik the code is bad

gentle lynx
#

in my code, i always have to put _'s in the first args

#

because the item names in the JSON file are like: "DIAMOND_SWORD"

#

is there any way to change it? so it will be something like $heat uncooked fish 2

slender thistle
#

You could replace the spaces in user input with underscores

gentle lynx
#

but wouldnt that be uncooked_fish_2 ?

pale vessel
tight plinth
#

it works

pale vessel
#

but wouldnt that be uncooked_fish_2 ?
@gentle lynx uppercase it

tight plinth
#

so shhh

gentle lynx
#

ik

pulsar bone
#

hello can someone help me with my code please πŸ₯Ί

pale vessel
#

but message can be an id sometimes?

gentle lynx
#

UNCOOKED_FISH_2 still doesnt work

#

maybe I can try remove numbers

tight plinth
#

its not the problem

#

ill fix that later

pale vessel
#

i'm not sure what doesn't work. is r defined?

tight plinth
#

the problem is that the funtion never triggers with the raw event

pale vessel
#

oh

tight plinth
#

ye

pale vessel
#

can you show the whole event?

pale vessel
#

are you sure the function never triggered?

#

have you tried adding a console.log() inside the function

tight plinth
#

i tried

#

nothin

pale vessel
#

damn

#

on the first line of the function?

tight plinth
#

it works o the first line tho

pale vessel
#

so it did trigger, it's just that r is not defined, making it return

tight plinth
#

hm

pale vessel
#

try logging js console.log(`${reaction.message.guild ? reaction.message.guild.id : reaction.guild}.rr.${reaction.message.id ? reaction.message.id : reaction.message}.${reaction.emoji.id || reaction.emoji.name}`)on the first line to make sure that it's the correct property for the role

tight plinth
#

it works as intended

drifting wedge
#

how do patreon webhooks work?

#

like i put mine and when i click test it doesnt work

gentle lynx
#

if I have an array
["TEST", "175, "LM", "7"]
how can I remove "175" and "7"?

#

the "numbers"

pale vessel
#

@tight plinth where did the console.log stopped working inside the function? if the db property is correct, then r should be defined

tight plinth
#

wait a min

#

after further investigation

pale vessel
#

so it's the function

tight plinth
pale vessel
#

check your db i guess

tight plinth
#

it works

#

but

#

idk

#

r exists

#

console.log(r works

pale vessel
#

still doesn't work?

tight plinth
pale vessel
tight plinth
#

so the problem is from the members thing

#

ye

sick apex
#

@thick gull ye yesterday we are tolking abiut my problem in code I found it in single command module there is defined command like message.content.slice(2) but 2 is length of normal prefix so when custom prefix is less or bigger than normal then it doesnt reposne πŸ˜‚πŸ˜‚ im idiot i know πŸ˜…

tight plinth
#

k i fixed it, it now works

#

thanks ^^

thick gull
#

what

sick apex
#

Nothing

#

πŸ˜‚πŸ˜‚

drifting wedge
#

can anyone help me? patreon webhooks arent working

#

hey @keen anvil im in a bit of a pickle, i know dank memer uses patreon and I was wondering how do you log / get the user who became a patron, thanks and sorry for the ping

long yew
#

does anyone have any clue how i can make a bot that plays spotify playlists in a voice chat?

#

in js

pearl trail
#

i have a problem. i'm using imdb to take movie information. the problem is when it doesn't have any movie poster, it'll return N/A, so i got UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body embed.thumbnail.url: Not a well formed URL.
i'm trying to use this trick:

        'N/A': "other_photo_link",
    }``` and in the thumbnail
```.setThumbnail(`${poster[movie.poster]}`)```
and yes, it works (for non poster movie), but not in movie that have a poster. so, in this case, i want to send image when it give us "N/A" and just bypass it when it have poster.
#

srry for slow responding if you answered my question : D

pale vessel
#

log the poster url

#

it could be a relative path

pearl trail
#

this is for movie that have poster

  _yearData: '2018',
  year: 2018,
  rated: 'PG-13',
  released: 2018-04-26T17:00:00.000Z,
  runtime: '149 min',
  genres: 'Action, Adventure, Sci-Fi',
  director: 'Anthony Russo, Joe Russo',
  writer: 'too long ;-;',
  actors: 'safe space',
  plot: 'safe space again',
  languages: 'English',
  country: 'USA',
  awards: 'Nominated for 1 Oscar. Another 46 wins & 73 nominations.',
  poster: 'https://m.media-amazon.com/images/M/MV5BMjMxNjY2MDU1OV5BMl5BanBnXkFtZTgwNzY1MTUwNTM@._V1_SX300.jpg',
  metascore: '68',
  rating: 8.4,
  votes: '805,496',
  imdbid: 'tt4154756',```
#

and this is for movie that doesn't have poster

  _yearData: '1993',
  year: 1993,
  rated: 'N/A',
  writer: 'N/A',
  actors: 'Tetsuo Kurata',
  plot: 'N/A',
  languages: 'N/A',
  country: 'N/A',
  awards: 'N/A',
  poster: 'N/A',
  metascore: 'N/A',```
gentle lynx
#

how can i turn this into

#

'wooden stick'

#

one string

umbral zealot
#

Array.join()

gentle lynx
#

thanks!

pale vessel
#

@pearl trail do you use the movie object or the poster object for the url?

pearl trail
#

poster

pale vessel
#

why not the movie object?

#

what's the poster object? is it from the api?

pearl trail
#

yes

#

imdb-api

pale vessel
pearl trail
#

yes

pale vessel
#

that's a string

pearl trail
#

so...

pale vessel
#

this confused me

#

you can use setThumbnail(object.poster || "unavailable url") for example

pearl trail
#

i mean, when it show poster: 'N/A',, it'll send other photo link

pale vessel
#

ah

pearl trail
#

yes, i've tried that

pale vessel
#

you can use object.poster === "N/A" ? "unavailable url" : object.poster

pearl trail
#

brb, lemme try

#

thank you very much flaze, it works

autumn summit
#

guys is it just me or is discord.py not working properly

pale vessel
#

just you

autumn summit
#

do you use it?

pale vessel
#

no

autumn summit
#

well then how do you know it’s just me

pale vessel
#

because other bots would've stopped working

drifting wedge
#

how do u guys use premium in ur bots?

umbral zealot
#

"use premium"?

#

premium what?

drifting wedge
#

like patreon

#

or some other thing?

#

@umbral zealot

umbral zealot
#

"it depends on the premium" I guess

#

not sure exactly what you're asking

still cliff
#

You might want to take a look at the Patreon API docs for that, @drifting wedge.

drifting wedge
#

no like im wondering what u guys use

#

like what platform

still cliff
#

To sell premium features in a bot?

drifting wedge
#

yea

still cliff
#

There are multiple ways to do that.

sacred cypress
drifting wedge
#

hey elian doggowave

still cliff
#

People use Patreon, PayPal integrations on a website that makes a call to the bot which is listening for them.

drifting wedge
#

alr cool

#

i prob will make paypal intergration

still cliff
#

It's pretty complex and you need to research a lot if you happen to be a newbie.

drifting wedge
#

dw im a pro 😎

abstract coyote
#

How could I use custom css for my bot's top.gg page?

pale vessel
#

add <style> css </style> in your description

abstract coyote
#

oh thanks!

pale vessel
#

the html style tag allows you to add css styling inside the description

abstract coyote
#

thats rly cool tysm!

earnest phoenix
#

Hey could some1 who made a dashboard for their bot dm me? (I DONT NEED UR CODE ETC)

#

I got a question

#

But i cant ask here

#

not me

#

Rip

#

Its a small question

umbral zealot
#

How about you ask the question here instead

earnest phoenix
#

Cant

umbral zealot
earnest phoenix
#

It sounds weird but cant

#

No

#

Its not

#

I swear to god

umbral zealot
#

If there's anything you'd tell a stranger in DMs, you can tell strangers in a server.

earnest phoenix
#

Its hella serious

#

I

#

K

umbral zealot
#

There's literally nothing that can be said in DMs with a rando from a server that can't also be said in a server.

#

(not when it comes to development)

earnest phoenix
#

No

#

It cant

umbral zealot
#

ah well. good luck with your problem then

hollow otter
#

Is it possible for a bot to read another bots embeds and parse the information from it?

umbral zealot
#

Anyone who asks for a bot token is trying to scam you.

#

didn't need a DM for that

pale vessel
#

Is it possible for a bot to read another bots embeds and parse the information from it?
@hollow otter yes

#

message objects have the embeds property

earnest phoenix
#

Your bot in front of approximately 0% of the queue.

#

100% when

#

he was asking if the guy who is making him the bot dashboard and asking him for his bot token is scamming him
@earnest phoenix stfu

#

U idiot

#

How to host you're site to your domain (selfhosting)

drifting wedge
#

is paypal integration hard?

earnest phoenix
#

I have a message event in it i require some external files to operate, does require stay in cache after the operations have been complete or no?

lyric mountain
#

is paypal integration hard?
@drifting wedge hard? no, not at all
risky? maybe

spiral crag
#

so i know all the beginner concepts in python and want to learn the intermediate concepts like generators async and stuff. can anyone please suggest an intermediate python tutorial ? I searched up but there is not enough tutorials for intermediate stuff unlike beginner stuff

lyric mountain
#

that was quite a satisfyingly descriptive question

spiral crag
#

thanks

lyric mountain
#

see W3Schools, they have a lot of good tutorials

#

also udemy, but most are paid

spiral crag
#

will see! thanks

sudden geyser
#

so i know all the beginner concepts in python and want to learn the intermediate concepts like generators async and stuff. can anyone please suggest an intermediate python tutorial ? I searched up but there is not enough tutorials for intermediate stuff unlike beginner stuff
@spiral crag I learned a lot of Python from Hyperskill, but they're going to a subscription model seen. Though, if you sign up before 2021, you get 3-4 months free.

earnest phoenix
#

How to selfhost my site?

#

I got a namecheap domain πŸ˜„

tight plinth
#

is there any good embed generator thing online that easily allows users to create embeds and sends a json output? I'm searching one for my bot

earnest phoenix
#

is there any good embed generator thing online that easily allows users to create embeds and sends a json output? I'm searching one for my bot
@tight plinth tim has one iirc

#

lemme find the link in his astro dev server

tight plinth
#

k

earnest phoenix
#

nevermind it's the highlight.js thingu

tight plinth
#

oof

earnest phoenix
#

but I'm sure you can find some embed generator things on bing google

tight plinth
#

ye im trying

earnest phoenix
tight plinth
#

but they are shit, mad for webhooks or output python/js code

#

and when i mean code

#

i mean real code

#

this one is made fr webhooks

earnest phoenix
#

How to selfhost you're website (its in html)

tight plinth
#

so the json output is bad

#

@earnest phoenix use a vpn

earnest phoenix
#

I keep asking it, if no one responses : P

#

@earnest phoenix use a vpn
@tight plinth wait what

tight plinth
#

use a vpn

#

idk i dont use google coz personal data

sudden geyser
#

Hugo wdym. Don't you want a JSON output?

#

The one I was going to link to is the same code917 linked to.

tight plinth
#

it sends json yes

#

but for webhooks

#

not the same as json for discord.js

sudden geyser
#

Then why not just parse it, then get the first element in the array.

#

You can send JSON

#

You don't need to create a messageembed

tight plinth
#

i dont use messageembed

#

lol

#

i use msg.channel.send({embed: JSON OBJECT})

sudden geyser
#

Then you can get the first element in the embeds array and send that, no?

tight plinth
#

eh why not

#

then i gotta check if they send valid json

sudden geyser
#

yes

earnest phoenix
#

bruh

#

JSON.parse("json data").message returns the complete message. All the other data is purely for webhooks.

#

and discord.js has a very similar syntax to just yeeting the message to the discord API without a wrapper so it won't be that fucking hard to figure smth out

#

am i the only one that just absolutely stalks this channel to steal ideas

faint prism
#

I don't steal ideas, lol. But I lurk a good amount

earnest phoenix
#

i steal them when they are good

#

so usually when its not a whitename talking kek

sudden geyser
#

am i the only one that just absolutely stalks this channel to steal ideas
noop, but learn

earnest phoenix
#

eh i already know how to do it

#

so sometimes i just fix stuff for ppl and then steal it

#

ive done that a few times

faint prism
#

Define what you mean by "steal". Are you copy/pasting, or just see a pic and go, "oh, I want that", and build it yourself?

rich ether
#

anyone know why i keep getting errors with import requests
import json
import datetime
import sqlite3
from datetime import timedelta

def cashappTable():
conn = sqlite3.connect('definitelynotadb.db')
c = conn.cursor()
c.execute(
'CREATE TABLE IF NOT EXISTS cashappPayments (sender TEXT, amount TEXT, time TEXT, status TEXT)')
conn.close()

#

im using vsc

faint prism
#

and python

rich ether
#

and i have pip requests installed

#

yes in python

faint prism
#

@rich ether can you send the error/stacktrace?

sudden geyser
#

eh i already know how to do it
learn as in I like this channel to learn from how others may solve a problem.

ebon kelp
#

Does anyone have a lot of experience in Spring boot with mongodb?

faint prism
#

Do you have a question for them if someone does?

ebon kelp
#

yes question

faint prism
#

Just ask it then

delicate shore
#

How to shift from quick.db to mongoose

#

Someone once told me but I can't recall

ebon kelp
#

Querring this in Mongo Compass gives me the correct results

{$or: 
  [
    {'title': {$regex : "po", $options: 'i'} },
    {'tags': {$elemMatch: {$regex : "po", $options: 'i'} } },
    {'categories': {$elemMatch: {$regex : "po", $options: 'i'} } }
  ]
}

However querring this in spring boot gives the following error:
Error: "Query failed with error code 2 and error message '$elemMatch needs an Object'"

@Query("{$or: [" +
  "{'title': {$regex: ?0, $options: 'i'} }, " +
  "{'tags': {$elemMatch: {$regex: ?0, $options: 'i'} } }," +
  "{'categories': {$elemMatch: {$regex: ?0, $options: 'i'} } }" +
  "] }")
List<Product> search(String input);

It's weird, they both have the same querry, but in spring boot I use parameters.
Which shouldn't be the problem, because I've also tested hardcoded

faint prism
#

design your code like this

delicate shore
#

;-!

#

There was a npm package

sudden geyser
#

Write a migration script.

faint prism
#

There was a npm package
@delicate shore Wha- that's a lazy approach. I'd just design your code so you can easily swap out databases whenever you want like in the picture

earnest phoenix
#

How to selfhost a website ?

lean wing
#

First you need to buy a domain and Second there are host that gives you domain and host for 5$

rich ether
#

bruh im sped the error was from me mispelling sqlite3.connect

delicate shore
#

@delicate shore Wha- that's a lazy approach. I'd just design your code so you can easily swap out databases whenever you want like in the picture
@faint prism
Wait you can ?

#

You mean you'll do it for me ?

faint prism
#

You mean you'll do it for me ?
@delicate shore "I'd just" Meaning, if i was you, I would do {X} vs your approach.
So, no? lol

ionic dawn
#

is there a way to see the user role that is giving him the displaycolor?

#

couldnt find anything

tardy hornet
#

someone here want command for command? (i will give him one of my commands for him to make me one)
if yes DM me

ivory seal
#
        const client = new Discord.Client();
        const DiscordOauth2 = require("discord-oauth2");
         const oauth = new DiscordOauth2();
         
         

    oauth.tokenRequest({
        clientId: "b",
        clientSecret: "a",
    
        code: accessCode,
        scope: "identify guilds guilds.join",
        grantType: "authorization_code",
        
        redirectUri: "http://localhost:5500",
    }).then(m=>{
        const access_token = m.access_token;
        oauth.getUser(access_token).then(user=>{
           let guild = client.guilds.cache.find("761736406669852672");
           user.add("767760486702776361");
          
        });
    })
         



        client.login("NzY3MDIxNDY1Njc2NTQ2MTE4.X4r2Zw.7eOTjh9eObrHpkXpc3Rx90Uty8Y");
    ``` it returns ``TypeError: user.add is not a function``
tardy hornet
#

we can see your token

misty sigil
#

nice token

tardy hornet
#

and read the error

delicate shore
#

That's a rip for me

ivory seal
#

its a wrong token ofc lolz

tardy hornet
#

and read the error

sharp hollow
#

nice fake token

ivory seal
#

i regenerated ofc lmao

#

like i would post a public token lmao

tardy hornet
#

bro

#

read the error

delicate shore
#

Abcdb

ivory seal
#

yes but according to guides thats the fnction

sharp hollow
#

What does this error mean? ```JS
(node:22) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
2020-10-19T14:56:43.203486+00:00 app[worker.1]: at IncomingMessage.<anonymous> (/app/node_modules/dblapi.js/src/index.js:118:25)
2020-10-19T14:56:43.203486+00:00 app[worker.1]: at IncomingMessage.emit (events.js:326:22)
2020-10-19T14:56:43.203487+00:00 app[worker.1]: at endReadableNT (_stream_readable.js:1223:12)
2020-10-19T14:56:43.203487+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
2020-10-19T14:56:43.203585+00:00 app[worker.1]: (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2020-10-19T14:56:43.203668+00:00 app[worker.1]: (node:22) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

ivory seal
#

its unaothrized

faint prism
#

which means your token is invalid

sharp hollow
#

Uhhhh

faint prism
#

or some other net request you do, can't tell from line numbers alone

sharp hollow
#

lemme regen and use again

ivory seal
#

this is oauth right @sharp hollow ?

sharp hollow
#

not discord oauth

pale vessel
#

so oauth lmao

sharp hollow
#

which means your token is invalid
@faint prism lol, error solved

faint prism
#

Client ID + Client Secret => Token (OAuth btw)

earnest phoenix
#

How to selfhost a server in HTML, could someone please help me?

#

I am asking this now for a while πŸ˜‚

faint prism
#

How to selffhost a server in HTML, could someone please help me?
@earnest phoenix That's Easy what language are you wanting to use

#

And don't say English

earnest phoenix
#

Html

pale vessel
#

html xd

#

lmao

earnest phoenix
#

ye i litterly said it

faint prism
#

No, I mean what backend language

earnest phoenix
faint prism
#

You derp

earnest phoenix
#

css?

pale vessel
#

you don't need backend if you're going to use html

faint prism
earnest phoenix
#

You mean?

pale vessel
#

just setup a webserver

faint prism
#

Hosting can't be done with HTML

earnest phoenix
#

How?

pale vessel
#

and host html files

earnest phoenix
#

How tho

faint prism
#

I'm asking for the BE/hosting language

pale vessel
#

you don't need it

faint prism
#

Some something that isn't markup

pale vessel
#

you can use html as is

faint prism
#

okay, fine

earnest phoenix
#

How to start a webserver

faint prism
#

The webserver is what I'm refering to

pale vessel
#

you should just use github pages if you want to host static html

faint prism
#

I referring to the Backend service that provides the html pages for a GET request. ie. The web "server"

pale vessel
#

"language"

#

xd

faint prism
#

ExpressJS, ASP.NET, Flask, Etc
JS, C#, Python, etc

#

Languages^

tardy hornet
#

someone here want command for command? (i will give him one of my commands for him to make me one)
if yes DM me
(lang: js)
(in cases)

pale vessel
#

yep, those are what i thought when you said languages

#

command for command is such a weird concept

delicate shore
#

I don't get what you are saying
Maybe your broken tooth is causing you problem in speaking

tardy hornet
#

someone here want command for command? (you will make me a command that i need+dont know how to make, and i will give you one of the commands i made)
if yes DM me
(lang: js)
(in cases)

#

better ?

sudden geyser
#

It's just a weird concept

tardy hornet
#

@delicate shore

sudden geyser
#

Commands aren't like cards

#

They may or may not work

tardy hornet
#

ik

delicate shore
#

Yes

#

Ok I give you my command you gimme your

#

if(message.content = "megay"){
message.channel.send("yes you gay")}

#

Now gimme your economy command

tardy hornet
#

user left the channel

snow urchin
delicate shore
#

No-one will download the file Callum imo

#

Maybe use hastebin or pastebin

tardy hornet
#

lol downloaded it

snow urchin
delicate shore
#

Thnx

#

Holy crap

snow urchin
#

yes.

tardy hornet
#

yup

solemn latch
#

"info This module is OPTIONAL, you can safely ignore this error success Saved 1 new dependency."

snow urchin
tired panther
#

How to make a guild count on top.gg

#

page

#

?

tardy hornet
#

is it a thing?