#development

1 messages · Page 820 of 1

green kestrel
#

theyre good for SEO, so long as they stick around more than 6 months

earnest phoenix
#

only the first-paged bot lists are good honestly

green kestrel
#

you put your bot on them and just leave it there

#

each one contributes backlinks

#

but the only one i ever get any traffic from is here

#

as in direct searches

#

i dont expect anyone to search for my bot on the other lists

earnest phoenix
#

It's because it gets on first google result

#

Other bot lists arent at the top like top.gg

green kestrel
#

they dont put the effort in to be at the top

#

they seem to put some botlist on glitch or heroku, and run it till they get fed up of the admin

#

and 6 months later its gone or merged

#

and what else gets my goat about them is the constant renaming! they use like .gl or .ml free domains etc and then every month or so the free hoster takes their domain away

#

so constant faffing with api endpoint names

bitter sundial
#

there was an open source bot list a lot of people forked

green kestrel
#

that would explain it, i guess this is where those bugs come from

#

you know theres one list thats almost identical to your appearance?

#

its like they nicked your CSS

earnest phoenix
#

Wow i'd love to see how a bot list works behind the scenes lol

green kestrel
#

(badly... everything jumps about when hovered over)

bitter sundial
#

yeah kinda weird

green kestrel
#

@earnest phoenix technically its simple enough, the hard part is running it

earnest phoenix
#

Yeah but like

green kestrel
#

dealing with queries, approving bots etc

bitter sundial
#

like they be like dbl/topgg bad imma make my own

...and then proceeds to copy everything we do lmao

earnest phoenix
#

Since i'm learning in class on how to make websites and stuff

#

I'd love to just look at the code and see how it works

green kestrel
#

the only thing i'd do different if i made my own list is go for something completely democratised and community run, and not get my hands dirty with bot approvals

#

but i dont even have time to set that up

earnest phoenix
#

hmm

green kestrel
#

plus it has its own issues, when you think about it

#

like voting colleges would form, cliques, etc

#

"you want your bot listed? you need to be on these guys good books as they are the swing vote" etc etc

#

a bit like how steam greenlight used to be a bit of a shitshow

earnest phoenix
#

Well here's one

bitter sundial
#

it's difficult to get a large community to do things right

#

and how about we dont link to them

earnest phoenix
#

oh ye

green kestrel
#

<a class="navtext" target="_blank" href="<%= response.invite ? response.invite : `https://discordapp.com/oauth2/authorize?client_id=${response.id}&scope=bot&permissions=0` %>">Invite</a>

#

theres part of the problem

#

it just plain ignores the url the user puts in

#

if people copied this source, it would explain the problem, but this ones far worse and strips permissions as well!

bitter sundial
#

it uses the invite and if none is provided, generates one for you

green kestrel
#

ah, true

#

i missed the inline-if bit

bitter sundial
#

dbl does the same

green kestrel
#

i cant actually find the broken code in there then

#

looks like that one works correctly

unreal cape
#

I want my d.js bot to respond when it's pinged, but i'm not sure how it works

    if (msg.content == "@wet crater") {
      msg.channel.send('test');
};
#

I made this but it doesnt really work and doesn't give an error

green kestrel
#

what error does it give?

unreal cape
#

none

#

oh wait there's a different error from a different part of the code

#

lol

#

gotta fix that first i guess

tight plinth
#

@unreal cape wait a sec

#
if (message.content.match(`^<@!?${client.user.id}>`))``` @unreal cape
#

Yes @earnest phoenix

unreal cape
#

ah okay thanks @tight plinth

small prairie
#

@unreal cape that won't work ever

#

Use

#

Ismentioned

unreal cape
#

I already solved my problem

small prairie
#

Oh okay

unreal cape
#

but thanks

small prairie
#

But discord.js has a .ismentioned so that's better

unreal cape
#

let me see actually

pale vessel
#

can't seem to find it

unreal cape
#

same, but i see people using it

amber fractal
#

Not sure if the regex is faster than checking message mentions, probably not even a noticeable difference so it doesn't really matter.

unreal cape
#

yeah i cant get it to work

#

so ill stay with the other solution

pale vessel
#

it does the same thing anyway, regex

tight forum
#

guyz hey

#

im trying to rebuild npm

#

when i said i solved the exact errors, a new error came

#

ffmpeg-binaries

#

cant install

grizzled raven
#

@earnest phoenix do \

#

\\

exotic prawn
#

@tall mesa

#

_yardım

#

_help

zenith terrace
#

@unreal cape is it v11 or v12 the mention

unreal cape
#

?

zenith terrace
#

Are you on v11 or 12

#

Or did you fix it

earnest phoenix
#

My bot dies when I exit the command prompt. Is there a solution against this so the bot can run 24/7?

#

I am on an Ubuntu VPS

slender thistle
#

tmux/pm2

earnest phoenix
#

How?

cursive dagger
#

For Pm2:
install pm2, google how to do it
pm2 start --name "NAME_HERE" "command_to_start_bot_here"

earnest phoenix
#

thx so much

cunning glen
#

if (message.author.id != message.guild.owner.id)

this command in dbl problem? -/

torn nebula
#

OwnerID

#

!==

cunning glen
#

this true

torn nebula
#

i don't get

cunning glen
#

in bot rules this command in used ?

thorny meteor
#
if (!value) throw new RangeError('EMBED_FIELD_VALUE');
                ^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.```how to fix this?
torn nebula
#

one of ur embed field is empty show embed

zenith terrace
#

@cunning glen wdym

cunning glen
#

wdm

zenith terrace
#

?

torn nebula
#

..

#

he must be using translator..

thorny meteor
#

@torn nebula thus error comes when i add

.addField("Game",message.author.presence.activities);```
#

when i that into the embed the error comes

zenith terrace
#

Change activities to status

torn nebula
#

maybe author don't have any activities
so it will be null value

zenith terrace
#

Whats the command

thorny meteor
#

oh

#

@torn nebula your i had no game on

#

i turned one on and it worked perfectly

torn nebula
#

...

unreal cape
#

@earnest phoenix you can just do apt-get install screen

pale vessel
#

screen is good

earnest phoenix
#

buggy

#

tmux superior :x

grizzled raven
hollow saddle
#

what version?

pale vessel
#

refer docs

#

only ask here something that you can't solve after spending efforts

nocturne dagger
#

@earnest phoenix

blissful scaffold
#

But is that for v11 or v12? KappaPeek

torn nebula
quartz kindle
#

its not the same

#

in v12 its guild.channels.create()
in v11 its guild.createChannel()

torn nebula
#

😐 in docs it showing
guild.channels.create() in both

pale vessel
#

i'm sure he knows how to change version in the docs

torn nebula
#

u try...

restive furnace
#

stable = 12.2

quartz kindle
restive furnace
#

master = 12

exotic prawn
#

_yardım

#

_changelog

restive furnace
thorny meteor
#

How to check if a user is playing a game or not?

zenith terrace
#

Is this for userinfo?

blissful scaffold
#

You can check the status of a user

torn nebula
#

check activity type == playing

zenith terrace
#

member.user.presence.game

thorny meteor
#

Is this for userinfo?
@zenith terrace yes

zenith terrace
#

member.user.presence.game
@thorny meteor

thorny meteor
#

that is in the v11

#

and thats not what i meant
i want to check are they playing or not?

torn nebula
small prairie
#

My bot can create emoji in ANY server other then one
No error
full Slots Available
Admin permissions

#

d.js

#

11v

#

It Just doesnt create

#

Responds to eval by which i create

torn nebula
lyric mountain
#

which permission allows the bot to give roles to members? Manage roles?

zenith terrace
#

Mhm

tight plinth
#

Tes

#

Yes

earnest phoenix
#

So i made a command called userinfo and the thing is that how do i make it show the game presence of a user (message.author or mentioned user's)
What's the code for it?

tight plinth
#

Google ?

earnest phoenix
#

Wait wot

#

[visible CONFUSION]

slender thistle
#

read the docs, rtd
google

earnest phoenix
#

I did but it slightly didn't help...

summer torrent
#

presence.game

lyric mountain
#

you do know that your answer will not be in plain sight in the docs, right?

earnest phoenix
#

@summer torrent that doesn't work at all

small prairie
summer torrent
#

presence.game is Object

earnest phoenix
#

Hmm lemme check that doc again real quick

summer torrent
#

what is ur djs version

thorny meteor
#
 ${message.author.presence.activities? ${message.author.presence.activities}: "No"}```
#

when the user is not playing the output is empty

#

what have i done wrong?

tight plinth
lyric mountain
#

when the user is not playing the output is empty
make a null check

thorny meteor
#

make a null check
@lyric mountain how?

lyric mountain
#

if (message.author.presence == null) return;

summer torrent
#

@thorny meteor presence.activities is Array

thorny meteor
#

yea

summer torrent
#

also ^

lyric mountain
#

or if (message.author.presence.activities.length == 0) return;

#

if you want to send a custom message when there's no activity, just put it where return is located

#

lenght
@slender thistle you haven't seen anything

nocturne grove
#

Hey, I have a quick question. Does slow mode (for text channels) affect your Discord bot?

small prairie
#

It does

finite bough
#

@nocturne grove depends

small prairie
#

unless they have the perms

#

to overrite it

lyric mountain
#

just like users

small prairie
#

basically manage messages or channels

nocturne grove
#

just as every user? If it has admin it doesn't affect the bot?

small prairie
#

No

finite bough
#

no

lyric mountain
#

actually a bot IS an user with additional functions

nocturne grove
#

Oh is manage msg or manage chan's enough for ignoring the slow mode?

summer torrent
#

if your bot has manage messages perm, no

finite bough
#

no

#

@nocturne grove

summer torrent
#

manage msg

small prairie
#

Its enough

zenith terrace
#

@earnest phoenix did u get it fixed yet?

nocturne grove
#

okay so not manage channels, only message messages (or admin)?

lyric mountain
#

admin is the master perm, it overrides anything else

#

i guess manage messages will not allow your bot to bypass slow-mode

earnest phoenix
#

@zenith terrace still working on it wait...

small prairie
#

@lyric mountain It does

lyric mountain
#

oh, didn't knew it was written there

small prairie
#

Members includes bots

#

@nocturne grove Manage channels, Messages and admin

nocturne grove
#

okay thank you!

small prairie
#

^_^

#

My bot can create emoji in ANY server other then one
No error
full Slots Available
Admin permissions
d.js
11v
It Just doesnt create
Responds to eval by which i create

nocturne grove
#

didn't know about that piece of text either

small prairie
#

someone help me :/

tight plinth
#

other than one

#

wdym

finite bough
#

@small prairie check its perms

small prairie
#

Check the message

#

@tight plinth Just cant create in one server

finite bough
#

again

#

coz

tight plinth
#

this server i guess?

small prairie
#

No

nocturne grove
#

that's weird

small prairie
#

Yea

finite bough
#

check the serve lr database then

tight plinth
#

did u try kicking the bot and readding it

small prairie
#

So
I'm mapping emotes from one server
And adding them to other

#

Yes 3 times

nocturne grove
#

I wish I could help you 😦

finite bough
#

like owo bot?

tight plinth
#

wat

small prairie
#

what?

tight plinth
#

ur bot is stoling emotes from other servers

finite bough
#

like

tight plinth
#

is that even legal

finite bough
small prairie
#

Uh

finite bough
#

stealing this

#

to ur server

#

@tight plinth yes it is

small prairie
#

i'm staff in the server lmao

#

;_;

tight plinth
#

oh

finite bough
#

many bots do ot

#

it

small prairie
#

i have been given the task to copy that to other server

#

and i dont wanna do it manually

#

i'm lazy AF

finite bough
#

I can only think of corrupted db rn

small prairie
#

db?

finite bough
#

database

small prairie
#

i'm not even using it here

#

-dotposting

#

;_;

finite bough
#

how the hell do u copy then

#

by link?

small prairie
#

Yes

#

first i map all emojis

#

then .url them

finite bough
#

u can make a bot to do that

small prairie
#

;_;

#

dude

finite bough
#

and not post the emoji once

#

and right click and copy url

#

lmao

small prairie
#

;-;

#

map from bot ofc

#

why would i be in this server

#

i mean asking for help in dev section

finite bough
#

is the emoji animated?

#

that wouldnt matter tbh

small prairie
#

it did the first time i ran it

torn nebula
#

url is valid?

small prairie
#

around 50

#

then stopped

#

@torn nebula i'm mapping it so i guess

torn nebula
#

check by logging them

finite bough
#

can u add console logs

earnest phoenix
#

What does it mean when console.log gives an error called RangeError?

torn nebula
#

full error...

earnest phoenix
#

Hmm... It's the RangeError from the message embed value....

finite bough
#

full error

torn nebula
#

maybe empty fields

earnest phoenix
#

No empty fields included

finite bough
#

rangeerror can be for more than 1 errors I think

small prairie
#

Yes url is valid

#

think its working now

finite bough
tight plinth
torn nebula
#

field values can be null

quartz kindle
#

i wouldnt use regex for that

small prairie
#

Why does NO ONE use this

finite bough
#

wut

small prairie
#

rip

#

wrong v

finite bough
#

@tight plinth try only <@..>

tight plinth
#

k

earnest phoenix
tight plinth
#

try it and see

quartz kindle
#

are you actually coding in nano?

#

lmao

mossy vine
#

yeah

#

vim is better

earnest phoenix
#

(useri is = message.author || message.mentions.users.first()) btw

#

Lol nano is more comfortable for me

finite bough
#

@tight plinth did it work?

quartz kindle
#

message.mentions should be first, else it will never be used, because message.author always exists

tight plinth
#

with <@${client.user.id> np

small prairie
#

(useri is = message.author || message.mentions.users.first())

#

seems wrong

#

message.mentions should be first, else it will never be used, because message.author always exists
Ah yeah

earnest phoenix
#

Hmm

finite bough
#

wut

#

holdon

quartz kindle
#

as for activities i think it returns an object, i dont remember

#

console.log it or check the docs, and you'll see

earnest phoenix
#

K lemme check

tight plinth
#

it doesnt

#

eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

quartz kindle
#

@tight plinth if(message.content.startsWith("<@!YOURID>") || message.content.startsWith("<@YOURID>"))

tight plinth
#

forgot the ! thing

zenith terrace
#

Btw, for V12. Is it better to rewrite the whole coding again

tight plinth
#

wait

quartz kindle
#

depends on your code, but possibly yes

earnest phoenix
#

@quartz kindle and btw wdym by message.mentions to be the first? I got a little confused

tight plinth
#

if(message.content.startsWith("<@!YOURID>" || "<@YOURID>"))

#

works too I guess

quartz kindle
#

no

#

it doesnt

tight plinth
#

oof

quartz kindle
#

something || somethingElse means literally something OR something else

#

if the first something exists, it will be used

#

the second something will never be used if the first one exists

#

message.author always exists

#

"<@ID>" always exists (its a literal string)

earnest phoenix
small prairie
#
message.guild.emojis.map(e=>{
client.guilds.get("ID").createEmoji(e.url,e.name)
})

this is in d.js v11
Dont tell me if its illegal or anything
I'm using it on a server i'm staff in

#

Is this right?

#

basically mapping all emojis of a server to another

earnest phoenix
#

@quartz kindle the message.mentions is the first

quartz kindle
#

alright

#

looks correct king

earnest phoenix
#

Hmm

small prairie
#

Well it doesnt work

#

No error

torn nebula
#

it won't work

small prairie
#

I use it with eval

#

Why so?

quartz kindle
#

ah i know why

small prairie
#

Uh?

quartz kindle
#

you cant use .map with async code

small prairie
#

spit it XD

#

Ah

#

gotta use foreach?

quartz kindle
#

because .map will resolve the entire loop instantly and not wait for any promise

#

same thing with foreach

tight plinth
#

works

small prairie
#

Then what can i use?

quartz kindle
#

they will both fire 50 requests at the same time, making you get rate limited

earnest phoenix
#

@quartz kindle so as you were saying the message.mentions to be the first... It's literally the first...

quartz kindle
#

if you have 50 emojis

#

you have to use a regular for loop, so you can await each request

small prairie
#

YES thats whats happening

#

for loop?

quartz kindle
#

@earnest phoenix yes and its correct, i said it because you said this before

earnest phoenix
#

Oh ok but what's the issue now?
Lemme show you the console.log error

small prairie
#

is there a collection.next thingy?
Or an index

quartz kindle
#

@small prairie js for(let i = 0; i < message.guild.emojis.size; i++) { await client.guilds.get(ID).createEmoji() }

small prairie
#

Createemoji's parameters?

#

how to get those?

quartz kindle
#

@earnest phoenix field values may not be empty

torn nebula
#
let some = message.guild.emojis.map(e => e.id === "id").url
<guild>.createEmoji(some)
earnest phoenix
#

Anyone know how to change a bot tag?

quartz kindle
#

one of your .addField()s has an empty value for some reason, you have to find out which one

small prairie
#

@earnest phoenix There isnt a way

earnest phoenix
#

Scroll up @quartz kindle

quartz kindle
#

try console.logging the embed before sending

small prairie
#

@torn nebula I dont think thats valid

#

for my case

quartz kindle
#

thats very wrong Sai lol

torn nebula
#

lol

earnest phoenix
tight plinth
#

I dont see any errors

quartz kindle
#

if you remove it then it works?

small prairie
#

can i convert it into an array and use array functions?

earnest phoenix
#

Yup

quartz kindle
#

then console.log useri.presence.activities

earnest phoenix
#

How was that done i forgot?

quartz kindle
#

@small prairie you have to use a for, for in or for of loop

#

array loops wont work

small prairie
#

No no no

#

See in a collection

#

there is no way to get from index right?

#

But i can use index from for loop in array

#

so can i convert it to array and use?

#

Does the fields(url,name) remain the same?

quartz kindle
#

@earnest phoenix console.log(useri.presence.activities) before the line where you use them

earnest phoenix
#

Oh ok lemme check

quartz kindle
#

@small prairie yes you can

small prairie
#

Alright Trying it

quartz kindle
#

you can also try using a for in

#

i dont know if it works with collections

#
for(let emoji in message.guild.emojis) {
  await something
}```
small prairie
#

Erm
SyntaxError: await is only valid in async function

#

do i need to convert the eval function in code to async? @quartz kindle

tight plinth
#

create an async function

quartz kindle
#

yes

small prairie
#

Oh, Okay

quartz kindle
#

or create an async function inside it

small prairie
#

Erm?

quartz kindle
#

!eval (async function() { await something() })()

#

lol

small prairie
#

async function some{})

#

Yeah

earnest phoenix
#

@quartz kindle oh and i didn't see... Sorry for asking but wdym "before the line where you use them"

quartz kindle
earnest phoenix
#

Oh in there?

#

Ok lemme check

#

@quartz kindle i did it and it shows nothing besides the same error as before...

small prairie
#
async function some(message){
var em=message.guild.emojis.array()
for(let i = 0; i < message.guild.emojis.size; i++) {
    await client.guilds.get("ID").createEmoji(em[i].url,em[i].name)
}
}
some(message)
#

is this correct?

tight plinth
pale vessel
#

.array()?

small prairie
#

i really dont want this video again

earnest phoenix
#

@quartz kindle you there?

quartz kindle
#

whats your current code?

earnest phoenix
#

You want to see it you mean?

quartz kindle
#

yes

earnest phoenix
quartz kindle
#

the error is the same as before, and nothing else showed up? it only happens with the userinfo command?

earnest phoenix
#

Yes

small prairie
#

code doesnt work

#

no error

#
async function some(message){
var em=message.guild.emojis.array()
for(let i = 0; i < message.guild.emojis.size; i++) {
    await client.guilds.get("468823185882742794").createEmoji(em[i].url,em[i].name)
}
}
some(message)```
#

@quartz kindle What if i use map but add a timeout?

#

1s before each request

pale vessel
#

are you having problem with the bot info command or the emoji list thing? different people

small prairie
#

emoji list

pale vessel
#

try console log the emojis first

earnest phoenix
#

@quartz kindle found any solution yet?

quartz kindle
#

nope, it makes no sense

#

can i see the error again?

earnest phoenix
#

Yes

small prairie
#

Tim
Reply to me?

earnest phoenix
quartz kindle
#

ah

#

i see why

small prairie
#
var add=0
message.guild.emojis.map(e=>{
add = add + 1000;
            const cunter = setTimeout(() => {
client.guilds.get("468823185882742794").createEmoji(e.url,e.name)
},add)
})
#

something like this

quartz kindle
#

activities is an empty array

earnest phoenix
#

Huh

#

Hmm

#

So how's it fixable?

quartz kindle
#

to check if an empty array contains values or not, you do if(array.length)

#

so your if has to be useri.presence.activities.length

#

@small prairie that will not work

earnest phoenix
#

Length set to nothing?

small prairie
#
async function some(message){
var em=message.guild.emojis.array()
for(let i = 0; i < message.guild.emojis.size; i++) {
    await client.guilds.get("468823185882742794").createEmoji(em[i].url,em[i].name)
}
}
some(message)```
pale vessel
#

ternary operator makes it easier

small prairie
#

why isnt this working?

pale vessel
#

what's wrong?

earnest phoenix
#

@quartz kindle so like the code needs to be like this?:

+ If (useri.presence.activities.length){
 userembed.addField("**Currently playing:**", useri.presence.activities, true)
}```
?
pale vessel
#

use ternary operator

quartz kindle
#

that will fix the error yes, but you will need to change the actual value of the field

earnest phoenix
#

Value to the what?

quartz kindle
#

because that will likely show up as [Object object]

earnest phoenix
#

Hmm so the value code needs to be changed to what tho? @quartz kindle

quartz kindle
#

check the docs

earnest phoenix
#

Hmm ok

small prairie
#

F

#
async function some(message){
var em=message.guild.emojis.array()
for(let i = 0; i < message.guild.emojis.size; i++) {
    await client.guilds.get("468823185882742794").createEmoji(em[i].url,em[i].name)
}
}
some(message)```
quartz kindle
#

@small prairie add console.logs to it or something to see which parts work

small prairie
#

the await stops the code right?

#

@quartz kindle

earnest phoenix
#

Anyone know how to setup two prefix on discord.js?I tried var prefixes = ["prefix1", "prefix2"] but I didn’t work

small prairie
#

@earnest phoenix You need to run the prefixes in message.content.start too

#

both of them

pale vessel
#

how do you remove the prefix from the command? slice?

small prairie
#

@quartz kindle
The code didnt seem to go after await
Its stopped

pale vessel
#

try await some(message)

small prairie
#

SyntaxError: await is only valid in async function

pale vessel
#

o h

#

where did you execute the function?

small prairie
#

eval

#

which isnt async

pale vessel
#

put it inside a code and try it

#

why are you using eval to code anyway

#

you can try then btw

earnest phoenix
#

@quartz kindle so i changed the if statement's end method to length and it fixed it without changing the value of the Field... Thx for the help at the very least...

small prairie
#

its a temp one time command
Why should i edit the code for it

pale vessel
#

oh

#

use .then

small prairie
#
!eval async function some(message){
console.log("2")

var em=message.guild.emojis.array()
for(let i = 0; i < message.guild.emojis.size; i++) {
console.log("y")
    await client.guilds.get("468823185882742794").createEmoji(em[i].url,em[i].name) //Stops Here
console.log("h")

}
}
console.log("h")
#

that last h isnt logged

#

and the y only logged once

earnest phoenix
#

@small prairie which discord bot wrapper are you using?

small prairie
#

d.js?

pale vessel
#

djs

earnest phoenix
#

Hmm

small prairie
#

v11

pale vessel
#

use .then dude

earnest phoenix
#

Seems suspicious of that code

small prairie
#
console.log("2")

var em=message.guild.emojis.array()
for(let i = 0; i < message.guild.emojis.size; i++) {
console.log("y")
    await client.guilds.get("468823185882742794").createEmoji(em[i].url,em[i].name).then(()=>{
console.log("Success")
})
console.log("h")

}
}
console.log("h")
some(message)
#

This?

pale vessel
#

no

small prairie
#

.then where?

pale vessel
#

client.guilds.get(id).then(guild => { guild.createEmoji(stuff); });

small prairie
#

lmao it seemes to be doing that now

#

i used the command 2 mins ago

#

and its creating the emojis now

#

ah rip

#

stopped after a few

#

TypeError: client.guilds.get(...).then is not a function

#

@pale vessel

earnest phoenix
#

hey i had this problem a long time ago but how do i make my warn command multi server?
(so the warns are different and not the same on every server)

finite bough
#

define the guild

#

like

pale vessel
#

probably because it doesn't return a promise

#

@earnest phoenix Do you use database?

earnest phoenix
#

i didnt use it
i dont know how

pale vessel
#

what's your current setup?

#

json?

earnest phoenix
#

i tried making one

#

wdym

pale vessel
#

where do you store warns?

#

oh

earnest phoenix
#

i dont?

small prairie
#

so nothing
i'm gonna go sleep

earnest phoenix
#

@small prairie gn

small prairie
#

good day or whatever to you

earnest phoenix
#

thats the thing i wanna write it myself i deleted the old one

pale vessel
#

you need some sort of database to store info

earnest phoenix
#

i dont know how to store for different servers

#

i found the old command

#

ok listen
i have a warnings.json file
where the warnings are saved

#

i dont know how to make it for each server

#

I have a question...
In my userinfo command i want it to show a message.author's and a mentioned user's date of them that they joined the server...
How is it possible?
Is that correct?

finite bough
#

@earnest phoenix use SQL db, or some other database

#

json is easy but not sage

#

safe*

earnest phoenix
#

can you teach me how?

lyric mountain
#

start with sqlite, it's kinda easy to get used to it

earnest phoenix
#

alright i will check

#

i have no clue where to start tho

lyric mountain
#

js?

earnest phoenix
#

yes

lyric mountain
earnest phoenix
#

@lyric mountain do you have any idea about my problem up there?

#

i just wanna use the normal json file i have no idea how to use that

#

i just dont know how to make it so the warn numbers will be different for each server

lyric mountain
#

i just wanna use the normal json file i have no idea how to use that
@earnest phoenix json is not safe nor lightweight, better to use a DB for storing guild configs

earnest phoenix
#

but i need some help with it

#

I think you should watch some tutorial somewhere...

lyric mountain
#

@lyric mountain do you have any idea about my problem up there?
@earnest phoenix the user object has a "joined at" attribute and a getAsMention function

#

you gotta check the docs for them tho

#

idk how they are called in js

earnest phoenix
#

Hmm lemme check then

lyric mountain
#

but i need some help with it
@earnest phoenix read the first link I sent you

#

it'll guide you through setting up and using sqlite

earnest phoenix
#

there are a few options

#

what should i choose

lyric mountain
#

@earnest phoenix note that mentions don't work within embeds (they actually show up, but doesn't ping the user)

#

what should i choose
@earnest phoenix all of them

#

they are sequential tutorials

earnest phoenix
#

Ik... I don't even want them to ping the users lol

#

That would be annoying if it did ping them

lyric mountain
#

@earnest phoenix just browse the docs for the things you need, d.js is quite well explained in its wiki

earnest phoenix
#

I'm doing it right now... I hope i be able to find it in low time...

lyric mountain
#

don't rush, the best bots takes months to be done

quartz kindle
#

been refactoring mine for 4 months and its still not ready lul

finite bough
#

astrobot @quartz kindle?

quartz kindle
#

ye

finite bough
#

it's one of the most complex looking botbi have ever seen tbh

quartz kindle
#

it pretty much is lol

finite bough
#

like I used the help cmd

#

and couldn't understand a thing written in it bloblul

quartz kindle
#

lmao

#

the refactored version has a better help command (i hope)

finite bough
#

I hope I can understand atleast 1 word

wicked pivot
#

how to edit a role in v11

quartz kindle
#

knowing astrology would make it easier to understand (as thats the main purpose of the bot)

wicked pivot
#

@torn nebula thx

earnest phoenix
#

@quartz kindle you there?

quartz kindle
#

no im not here

earnest phoenix
#

Lol

#

does anyone know how to solve this error, and any possible causes

#
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:202:19)```
tight plinth
#

show code?

earnest phoenix
#

there is 6.6k lines

#

Holy

#

i have no idea where it is coming from

quartz kindle
#

@earnest phoenix message.mentions.members.first()

earnest phoenix
#

Oh hmm... Let's check that

tight plinth
#

hmmm

quartz kindle
#

@earnest phoenix that looks like a mongodb connection error

#

are you using atlas?

earnest phoenix
#

@quartz kindle thx it worked...

wicked pivot
#

how do you remove permissions from a role? (<role> .edit)

earnest phoenix
#

I used that code before but i don't know why it didn't work before...

#

yes @quartz kindle

#

it looks like just internet

#

might not happen on my host

quartz kindle
#

did you whitelist your ip address in atlas?

#

or are you connecting from a different ip?

floral bloom
#

How do I get the default role of a guild? Was that removed?

grizzled raven
#

everyone role?

#

dont think there really is such thing as a default role

quartz kindle
#

guild.roles.everyone

#

i think

grizzled raven
#

why is v11 so outdated

#

i feel like im using v12 but im not

#

my bot is a mess currently

floral bloom
#

dont think there really is such thing as a default role
It used to be message.guild.defaultRole but that doesn't work anymore. Tim (answer quoted below) is correct.

guild.roles.everyone
Thank you! That's it!

wicked pivot
#
let role = message.guild.roles.get('688090958507933755')
        message.channel.overwritePermissions(role, { CONNECT: false })
       .then(updated => console.log(`Edited role`))
       .catch(console.error);``` there is no error but it does not work
quartz kindle
#

you want to edit the role permissions or the channel permissions?

wicked pivot
#

role"

quartz kindle
#

role.edit(data,reason)

wicked pivot
#

ok but from there, how do you remove permission from a role?

quartz kindle
#

its explained in that link

#
role.edit({
  pemissions: ["SEND_MESSAGES","ATTACH_FILES"]
},reason)
slate oyster
#

Ya'll Discord.js users are lucky
Ya'll don't have to fight with Reactive programming, while I do

wicked pivot
#

its these add permissions not remove?

quartz kindle
#

its to set them

#

it doesnt add or remove them, it sets them to exactly that

#

to add or remove you have to get the current ones, and change them then put them there as a list like that

wicked pivot
#

I really don't understand, then with this discord.js documentation I really have a hard time excuse me (I'm French, it doesn't help either)

quartz kindle
#

you can also use this

wicked pivot
#
message.guild.channels.forEach(async (channel, id))```possible that the text or voice channels in the "for each"
lyric mountain
#

@slate oyster what's a reactive programming?

earnest phoenix
#

So in my bot... The command userinfo works but i want it to show the user info as well when you mention someone by thier ID's... What's the code for that?

wicked pivot
#
let User = message.mentions.users.first() || message.guild.members.get(args[0])```
earnest phoenix
#

Oh hmm... Lemme try that real quick...

#

@wicked pivot get method needs to be set to args[0] or user.id?

wicked pivot
#

like this the syntax will be,<prefix>userinfo [@user || id]

earnest phoenix
#

Hmm... I did your code... Lemme check if it works...

#

@wicked pivot it says message.guild.members.get is not a function... I think the get method has been removed or renamed...

#

Oh wait ik what's it renamed to... Brb

wicked pivot
#

which version are you in?

earnest phoenix
#

You mean what is the version of discord.js I'm using?

finite bough
#

yes

wicked pivot
#

yes"

earnest phoenix
#

It's 12.0.2

wicked pivot
#

i can't help you sorry i'm using v11

earnest phoenix
#

Oh anyways... Thx for the help at least...

quartz kindle
#

in v12 its members.cache.get()

golden condor
#

I'm tryna use discord.js-commando and I don't know how

lyric mountain
#

have you rtd?

golden condor
#

?

lyric mountain
#

have you read the docs?

golden condor
#

Ys

lyric mountain
#

then what's your issue?

#

implementing it?

golden condor
#

I have a system

#

And I don't know how to convert ut

lyric mountain
#

ok, let's go step by step

#

what do you mean by "system"?

golden condor
#

So

#

I have tons of commands not in the commando format

#

and I dunno how to convert all my args and prefixes and stuff

hoary elm
#

Have you checked their docs?

golden condor
#

Yes

#

I am checking over again

hoary elm
#

iirc with setting up commando you should start in the Registry area of the Docs. But it's been a while since I've used them

quartz kindle
#

instead of thinking about how to "convert" your command to commando, try rewriting it in commando

hoary elm
#

^^

quartz kindle
#

aka, create it again from scratch, using commando functions and methods

#

that will help you understand how commando works

golden condor
#

I wanna rewrite my whole bot

#

Into command

#

o

hoary elm
#

Re-write it and follow the docs and you should be good

royal ravine
#

hi how can i check if a server contains a text channel named "TEST"

copper cradle
#

at least they're trying to learn

hoary elm
#

This is true

copper cradle
#

@royal ravine
maybe check for it?

royal ravine
#

how

#

guild.channels.find doesnt work

#

thats wha ti can find online

copper cradle
#

like you can filter them by name

royal ravine
#

hmm

copper cradle
#

what doesn't work

royal ravine
#

can you maybe send a link >?

copper cradle
#

mo

#

no*

#

show your code

#

lemme guess

royal ravine
#

1 sec

copper cradle
#

you're getting a guild is not defined err

#

more like

hoary elm
#

message.guild.channels.find(c => c.name === '') ??

copper cradle
#

cannot read property channels of undefined

#

why

#

why did u fucking tell 'em

#

we're not supposed to spoon feed

hoary elm
#

.... I would like to point out that depending on what exactly he's trying to do that is some what of an answer

#

But there are things that he could be attempting to do which would make it incomplete

#

🤷🏻‍♂️

copper cradle
#

it's still spoon feeding

hoary elm
#

K

royal ravine
#

var channelNAME = message.channel.name

            message.channel.send(channelNAME)
            
            Chan[ServerName] = channelNAME;
            fs.writeFileSync("./C.json", JSON.stringify(Chan));
            
            if () //i wanna check if there is a channel named Chan[ServerName] and send a message there
            message.channel.send("The theme of today is " + "`"+Themes[theme]+"`")
crimson vapor
#

that was not spoonfeeding

royal ravine
#

i am writing the channelname where the command was send to a json file

crimson vapor
#
var channelNAME = message.channel.name

                message.channel.send(channelNAME)

                Chan[ServerName] = channelNAME;
                fs.writeFileSync("./C.json", JSON.stringify(Chan));

                if () //i wanna check if there is a channel named Chan[ServerName] and send a message there
                message.channel.send("The theme of today is " + ""+Themes[theme]+"")```
royal ravine
#

and i wanna checn every intervall if the name in the json exist in tje server

#

and then send a message in that channel

crimson vapor
#

so you would be creating a setInterval

royal ravine
#

how can i use the if function to check

#

that is already in a interval

#

thats the content

quartz kindle
#

@royal ravine are you on v11 or v12?

royal ravine
#

12 i think

crimson vapor
#

check the package.json if you need

royal ravine
#

yeh 12

crimson vapor
#

ok

#

you want to check the json for a variable, correct?

royal ravine
#

i have this in my json

#

{"Bot Test Server":"tes1"}

#

and i wanna check if that "tes1" is in the server

#

tes1 is a text channel

quartz kindle
#

to find a channel in v12 its <guild>.channels.cache.find(channel => channel.name === NAME)

crimson vapor
#

are you searching for a specific channel per guild or just a specific channel?

royal ravine
#

when a command is typed in a server

#

i save the text channel name in a json

crimson vapor
#

ok got it

royal ravine
#

every intervall i wanna check if that text channel still exists

#

and when it does i wanna send a messgae

crimson vapor
#

why would you do that?

quartz kindle
#

its better to save the channel ID not the name

royal ravine
#

when it doesn't its just gonna console.log

quartz kindle
#

because the channel name can change

royal ravine
#

hmm

copper cradle
#

yeah

royal ravine
#

okay willchange that

crimson vapor
#

are you making it to a message will be sent on an inverval?

#

or when a command is used?

royal ravine
#

messga ewill be send on a intervall

#

okay changed to the channel id

crimson vapor
#

ok

royal ravine
#

so now it saves the channel id in the json

#

{"Bot Test Server":"688123488524683288"}

#

like that

crimson vapor
#

change the guild name to guild id

#

because names change as well

royal ravine
#

okay

crimson vapor
#

ok, do you plan to do this for every guild or just the test server?

royal ravine
#

i get guild is not defined

amber fractal
#

Message and interval should never be said in the same sentence unless you're explaining why it's bad

copper cradle
#

send your code

royal ravine
#

if (message.content.startsWith(prefix + "START"))
{

        var interval = setInterval (function () {
            var theme = Math.floor(Math.random() * Themes.length);
            var ServerName = message.guild.id
            var channelID = message.channel.id
            
            Chan[ServerName] = channelID;
            fs.writeFileSync("./C.json", JSON.stringify(Chan));
            
            if (guild.channels.cache.find(channel => channel.name === Chan[ServerName])){
            message.channel.send("The theme of today is " + "`"+Themes[theme]+"`")
            }
            

            //write to .json
            ServerConfig[ServerName] = Themes[theme];
            fs.writeFileSync("./S.json", JSON.stringify(ServerConfig));
            //write to .json
            //}

        }, 1 * 1000); //1000 = 1 sec
    }
crimson vapor
#
if (message.content.startsWith(prefix + "START"))
        {

            var interval = setInterval (function () {
                var theme = Math.floor(Math.random() * Themes.length);
                var ServerName = message.guild.id
                var channelID = message.channel.id

                Chan[ServerName] = channelID;
                fs.writeFileSync("./C.json", JSON.stringify(Chan));

                if (guild.channels.cache.find(channel => channel.name === Chan[ServerName])){
                message.channel.send("The theme of today is " + ""+Themes[theme]+"")
                }


                //write to .json
                ServerConfig[ServerName] = Themes[theme];
                fs.writeFileSync("./S.json", JSON.stringify(ServerConfig));
                //write to .json
                //}

            }, 1 * 1000); //1000 = 1 sec
        }```
#

I gotchu

royal ravine
#

ty

#

:D

copper cradle
#

well that's bc you didn't fucking define guild

#

put message. before it

royal ravine
#

message.guild.channels.cache.find(channel

#

like that ?

crimson vapor
#

ok this is inefficient

#

if your bot goes offline, it will stop working

copper cradle
#

yes

#

like that

royal ravine
#

oh yeh i see

crimson vapor
#

first, work on a command to set the data

royal ravine
#

uum

crimson vapor
#

then in the main file, you can work on a function to keep updating it

royal ravine
#

first, work on a command to set the data
@crimson vapor like if it is enabled ?

crimson vapor
#

umm

#

lemme explain

royal ravine
#

okay

crimson vapor
#

so the command will only set the data for the json, instead of making an interval which will reset when the bot goes offline

#

you can do that in a different file

royal ravine
#

jup

#

adn then check if that command is enabled in a server ?

#

and then ceck the channel id if it stil exists ?

crimson vapor
#

one sec, im editing your code so I can better explain what you would be doing

royal ravine
#

ah thanks

earnest phoenix
#

Hi, i have a problem, i use shortand if for do a variable that save a value or other value

    let roleOwner = membersWithRoleOwner == [] ? "Vacio" : membersWithRoleOwner.join('\n');

membersWithRoleOwner is a array that should have all the users with that role
but one role dont have any member so i do that condition
but the console returns nothing
any solution?

quartz kindle
#

you cant do an array comparison like that

#

what are you trying to compare exactly?

earnest phoenix
#

if the array is empty or no

quartz kindle
#

membersWithRoleOwner.length

crimson vapor
#

alright

earnest phoenix
#

Oh

#

I dont think that XD

crimson vapor
#

I cannot help with the function on the index.js but the command would be just defining the data

royal ravine
#

hmm okay

#

i think i can figure that out

earnest phoenix
#

@quartz kindle so umm... Remember the help i asked?
How can i set my userinfo command to show info of the user that's mentioned by their ID's...?

royal ravine
#

should i save everything in one json file ?

crimson vapor
#

up to you

royal ravine
#

so the serverid channel id and if the function is enabled ?

crimson vapor
#

first, define theme, then define serverID and channelID, and set Chan[serverID] = channelID, then write to the json. then you can do the message.channel.send @royal ravine

quartz kindle
#

@earnest phoenix how do you get the user now?

royal ravine
#

yeh

crimson vapor
#

when you are done, please show your code

royal ravine
#

and how to check if the channel exists ?

earnest phoenix
#

@quartz kindle wdym?
You mean like message.author and message.mentions.users.first()?

royal ravine
#

should i sne doy uin pm ?

#

or

crimson vapor
#

here is fine I think

royal ravine
#

okay

quartz kindle
#

@earnest phoenix yes, so basically you have to add another option in that line

earnest phoenix
#

And that option is what I'm asking for...
What's the code for it?

slate oyster
#
quartz kindle
#

do you parse message arguments in any way?

#

ie: args = message.content.split() or something

earnest phoenix
#

Yes

#

Args = messageArray.slice(1)

quartz kindle
#

so lets say P!userinfo something

#

your args[0] will be something

#

correct?

earnest phoenix
#

Yea?

quartz kindle
#

then you use args[0] to first check if it exists, then check if its a number, then check if the number is a user id

earnest phoenix
#

And then how's the code done for that?

quartz kindle
#

whats your discord.js version again?

earnest phoenix
#

12.0.2

royal ravine
#

@crimson vapor if (message.content.startsWith(prefix + "START"))
{
var interval = setInterval (function () {
var theme = Math.floor(Math.random() * Themes.length);
var serverID = message.guild.id
var channelID = message.channel.id

            Chan[serverID] = channelID;
            fs.writeFileSync("./C.json", JSON.stringify(Chan));
            
            if (message.guild.channels.cache.find(channel => channel.id === Chan[serverID])){
            message.channel.send("The theme of today is " + "`"+Themes[theme]+"`")
            }
            else
            {
                console.log("Channel  not found!")
            }
        }, 1 * 1000); //1000 = 1 sec
    }
#

thats what i have now

#

just what you said that when the bot goes offline it doesnt work anymroe

crimson vapor
#

yeah so I made something different

#

am I allowed to show or would it be spoonfeeding?

quartz kindle
#
let user;
if(message.mentions.users.size) {
  user = message.mentions.users.first()
} else if(args[0] && !isNaN(args[0])) {
  user = client.users.cache.get(args[0])
  // or if the user is not cached, you have to do this instead
  user = client.users.fetch(args[0]).catch(e => null)
} else {
  user = message.author
}```
crimson vapor
#
    if (message.content.startsWith(prefix + "START")) {
        var theme = Math.floor(Math.random() * Themes.length);

        var sID = message.guild.id
        var cID = message.channel.id

        Chan[sID] = cID;

        fs.writeFileSync("./C.json", JSON.stringify(Chan));

        message.channel.send("The theme of today is " + "" + Themes[theme] + "")
    }``` this is what I made
royal ravine
#

hmm

#

so you define the themem serverid channelid

#

then save it to json with ServerID:ChannelID

crimson vapor
#

yes

royal ravine
#

and then message

earnest phoenix
#

@quartz kindle hmm imma try that...

royal ravine
#

hmm yeh i have kinda the same now i think

crimson vapor
#

you need a function on a different file that sends the theme

royal ravine
#

everything works fine now but i just have to fix that when to bot goes offline it will just work again

#

so like a loop where it checks

crimson vapor
#

yeah kinda

royal ravine
#

hmm okay i wil try that

crimson vapor
#

@royal ravine accept friend

earnest phoenix
#

@quartz kindle tysm for the help... It worked...

astral yoke
#

Hello. For my bot I'm trying to show a cpu usage, however when I run the command, it says NaN bytes.
Let me show you.
https://prnt.sc/rg126r

Lightshot

Captured with Lightshot

#

.addField(CPU usage:, ${process.cpuUsage().heapUsed / 1024 / 1024} bytes., true)

prime cliff
#

Is this in js or c#?

astral yoke
#

js.

prime cliff
#

Cpu usage is not in bytes though that is ram Thonkeng

astral yoke
#

Ah.

#

So how would I fix it so that one, it shows the usage, and two change bytes to something else?

summer torrent
prime cliff
#

That would be process.memoryUsage()

astral yoke
#

No, talking about cpu usage.

#

I already have a memory usage above that.

copper cradle
#

yes but cpu usage isn't measured in bytes

astral yoke
#

and what's it measured in?

modest maple
#

have a guess

astral yoke
#

percentage?

#

idk

copper cradle
#

the cpu usage is measured in clock ticks or seconds, => a percentage

astral yoke
#

ahh

earnest phoenix
#

how can i know the mutual server my bot is in with a user?

#

discord.js

summer torrent
#

i think you cant

smoky spire
#

Filter client.guilds.cache for if the guild has that user

astral yoke
#

Well now it says this.

dapper hill
#

Hello. I am new to discord bot developing and have some quistions. I am trying to get my bot online but keep hitting the same error. Could anyone explain what I am doing wrong?

#

if it isnt too hard could you please @ me when you repsond because I have this server muted

earnest phoenix
#

bruh...

#

literally

dapper hill
#

am I just really dumb?

earnest phoenix
#

yes

dapper hill
#

I figured

earnest phoenix
#

what was the problem

dapper hill
tight plinth
#

new discord.client --> new Discord.client

dapper hill
#

trying to get it online

zenith terrace
#

@dapper hill capital D in Discord.client

dapper hill
#

o thank u

#

lol

tight plinth
#

U forgot the caps

earnest phoenix
#

yes

dapper hill
#

im really dumb

shy kelp
#

also you'll wanna change bot.on stuff to client.on

dapper hill
#

thanks guys

#

ok thank u

zenith terrace
dapper hill
#

uhh I seem to be getting the same erro

#

error*

#

wait

zenith terrace
#

Yea u defined it as client so it has to be changed from bot to client

#

Same error?

dapper hill
#

yes

zenith terrace
#

Did you install the discord.js package?

dapper hill
#

uhh

#

yes

#

I did

#

I think

#

one second

#

no

#

I did not

#

let me do that

zenith terrace
#

Oof

shy kelp
#

One question.. did you save after changing it

dapper hill
#

no IU did not save

#

one moment

#

ya still doesnt work after save let me install discord.js

zenith terrace
#

Ok

#

@dapper hill whats happening now?

dapper hill
#

Broken. I have to leave for a phonecall will report back in a few hours

#

phone call*

zenith terrace
#

Ok

copper cradle
#

you didn't even install d.js

earnest phoenix
#

think about it for a moment

#

Hmm

radiant parcel
#

@earnest phoenix what app name in mobile?

earnest phoenix
#

@radiant parcel Termux

radiant parcel
#

Thank you 🥳🙂

earnest phoenix
#

Np

#

So... Solution anybody?

#

the result of your math floor returns NaN

#

Yup

#

Which NaN is aka not a number... But what's wrong there tho?

#

why do you need to floor in the first place

#

Umm... Just to get the result of how much of latency there is... Is there another solution to that?

#

do you even know what flooring a number means

#

Bruh moment

zenith terrace
#

@earnest phoenix

(`Pong! (took: ${msg.createdTimestamp - message.createdTimestamp}ms)`)

This is what I have

earnest phoenix
#

exactly that

#

but don't spoonfeed code

#

let them figure it out themselves

#

Hmm... Lemme try that real quick

vestal star
#

does guild.create run when somebody dm's my bot?

zenith terrace
#

No idea

#

Try it out

true ravine
#

It only fires when it joins a guild I think

vestal star
#

Okay

true ravine
#

DM's trigger the message event

vestal star
#

oh damn

earnest phoenix
#

The issue is the second code... After that first one...

zenith terrace
#

Look up on the discors.js forums

#

Idk about API pings

earnest phoenix
#

Hmm... Imma check that real quick...

#

stop doing operations without knowing what they actually do

#

you saw it somewhere and now you're copypasting it

vestal star
earnest phoenix
#

there's no need to floor or round since it's a time measurement for latency, milliseconds, it won't have a decimal

#

where tf does it say that @vestal star

vestal star
#

I misinterpreted it ¯_(ツ)_/¯

zenith terrace
#

Guild create only works when the bot joins a server

vestal star
#

ok

true ravine
#

Yeah that's what I thought as well

earnest phoenix
#

any dpy people?

#
    @tasks.loop(seconds=1)
    async def check_stream_change(self):
        g: discord.Guild
        r: discord.Role
        m: discord.Member
        c: discord.TextChannel
        async for g in self.bot.fetch_guilds():
            await g.fetch_roles()
            if self.cfg.data[g.id]["streamer-channel"] == 0 or \
                    self.cfg.data[g.id]["streamer-role"] == 0:
                continue
            c = g.get_channel(self.cfg.data[g.id]["streamer-channel"])
            print(self.cfg.data[g.id]["streamer-role"])
            r = g.get_role(self.cfg.data[g.id]["streamer-role"])
            for m in r.members:
                tw = self.db.lookup_gaming_record(m.id)[4]
                if tw is None: continue
                msg: str = self.cfg.data[g.id]["streamer-message"]
                u: twitch.helix.User = self.helix.user(tw)
                if m.id not in self.online.keys():
                    self.online[m.id] = u.is_live
                else:
                    print(u.is_live)
                    print(u.display_name)
                    print(m.display_name)
                    print("---")
                    if u.is_live and not self.online[m.id]:
                        await c.send(msg)
                        self.online[m.id] = u.is_live
#
ERROR:discord.ext.tasks:Internal background task failed.
Traceback (most recent call last):
  File "D:\repos\AnsuraBot\venv\lib\site-packages\discord\ext\tasks\__init__.py", line 73, in _loop
    await self.coro(*args, **kwargs)
  File "D:\repos\AnsuraBot\cogs\streamer.py", line 43, in check_stream_change
    for m in r.members:
AttributeError: 'NoneType' object has no attribute 'members'
#

but the role has me as a member

#

so i am much confused

modest maple
#

r is null

earnest phoenix
#

but why?

#

i had it print the role id

#

and the role id matches

#
r = g.get_role(self.cfg.data[g.id]["streamer-role"])
#

im assuming its this line?

zenith terrace
#

Idk py

earnest phoenix
#

self.cfg.data[g.id]["streamer-role"] returns an integer id

modest maple
#

Because it seems to not be finding the role?

earnest phoenix
#

but thats what im asking tho

#

its a valid role

#

i can ping it by id

#

i had it print self.cfg.data[g.id]["streamer-role"] before it tried to grab the role

modest maple
#

Is the guild object the same guild object as it should be

earnest phoenix
#

ye. the config file is a yaml hold on

#
604823602973376522:
  streamer-channel: 0
  streamer-message: '%user% is streaming'
  streamer-role: 0
643870039660953612:
  streamer-channel: 643870039660953615
  streamer-message: '%user% is streaming'
  streamer-role: 682056617269002321
#

it skips the first guild

#

cuz nothing is set

modest maple
#

I ment are you getting passed the guild object you expect

earnest phoenix
#

wym?

#

it fetches the id from the config

#

that it gets from bot.fetch_guilds

#

similar code to my (working) config initialization code

modest maple
#

You are overriding g several times

earnest phoenix
#

no

#

im type hinting first

#

so my ide can autocomplete

#

then defining it

modest maple
#

Also I don't advise doing lots of ws requests in a for loop