#development

1 messages · Page 1098 of 1

restive willow
#

i saw one guy get rejected for putting his own google ads on his bot page lol

faint prism
#

nice

halcyon crow
#

My bot is so niche

faint prism
#

Same

halcyon crow
#

I can’t see it getting much love

restive willow
#

what is it

halcyon crow
#

It’s a ‘go’ bot

restive willow
#

a whatnow

faint prism
#

I can see mine people be curious about, but not use for long

halcyon crow
#

Go being the board game from ancient china

faint prism
#

oh shit

#

nice

halcyon crow
#

It turns a discord server into a go playing server

#

Multiple game rooms

restive willow
#

pretty cool if it works

halcyon crow
#

Yeah it does haha

#

But it’s not prod ready yet

whole knot
#

Hey, I do not know if that belongs here but I have a problem. So running "!pause" will pause the song and output that.
Running the command again will resume the song but "Song paused" is given out. Can someone give me a tip how to output "Song resumed" then? :)

faint prism
#

Mine tells you how nice users' messages are

halcyon crow
#

Lol

#

It’s like teaching your grandma to suck eggs +99% rude

restive willow
#
async def pause(self, ctx):
  client = ctx.guild.voice_client
  if client.is_paused():
    client.resume()
    await ctx.send("**Playing song.**")
  else:
    client.pause()
    await ctx.send("**Song paused.**")
#

is this what you mean?

#

@whole knot

bright dove
#

how come some bots have a max purge limit of 1000 but it says I'm not allowed to go above 100

#
limit: int value should be less than or equal to 100.```
faint prism
halcyon crow
#

Lol

faint prism
#

Gonna stop posting screenshots though b/c don't want to advert

halcyon crow
#

Nah that was anti advert

faint prism
#

;P

halcyon crow
#

No way im getting it now

faint prism
halcyon crow
#

Nice did you train the net and stuff?

#

Not done much with ais yet myself

faint prism
#

I trained it with a detox_wiki_40k_lines.tsv

halcyon crow
#

Lol

faint prism
#

It's hosted by Microsoft, and it's full super super offensive training data

#

But it's because it's unfiltered

whole knot
#

@restive willow Yes, but the problem is that I worked with Client, which is needed as my bot also listens to reactions. I hope you understand the problem there as I also tried your method

restive willow
#

what u mean

#

why doesnt my methoid work

faint prism
#

@whole knot Is there no way to set an event handler for that?

quartz kindle
#

@bright dove the limit is 100 for everyone

#

what they do is execute it multiple times until the requested amount is reached

restive willow
#

@restive willow Yes, but the problem is that I worked with Client, which is needed as my bot also listens to reactions. I hope you understand the problem there as I also tried your method
@whole knot im not sure what you mean but that shouldnt mean you need to work with Client. look at wait_for and on_reaction_add

bright dove
#

what they do is execute it multiple times until the requested amount is reached
@quartz kindle oh... is adding that a lot more complicated than a normal one? or is that easy to do

restive willow
#

its just a loop

quartz kindle
#

a loop and some math

whole knot
#

@restive willow I will have a look at that, guess I should rest a bit and I will get there myself. Thanks though! ❤️

queen marsh
#

Hey thankyou for telling me abt botghost

#

i have one last question

#

is there anyways with botghost i can make a command that lists the ammount of members in my server

earnest phoenix
#

Qucc

#

Jda for discord4j

#

Or*

pale vessel
#

jda

exotic cradle
#

guys

#

i just hit a milestone

#

22 server

#

*servers

#

i am so happy its not even funny

ionic dawn
#

Hi, this question is not related to a bot: How can I get a user avatar to display it on a website? so whenever he change it it will change at the website aswell

solemn latch
#

A user logged into the website?

hollow tundra
#

woa

earnest phoenix
#

Recruiting devs for a bot named "Skynet". It will have more features than MEE6 and Carl bot. To audition/join Dm me

solemn latch
#

Better be paying pretty good to have more features than mee6 and Carl bot

sweet ruin
#

Hello! I am trying to create a rank order thing, but the prefixes arent lining up, can anyone help?

  let level = u.level;
      let j = 0;
      let xpInLevels = 0;
      if (level >= 1) {
        do {
          let multiplier = j * 1.25;
          if (multiplier === 0) multiplier = 1;

          let xp = 150 * multiplier;
          xpInLevels = parseInt(xpInLevels) + parseInt(xp);
          j++;
        } while (j + 1 <= level);
      }

      let ranks;
      switch (++j) {
        case 1:
          ranks = "🥇";
          break;
        case 2:
          ranks = "🥈";
          break;
        case 3:
          ranks = "🥉";
          break;
        default:
          ranks = `#${j}`;
      }

      let xp = parseInt(xpInLevels) + parseInt(u.xp);

      let text = `**${ranks} ![blurple_marker](https://cdn.discordapp.com/emojis/738102704655695972.webp?size=128 "blurple_marker")** **${m}**```
solemn latch
#

🤔

boreal delta
#

Any node experts here?

earnest phoenix
#

Xdd

#
@commands.command(pass_context = True, aliases=["c"])
    @commands.cooldown(1, 5, commands.BucketType.guild)
    async def math(self, ctx, num1, num2):```
#

How do I make the error for @commands.cooldown

#

it works but Idk how to display error

#

how

slender thistle
#

Do you have an on_command_error?

earnest phoenix
#

nah

earnest phoenix
#

no

#

k

earnest phoenix
#

how to check if the member is connected to the same voice channel as the bot?

#

in discord js

pale vessel
#

member#voice

#

guild#me#voice

earnest phoenix
#

@pale vessel ok man thanks

mild flower
#

what is the tag to detect a role mentioned by a user?

For example : for users its message.mentions.channels.first()
For roles it will be what?

earnest phoenix
#

Hey can anyone give me some info on formatting some JSON

#

I have some nested values here

#

I'd like to assign a value to the "save" key and also the "server" key

#

I know i'm still working on everything

#

So what i'd like to do is after parsing it

#

I'd like to access json.save

#

and have one string

#

and another for json.save.server

#

Well yes

#

But I'd also like to have a string value return from the parent key

#

yeah

#

in your example "9"

#

UH

#

So what I want is

#

I want to be able to have the key "save" and have a string value assigned to t

#

And also have sub keys of "save" with their own string values

#

i wonder if i can just do "":

granite oracle
#

So i have a method that takes a good while to run but isn't always necessary to have my bot running, is there a way to start the method and continue normal message listening/bot function and let it continue when its done?

#

its one that i created

#

it takes several minutes to run

#

yeah thats what ive been looking into

#

theres stuff to do threading with python yes?

#

should i use the threading library?

earnest phoenix
#

is a web dashboard worth it ?

queen marsh
#

i feel like my bot got declined because it wasnt active for the logest of time, but its online now and i dont know if it got declined while it was offline

clever vector
#

guys is my addField correct?

#

.addField("usage","${command.config.usage || "No Usage"}")

slender thistle
#

template strings are done with `

torn ravine
#

does anyone here use mongoose and think they can help me

mild flower
#

message.member.roles.add()
this is the line for adding roles
what if i wanted to assign the role to a member defined by a variable?

this is what i thought would work
roleuser.roles.add()

weak rain
#
              ^
TypeError: NovelCovid is not a constructor
at Object.<anonymous> (/app/commands/info/corona.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
at /app/handlers/command.js:19:24
    at Array.forEach (<anonymous>)
at module.exports (/app/handlers/command.js:11:32)```
#

what should i do?

copper cradle
#

what is NovelCovid

weak rain
#

package

copper cradle
#

yes but what exactly

#

gimme their docs

weak rain
pale vessel
#

imagine needing an extra package when you can use the api directly

#

oops i'm sorry because that can be taken as toxic

copper cradle
#

@weak rain it's not a constructor

#

read the examples

weak rain
#
const { NovelCovid } = require("novelcovid");
const track = new NovelCovid();

module.exports = {
  name: "corona",
  category: "info",
  description: "Get the stats of corona",
  usage: "corona all or corona <country>",
  aliases: ["covid", "covid19"],
  run: async (client, message, args) => {
    
    if(!args.length) {
      return message.channel.send("Please give the name of country")
    }
    
    if(args.join(" ") === "all") {
      let corona = await track.all() //it will give global cases
      
      let embed = new discord.MessageEmbed()
      .setTitle("Global Cases")
      .setColor("#ff2050")
      .setDescription("Sometimes cases number may differ from small amount.")
      .addField("Total Cases", corona.cases, true)
      .addField("Total Deaths", corona.deaths, true)
      .addField("Total Recovered", corona.recovered, true)
      .addField("Today's Cases", corona.todayCases, true)
      .addField("Today's Deaths", corona.todayDeaths, true)
      .addField("Active Cases", corona.active, true);
      
      return message.channel.send(embed)
      
      
      
    } else {
      let corona = await track.countries(args.join(" ")) //change it to countries
      
      let embed = new discord.MessageEmbed()
      .setTitle(`${corona.country}`)
      .setColor("#ff2050")
      .setDescription("Sometimes cases number may differ from small amount.")
      .addField("Total Cases", corona.cases, true)
      .addField("Total Deaths", corona.deaths, true)
      .addField("Total Recovered", corona.recovered, true)
      .addField("Today's Cases", corona.todayCases, true)
      .addField("Today's Deaths", corona.todayDeaths, true)
      .addField("Active Cases", corona.active, true);
      
      return message.channel.send(embed)
      
      
    }
    
  }}```
#

this is my code

#

but it was working

#

before i added canvas senpie

copper cradle
#

canvas senpie?

weak rain
#

thats a package too

sinful sorrel
#

hello

#

sir

weak rain
#

Hi

sinful sorrel
#

where can i promote my bot

weak rain
#

go apply on the website

low shard
#

@weak rain lol

weak rain
low shard
#

Canvas senpie

copper cradle
#

@weak rain as I said, it's not a constructor, remove that line and call everything directly on the object that you're importing

sinful sorrel
#

go apply on the website
@weak rain ty sir

weak rain
#

@low shard my friend advised me that

#

@weak rain as I said, it's not a constructor, remove that line and call everything directly on the object that you're importing
@copper cradle which line

copper cradle
#

2nd

#

nooo

#

3rd

#

I meant 3rd

#

not the second line

weak rain
#
    if(args.join(" ") === "all") {
      let corona = await track.all() //it will give global cases
      ```
copper cradle
#

go to their page and read the examples they have

weak rain
#

now giving error here

#

track

copper cradle
#

ofc bc you didn't define track

#

change track to NovelCovid

weak rain
#

ok

copper cradle
#

and on the second line remove those {}

weak rain
#

kk

#
novel covid is not defined```
#

oh done

copper cradle
#

oml

#

what did you even do

#

lmao

weak rain
#

error is gone

#

xD

copper cradle
#

lol

weak rain
#
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
at /app/handlers/command.js:19:24
    at Array.forEach (<anonymous>)
at module.exports (/app/handlers/command.js:11:32)
at /app/server.js:19:35```
#

now here

#

@copper cradle

copper cradle
#

where did that even come from

#

show your code

weak rain
#

server.js?

copper cradle
#

idk where that error came from

#

I guess it was server.js

weak rain
#

ok

#
const { config } = require("dotenv");
const discord = require("discord.js") //Gonna use Discord.js Module xD
const Canvas = require("canvas");
const client = new discord.Client({
  disableEveryone: true // what does this disable thing do?
});
const { CanvasSenpai } = require("canvas-senpai")
const canva = new CanvasSenpai();
const db = require("quick.db") //WE WILL BE USING QUICK.DB
const { addexp } = require("./handlers/xp.js")
client.commands = new discord.Collection();
client.aliases = new discord.Collection();




["command"].forEach(handler => { 
  require(`./handlers/${handler}`)(client)
})



client.on("ready", () => { //When bot is ready
  console.log("I am Ready to Go")
  client.user.setActivity(db.get(`status`)) //It will set status :)
})

client.on("message", async message => {
  
if(message.author.bot) return;
  if(!message.guild) return;
  let prefix = db.get(`prefix_${message.guild.id}`)
  if(prefix === null) prefix = default_prefix;
  
  if(!message.content.startsWith(prefix)) return;
  
     if (!message.member) message.member = await message.guild.fetchMember(message);

    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const cmd = args.shift().toLowerCase();```
#
    
    if (cmd.length === 0) return;
    
    // Get the command
    let command = client.commands.get(cmd);
    // If none is found, try to find it by alias
    if (!command) command = client.commands.get(client.aliases.get(cmd));

    // If a command is finally found, run the command
    if (command) 
        command.run(client, message, args);
  
return addexp(message)

 }) //All codes link in description

//GONNA USE EVENT HERE

client.on("guildMemberAdd", async (member) => {
  let chx = db.get(`welchannel_${member.guild.id}`);
  //Better :)
  if(!chx) return;
  //Canvas code
   let data = await canva.welcome(member, { link: "https://cdn.discordapp.com/attachments/706050979941843033/737985899442208789/20single-frame.png" })
  
  let wembed = new discord.MessageEmbed()
  .attachFiles([{
    attachment: data,
    name: "hello.png"
  }])
  .setColor("RANDOM")
  .setImage("attachment://hello.png")
  .setThumbnail(member.user.avatarURL())
  .setDescription(`** Welcome <@${member.user.id}> To our Server** 
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**Make sure to**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**Read and Follow our Rules.**
**Be upto date with our announcements.**
**Make new friends in the chat and be active.**
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
**We hope that u have fun in the server!**`);
  client.channels.cache.get(chx).send(wembed)
})

client.login(token)```
#

@copper cradle

copper cradle
#

I can't quite read that

#

I'm on my phone lmao

weak rain
#

:/

copper cradle
#

well

torn ravine
#

thunder are you still having the same problem?

weak rain
#

na its another

torn ravine
#

ah ok

weak rain
#

can u help me related this?

weak rain
#

anyone?

earnest phoenix
#

Nope, sorry

mild flower
#

how do i check if a member has the role specified

earnest phoenix
#

which lib?

void vale
#

hi

lusty quest
#
 embed.attachFiles([attachment]);
 embed.setTitle(data.title);
 embed.setImage("attachment://image.png");
``` I create a image with canvas and chart.js but the image doesnt get send. I validated that a image is generated (sending the image in a channel works) also validated that the embed is valid and accepts images (used a url for a temporary image)
void vale
#

v11 or v12?

#
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'image.png');
embed.attachFile(attachment)
embed.setImage("attachment://image.png");
#

@lusty quest try it

lusty quest
#

V12

#

this is also what i already do

#
  const canvasRenderService = new CanvasRenderService(width, height, (ChartJS) => {});
               const image = await canvasRenderService.renderToBuffer(configuration);
               const attachment = new Discord.MessageAttachment(image, "image.png");
               let embed = new Discord.MessageEmbed();
earnest phoenix
lusty quest
#

and message.channel.send(attachment) sends in the Image

earnest phoenix
#

How do I make inline 2 across

#

not 3

lusty quest
#

make one empty field but then it will probably look wired

earnest phoenix
#

how do I do a empty field

#

in python

lusty quest
#

¯_(ツ)_/¯

#

idk py

earnest phoenix
#

PythoDocs can help you

void vale
#

Where to get a pack of standard emoji?

#

for canvas

mild flower
#

how do i check if a member does not have the role mentioned?

void vale
#
var role = msg.mentions.roles.first()
#

Do you need this?

earnest phoenix
#

bro can help me, i have some error when install npm quick.db pls help 🙂

#

msg.member.hasRole

I believe

#

Install: XCode

Run: npm i -g node-gyp in terminal

Run: node-gyp --python /path/to/python2.7 (skip this step if you didn't install python 3.x)

Run: npm i quick.db

#

How do I do empty field in python

#

Read doc

#

o okay thx

pure lion
#

@mild flower roles.has

earnest phoenix
#

How do I do empty field in python
@earnest phoenix u cant ig

pure lion
#
            let promise = Promise.all(a);
            (await promise).forEach(p => { if (p) console.log; else return })```

so i tried this and it logged nothing
void vale
#

My English is bad

lusty quest
#

@pure lion what did you pass to it?

pure lion
#

All the guild IDs from oauth, so there are some null and some not

earnest phoenix
#

@earnest phoenix shush you can

#

oh?

#

how?

pure lion
#

Before it logged everything including nulls

earnest phoenix
#

Quick google search can help you :)

lusty quest
#

not sure if this is still needed but try console.log(p)

earnest phoenix
#

bruh

pure lion
#

@lusty quest I did that, it's an array of resolved promises

earnest phoenix
#

@earnest phoenix send me that code pls

#

thats just 101hax

#

Search it yourself

#

lmfao

pure lion
#

I just want to filter out the nulls

earnest phoenix
#

Programmer need searching skill :)

#

@earnest phoenix just give the code pls

#

Nuh no spoonfeeding code

#

xd

#

but u can actually add \n\n in the description itself

#

like i did

#

embed.add_field(name=title, value=description + "\n\u200b")

#

ty

#

Nfp

#

but title wot remain title

#

.-.

#

wont*

lusty quest
#

@pure lion you get an array in a array?

#

usually for each should make a new Console.log for each entry in the array

pure lion
#

It's a promise all to resolve all of da shit

#

Also okay

earnest phoenix
#

em.add_field(name=title, value=description + "\n\u200b")

#

when I do this

#

it says title isn't defined

#

lmfao

#

add some text into title

#

I don't want

#

also into description

#

there to be a title

exotic yew
#

Do anybody has 10 coins of member + bot

earnest phoenix
#

I want it completely empty..

#

hence empty field

#

u cant to it

#

I don't want

#

3 of these

#

in row

#

I want 2

#

put

#

maybe invis text

#

inline=False

#

that won't work

#

how do u want it to be

#

dm me

#

Mongodb gud or nah

torn ravine
#

I’ve used it long enough to say its okay

slow fable
#

i use json files .-.

earnest phoenix
#

e w

pure lion
#

U serious?

torn ravine
#

@slow fable you need a DB NOW

slow fable
#

yep

earnest phoenix
#

@slow fable use quick.db

slow fable
#

lmao is it free tho?

pure lion
#

@slow fable get a db or ill spam your dm

torn ravine
#

512MB free

slow fable
#

Alright

#

ok

pure lion
#

I wanna filter nulls from an array, how I do?

slow fable
#

maybe like for loop or sm

lusty quest
#

array.filter(p => p<1) something like this

pure lion
#

Well its an array of both nulls and maps, would that still work?

earnest phoenix
#

array.filter(m => m!=null||m!=undefined)

lusty quest
#

^

pure lion
#

Ok thanks

earnest phoenix
#

np

pure lion
#

Its only null btw so it's fineeee

slender thistle
#
>>> let a = [1,2,3,4,5,6,null,"a", null, "e"]
undefined
>>> a
Array(10) [ 1, 2, 3, 4, 5, 6, null, "a", null, "e" ]

>>> a.filter(elem => elem != null)
Array(8) [ 1, 2, 3, 4, 5, 6, "a", "e" ]
earnest phoenix
#

sHivaCo

lusty quest
#

i still hate canvas. like the issue i have make no sense for me

pure lion
#

Freeshivaco
Paidshivaco

glass steeple
#

Hey, can anyone tell how to time the bot to run specific commands
like cleaning a channel daily at specific time

earnest phoenix
#

@lusty quest I like your profile picture

#

You can use setTimeout

pure lion
#

#shit

earnest phoenix
#

Orr

#

1 sec

pure lion
#

I give up

glass steeple
#

@earnest phoenix ok

earnest phoenix
#

You can search google for the codeee

pure lion
#

Just use setInterval(function (params) { //cool shit }, timeout)

glass steeple
#

@pure lion ok thanks

earnest phoenix
#

If the bot restart

pure lion
#

U fucced

earnest phoenix
#

The interval will got reset

glass steeple
#

ooh okay

earnest phoenix
#

I cant think of a way to do it

#

Excdept

#

Set an interval that run every 1 second that check time

glass steeple
#

will search for it

mild flower
#

how do i check if a role specified by a variable is in a guild or not

#

@ me

earnest phoenix
#

Wdym by that?

mild flower
#

i want it to say that that is not a valid role

earnest phoenix
#

So

#

You can do something like

#

Get roles map

#

And filter them

#

.filter(r = r.name).includes("somerolename");

#

and if the role doesnt exist, it will return falsr

mild flower
#

let rmentioned = message.mentions.roles.first() || args[1] if(!rmentioned) return message.channel.send(Erole)
if i do this it wont detect non-role words

earnest phoenix
#

oh

mild flower
#

any way to modify this if statemtn?

earnest phoenix
#

I see what you mean

#

You see the return state ment?

#

Add ;

mild flower
#

no

#

i mean

earnest phoenix
#

To the return

mild flower
#

i want it to include non-roles

earnest phoenix
#

so you want the statement to detect non role?

mild flower
#

if(rrmentioned = !message.roles) return message.channel.send(Erole)

#

wont something like this work

#

so you want the statement to detect non role?
yes

earnest phoenix
#

so the reason it dkesnt work

#

Is because

#

You forgot to add ;

mild flower
#

hmm

earnest phoenix
#

return;

mild flower
#

ok

#

leme try

earnest phoenix
#

For the love of god, add ;

#

It will make your code better by like

#

10000%

mild flower
#

oh whoops

#

ill sort it from here

#

thanks

primal lynx
#

$ma

earnest phoenix
golden condor
#

Hello there,
In my bot I am trying to make a mute system which the mutes are stored in a dB and when the bot restarts it loads up this dB. What is the best way for me to go about loading them back up? Would I use timeouts or do something more efficient (I am using node.js and Eris). Thanks!

earnest phoenix
#

so you want the bot to poad the db everytime it restart?

pure lion
#

Fucking share button always sending the wrong channel

earnest phoenix
#

@golden condor sorry for ping

#

so you want the bot to load the db everytime it restart?

golden condor
#

@earnest phoenix yes that's what I want, I can do that but I want to try and make it so it loads the mutes efficiently

vestal walrus
#

When will my bot show on the website?

earnest phoenix
#

@vestal walrus when it get verified

vestal walrus
#

Is that easy?

earnest phoenix
#

Just add your bot and wait for 3-4+ weeks

#

Also

vestal walrus
#

Ok thanks

earnest phoenix
#

does the inline thing in python work properly?

golden condor
#

Hello there,
In my bot I am trying to make a mute system which the mutes are stored in a dB and when the bot restarts it loads up this dB. What is the best way for me to go about loading them back up? Would I use timeouts or do something more efficient (I am using node.js and Eris). Thanks! I have sorted out loading the mutes with the database, all I need to do is wait out the time (I have calculated it) and I am not sure how to go about that, whether I should use timeouts or I should use another method to make it more efficient. Another thing, if I used timeouts, how would it work correctly, as it might not work due to it waiting for the timeout to finish.

primal lynx
#

@earnest phoenix what

earnest phoenix
#

run a loop which checks the time when the person needs to be unmuted, if the time matches current time then unmute

#

maybe

#

just an idea

tight plinth
#

i'ld say use a setInterval that checks the dB each minute

earnest phoenix
#

what if two ppl are muted at the same time

#

with seconds gap

tight plinth
#

the setInterval can check the entire dB with a foreach

earnest phoenix
#

oh ye

tight plinth
#

and seconds who cares

earnest phoenix
#

I got him

tight plinth
#

why would someone be muted for 3 seconds

earnest phoenix
#

for a minute?

#

it will work

#

nvm

tight plinth
#

in this case make it check every 30 sec

golden condor
#
mutes.map(m => { 
if(m.time <= Date.now() ) {
//Unmute
}
else {
setTimeout(() => {
//Unmute
}, mute.time - Date.now())
}
return;
})```i feel as though something like this would work
#

But checking every so often is a good idea too

tight plinth
#

no

#

the entire function needs to be in a setInterval

#

that runs every, let's say, 30 secs

golden condor
#

No this is on startup

tight plinth
#

yes ik

golden condor
#

The thing I put about

tight plinth
#

but it's better to me to use a setInterval

opaque bronze
#

i made a bot

tight plinth
#

so you don't have to handle startup

opaque bronze
#

i am so fucking proud of it

tight plinth
#

it just works

#

@opaque bronze gg

golden condor
#

I'm just considering the efficiency

tight plinth
#

I mean

golden condor
#

So how often should it run

tight plinth
#

I'll not force you

#

30 seconds seems to be a good deal for me

golden condor
#

I am just thinking how to go about it

#

I think your idea works

#

But for like accurate things I could do like every 5s?

glass steeple
#

how to restrict bot from rplying to admins on keywords ?

I tried

If message.author.roles != 'Admin' :

But it didn't work

golden condor
#

Python I assume?

glass steeple
#

yes

tight plinth
#

But for like accurate things I could do like every 5s?
@golden condor I think 5 seconds would be a bit too migh, try 10

golden condor
#

So what about shorter mutes, what should I do for those, use that system or have a seperate one (that's why I was thinking 5s)

earnest phoenix
#

how to restrict bot from rplying to admins on keywords ?

I tried

If message.author.roles != 'Admin' :

But it didn't work
oh

#

is the role name admin?

#

@glass steeple

#

or you can check the perms directly

tight plinth
#

@golden condor who mutes someone for 5 seconds lol

#

it's useless

golden condor
#

Because people are stupid

tight plinth
#

true

golden condor
#

So I am thinking to do every 5s for more accuracy

earnest phoenix
#

every 1s is more accurate

golden condor
#

Yeah but a bit unnecessary

earnest phoenix
#

load the data into a file

tight plinth
#

5s is ok

earnest phoenix
#

and keep checking that file

#

maybe

golden condor
#

I am thinking of storing them in a seperate collection

earnest phoenix
#

but accessing a remote db every five seconds

#

not recommandeble ig

golden condor
#

What's wrong with that

tight plinth
#

corruption

#

memory usage

#

intense cpu

earnest phoenix
#

also doesnt it slow up?

tight plinth
#

that's why i'ld recommend every 30sec

#

a little bit

earnest phoenix
#

ye

tight plinth
#

but not too loch to make the bot laggy

earnest phoenix
#

Heres smart idea

#

Every 1 min

tight plinth
#

what about 30 sec muted

earnest phoenix
#

i change my bot's custom status every 10s

#

😆

tight plinth
#

erm

earnest phoenix
#

what about 30 sec muted
@tight plinth settimeout

tight plinth
#

you should change it every 13 sec

glass steeple
#

@earnest phoenix i copied the role name , but it didn't worked , people roles gives a list of roles so u have to check in the list for admin , so will tey that

tight plinth
#

so its not ratelimited

golden condor
#

Should I store them inside the map

earnest phoenix
#

ye ur code is wrong @glass steeple

tight plinth
#

inside the db

earnest phoenix
#

ur code doesnt check the name of role

tight plinth
#

i'ld say create a collection

#

map with forEach

glass steeple
#

@earnest phoenix hmm, i will check in the list of roles like , Admin in member.author.roles

earnest phoenix
#
if i.name.title()= 'Admin':```
#

role is an object

#

it has different attributes

#

admin is a string , so u cant compare it with role object

golden condor
#

@tight plinth will do this every 30 seconds and for mutes less than 30s I will use a timeout

tight plinth
#

good idea

earnest phoenix
#

My idea-

golden condor
#

Or I could do it for less than 15s

earnest phoenix
#

@tight plinth will do this every 30 seconds and for mutes less than 30s I will use a timeout
@golden condor is it a private bot

#

or a public one

lusty quest
#

lol i change it every 5 minutes on my bot. to fast is in my opinion annoying

earnest phoenix
#

or maybe load all the data into a json file

#

and further mutes get added to the json file as well as the db

golden condor
#

@golden condor is it a private bot
@earnest phoenix public

#

I have an idea, not sure how good this is. You can set a Timeout for every mute

#

On start up

earnest phoenix
#

then maybe u can make some moni with it if it becomes famous xD

golden condor
#

I kinda had this idea before

#

But I'm not sure

earnest phoenix
#

put cooldown for the non premium users

#

and no cooldown for prem

#

xD

#

101 business xD

golden condor
#

@tight plinth what do you think of setting a timeout for every mute?

earnest phoenix
#

Good idea

tight plinth
#

i'ld say it doesn't matter but every minute seems better to me

earnest phoenix
#

or just add a restriction that mute time cant be less than 1minute

golden condor
#

I'm just wondering how efficient that would be

earnest phoenix
#

you might exhaust the pool by setting a timeout for every action

golden condor
#

So the interval is better?

earnest phoenix
#

im not entirely sure how well node handles it so i can't exactly suggest what's the best

looking back at my old code in c# i had something equivalent of setTimeout for every action, but that's because c# is multithreaded

golden condor
#

Oh ok

viral iris
#

how to make api loop with fetch ?

earnest phoenix
#

loop?

#

Not recommend, unless have timeout

#

Or use interval

golden condor
#

Ok

viral iris
#

loop?
i mean autoupdate

halcyon crow
#

What is the context?

viral iris
#

what do u mean ?

halcyon crow
#

I mean what are you trying to do? What needs to be auto updated?

viral iris
#
**${json.data.dynamicKeys[6].pakFilename}:**
\`\`${json.data.dynamicKeys[6].key}\`\``
#

this

#

u wanna the full code ?

halcyon crow
#

Seems out of my scope sorry mate

#

Don’t understand

viral iris
#

it's an api

tight plinth
#

what can I do against YouTube rate limiting lavalink node?

pure lion
#

Does lavalink get directly from YT?

restive furnace
#

lavalink scraps

#

what can I do against YouTube rate limiting lavalink node?
ip rotating

pure lion
#

e

halcyon crow
#

How noticeable is the difference in speed between discordpy bots and nodejs bots? Or are other factors more limiting?

earnest phoenix
#

node is singlethreaded so there's that

#

multithreaded languages will always be more performant than single threaded ones

restive furnace
#

^

#

so if you want pure speed, go with multithreaded one.

halcyon crow
#

Python doesn't have true multithreading though right?

earnest phoenix
#

it does, it's just a mess to work with though

pure lion
#

Install windows build tools

#

And py

earnest phoenix
#

How?

tight plinth
#

you have to install python 2.7 and windows build tools

earnest phoenix
#

ok

#

Woops

lusty walrus
#

hmm is quick.db lag ?

earnest phoenix
#

Nah

pure lion
#
    <p id="uGuilds">
        <script>
            let s = document.getElementById('uGuilds')
            `<%-userGuilds%>`.forEach(g => s)
        </script>
    </p>

userGuilds is an array of maps and i want to create a grid for each guild that holds params of each map in individual lines columns (haha very funny i know im putting nosql into sql)

still lily
halcyon crow
#

Why not just post the problem and see if anyone can help that way lol

pure lion
#

@still lily don't ask to ask

still lily
#

how can i save a attchemnt that was send by a user in discord.py

halcyon crow
#

for attachment in message.attachments:

earnest phoenix
#

make a GET request to the attachment url and save what's returned in the response body

slender thistle
#

attachment.save

halcyon crow
#

^

slender thistle
#

rtfd

halcyon crow
#

await save(attachment) <--- wrong, my mistake

slender thistle
#

... no?

earnest phoenix
#

oh that exists

slender thistle
#

literally what I just did

halcyon crow
#

shivaco is right, my mistake

slender thistle
#

Do you mean a table by grid or literal grid?

still lily
#

and im getting a error

earnest phoenix
#

how do you expect the code to know what attachment is

pure lion
#

i forgot how to spell anyway

slender thistle
#

You're not getting the attachments in the message

pure lion
#

Do you mean a table by grid or literal grid?
table ye

earnest phoenix
pure lion
#

Just wait

earnest phoenix
#

just wait ™️

pure lion
#

Just wait™®©

still lily
#

if anyone could just give me the code for the command would be epic its 1:30 am here and my brain isnt really working

earnest phoenix
#

no :)

still lily
#

im just gonna do something else in the mean time

lusty walrus
#

enter

earnest phoenix
lusty walrus
#

press enter

earnest phoenix
#

go to sleep and then pick it up in the morning

lusty walrus
#

lmeo im press and it done lmeo

earnest phoenix
#

wait

#

may be the message has an attachment attribute?

#

?_?

slender thistle
#

message.attachments

#

which is a list of Attachment object

#

And those objects have a save method

pure lion
#

a

still lily
#

so how would that look in a full command @slender thistle

pure lion
#
    <p id="uGuilds">
        <script>
            let s = document.getElementById('uGuilds')
            `<%-userGuilds%>`.forEach(g => s)
        </script>
    </p>

userGuilds is an array of maps and i want to create a table that holds all of the shit in each map (every param has its own cell)

earnest phoenix
#

pretty

#

it would look pretty

pure lion
#

so how would that look in a full command
pretty damn cool

slender thistle
#

Iterate over message.attachment, the current element named attachment (for attachment in message.attachments:)

#

then inside that loop, you use attachment.save

still lily
#

k ill try that

pure lion
#
for (const every of array) { /*do stuff*/ }
#

oh heyyy my net went down again

#

jejejejeje

slender thistle
#

I mean there's an option of making a row with column names and then putting actual data in rows below

pure lion
#

That would be useful but can it be made over iterations

#

?

#

Fuck it just send me da docc

slender thistle
#

It can, just make a table element, append all your shit to a string, and then edit the table's innerHTML to table contents (the string you edited)

glass steeple
#

command to mention channel ?

pure lion
#

no command

#

[#development](/guild/264445053596991498/channel/272764566411149314/)

glass steeple
#

how to put that in code

#

it shows red after hashtag

restive furnace
#

its string

pure lion
#

^^

glass steeple
#

ooh sorry

#

my bad

#

working 👍 thanks

earnest phoenix
#

Still same oof

still lily
#

i dont even know anymore

#

im to tired

#

lol

tight plinth
#

you're trying to make the argument a for loop

brave sapphire
#

I wish everyone Good luck With You're bots

#

Sry for My Wirting im Trining to type Englisch on a german keyboard

pure lion
#

typing in localhost:5000 too much today fucking help

golden condor
#

Hello guys, I am trying to code my bot and I keep getting this error for no reason at all as soon as I start to connect

#

Error: Client network socket disconnected before secure TLS connection was established

pure lion
#

ohno

brave sapphire
#

Connect to What?

#

Voice Chanel?

golden condor
#

Ok nvm it was lavalink being bad

pure lion
#
    <table id="uGuilds">
        <tr>
            <th>Guilds</th>
        </tr>
        <tr>
            <td><%-userGuilds.map(g => g.guildID).join('\n')%></td>
        </tr>
    </table>

how do i create a new table element for each guild?

slender thistle
#
g => `<tr>...</tr>`
amber widget
#
client.guilds.cache.map(r => r.name)
pure lion
#

Also it's not drawing lines

#

Oh ty

slender thistle
#

That sounds like a CSS issue

pale vessel
#

default html tables are not styled

slender thistle
#

They're not?

#

I thought there was some default styling

pale vessel
#

nah

slender thistle
#

TIL

pale vessel
pure lion
#

It doesn't make a new row for every ID

delicate zephyr
#

imagine using html tables and not css grids

slender thistle
#

What's the difference actually

pure lion
#

://////////////////////

delicate zephyr
#

@slender thistle css grids are nicer imo

#

less having to pussy foot and remove the outlines of table shit

earnest phoenix
#

flexbox grids >>>>

delicate zephyr
#

^ this

#

holy shit did we just... agree on something

slender thistle
#

Someone confused rows with columns apparently

delicate zephyr
#

yes

pure lion
#

u h

earnest phoenix
#

Still sanee

#

Same*

clever vector
#

Guys how to add emoji in .setFooter

tight plinth
#

you can't

restive furnace
#

you can

#

but not custom one

half bison
#

bruh.

clever vector
#

@restive furnace cant use custom one?

#

@torn ravine used custom one

#

HEy guys i wanna 1 more

#

i want my info to be this

#

Cat Police
This is a quite easy to use which contains : '' Moderate | Information | Fun | Animal | Social & more systems. "
Invite Discord Prefix
Click Here Click Here .
Team
@compact flume

robust arrow
#

are you familiar with inline

clever vector
#

inline: true right

robust arrow
#

or you can just addfield(””, ””, true)

clever vector
#

Ya

robust arrow
#

so what ur problem

clever vector
#

i use inline: true in my bot

#

@robust arrow can you come to my bot test real quick?'

robust arrow
#

im on my phone

#

but sure

torpid edge
#

hey guys
i saw this tutorial on how to host bot 24/7 and i have to add my github repo to heroku
and i have to deploy branch in one step and it recognized a mistake in my package,json

#

it said this

#

We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   Some possible problems:
   
   - node_modules checked into source control
     https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
#

i dont understand

#

can someone explain

tight plinth
#

dont use heroku to host discord bots

torpid edge
#

then what should i use

tight plinth
#

but free hosts are bad in general so

torpid edge
#

oh

obsidian shell
#

Use heroku

robust arrow
#

get a vps

tight plinth
#

^

earnest phoenix
#

is the bot dev badge forever?

tight plinth
#

@obsidian shell no

torpid edge
#

Use heroku
@obsidian shell how

tight plinth
#

@earnest phoenix except if you delete your bot, it wont go away

torpid edge
#

We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   Some possible problems:
   
   - node_modules checked into source control
     https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits

@obsidian shell i need u to explain this then

#

pls

#

i need help

robust arrow
#

do not use free host

obsidian shell
#

Oc

robust arrow
#

use something like bungeecloud

#

cheap vps

obsidian shell
#

I have a video that explains it well, but it is in Spanish

torpid edge
#

its ok

#

just send

obsidian shell
#

Oc

torpid edge
#

ill try to figure out

pure lion
#

Is there a way to add/replace values in a map?

torpid edge
#

send in dm or something

#

@obsidian shell

robust arrow
#

get a vps

#

1$/mo isnt much

#

12$/year

earnest phoenix
#

Hey

pure lion
#

Issue?

earnest phoenix
#

how can I make that once the user vote for my bot

#

get coins

honest perch
#

Webhools

pure lion
#

Use the DBL API

earnest phoenix
#

or anything I want

honest perch
#

Webhooks

earnest phoenix
#

I searched and tried

#

but nothing works

honest perch
#

It does

#

You need to use webhooks

earnest phoenix
#

it does, you just did it wrong

honest perch
#

Take the vote and do what you want

earnest phoenix
#

I don't want it in a command

honest perch
#

Ffs

earnest phoenix
#

I want it like an event

honest perch
#

Webhooks

#

Webhooks

earnest phoenix
#

OK

#

I understand webhooks

honest perch
#

Use the api

earnest phoenix
#

DBL webhooks != discord webhooks

honest perch
earnest phoenix
#

oh

#

I saw this example

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
#

so when someone vote, this will get triggered?

honest perch
#

Yes

earnest phoenix
#

op

#

Ok

#

I will try it

#

and here

const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });

webhookServer isn't required?

slender wagon
#

so if u are able to log it in a console u can even make it so it sends a message in a certain channel?

honest perch
#

You need a sercer

#

Server

#

To receive the votes

earnest phoenix
#

Ok thanks

#

I will try it

slender wagon
#

is there any tutorial for the webhook servers?

honest perch
#

Its just the language you are using

#

Depends what you want to do @slender wagon

slender wagon
#
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
``` this
honest perch
#

Yes, the server just receives the vote

#

And you console log the ip

#

Id

#

Then you can do anything in JavaScript else

pure lion
#

How do I set a background image for my site so that it always fills the screen?

#

No tiling btw*

pale vessel
#

sounds like background-repeat

slender wagon
#

can i use discord webhooks?

honest perch
#

Directly no

#

But you can send it from the server

#

After receiving the vote

slender wagon
#

so i will still need the server

pale vessel
#

background-repeat: no-repeat;

honest perch
#

Yes

pale vessel
#

something like this maybe @pure lion

slender wagon
#

can u send an example of the server?

honest perch
#

You just sent one

pure lion
#

Yeah but i want it to fill the screen too

slender wagon
#

so that's it?

honest perch
#

You just need to send a json/application webhook to discord

#

From your server

slender wagon
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); like where do i find the pass? or just the webhook token?

honest perch
#

Dbl token is in the api docs

pale vessel
#

can you like do a simple google search?

honest perch
#

The auth you can set in your bots edit page

pale vessel
slender wagon
#

oh okay

pale vessel
#

you can do better than this

pure lion
#

No I can't flaz I searched that last time and I'm a retar x)

earnest phoenix
#

what is the advantage of this

 console.log(`Webhook running with path ${hook.path}`);
pure lion
#

So you know

#

¯\_(ツ)_/¯

earnest phoenix
#

what?

pure lion
#

So you know where it's running

#

And if it's actually running or not

earnest phoenix
#

thanks

pure lion
slow fable
#

what

#

how

earnest phoenix
#

wait

pure lion
#

It's a joke

earnest phoenix
#

everything is working fine

pure lion
earnest phoenix
#

for my webhook

#

but when voted

#

nothing get on the console log

honest perch
#

It takes time

earnest phoenix
#

It's been 4 minutes

#

nothing got consoled

#

like nothing

torpid edge
#

ok
i got how to host a bot 24/7 i think
i did it with heroku and github

honest perch
#

Ew

pure lion
#
            let promise = Promise.all(a);
            let mDBguilds = (await promise).filter(x => x != null)
            for (let guild of mDBguilds) {
                guild.set(guildID, client.guilds.cache.get(guild.guildID).name)
            }

is this a valid way to change all of one map value?

earnest phoenix
#

Why voting event isn't working

mild flower
#

if(rmentioned = !message.guild.roles) return message.channel.send(Erole)
What should i substitute message.guild.roles with??

slender thistle
#

what are you trying to do

earnest phoenix
#

@mild flower explain please

#

what is this code

mild flower
#

uh

#

wait

#

im creating a give roles command

#

whenever i type a non role

#

it does this and crashes

void vale
#

wait

mild flower
#

how can i detect if its a role or not

crystal stream
#

@mild flower do the check if role existing in server

mild flower
#

how

#

im asking what is the tag

#

if(rmentioned = !message.guild.roles)
this it?

pure lion
#

mentions.has

void vale
#
var role = msg.mentions.roles.first()
var member = msg.guild.members.cache.get(msg.author.id)
member.roles.add(role)
crystal stream
#

@mild flower, Search for roles by name using iterates over all roles

#

What version of discord.js u using?

mild flower
#

0.14

#

if(rmentioned = !rperson.roles.cache.has(rmentioned.id)) i think this is correct?

#

wait

#

this is not what i wanted

golden condor
#

If you get 429 on lavalink, how long does this mean you are limited for?

void vale
#

= !

#

wtf

mild flower
misty sigil
#

return.

#

return sending the already has

mild flower
#

if(rperson.roles.cache.has(rmentioned.id)) return; message.channel.send(`:red_circle: ${rperson.displayName} already has that role!`)

misty sigil
#

no

mild flower
#

how can i make it break if the if statement is succesful

misty sigil
#

remove the ;

mild flower
#

ok

robust arrow
#

the ; after return should be at the end

misty sigil
#

then that will work

#

put the ; at the end yea

void vale
#
if(rperson.roles.cache.has(rmentioned)) {
message.channel.send(`:red_circle: ${rperson.displayName} already has that role!`)
return;
}
digital ibex
#

you put the return before sending the message

mild flower
#

bru

#

now its sending the opposit

misty sigil
#

wouldn't it be return message.channel.send();?

mild flower
#

yes thats what i wrote?

pure lion
#

Idk what's going on but yes Jeremy it would be

#

Btw whats the atmods count

robust arrow
#

yeah

misty sigil
#

what code do you have

mild flower
#

wait

#

lemme make bin

misty sigil
#

finally someone who doesn't spam chat

earnest phoenix
#

ip logger

misty sigil
#

i can't see whats wrong

mild flower
#

hmm

earnest phoenix
#

why he delete after i made joke

#

seems sus

digital ibex
#

thats not an ip logger lmao

mild flower
#

bruh

earnest phoenix
#

ik but it made it funny

#

when he deleted it

mild flower
#

r/wooosh

earnest phoenix
#

drop it again shadow

mild flower
#

._.

pure lion
#
            mDBguilds.forEach(mguild => mguild.set(mguild.guildID, client.guilds.cache.get(mguild.guildID).name))

this isnt working (mDBguilds is an array of objects)

earnest phoenix
#

so who here knows alot about

#

intellij

pure lion
#

#shitepostoffice

earnest phoenix
#

?

mild flower
#

WHY IS ; NOT WORKING

#

i cant get it to work right

#

when i already have the role

robust arrow
#

ä

slow fable
#

why do yall hate json files

pure lion
#

how to edit single value of object

robust arrow
#

pure lion
#

why do yall hate json files
json succ

digital ibex
#

why

mild flower
#

is there no way to see if the variable entered is a role in the guild or not?

pure lion
#

why what

digital ibex
#

why does json suck

#

json is useful

pure lion
#

oh i thought you were gonna help m-

digital ibex
#

lol

#

idk what ur issue is lmao

slow fable
#

its a bit slower than db

restive furnace
#

just eat ur ram

#

so u dont need real db

pure lion
#

my issue is that i dont know how to edit a single value of an object

restive furnace
#

object['thing'] = "yes";

digital ibex
#

what is the object?

pure lion
#

in an array

#

🗿

#

ok sorry

#

it holds guild info

digital ibex
#

just like

#

array[0].whatever

#

im assuming this is the guilds thing

pure lion
#

array.forEach

digital ibex
#

?

pure lion
#

yeah

digital ibex
#

no forEach pls

pure lion
#

i wanna replace ID with name and i have got those values

digital ibex
#

for loop

pure lion
#

idk how to pot the thing and the thing together

void vale
#
client.on('message', msg => {
if (!msg.content.startsWith(prefix) || msg.author.bot) return

var role = msg.mentions.roles.first()
var self = msg.guild.members.cache.get(msg.author.id)
var args = msg.content.slice(prefix.length).trim().split(' ').filter(item => item !== '')
if (role) args = args.filter(item => item !== role)
var cmd = args.shift().toLowerCase()
if (cmd === 'role') {
if (self.roles.cache.has(role)) {
message.channel.send(`:red_circle: ${rperson.displayName} already has that role!`)
return;
}
self.roles.add(role)
})
digital ibex
#

lemme pull up the discord docs 1 sec

restive furnace
#

discord.js u mean?

digital ibex
#

he's not using a library

#

in his dash

pure lion
#

lost i just want to replace the thing with the other thing

#

i have the data of both idk how to replace

digital ibex
#

you've only got the guild id, and you want to replace it with the guild name?

pure lion
#

ye

#

and i have that

digital ibex
#

then yeah

#

you need to make an api request to discord

#

oh

pure lion
#

how do i yeah

#

omg lost

#

i have

#

the

#

info

#

apidfgheiorwhgopwhir'g

digital ibex
#

u confuse me

pure lion
#
x = { bob:1 }
how make bob 2
digital ibex
#

i dont understand

pure lion
#

i want to make x.bob 2

digital ibex
#

u got: js x = { bob: 1 } and u wanna change it to```js
x = { bob : 2 }

pure lion
#

yes

digital ibex
#

x['bob'] = 2

pure lion
#

ok ty

lusty quest
earnest phoenix
#
let x = { bob: 1 };

x.bob; // 1
x.bob = 2;
x.bob; // now 2
void vale
#

👍

earnest phoenix
#

also ```js
let x = { bob: { value: 1 } };

x.bob.value = 2;

#

:noice:

digital ibex
#

nice

mild flower
#

how do i detect if the variable is a role in the guild?

if(rmentioned = !message.guild.role.has(rmentioned.id)) doesnt work

misty sigil
#

!= is doesn't equal

mild flower
#

Cannot read property 'has' of undefined

#

i think thats not the problem

earnest phoenix
#

how do i detect if the variable is a role in the guild?

if(rmentioned = !message.guild.role.has(rmentioned.id)) doesnt work
@mild flower if(message.guild.roles.cache.has('role id')) { // TODO role existing }

#

also can use !!message.guild.roles.cache.find(r => r.name == 'role name')

#

Cannot read property 'has' of undefined
@mild flower Means that role is undefined

robust arrow
#

shadowblazer r u on djs11 or 12

mild flower
#

14

slender wagon
#

lol

earnest phoenix
slender wagon
#

XD

slender thistle
#

what's your discord.js version, Shadowblazer

digital ibex
#

??

earnest phoenix
#

require('discord.js').version

mild flower
#

oh

#

will ahve to checl

void vale
#

guild.roles.cache.has(role)

mild flower
#

im pretty sure its latest

earnest phoenix
#

guild.role.cache.has(role)
@void vale roles

void vale
#

ok

mild flower
#

Cannot read property 'cache' of undefined

earnest phoenix
slender wagon
#

it is not v12

misty sigil
#

because guild isn't defined

#

its the guild object

slender wagon
#

since it doesn't support cache

mild flower
#

k

earnest phoenix
#

Cannot read property 'cache' of undefined
@mild flower I think you are using discord.js v11, or guild object is not defined

robust arrow
#

i think he is on djs11 too

misty sigil
#

he probs just copypasted it

robust arrow
#

or ^^

misty sigil
#

without making it the guild object

slender wagon
#

@mild flower try to remove the cache.

misty sigil
#

no

#

show us what you have first

earnest phoenix
#

yeah

mild flower
void vale
#
msg.guild.roles.cache.has(role)
//or
var guild = client.guilds.cache.get('id');
guild.roles.cache.has(role)
earnest phoenix
#

Command handler using switch Thonk

mild flower
#

why

misty sigil
#

ok so first

#

why do you need admin perms

mild flower
#

why not

misty sigil
#

put || there instead

earnest phoenix
#

message.member.hasPermission("MANAGE_ROLES") && message.member.hasPermission("ADMINISTRATOR")

mild flower
#

ok

earnest phoenix
#

instead of

mild flower
#

pretty sure thats not the issue tho?

earnest phoenix
mild flower