#development

1 messages · Page 327 of 1

earnest phoenix
#

@scenic crest It's a string

#

the hex for it is 0x8 but Discord.js just interpretes it for you

earnest phoenix
#

@sinful meadow a lot*

sinful meadow
#

Eh

#

i dont care lmao

earnest phoenix
#

lol

sinful meadow
#

Who really gives a fuck on the internet @earnest phoenix

earnest phoenix
#

i do.

sinful meadow
#

I dont

earnest phoenix
#

cool

sinful meadow
#

Its the internet

#

Express yourself

earnest phoenix
#

ok

sinful meadow
#

They dont know the true you

earnest phoenix
#

:/

#

or do they...

#

👀

low niche
#

how would you read the latest article from this https://newsapi.org/v1/articles?source=engadget&sortBy=latest&apiKey=apikey-here and post it to Discord?
and by the way, the JSON looks like this: https://haste.passthemayo.space/izotosoxop.pl

#

in JS

earnest phoenix
#

what is it

low niche
#

news cmd

earnest phoenix
#

aaaa js

low niche
#

lol

earnest phoenix
#

do you wanna read it into a list or array

#

or wot

#

or dict

#

just google™

#

I'm doing all this using google

#

@low niche

low niche
#

@earnest phoenix list

#

i want to return the title, description, url and image

earnest phoenix
#

GOOGLE

#

@low niche &

#

that link help

low niche
#

@earnest phoenix lol

#

thanks kotlin

earnest phoenix
#

Hello?

#

Erm i have a question

#

Heeelllooooo????

elder rapids
#

so then ask it

earnest phoenix
#

Okay

#

Well

#

Im trying to get a server ID

#

But im sure thats not correct

trim steppe
#

Wew

earnest phoenix
#

At all lol

trim steppe
#

Have you tried consulting the documentation

elder rapids
#

"group"

earnest phoenix
#

Yes

elder rapids
#

lol

trim steppe
#

That might help

earnest phoenix
#

Lol

#

Its what i have been using this whole time

elder rapids
#

Discord servers are called guilds

earnest phoenix
#

To create the other commands

trim steppe
#

Are you lying?

earnest phoenix
#

Ik

#

Nope

trim steppe
#

Guilds

earnest phoenix
#

Yes

#

So

trim steppe
#

Yes!

earnest phoenix
#

ALRIGHTY!

trim steppe
#

Where did you think it was called group

earnest phoenix
#

It auto completed

trim steppe
#

No no no no

earnest phoenix
#

In my vcs

trim steppe
#

Check the documentation

earnest phoenix
#

Okay

#

Oh ye

#

It shows all the keywords and end strings

trim steppe
#

Check before you ask

earnest phoenix
#

I did lol

trim steppe
#

Well it wouldn't come up with group

#

Are you using djs?

earnest phoenix
#

No

#

Im using node.js

#

And visual code studio

#

Along with discord.js and commando

#

Lel

trim steppe
#

Well you do

#

Please don't complicate things

#

It makes it harder to help you

earnest phoenix
#

Okay...

#

.>

trim steppe
#

You said no but you are using it

earnest phoenix
#

Lol oml

#

Bruh

jagged plume
#

nice

earnest phoenix
#

I found out the last strings are similer between users and channels and servers

#

like .id

trim steppe
#

Found out?

earnest phoenix
#

Yes, from the documentation

#

That you gave me lol

trim steppe
#

wew

earnest phoenix
#

Now i need to find a way to incorperate mentions

#

.>

#

So you can do like a mention ID

#

Welp, time to expeariment!

#

Thx guys!

sinful meadow
#

@earnest phoenix

#

roll: Rolls a die

earnest phoenix
#

Lol yep

#

Rolls a die

#

Oh nu wait

tawny lava
#

What’s the point of showing someone a channel / guild / user Id thonkku

earnest phoenix
#

Development purposes lol

#

Also general knowledge

#

Such as other bot's ID bans

shrewd field
#

hey how can i make in a dm message separate lines from a bot

fluid fable
#

h!help

#

-bots

gilded plankBOT
#
🎃sedoCremaG🎃#0257
Bots

@timid bolt

fluid fable
#

-bots @timid bolt

gilded plankBOT
#

Bots don't have bots, silly.

fluid fable
#

-userinfo

#

h!userinfo @fluid fable

austere meadow
#

does anyone know who does the backend on https://discordbots.org/? i wanted to ask a quick question about how it works

bitter sundial
#

that would be me

austere meadow
#

if you are alright with me asking, how do you handle user logins and oauth2 token storage? i am trying to make a website in node.js but im a bit stuck 🤔

bitter sundial
#

refer to oauth2 docs and store to a database

noble hazel
#

@bitter sundial what lang/lib

bitter sundial
#

@noble hazel for?

noble hazel
#

the site

#

:P

bitter sundial
#

oauth?

noble hazel
#

the site itself

bitter sundial
#

nodejs

noble hazel
#

cool

#

:o

bitter sundial
#

express

noble hazel
#

👌

earnest phoenix
#

Thx Luca

scenic crest
#

!!test

supple ocean
#

code=

 await client.change_presence(game=discord.Game(name=f'$help | Servers: {len(client.servers)} | Users: {len(client.users)}'))```
error =
```Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\Roei\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 223, in _run_event
    yield from coro(*args, **kwargs)
  File "C:/Users/Roei/Desktop/Skeletron Bot/main.py", line 16, in on_ready
    await client.change_presence(game=discord.Game(name=f'$help | Servers: {len(client.servers)} | Users: {len(client.users)}'))
AttributeError: 'Client' object has no attribute 'servers'```
if anyone is able to help than thanks
scenic crest
#

what does the error say?

supple ocean
#

Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\Roei\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 223, in _run_event
yield from coro(*args, **kwargs)
File "C:/Users/Roei/Desktop/Skeletron Bot/main.py", line 16, in on_ready
await client.change_presence(game=discord.Game(name=f'$help | Servers: {len(client.servers)} | Users: {len(client.users)}'))
AttributeError: 'Client' object has no attribute 'servers'

scenic crest
#

the error says 'Client' object has no attribute 'servers'

#

what do you think that could mean

supple ocean
#

well

#

i just got told on rewrite it got changed to guides

#

guild*

scenic crest
#

mhm

supple ocean
#

what should the client.users change to

#

nvm actually works!

shrewd field
#

hey how can i make like this

scenic crest
#

the link?

#

nold?

#

bold

shrewd field
#

the lines are under each other

scenic crest
#

\n

#

that's a newline character

shrewd field
#

and the requested

scenic crest
#

requested is a footer

shrewd field
#

how do i do it in embed

scenic crest
#

stating your lib would be a good start#

stone kiln
#

msg.channel.user

#

in d.js

shrewd field
#

js

scenic crest
#

js is not a library

#

it's the language

#

there are like, 5

shrewd field
#

d.js

scenic crest
#

ah

#

then ^^

shrewd field
#

then what

scenic crest
#

computerfreaker - Today at 14:34
msg.channel.user
in d.js

#

set the embed footer to that

umbral pelican
#

the heck is msg.channel.user

shrewd field
#

k

#

403

#

how do i do the lines

stone kiln
#

after your whole text do ,true

#

it will make it in line

shrewd field
#

whole text like this

earnest phoenix
#

ya

stone kiln
#

yeah

earnest phoenix
#

but eww embed builder

shrewd field
#

i have it

#

but

#

it makes this

#

error

stone kiln
#

no after .addField don't put a ;

shrewd field
#

ok

scenic crest
#

these damn ads istg

shrewd field
#

it says

jagged plume
#

.addField("", "", "", "")

#

is what he has done

#

lol

shrewd field
#

yep

#

is it wrong

stone kiln
#

yes

jagged plume
#

Yes.

shrewd field
#

isnt that what makes separate lines

#

ok

stone kiln
#

no

shrewd field
#

how can i make seperate lines in embed rich embed

stone kiln
#

.addField(some text, true)
.addField(more text, true)
.addField(somewhat more text, true)

#

for every line that has " "

shrewd field
#

this what u mean

stone kiln
#

;

#

semi-colin!!!!!!!!

#

!!!!!!

shrewd field
#

add semi-colin

stone kiln
#

no

#

delete that semi-colin

shrewd field
#

this

stone kiln
#

still wrong

#

no semi-colins

#

are needed

shrewd field
#

this is what i get for deleting semi colin

#

ok thanks it worked

stone kiln
#

np

#
 url(image => {
        var emb = new Discord.MessageEmbed()
        .setDescription(`[image link](${image})`)
            .setImage(image)
            .setColor([
                Math.floor(Math.random() * 256),
                Math.floor(Math.random() * 256),
                Math.floor(Math.random() * 256)
            ]);

        msg.channel.send({
            embed: emb
        });
    });```
this is how i have done it btw
shrewd field
#

how do u make a kick command

#

that works

#

i have this but it doesnt work

#

the rest

stone kiln
#

i have to go
and look at examples online

#
client.on("message", (message) => {
    if (message.content.startsWith("/kick")) {
        // Easy way to get member object though mentions.
        var member= message.mentions.members.first();
        // Kick
        member.kick().then((member) => {
            // Successmessage
            message.channel.send(":wave: " + member.displayName + " has been successfully kicked :point_right: ");
        }).catch(() => {
             // Failmessage
            message.channel.send("Access Denied");
        });
    }
});```
@shrewd field simple example
shrewd field
#

and

#

nvm

stone kiln
#

just do ** text **

shrewd field
#

the one for kick u did

#

works

#

just copy paste

#

or there is edits i should do

stone kiln
#

you can edit it with reasons and that kind of stuff

#

this is just a basic example

shrewd field
#

ok

#

thanks

stone kiln
#

np

shrewd field
#

how reasons

stone kiln
#

you know reasons why that person got kicked

#

but i have to go now

#

work and stuff

shrewd field
#

ok

#

thanks

#

guys i have this code

#

error

stone kiln
#

did you global define prefix

shrewd field
#

yes

#

i did

#

i defined it

#

anyone

uncut slate
#

there might not be any mentions

shrewd field
#

anymentions

#

what do u mean

uncut slate
#

that code expects a mention

#

there might not be one

#
const member = msg.mentions.users.first();
member // will return undefined if there are no mentions
member.kick() // will throw 'cannot read property kick of undefined'
shrewd field
#

ok i will retry

shrewd field
#

aeth

#

it has the same error still

uncut slate
#

what did you change

supple ocean
#

hm

#

at python rewrite how do i send a DM to user?

shrewd field
#

i didnt change anything

#

@uncut slate

uncut slate
#

well duh

shrewd field
#

the code works but

#

it only gives the part which says "access denied"

#

not the kicked

#

how can i make it say kicked user

scenic crest
#

message the channel

shrewd field
#

huh

scenic crest
#

and say the user was kicekd

#

xD

shrewd field
#

look

stone kiln
#

meber instead of member

shrewd field
#

ohh

#

member

#

actually i fixed it

#

but this is old

#

it is fixed from meber to member

stone kiln
#

okay

shrewd field
#

scrnshot

#

above with the bot

#

i want it to kick not say access denied

#

computer freaker

#

hello

lavish mango
shrewd field
#

computer freaker

bitter sundial
#

typing their name wont help much

shrewd field
#

ok

supple ocean
#

anyone can help me

shrewd field
#

can i mention

lavish mango
#

@supple ocean with what?

shrewd field
#

tonkuu

supple ocean
#

You know python rewrite?

bitter sundial
#

dont mention multiple times

shrewd field
#

ok

bitter sundial
#

like just
don't be annoying with the mentions

supple ocean
#

@lavish mango

shrewd field
#

@stone kiln @uncut slate

bitter sundial
#

remember that we're talking over text

uncut slate
#

Dude.

stone kiln
#

???

shrewd field
#

can u help

bitter sundial
#

not irl face to face

lavish mango
stone kiln
#

i'm partially busy with other stuff

shrewd field
#

ok

uncut slate
#

you literally just got told to stop mentioning people randomly.. @shrewd field I've told you so many times. If someone can help, they will.

shrewd field
#

ok

supple ocean
#

rip

uncut slate
#

Just ask your question and wait.

shrewd field
#

ok

supple ocean
#

If so, plz help

lavish mango
#

just post your question

supple ocean
#

Im trying to make a $Report command, It should be like: $Report @Roi#4575 spamming and then it sends DM to the owner of the server

lime falcon
#

Though I'm not officially a dev so my answers come with a grain of salt :P

#

You can get the server owner with Guild.owner, and the Member object is a child of messageable

#

So you can just do Guild.owner.send() to send a PM to them

supple ocean
#

oh

#

i found out to send DM to the owner

#

ik

#

member.guild.owner.send()

#

But now I need the message inside the $Report will be sent

#

Not "test"

lime falcon
#

If you want to just pull all that the person typed, you take in def report(ctx, *message)

scenic crest
#

*message?

#

python has pointers?

lime falcon
#

In a function definition, *args means 'take in any number of arguments'

#

And it gives them to you as a tuple

#
@commands.command()
async def report(ctx, *message):
    message = ' '.join(message)
    ctx.guild.owner.send(message)
scenic crest
#

ahh like varargs?

lime falcon
#

Yeah

scenic crest
#

weird cuz in the langs I code in that's either a pointer or a spread operator

lime falcon
#

Yeah. Python doesn't have explicit pointers, though all lists, dictionaries, and class instances are actually pointer variables

scenic crest
#

ahh yeah

#

so like Java I presume

lime falcon
#

Yeah

#

Learning some of this stuff was a pain, when you're not explicitly taught it. Especially as it relates to imports.

scenic crest
#

I'm struggling so much with pointers

#

Java and Kotlin did it for me

#

now Go's like

#

here have these pointers and stuff, enjoy!

lime falcon
#
import lib
from lib import func_a
assert lib.func_a != func_a
scenic crest
#

👀

lime falcon
#

import lib creates an import object for lib. From lib import function copies that function into your __main__ area.

#

So thus, they're two different copies of the same function

#

Other fun special python intake form is

def function(**kwargs):
    for key in kwargs:
        print(key, kwargs[key])

function(a="123", hello="world")

Prints

a 123
hello world
#

*args is an unnamed tuple. **kwargs is a dictionary of named input values.

scenic crest
#

👀

#

bamboozled

lime falcon
#

Python is fun. Anyways back to making sure the bot does what it should on server join.

scenic crest
#

👍

shrewd field
#

the code works but
it only gives the part which says "access denied"
not the kicked
how can i make it say kicked user

surreal peak
#

params IMessage messages best way @scenic crest 😏

scenic crest
#
public void method(String required, String... optional) {}```
#

@surreal peak

surreal peak
#
public async Task Report(IUser user, [Remainder] string reason) {}
scenic crest
#
fun method(required: String, vararg optional: String) {}```
surreal peak
#

remember the mighty RemainderAttribute

#

fun

#

wut

scenic crest
#

func

#

Kotlin

surreal peak
#

oh k

#

weird

lime falcon
#

That's one fun method

scenic crest
#

yeah kotlin is so weird

#

but it's weird to the point where it's just cool

#
func method(required string, optional ...string) {}```
shrewd field
#

anyone

#

knows my error

scenic crest
#

nop

shrewd field
#

Why

#

403 forbidden

#

Do u know how to make a kick command with d.js

scenic crest
#

no

shrewd field
#

Ok

#

If someone knows tell me plz

jolly zodiac
#

I give up. I just can’t get the server count to update with Python. Even when I try @royal pelican’s example from #312614469819826177, all GET https://discordbots.org/api/bots/363007359204982786/stats gives me back is {"shards":[]}. Also, my bot’s page on discordbots.org says that my bot is offline, even though it’s not. Am I missing something? I can’t find any more documentation than that given on https://discordbots.org/api/docs.

prime cliff
#

@jolly zodiac The bot offline thing is a website bug

jolly zodiac
#

But it seems to work for other bots.

prime cliff
#

Did you use the bot specific tokens?

jolly zodiac
#

Yes I did.

shrewd field
#

guys

#

does anyone know how to make a title for a field in richembed

lavish mango
#

@shrewd field could just use   if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("you don't have the correct perms to use this commans"); instead of using catch

shrewd field
#

ok

bitter sundial
#

@jolly zodiac it's supposed to be a post request

lavish mango
#

.settitle("text")

shrewd field
#

ok

#

can i do it for multiple fields

prime cliff
#

Oh yea

lavish mango
#

Can only do titles once

shrewd field
#

why like this

#

how

jolly zodiac
#

Does that help?

#

(Even though it’s originally meant for Python)

lavish mango
#

You can do .addfield("Usage !8ball", "Ask a question") @shrewd field

shrewd field
#

ok

#

i want multiple

#

8ball cat and face

lavish mango
#

You can do multiple .addfields

shrewd field
#

and i need the description part

lavish mango
#

Only things like title, description, footer are limited to 1

shrewd field
#

how did this guy do it

#

how did he do it

jolly zodiac
#

@bitter sundial It is, I just used the GET request to check if it has worked.

shrewd field
#

huh

bitter sundial
#

check the error from the post

shrewd field
#

how does he do it

trim steppe
#

The documentation for embeds are on the discord API docs

jolly zodiac
#

It doesn’t seem to give me any errors, @bitter sundial. Or I’m overlooking something.

bitter sundial
#

check status code and response body

#

if you dont get those you aren't sending anything

jolly zodiac
#

I get HTTP code 200 – OK

#

And I’m POSTing {"server_count": 3}

#

@bitter sundial

#

But even then the response body just says {"shards":[]}

scenic crest
#

Server count is supposed to be used non sharding I think

jolly zodiac
#

And it doesn’t matter if I use the example or my own solution: ```python

count
b'{"server_count": 3}'
testreq = urllib.request.Request("http://discordbots.org/api/bots/363007359204982786/stats")
testreq.add_header("Content-Type", "applications/json")
testreq.add_header("Authorization", "my token")
resp = urllib.request.urlopen(testreq, count)
resp.read()
b'{"shards":[]}'
resp.getcode()
200

inner jewel
#

you can use it while sharding too

jolly zodiac
#

And it’s just the response, anyway.

bitter sundial
#

the status and body of the post request

#

but looks like you're not posting at all

shrewd field
#

hey how do u make a guildcount command

#

i dont know how to build it

scenic crest
#

you make a regular command and make it return the number of guilds

#

if you're using d.js

#

bot.guilds.size

#

or client.guilds.size

#

depends on what you called the instance

inner jewel
#

instance.guilds.size

#

myVar.guilds.size

jolly zodiac
#

I am posting. If you give urllib.request.urlopen() a second argument, that’s what it will post. If you just pass it one argument, namely the Request object created before, it’s just a GET request.

#

And the method returns an object containing the server’s response.

#

You could also include the POST data in the Request object itself, but the results should be the same.

#

My solution is more or less like they do it in the Python documentation.

#

Only that it’s JSON.

shrewd field
#

hey

#

403 forbidden

#

does this work for guildcount

#

@scenic crest

scenic crest
#

it's red

#

so I don't think so

#

try bot

shrewd field
#

i have it client

#

it says

#

unexpected token

#

{

scenic crest
#

ah

#

could be that you don't need to put +

#

that should be inside the quotation marks

#

"blah ${x.y} blah blah"

shrewd field
#

ok

#

why does the bot say NaN

scenic crest
#

idk

shrewd field
#

didnt excute

#

dude

bitter sundial
#

@jolly zodiac well it's not working. Despite having the second argument it is still doing a get

shrewd field
#

ok

south bolt
#

ok

#

ok

shrewd field
#

it works

south bolt
#

ok

#

ok

jolly zodiac
#

Meh.

#

I’ll have to look into that tomorrow. Thanks for the support, anyway!

earnest phoenix
#

@shrewd field you tried to insert ${client.guilds.size} into something that isn't a template literal

#

So no, that wont work

topaz fjord
#

anyone know sqlite3

median lintel
#

no

earnest phoenix
#

Anyone interested in helping with my bot? You need to be good with working on stuff using many API's OR you can help with the back end database systems... I'm making a bot that acts as a bridge between Discord, normal phone calls, SMS and many other messaging platforms such as Telegram, Email, WhatsApp, Facebook Messager, a Socket.IO chatroom, IRC, and more. We're using twilio for SMS and voice calls right now, but we're open to change. We haven't decided on a database yet, so if you'd like to use a certain database, be prepared to explain the pros and cons of it as well as why it will fit our needs better than another option. Knowledge of server-side JavaScript is required. DM me on Discord (moose#3054) or email me: cooper@moosehub.xyz

#

DM me if you are

#

@unique jasper BRO

#

XD

cerulean zinc
#

If I knew more JS, I'd be more than glad to help @earnest phoenix

earnest phoenix
#

How much do you know? @cerulean zinc

cerulean zinc
#

Not exactly sure

earnest phoenix
#

Also someone who can work with the server side stuff

cerulean zinc
#

Its kinda like C# in a way, im sure id be able to catch on quick

earnest phoenix
#

Yeah

#

DM me

cerulean zinc
#

Me?

earnest phoenix
#

If you're interested

earnest phoenix
#

how could i filter out text channels from this

#

client.guilds.forEach(g => g.channels.first().send(content))

#

?

sinful meadow
#

uh @earnest phoenix

#

What are you trying to do

trim steppe
#

find()

earnest phoenix
#

xD

#

no

#

this is for an announcement command

#

xD

trim steppe
#

annoucement command

earnest phoenix
#
const Discord = require('discord.js')
exports.run = (client, message, args) => {
let content = message.content.split(' ').slice(1).join(' ');

client.guilds.forEach(g => g.channels.first().send(content))
}
#

just a basic one

#

i need to filter it

median lintel
#

very basic

trim steppe
#

why do you need Discord

earnest phoenix
#

so it only sends to text channels

#

xD

median lintel
#

ye

#

y u need Discord

earnest phoenix
#

im going to be adding embeds later

median lintel
#

i dont have that in my bot

trim steppe
#

please don't use richembed

earnest phoenix
#

xD

median lintel
#

use a simple embed

earnest phoenix
#

k

trim steppe
#

not simple embed

#

use an object

earnest phoenix
#

thats not helping my

trim steppe
#

anyway

earnest phoenix
#

problem

#

xD

trim steppe
#

what was your problem?

earnest phoenix
#

i need to filter out text channels

#

from this

#

const Discord = require('discord.js')
exports.run = (client, message, args) => {
let content = message.content.split(' ').slice(1).join(' ');

client.guilds.forEach(g => g.channels.first().send(content))
}

median lintel
#

just check if it is a textchannel

#

if not

earnest phoenix
#

client.guilds.forEach(g => g.channels.first().send(content))

umbral pelican
#

.filter()

median lintel
#

do nothing

earnest phoenix
#

ik

trim steppe
#

use client.channels

earnest phoenix
#

but

#

ehh

#

k

trim steppe
#
client
    .channels
    .filter((channel) => channel.type === 'text' && channel.name.includes('announce'))
    .send('ping');
earnest phoenix
#

client.channels.filter((channel) => channel.type === 'text' && channel.name.includes('announcements'))

#

?

#

xD

trim steppe
#

it filters out text channels

earnest phoenix
#

k

#

ik

#

i need

#

a forEach

#

or map

#

someone said

#

:3 but i dont know where to add them

trim steppe
#

For each to send message

earnest phoenix
#

Uh guys

#

I have a question

#

How do i work mentions into the code?

lime falcon
#

What library are you using?

earnest phoenix
#

Commando and discord.js

#

Like

#

I want to have it so you can mention a user

#

And i.e. it gets their ID

lime falcon
#

Alright. Just quick note that if it's similar to discord.py there should be methods for getting mentions from a user object

earnest phoenix
#

Erm k

lime falcon
#

I'm looking up documentation quick

trim steppe
#

Use <@id here>

earnest phoenix
#

No

#

I ment

#

Im looking at the documentation

#

So

trim steppe
#

message.mentions?

earnest phoenix
#

Hm

#

Like

#

You mention a user

lime falcon
#

.toString()
When concatenated with a string, this automatically concatenates the user's mention instead of the Member object.

earnest phoenix
#

And it gets their ID

lime falcon
#

Ohhh

trim steppe
#

message.mentions

#

That

earnest phoenix
#

I know how to get the ID bit

#

Oh thx!

trim steppe
#

wow

earnest phoenix
#

Just inside a function?

trim steppe
#

Message mentions and then get the tag of the user

earnest phoenix
#

The ID yes

#

SO

#

*So

trim steppe
#

Pretty sure message.mentions returns a user

#

So you can just do message.mentions[0].tag

earnest phoenix
#
//message.reply(message.mentions + "'s ID is: " + message.mention.id)?
trim steppe
#

Mentions is an array of users

#

Read the doc

earnest phoenix
#

I did

#

Bruh

trim steppe
#

Well why are you using an array in the string

earnest phoenix
#

MessageMentions

#

Oh

#

Wait

#

Whoops

#

My bad

#

The array is supposed to be out of the string

#

Dere

#

whoops

#

Okay there

#
////message.reply(message.mentions.username + "'s ID is: " + message.mention.id)
#

So this?

#

WAIT

#

Okay

trim steppe
#

Array

earnest phoenix
#

Is this the proper code?

trim steppe
#

How do you access elements of an array

earnest phoenix
#

?

trim steppe
#

Do you know JavaScript?

earnest phoenix
#

Yes lmfao

umbral pelican
#

🤦

earnest phoenix
#

I dont know the terminology

#

I call them extentions lol

trim steppe
#

Wtf

earnest phoenix
#

Ugh dont judge :/

trim steppe
#

Properties

earnest phoenix
#

?

#

Arrays

#

Collections

#

Actually

trim steppe
#

You need to research terms

earnest phoenix
#

User_pattern

trim steppe
#

Is message.mentions a collection or an array

#

because a collection is a d.js extension of a map

#

You need to use .first() instead there

earnest phoenix
#

MessageMention

#

Thats what the documentation says

#

So wait

umbral pelican
#

you'll need message.mentions.users or .members

earnest phoenix
#

Okay thanks lol

#

Dats all i wanted to know xD

trim steppe
#

I didn't have the docs on hand

umbral pelican
#

read the docs then 🤦

earnest phoenix
#

I did XD

trim steppe
#

Im on my phone

#

You can't understand the docs

earnest phoenix
#

I can

trim steppe
#

If you don't understand the terminology

earnest phoenix
#

Alright so, now i can create a ban system along with a ping ID system

#

Bro

#

Of course i dont understand

#

The terms

#

Lol

#

All i know is that there are .<values>

#

Lol dont judge pls

#

Alrighty created a testing thing

#

Uh

#

It came up "Undefined's id is: undefined"

umbral pelican
#

because it's an array

earnest phoenix
#

Okay

umbral pelican
#

collection

earnest phoenix
#

I have used arrays in this though

#

i.e.

umbral pelican
#

map

earnest phoenix
#
//message.reply(message.channel.name + "'s ID is: " + message.channel.id);
#

This works fine

#

.>

umbral pelican
#

read.the.docs

earnest phoenix
#

OH

#

WAIT

#

Its a continued

#

Its undefined

umbral pelican
#

wtf

trim steppe
#

Check if it exists first

earnest phoenix
#

Oml 🤦

#

I get it now lmao

trim steppe
#

In case there is no mention

earnest phoenix
#

?

#

Uh k

#

Why though lol

#

Um

#

It needs a map

#

AH

#

wait

trim steppe
#

It's a map

#

Read the docs for a collection

#

Which is an extension of a mao

#

Mao

#

Map

earnest phoenix
#

Should i use an array?

#

To store the data?

#

"Array.map"

#

sure

#

you could use sql or enmap but it's really your choice.

#

;-;

trim steppe
#

Array.map is different

#

That goes through an array and does something with every element

earnest phoenix
#

Okay

#

So an array is basically a storage table

#

Understood

trim steppe
#

Well a stack of plates really

#

You can count the plates from bottom to top

earnest phoenix
#

Alright, so how would this be useful in mentions >.>

trim steppe
#

You need the first mention

#

The message.mentions is a collection

earnest phoenix
#

message.mentions

#

Should i assing that to a variable?

#

*assign

trim steppe
#

Therefore you need to use .first() on the collection

earnest phoenix
#

Ah

#

Okay

#

So

#

wait

#

Hm

#

Attached to what?

#

Any function?

#

Nonono

#

.>

#

Okay wait

#

So whats happening is

#

The message.mentions is turning it into an ID

#

I need to store that ID

#

Then call it?

#

message

#

.mentions

#

.first()

#

Okay

#

What do i put inside first?

#

Like what kind of code

#

Oh

#

Hm

#

So in this case it would be .first(1)?

#

Since i need 1 value?

#

okay what do you want to do

#

I want to get a user's ID from their mention

trim steppe
#

Wat

#

.first() only gets the first

earnest phoenix
#

okay so if a user mentions your bot you want to get the id of them?

trim steppe
#

Read the docs

earnest phoenix
#

I did

#

It says to put a number value

#

wot.

trim steppe
#

Screenshot the docs for .mentions

#

Need to get things straight

earnest phoenix
trim steppe
#

You need to learn how to read the docs correctly because trying random values won't help

earnest phoenix
#

It says to put a count in .first([count])

trim steppe
#

Throw a URL at me

earnest phoenix
#

?

#

Which?

trim steppe
#

message

earnest phoenix
#

Its not in message though

#

Its in collections

#

The count is optional.

#

Oh

#

Okay

#

I assigned the code to a variable

#

So according to what you guys said

#

It should get the first mention

#

And store it

trim steppe
#

Wait

earnest phoenix
#

?

trim steppe
#

Message is the messagr

#

.mentions are mentions

earnest phoenix
#

Yes

#

Yes

trim steppe
#

.members are members that are mebtiobed

earnest phoenix
#

var mentions = new message.mentions.first()

trim steppe
#

No no no

#

New?

earnest phoenix
#

Mebtiobed?

trim steppe
#

I'm on a phone

#

Ignore it

earnest phoenix
#

Oh

#

Okay

trim steppe
#

message.mentions.members.first().id

earnest phoenix
#

AH

#

Okay now i get it

#

So it gets the first member mention and gives the id

trim steppe
#

click through blue links to see what things an object has

earnest phoenix
#

Wow this is very specific lol

#

Okie

#

Thanks so much

#

😃

#

Uh

#

Nvm

#

-bots @earnest phoenix

gilded plankBOT
#
moose#3054
Bots

@serene moon
@mossy magnet

earnest phoenix
#

Is it the same thing with the username?

#

what?

#

message.mentions.members.first().username?

#

@earnest phoenix yes

#

It comes up undefined

#

.>

#

The ID thing works

#

But the name doesnt

umbral pelican
#

because it's a member not user

earnest phoenix
#

Yes...

#

?

#

OH

#

Okay

#

So instead of members

#

It would need to be

#

oh yeah yeah you could do message.mentions.members.first().user.username

#

user?

#

OH

#

Okay so you need a

#

Ohhhhhhh

#

Okay

#

I need to make @mossy magnet work

#

Hm

#

Whats wrong with it?

sinful meadow
#

HOW DARE YOU SAY IT

#

Whats wrong with him @earnest phoenix

earnest phoenix
#

doesn't work

#

I haven't worked on it in months

#

any errors?

#

Oh

#

Okay ye

#

Any errors?

#

And i dont like to assume bot's genders because some dude yelled at me for that so i say it lmao

#

lol

#

Erm

#

Okay

#

Trying to make my bot send friend requests

#

Code i have:

#

message.author.user.addFriend(message.author)

#

Is this correct?

#

It comes up with an error

#

Ah wait

umbral pelican
#

did you read what the error said 🤦

trim steppe
#

🤦

#

Probably promise rejection warning with no reason

#

Because it was uncaught

earnest phoenix
#

I need to catch it?

#

Okay

trim steppe
#

Catch those warnings

earnest phoenix
#

How lol >.>

trim steppe
#

You need to research promises

#

that's a new thing in js

#

well not new new

umbral pelican
#

or do you call them something else in your terminology bloblul

trim steppe
#

but new enough to not be taught widely

#

"things that return something later"

earnest phoenix
#

Lmao

#

Okay

#

So i need to catch this

#

🤔

trim steppe
#

No

#

Well you can

earnest phoenix
#

Apparently it wont let me if i dont lol

trim steppe
#

But then you'll just delete the code after seeing the error anyway

earnest phoenix
#

Oh

#

Also

trim steppe
#

It'll be fun finding out how to catch promises

earnest phoenix
#

.>

#

message.author.members.first().clientuser.addFriend(message.author)

trim steppe
#

(promise).catch((error)=>{
console.log(error)
})

umbral pelican
trim steppe
#

Lol

earnest phoenix
#

I did lol

umbral pelican
#

;-;

earnest phoenix
#

My bot has a user account

trim steppe
#

Wait what

#

Selfbot?

earnest phoenix
#

No lol

#

OHHHHH WAIT

trim steppe
#

I'm sorry I'm going to contact b1nzy

umbral pelican
#

🤦

earnest phoenix
#

XDDDDDDD

#

Im such a freaking noob oml

trim steppe
#

RTFD

#

Read
The
Fucking
Docs

earnest phoenix
#

I thought the discord development was a user account

#

🤦

trim steppe
#

and then interpret it correctly

earnest phoenix
#

Nah im not gonna have my bot friend people

#

Its just too complex

#

Now, imma do a ban system!

#

Lel

#

Gonna go research that

trim steppe
#

Try not asking us for everything

earnest phoenix
#

Ik im not

#

Lol

trim steppe
#

Keep persisting

#

Because asking isn't how you learn

#

Well sometimes maybe

earnest phoenix
#

message.mentions.GuildMember.first().user.ban("Banned for unknown reasons")

#

Got it!

#

It says ban can go onto users

#

I might need to just get rid of user

#

But ill test and expeariment

#

😃

umbral pelican
earnest phoenix
#

Ah more promises

#

Also that code was very wrong

#

Lmao

#

Currently testing

topaz fjord
#

guys

#
.setAuthor('Google Search Results')
#

how do i put an image link for the author

umbral pelican
earnest phoenix
#

Ohmegerd

jolly zodiac
#

Docs? Are that the tutorial sites you copy-paste your code from?

earnest phoenix
#

wat

uncut delta
#

It is helpful site for getting some info

#

About discord.js

uncut slate
#

@jolly zodiac docs = documentation

jolly zodiac
#

I know. That was a bad joke.

jagged plume
#

kek

tawny lava
#

thonk

karmic parcel
#

no

median lintel
#

YES

shrewd field
#

how can u get a mentioned user's id

scenic crest
#

substringing

shrewd field
#

huh

scenic crest
#

if the pattern is <@id> or <@!id>

#

then you can get the id part very easily

shrewd field
#

😕

#

how

scenic crest
#

if you're unaware of what substringing is then google it

#

and then you shouldn't be making bots imho

#

don't make the mistakes everyone else does

shrewd field
#

ok the command is !id @user

scenic crest
#

what lang?

shrewd field
#

js

#

lib d,.js

scenic crest
#

read.

shrewd field
#

ok

#

i read it

#

but idk how to do the command

#

@scenic crest

#

403

scenic crest
#

you can use message.mentions

#

then there's a members property

shrewd field
#

ok

scenic crest
#

that's a collections of everyone who was mentioned

shrewd field
#

like

scenic crest
#

then you can use that object to get the ID

#

either that or substringing

shrewd field
#

can u gimme an example

scenic crest
#

message.mentions.members

#

is a collection of user mentions

shrewd field
#

ok then

#

let member = message.mentions.members.first();

#

like this u mean

scenic crest
#

uhh

#

yes

#

then you have a member

shrewd field
#

ok then

scenic crest
#

then you can get the member's ID

#

do you at least know how to do that

shrewd field
#

how

scenic crest
#

docs are your friend

#

they provide you w/ everything you need to know

#

I'm terrible at JS and I've never used discor.js

#

yet I was able to help you by reading the docs

stone kiln
#
let member = message.mentions.members.first();
member.id```
shrewd field
#

ok

#

guys

#

i have another thing

scenic crest
#

huh

shrewd field
#

how can i make it that the message sends the id only to the owner

stone kiln
#

dm

scenic crest
#

guild owner?

shrewd field
#

if it is not to the owner returns "acceess denied"

#

yes guild owner

scenic crest
#

ohh

#

so if the owner does it

#

it dms it

#

and someone else it says error?

shrewd field
#

yes

scenic crest
#

ok

north fog
#

im pretty sure there is a Discord API guild

scenic crest
#

get command person's id
get guild owner
check if command sender's ID === guild owner ID
if it isn't, error
if it is, do what we said earlier for getting IDs

shrewd field
#

ok how to do step 2-5

scenic crest
#

we literally just told you step 5

shrewd field
#

i mean 4

scenic crest
#

for 2, you can get the guild from the event

#

ah

shrewd field
#

how

#

2-4

scenic crest
#

get the guild from the event

shrewd field
#

how

scenic crest
#

guild.ownerID

#

you got to be kidding me

shrewd field
#

exapmle