#development

1 messages · Page 943 of 1

neat ingot
#

sweet ❤️

#

ty again ^_^

modest maple
#

@limber flume

#

You assign Reactorslist as a list

#

you then dont append users to it atall

#

so when random.choice() happens

#

its still a empty list

#

btw

#

dont DM me saying halp

neat ingot
#

yusss

#

❤️

tight forum
#

hi there

#

just trying to get username from id (in v12)

firstly i used

const user1 = client.users.fetch("123456789012345678");

for get info of user

console logs look good but when i trying to send it to channel it couldnt send

#

got an empty message error

earnest phoenix
#

fetch is a promise

tight forum
limber flume
#

@limber flume
@modest maple ok so i need to put this ```py
winner = random.choice[reactorsList]

neat ingot
#

that 'very clearly' says needs appending

#

😄

limber flume
#

ok

#

ima google define appending

#
add (something) to the end of a written document.
#

wHat aM i AddINg

#
@bot.command()
async def giveaway(ctx, waitTime, *arg):
    reactEmoji = '🎉'
    embed = discord.Embed(colour=0xff0000,description=f'**React with {reactEmoji} to participate in this giveaway!**\nTime remaining: **{waitTime} minutes!** 🕰')
    embed.set_footer(text='1 winner')
    messageObject = await ctx.send(embed=embed)
    await messageObject.add_reaction(reactEmoji)
    waitTime = int(waitTime) #*60 # amount of seconds to wait
    reactorsList = []
    print('waiting')
    await asyncio.sleep(waitTime)
    print('I have waited!')
    messageObject = await messageObject.channel.fetch_message(messageObject.id)
    allReactions = messageObject.reactions
    print(allReactions)
    for reaction in allReactions:
        print('checking reaction')
        print(str(reaction.emoji))
        if str(reaction.emoji) == reactEmoji:
            print('found reaction!')
            print(reaction)
            users = await reaction.users().flatten()
    print(reactorsList)
    winner = random.choice[reactorsList]
    await ctx.send(f'The winner of the giveaway for {arg} is <@!{winner}>')
modest maple
#

lists litterally have a append() method

#

you should know this smh

spice smelt
#

Hello, I would like to know your opinion on Mongoose: is it better than basic mongo?

mossy vine
#

if you need or want to use its schema system, yes

spice smelt
#

wait is mongoose just about schemas ?

mossy vine
#

as far as i know, yes

neat ingot
#

yes

spice smelt
#

uh, ok. i hadn't read all the docs. thanks then

neat ingot
#

mongoose is a means of utilizing schemas with mongodb, which is by its very nature, schemaless

rocky dagger
#

how can you see what server your bot is in?
feel free to @ me

mossy vine
#

you can do regular mongodb operations like insertOne and stuff manually with mongoose too

neat ingot
#

tbh mongoose is too good.

#

i just like being able to be strict with what goes in my database tho

mossy vine
#

i kinda dislike it

spice smelt
#

it looks like SQL in noSQL x)

mossy vine
#

i like the headache that comes from it :)

neat ingot
#

i wrote a wrapper module thing for mongoose (unreleased) that i dubbed 'common mongo'. it allows me to very easily create document structures, as well as a cache system that caches data for a few minutes before saving and discarding the datas. it literally cut the amount of queries i was doing to mongo from a couple hundred per minute to like, 3...

#

(per player)

#

now i can make my document structure in files like that

#

super easy ❤️

blazing portal
#

@rocky dagger which library?

toxic jolt
#
client.on("guildBanAdd", async (guild, user) => {
   let i = await db.fetch(`bankoruma_${guild.id}`);
   if (i === "kapali") return;
  if (i === "açık") {
    let log = guild
      .fetchAuditLogs({ type: "MEMBER_BAN_ADD" })
      .then(k => k.entries.first());
    let exec = guild.members.get(user.executor.id);```
#

here error

earnest phoenix
#

user.executor is undefined

toxic jolt
#

why

earnest phoenix
#

i don't think that property even exists under the user object

toxic jolt
#

OMGGG

earnest phoenix
#

is that what you meant

toxic jolt
#

because she has authority over the bot

#

Roles:

earnest phoenix
#

do console.log(user)

toxic jolt
#

Banner < role

#

Bot < role

#

its not
does not see

#

oh okay fixed.

earnest phoenix
#

?

#

...

#

well user.executor doesn't exist anyway

#

are you seriously?

toxic jolt
#

I'll do it again. The role of the bot is in the role under "banner".

#

so she made a mistake

earnest phoenix
#

Çeviriden mi yazıyorsun

toxic jolt
#

evet

earnest phoenix
#

aferin bende diyom niye birşey anlayamıyorum

toxic jolt
#

LASDNSADASKSDNMD

#

en iyisi

#

normal yazıyım.

#

kendi ingilizcemle

earnest phoenix
#

konsola useri ver

#

damn only if i was bilingual

toxic jolt
#

come dm

#

pls

#

okay sorry @earnest phoenix

earnest phoenix
#

lol it's fine

#

I need help with embedding

#

And markdown

mossy vine
#

you cant use markdown in embed titles

sudden geyser
#

You can, but it's limited.

earnest phoenix
sudden geyser
#

There's a dedicated url property for it. If that's the title, just specify url: <url>

mossy vine
#

^

#

yes

#

theres a url property

#

that applies to the title

sudden geyser
rocky dagger
#

@rocky dagger which library?
@blazing portal what do you mean?

mossy vine
#

what library are you using

#

is what they mean

#

d.js, d.py, eris, etc.

rocky dagger
#

js

mossy vine
#

discord.js?

rocky dagger
#

yes

earnest phoenix
#

But idk how to change the title. I don't want the url as the title.

mossy vine
#

you specify both a title and url property

earnest phoenix
#

title = 'title'

#

Like this?

spice smelt
#

hi back. I just installed Mongo and its node client and I configured it. but when i launch my bot's beta version with mongo in it, there's the following warning: (node:16857) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.

mossy vine
#

pass option { useUnifiedTopology: true } to the MongoClient constructor.

spice smelt
#

why? I mean, why put smth deprecated in the newest version of the node driver?

mossy vine
#

its not deprecated

#

yet

#

its a warning that it will be deprecated

#

well technically it is already deprecated but still exists

#

so its deprecated but not really

spice smelt
#
const MongoClient = require('mongodb').MongoClient({ useUnifiedTopology: true})```
so i have to do this ?
mossy vine
#

yea

#

wait no

#

when creating a MongoClient

#

so

const MongoClient = require('mongodb').MongoClient
const mc = new MongoClient({ useUnifiedTopolgy: true })```
blazing portal
#

@rocky dagger Depends what exactly you want. All the Servers the Bot is in are saved in client.guilds.cache . so if you want to log all guild names for example you could do client.guilds.cache.forEach(guild => console.log(guild.name));

spice smelt
#

ok, thanks 👍

queen violet
#

does anyone know the name of the software renderer nvidia thing

#

google does not want to give me it

clear wraith
earnest phoenix
#

if that user is not in the server, it shows up as "invalid-user" on phone

#

on pc it shows up as the id

#

unless your client cached that user before it got kicked/banned/left

clear wraith
#

Yeah... But why does it spam that if a user is bot leaving?

earnest phoenix
#

well thats up to your code, maybe show us the code

clear wraith
#

No one is joining/leaving, and it spams that

#

K

earnest phoenix
#

nope

clear wraith
#
module.exports = async (client, member) => {
  const channel = client.channels.cache.find(
    channel => channel.name === "│joins-and-boosts"
  );
  if (!channel) return;

  channel.send(
    `Welcome to our server ${member}!, Please read our rules in the rules channel!`
  );
};
#

@earnest phoenix, That's my code ^

earnest phoenix
#

are you maybe running multiple instances of your bot?

#

i mean't Roman, but you shouldn't run 2 instances

#

i'd suggest merging

viral spade
#

Tim are you here?

clear wraith
#

Instances?

#

Like... 2 or more of the same thing?

#

I'm confused

earnest phoenix
#

having the code run twice

#

so stuff gets sent twice

clear wraith
#

I have an events folder that keeps that stuff. And it only says that once...

#

Hmm

#

Interesting

cinder patio
#

maybe you run the script twice

earnest phoenix
#

thats what i meant with 2 instances

radiant estuary
#

i have problems to read my data.json file. In the console stands: ReferenceError: Cannot access 'data' before initialization

#

but it always worked

zenith terrace
#

Just use the guild member add event 😫

#

I saw events folder

#

🤔

#

Hmmm

radiant estuary
#

i have problems to read my data.json file. In the console stands: ReferenceError: Cannot access 'data' before initialization
can somebody help me please?

neat ingot
#

your trying to use a variable data before you have declared it.

#

example:```javascript
data.someProperty

//... later in code
const data = require('data.json');```

radiant estuary
#

i have declared it, then comes my ready function, and the my message function. And there i get the error: ```if (!data[server.id]) data[server.id] = {
prefix: "/"
};

#

und yes, server is definied

viral spade
#

I am trying to use deferred promises to let multiple cache misses of the same object resolve to the same promise (and hence not loading the cache object multiple times)

Now when loading a guild with multiple events (messages) at the same time, the guild cache guild.appData will build up. Each event will await the same promise, and as soon as it is finished, the cache should be loaded. The promise then is resolved for all of the events' calls and the cache guild.appData can be accessed from everywhere.

Somehow this principle does not work for roles. I can only access the appData property for the event that triggered the promise-creating in the first place. role objects from other events that came in during the cache loading will not have the property appData stored. However, all events after the cache has loaded, will be able to access the property.

A solution could be not simply letting the promise resolve with nothing, after the cache has loaded, but return/resolve the cached object itself.
Or is there a way to maybe "refresh" the role objects in those events, that follow-up the first event?
What do you think?

radiant estuary
#

i have declared it, then comes my ready function, and the my message function. And there i get the error: ```if (!data[server.id]) data[server.id] = {
prefix: "/"
};

I found my Bug

#

i copy and pasted things into the code, that I dont want to add 😄

timid blade
#

so guild.me might not exist, but if it doesnt does await guild.me.fetch() work? or must i manually fetch with the member manager
(discord.js)

smoky spire
#

You have to fetch from the member manager

timid blade
#

ok

indigo tapir
#

I keep getting this error in discord.js:

(node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
#

Can't send code since it's way too long

earnest phoenix
#

send it on pastebin

#

white censoring your token ofc

viral spade
#

I need tim 😫 please ping me when he's here 😄

valid frigate
#

you could just ping him lmao

neat ingot
#

wait, guild.me might not exist? how?

#

surely every client has access to its own client?...

#

also: most important development question of the day:
Do i call my new bot GameBOT, or Arkade/Arcade ?? Any thoughts?

earnest phoenix
#
const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./config.json');
const blacklisted = require('./blacklisted.json');
const fs = require('fs');
const Enmap = require('enmap');
const client = new Discord.Client({disableEveryone: true});
client.commands = new Discord.Collection();
// Command Handler
client.on('message', async(msg) => {
    if(msg.author.bot) return;
    if(!msg.guild) return;
})
//Bot Login
client.login(config.token)
#

This is my code, I have a file for blacklisted users (i am updating my bot to v12) and I want to add under if msg.author if the users id is in blacklisted.json to return nothiing

#

how would I go about doing this

neat ingot
#

step 1: get a real database (optional, highly recommended)
step 2: convert your blacklisted user ids into an array
step 3: check if that array includes the desired user id.

hardy vector
#
const fortnite = require('simple-fortnite-api')
const fnclient = new fortnite('');
const { MessageEmbed }  = require('discord.js')
const { stripIndents } = require('common-tags')

module.exports = {
    name: "fortnite",
    description: "fortnite stats",

    execute: async(client, message, args) => {
        if(!args[0]) return message.channel.send("Please supply a username.");
        if(args[1] && !["lifetime", "solo", "duo", "squad"].includes(args[1])) return message.channel.send("Usage: `fortnite <username> <gametype>`\nGameTypes: Lifetime, Solo, Duo, Squad");
        let gametype = args[1] ? args[1].toLowerCase() : "lifetime";

        let data = await fnclient.find(args[0])
        if(data && data.code === 404) return message.channel.send("Unable to find a user with that username.")
            const { image, url, username } = data;
            const { scorePerMin, winPercent, kills, score, wins, kd, matches } = data[gametype]

                const embed = new MessageEmbed()
                    .setColor("RED")
                    .setAuthor(`Epic Games (Fortnite) | ${username}`, image)
                    .setThumbnail(image)
                    .setDescription(stripIndents`**Gamemode:** ${gametype.slice(0, 1).toUpperCase() + gametype.slice(1)}
                    **Kills:** ${kills || 0}
                    **Score:** ${score || 0}
                    **Score Per Min:** ${scorePerMin || 0}
                    **Wins:** ${wins || 0}
                    **Win Ratio:** ${winPercent || "0%"}
                    **Kill/Death Ratio:** ${kd || 0}
                    **Matches Played:** ${matches || 0}
                    **Link:** [link to profile](${url})`)
                    .setTimestamp()

                    message.channel.send(embed)
    }
}``` i get this error when i try to start the bot https://hastebin.com/ekusigider.sql
earnest phoenix
#

I plan to switch to SQL, I havent coded in js in a long time so I have no idea what ur talking about

#

and json will be fine since I will be hand picking users

neat ingot
#

@Nerd you should probably remove that string that im certain is a key/token for your fortnite api access

copper cradle
#

@radiant estuary show your code

#

i copy and pasted things into the code, that I dont want to add 😄
@radiant estuary don't copy and paste duh

#

write your own code

#

and unless you're trying to get the entire bootstrap stylesheet you shouldn't be copy and pasting code

hardy vector
#

i regenned it

next remnant
#

how do i enable non-interactive mode in psql?

#

every time i try to use -1, it says: psql: fatal: -1 can only be used in non-interactive mode

#

i haven't been able to find anything from googling

neat ingot
#

its a strange world we live in, where people are proud to be weeb simps 😄

earnest phoenix
#

this is my code

#

I dont get how name is undefined when its any

#

props.help doesnt exist

#

prob

#

okie

#

ty

golden condor
#

Hi uh just a general question, sorry if it is the wrong place, what is super() inside a class, and how would I use it, (I'm a bit confused by it)

earnest phoenix
#

let me ask you

#

does it look like this?

#
constructor() {
  super('volume', 'music', ['vol', 'v']);
}
golden condor
#

no, I am just trying to find out what it is that's all

#

i'm not sure how to use it

prime ruin
#

Ola

neat ingot
#

super is used to call a function from the parent class of the current class

prime ruin
#

Tudo bem com vcs

neat ingot
golden condor
#

super is used to call a function from the parent class of the current class
@neat ingot wdym by that

earnest phoenix
#

do you know what classes are?

golden condor
#

yes

#

an example class

earnest phoenix
#

then you should know inheritence as well

golden condor
#
class example {
constructor(h){
this.h = h
}
//functions and stuff 
}```
#

I am not sure about that

neat ingot
#

classes can inherit properties from other classes. when it does this, the class that was inherited is called the parent class. super allows you to call functions exclusively from the parent class

golden condor
#

so like this?

#

ohhhhhhhhhhhhhhhhhhhhh

#

That makes much more sense

#

So what about in this context

#

super(length, length);

mossy vine
neat ingot
#

that would call the parent class's constructor method whilst passing length property as the first two arguments to said parent class function.

earnest phoenix
#

ok so im getting an error about something that doesn't exists.....

golden condor
#

that would call the parent class's constructor method whilst passing length property as the first two arguments to said parent class function.
@neat ingot umm, so it would be like doing new Rectangle()

neat ingot
#

pretty much

golden condor
#

ok so you call the constructor inside a constructor that extends the original

neat ingot
#

except that, its not creating a new object, its altering the existing instance of the Square class

golden condor
#

and use functions from the original constructor

#

that makes more sense

#

so say if I wanted to extend the discord client I could do this

#
class CustomClient extends Client {
constructor(token){
super()
this.token = token
}
super.login(this.token)
}```
#

?

neat ingot
#

i want to say yes? but for some reason that i cannot put my finger on, i feel like it not correct syntax 😄

golden condor
#

is that not the right way to do it?

neat ingot
#

no it is, i've just never tried to call a function from the superclass within the constructor of the child class in javascript 😄

golden condor
#

Oh yeah I just wrote that now so

neat ingot
#

i preffer to do my classes 'the old way' in javascript, it feels more explicit imo

earnest phoenix
#

if you want an example i can give you one...

golden condor
#
class CustomClient extends Client {
constructor(token){
super()
this.token = token
}
connect(){
super.login(this.token)
}
}
new CustomClient("TOKEN").connect()``` Like this?
neat ingot
#

nah you were more correct the first time. that way the login would never get called and may throw error

#

ok yea that should work

golden condor
#

ok

earnest phoenix
#

One message removed from a suspended account.

mossy vine
#

you clearly cant be bothered to fix it either

earnest phoenix
#

One message removed from a suspended account.

#

One message removed from a suspended account.

grizzled raven
#
class CustomClient extends Client {
constructor(token){
super()
this.token = token
}
connect(){
super.login(this.token)
}
}
new CustomClient("TOKEN").connect()``` Like this?

@golden condor yeah thats correct

#

super just refers to the class which your class extends

earnest phoenix
#

One message removed from a suspended account.

grizzled raven
#

super as a function is equal to new ClassYouExtend()

earnest phoenix
#

One message removed from a suspended account.

golden condor
#

Great thanks for the help guys, and thanks for being really nice and helping out <3

flat vine
#

665217134275854357

balmy knoll
#
client.on("ready", () => {
  
    let activities = [ `${client.guilds.cache.size} servers | ${client.users.cache.size} users`, `${default_prefix}invite | Invite me`, `${default_prefix}support | My server`, `${default_prefix}donate | Donate me`, `${default_prefix}info | About me`], i = 0;
    setInterval(() => client.user.setActivity(activities[i++ % activities.length], { type: 'STREAMING', url: 'http://twitch.tv/mrskewer' }), 5000);
  
});

client.on("guildCreate", () => {
    
    let activitiesCreate = [ `${client.guilds.cache.size} servers | ${client.users.cache.size} users`, `${default_prefix}invite | Invite me`, `${default_prefix}support | My server`, `${default_prefix}donate | Donate me`, `${default_prefix}info | About me`], i = 0;
    setInterval(() => client.user.setActivity(activitiesCreate[i++ % activitiesCreate.length], { type: 'STREAMING', url: 'http://twitch.tv/mrskewer' }), 5000);
  
});

I have set a state on my bot that changes every 5 seconds and contains the number of servers it is on. I want to update these counters every time the bot is added or removed from a server. I tried this code, but it doesn't work since the two setinterval overlap. How do I fix it?

earnest phoenix
#

665217134275854357
@flat vine this guy's called discord bot maker weirdsip

#

@balmy knoll introduce global variables instead

#

so that you could simply update these variables accordingly without disrupting the current setinterval

sudden geyser
#

@balmy knoll for the ready event, whatever the size of the collection is is what will be displayed as your status as it's saved. Aka ${client.guilds.cache.size} servers will always be the original number at the start of when the event was fired.

balmy knoll
#

I don't quite understand. How could I fix it?

sudden geyser
#

really all you need to do is update the activity in the ready event once then update it for every new guild created or deleted with a rate limit.

balmy knoll
#

I don't understand. Can you explain with example codes?

earnest phoenix
#

for example client.guilds.cache.size is a variable that changes depending on your server count

#

you just have to keep the onready event and remove the guild create one

#

because of the setinterval. the client.guilds.cache.size changes if a guild is added

#

what do I do

#

it says there is a error within the downloaded mongoose

mossy vine
#

you.. read what it says

earnest phoenix
#

I know but the error is in the module downloaded

mossy vine
#

man

#

it tells you

#

what link to go to

#

and that will tell you how to fix it

#

please read the fucking error message

earnest phoenix
#

why be so rude cuck head

mossy vine
#

why be not able to read omegalul

earnest phoenix
#

weirdsip he is just speaking facts lol

#

if you get pissed off from people asking for help dont help

mossy vine
#

i get pissed off from people not reading whats literally in front of them

brave rover
earnest phoenix
#

i am using that

#

so...

regal saddle
#

The answer is right infront of you?

earnest phoenix
#

its not, i am using what it tells me to use

#

and its giving me that error

brave rover
#

read it again :>

earnest phoenix
#
<body>
<style>
body {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
h1 {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
div {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}

</style>

<h1 style="text-align: center;">
Meltin*[BOT]
<p>le bot discord de la guilde Meltin*pot !</p>
<p>Il est fait pour les joueurs de NosTale FR.<br />Il est utilisé pour modérer des serveurs de familles.
<br />Il est présent sur plus de 60 serveurs à ce jour !<br />Tu est fatigué de chercher les plans des ts/raids ?<br />Tu veux simuler des tentatives de up et de craft ?<br />Montrer à tout le monde ton rang dans le classement ?<br />Afficher les tableaux des parfums, tarots, livres ?<br /><br />Ce bot est fait pour toi !<br /><br /><br />
</p></h1>
<img src="https://www.aht.li/3512102/mb2.png" alt="meltinbot" style="width:668px">

</body>
regal saddle
earnest phoenix
brave rover
earnest phoenix
#

and Cyber told me to go ton the link provided

regal saddle
#

all of 3 pics show you the answer

brave rover
earnest phoenix
#

i understand it doesnt support it

regal saddle
earnest phoenix
#

@earnest phoenix and what exactly isnt working?

#

the white color for the text

#

and also, i don't know how to center the text

regal saddle
#

Diggy, dont star it. No context 😬

earnest phoenix
#

define p in your css

#

since p if the text

#

*-*

#

plus, h1 should be closed accordingly

brave rover
#

apologies

earnest phoenix
#

and p should be closed too

#

so not

<h1>my cool header
<p>my cool text under the header
</p>
</h1>

but like this:

<h1>My cool header</h1>
<p> my cool text</p>
#
<body>
<style>
body {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
h1 {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
p {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
</style>
<h1>Meltin*[BOT]</h1>
<p>le bot discord de la guilde Meltin*pot !
<br />Il est fait pour les joueurs de NosTale FR.
<br />Il est utilisé pour modérer des serveurs de familles.
<br />Il est présent sur plus de 60 serveurs à ce jour !
<br />Tu est fatigué de chercher les plans des ts/raids ?
<br />Tu veux simuler des tentatives de up et de craft ?
<br />Montrer à tout le monde ton rang dans le classement ?
<br />Afficher les tableaux des parfums, tarots, livres ?
<br /><br />Ce bot est fait pour toi !</p>
<img src="https://www.aht.li/3512102/mb2.png" alt="meltinbot" style="width:668px">
</body>
#

It's almost that

#

I put white for the title, it stays gray

#

And the white background, I can't find of how to make it gray

#

i tryed with div and background but that wont work 🤣

balmy knoll
#

@sudden geyser Wait

earnest phoenix
#

@earnest phoenix use inspect element for the background

earnest phoenix
#

I'm really bad 😭

#

i tryed with
div{}
div class="content"{}
content{}

astral yoke
#

me my friend making a bot together right
so we have this for guildmemberadd function

      var autorole = db.get(`autorole_${message.guild.id}`)
         if(autorole === null) return;
    member.addRole(autorole)
});```
#

why is this erroring with

sudden geyser
#

what's the error

astral yoke
#

addRole undefined

turbid bough
#

there is no function called addRole in guildmembers

astral yoke
#

what am i able todo as an alternative to get it working

turbid bough
#

you would need to use member.roles.add

astral yoke
#

i see

#

lemme try that ill get back with you

astral yoke
#

@turbid bough it dosent give an error but it dosent add the role

#

would that have todo with my autorole command

turbid bough
#

Do you get any errors?

#

oh wait you don't

astral yoke
#

nun

sudden geyser
#

@astral yoke the first argument of the guildMemberAdd listener is the guild member.

astral yoke
#

correct

#

oh

sudden geyser
#

as for addRole vs. roles.add, that depends on your version.

astral yoke
#

v11

#

would this work?

#

let role = message.mentions.roles.first();

earnest phoenix
astral yoke
#

i have it

sudden geyser
#

How would you get the message in the first place?

astral yoke
#

but i dont konw if its getting it correctly

turbid bough
#

how do you know

astral yoke
zenith terrace
earnest phoenix
#

Hope, I managed to change the color by inspecting the element, but not in my css

quartz kindle
#

show your css

earnest phoenix
#

It annoys me even more 🤣

zenith terrace
#

Wait what are you trying to do

earnest phoenix
#
h1 {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
p {
  background-color: #2F3136;
  text-align: center;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
body {
  background-color: #2F3136;
}
quartz kindle
#

now show how you changed it in the inspector

earnest phoenix
zenith terrace
#

U need to do

}```
earnest phoenix
zenith terrace
#

U need to actually do

}```
#

My bad

earnest phoenix
#

Nice

#

You helped me a lot, thanks 🙏

neat ingot
#

man... call of duty really needs to fix their shit :/

earnest phoenix
zenith terrace
#

@neat ingot wrong channel

earnest phoenix
#

It's super neat now. thx again

zenith terrace
#

No

#

Np*

neat ingot
#

@zenith terrace idc, the off topic channel here is filled with absolute trash lol.

#

and it was just an offhanded comment, not trying to get a whole discussion on it or anything

viral spade
quartz kindle
#

@viral spade how do you define roles before the for loop?

viral spade
#

its msg.member.roles.cache

quartz kindle
#

if its roles.cache, then the loop shouldnt even work

#
for(let role of roles.cache) {
  console.log(role) // [3075803708733,Role]
}
viral spade
#

it does work
its roles.cache but with the second index extracted

quartz kindle
#

thats why i asked, how did you extract it?

viral spade
#

i tried it both ways. first with for (role of msg.member.roles.cache) { role = role[1]; ..}

then with extracting first msg.member.roles.cache.forEach(role => roles.push(role));

both with same result

#

when i tried resolving the object itself all worked fine

quartz kindle
#

try doing let role instead of role

#

not declaring it in a for of loop sometimes produces weird results

viral spade
#

right, i had that too sometimes. ill try

#

thank you so much

#

i think i need to change many for loops 😅

modest maple
#

Can JS actually support Ctype libs?

#

Just outa curiosity

viral spade
#

also, is it ok to load the cache for roles that way? (as roles are not that many i guess its ok)? I could also on guild cache load add a field "noXpChannelIds" to the guild cache

#

the code is the on message code which gets executed almost every time a user writes a message

earnest phoenix
#

ctype?

modest maple
#

ctype?
@earnest phoenix a compiled lib usually written in c (not so much now) or c++ which scripting languages use to help speed up tasks

earnest phoenix
#

uhm

#

well yes node.js does sometimes use compiled modules. not even to "speed up" a lot of the time

#

a lot of the time it's just to access c libraries (curses maybe) or to access other system stuff

quartz kindle
#

node.js has wide support for C and C++

#

and several APIs for it

modest maple
#

Nice to know

quartz kindle
#

browsers have support via wasm modules

amber fractal
#

Tim how's your lib coming

quartz kindle
#

its on hold indefinitely atm

amber fractal
#

feelsbad

quartz kindle
#

i start digging too much

#

went from discord to zlib shenanigans

#

making a zlib sync lib

amber fractal
#

idek what zlib is tbh

quartz kindle
#

compression and decompression

#

discord supports zlib compression

#

when you enable it, you use 80% less bandwidth

#

in exchange for like 1% more cpu

#

its stupidly efficient

amber fractal
#

so they compress the packets or something?

quartz kindle
#

they have two options

#

packet compression and stream compression

#

stream compression is a bit better/faster

#

packet compression is easy to implement

earnest phoenix
#

i gave it here where is the users id is not in "owners" in a json file it blocks it from a command, but I want the opposite affect how do i do this

quartz kindle
#

remove the !

earnest phoenix
#

thats it

quartz kindle
#

! means "NOT"

#

it inverts whatever you put in front of it

#

your code basically says "if not includes"

earnest phoenix
#

ahh thank you very much

quartz kindle
#

if you remove it, then it says "if includes"

earnest phoenix
#

awesome

#

thank you very much

#

@gilded plank
@earnest phoenix pinging luca why?

#

hey, anyone know if there is a bot for adding or deleting permissions for every roles in a server ?

#

nope theres none

#

really ?

#

maybe dyno could do that, though look on top.gg yourself

neat ingot
#

I cannot decide what to name my new bot :/

#

literally spent hours trying to decide lol

earnest phoenix
#

i just use my name in it and just brainstorm the fuck out of my time

neat ingot
#

my last/first bot was 'DekBOT', i dont think Botita would work for this new bot 😛

#

i have two names i think fit the bot well: G4M3B0T and Arkade just cant decide which one i want to go with

earnest phoenix
#

Arkade sounds quite nice in my opinion

neat ingot
#

i do feel the way i've spelled gamebot is shit for search queries

earnest phoenix
#

@earnest phoenix wdym?

viral spade
#

arkade is too basic and G4M3B0T too complicated to write

neat ingot
#

what test? you just do the application ~ the test is if it works when they go to apprrove it 😄

earnest phoenix
#

@earnest phoenix just do join logs

#

you should be good with that

#

and you'll see if you get a notification that it joined discord bot list

viral spade
#

try to get 20 upvotes fast. you will get on the front page for a few days

earnest phoenix
#

dont bot your votes tho GWomoDrakeYea

neat ingot
#

how come you think arkade is too basic? i thought it seemed kinda cool

earnest phoenix
#

@neat ingot no i mean it sounds nice

#

But how do I get them to test it?
@earnest phoenix They get added to a secret server for testing

neat ingot
#

nah, linck said it was basic 😛

earnest phoenix
#

they will test through your commands if they follow the #rules-and-info, ratelimiting guidelines and tos

#

you cant

neat ingot
earnest phoenix
#

they will add it once it is your bots turn for approval

neat ingot
#

^ fill that in, wait for weeks, hope.

earnest phoenix
#

they submitted it already i reckon

neat ingot
#

probably, but you never know 😛

#

i mean, some of the questions that get asked in here...

paper phoenix
#

Would this be a good icon for a bot that's based off a Griffin?
@earnest phoenix - I'm a bit late to the party but that's wicked

earnest phoenix
#

ok so :U anyone here verified their bot?

#

most people yeah, why?

#

im on exactly 75 servers and nothing's showing up

#

it shows up at 76

#

:U

#

bruh discord is a lier

#

gotta wait a day i guess lmao

#

thanks

#

once your bot surpasses 75 servers

#

meaning 75+

#

y discord lier meen

#

waiting for rozette

#

like 1m year

#

This process is currently available for bots in 75 or more servers

#

75 or more

#

this is official discord page, mind u

neat ingot
#

or

earnest phoenix
#

yes

#
  1. or more than 75
neat ingot
#

not exclusively more than

earnest phoenix
#

yea that

#

this was posted 10 days ago too

#

so. anyway oh well

neat ingot
#

i havent even bothered verifying my bot yet

#

dont trust stripe tbh 😄

#

ik imma have to, but yea...

empty owl
#

hey how do I add an options object to guild.createchannel in js
its nopt on the docs

earnest phoenix
empty owl
#

thanks

#

how do u get the guildchannelmanager

#

or does that extend guild

earnest phoenix
#
// Create a new text channel
guild.channels.create('new-general', { reason: 'Needed a cool new channel' })
  .then(console.log)
  .catch(console.error);
``` one of its examples
empty owl
#

okay thanks

earnest phoenix
#

the other useful stuff is mentioned on the .create method in the docs GWgoaMonikaSmug

empty owl
#

i dont keep up with updates so i missed that

#

TypeError: reaction.message.guild.channels.create is not a function

#

are the permission overwrites like this js permissionOverwrites: [ { id: message.author.id, allow: ['VIEW_CHANNEL'], }, { id: message.guild.id, deny: ["VIEW_CHANNEL"] }, { id: "693623178253041775", allow: ["VIEW_CHANNEL"] }, ],

#

wait

#

give mne as ec

earnest phoenix
empty owl
#

erm im accessing the message through the reaction and the guild through the message

#

is that wrong

earnest phoenix
#

well theres no reaction.message.guild method

#

see the docs

keen vapor
#

imagine being able to develop a bot 😭

earnest phoenix
#

@keen vapor you can always start learning it

empty owl
#

so would i have to access the guild by getting it through the client?

earnest phoenix
#

presumably yeah, though since i only learn through the docs, i dont really know

#

oh wait

empty owl
#

okay thanks

earnest phoenix
#

are you using discordjs 11 or 12

#

show me your code for a sec

empty owl
#
reaction.message.guild.create(`${type}-${user.username}`, {
  type: "text", 
  permissionOverwrites: [
     {
       id: message.author.id,
       allow: ['VIEW_CHANNEL'],
    },
    {
      id: message.guild.id,
      deny: ["VIEW_CHANNEL"]
    },
    {
      id: "693623178253041775",
      allow: ["VIEW_CHANNEL"]
    },
  ],
  
  
}).then(channel => { 
  bot.ticket.set(user.id, {
    userID: user.id,
    channelID: channel.id
  })
})
#

im using discord.js 11.5.1

#

should I update

earnest phoenix
#

11 will be deprecated sooner or later, so i'd suggest to do so

empty owl
#

okay

earnest phoenix
#

and it is reaction.message.guild.channels

empty owl
#

thanks

astral yoke
#

for my guildCreate file

#

i have this right

#
const RichEmbed = require('discord.js')
module.exports = async (bot, guild) => {
    const getDefaultChannel = (theGuild) => {
        if (theGuild.channels.has(theGuild.id)) return theGuild.channels.get(theGuild.id);
        const generalChannel = theGuild.channels.find(channel => channel.name === "general");
        if (generalChannel) return generalChannel;
        return theGuild.channels
            .filter(c => c.type === "text" &&
                c.permissionsFor(theGuild.client.user).has("SEND_MESSAGES"))
            .sort((a, b) => a.position - b.position || 
                Long.fromString(a.id).sub(Long.fromString(b.id)).toNumber())
            .first();
      let embed = new RichEmbed()
      .setDescription(`Hello! My name is DogBot. Thanks for having me here! Use these configs!
db!welchannel <#channel> | Set a channel for DogBot to welcome!
db!byechannel <#channel> | Set a channel for DogBot to log leaving!
db!modlogchannel <#channel> | Set a channel for DogBot to modlog!
db!setprefix (prefix) | Set a prefix!
db!deleteconfig (welcome, goodbye, modlog) | Delete a logging!`)
      generalChannel.send(embed)
    } 
}

#

anyone know why it dosent work?

#

it dosent error but dosent send it neither

sudden geyser
#

did you ever call the function.

earnest phoenix
#

and do a few debug lines

sudden geyser
#

also are you not returning a bit too early

steel drum
#

@astral yoke const RichEmbed = require('discord.js')

#

i think you're trying to . do js const { RichEmbed } = require('discord.js')

paper phoenix
#

I really wished they'd add named exports to DJS

astral yoke
#

ill try

steel drum
#

assuming you're working with djs v11

astral yoke
#

mhm

paper phoenix
#

So that we could import { MessageEmbed } from 'discord.js';... Instead of:

import Discord from 'discord.js';

const { MessageEmbed } = Discord;
empty owl
#

@earnest phoenix for the .create options. how do u specify the category?

earnest phoenix
#

ok so

#

doing the verify thing

#

it says the answers must be at least 100 chars

#

wat

paper phoenix
#

11 will be deprecated sooner or later, so i'd suggest to do so
@earnest phoenix - They will have to upgrade before October

earnest phoenix
#

how to say "no" in 100 chars

paper phoenix
#
console.log( `n${ 'o'.repeat( 99 ) }` );
earnest phoenix
#

11/10

#

ah

#

i mean

#

@empty owl lemme check

#

will they accept that

#

are you talking about discord verification?

#

yea

#

probably not then

empty owl
#

did .u find the answer

earnest phoenix
#

still lookin

paper phoenix
#

They musta added that later. I literally said, "Nope."

empty owl
#

what was the question

paper phoenix
#

I'm assuming that's the, "Do you store any Discord data, etc."

empty owl
#

oh lmao

earnest phoenix
empty owl
#

wait

paper phoenix
#

Or do you need intents etc

earnest phoenix
#

like

#

nope

#

bot does not need a single permission

empty owl
#

for the Do you store any Discord data, etc if u store ids for a database do u have to say tahta

paper phoenix
#

Infrastructure should 100% be 100+

earnest phoenix
#

stev tis this one

paper phoenix
#

I said, "Users are free to DM me"

earnest phoenix
#

not the infrastructure one

empty owl
#

just put a email @earnest phoenix

paper phoenix
#

Literally that

empty owl
#

or a support srever

earnest phoenix
#

😠

empty owl
#

thanks hope

earnest phoenix
#

yea well i have like

#

oh just link the support server i guess

#

whatever seems filler enoughx

#

xd

paper phoenix
#

They don't want an essay for stuff like that

earnest phoenix
#

well yea but 100 chars is a lot

#

like fr why cant i just say "no" or whatever

#

anyway im kinda dumb so when they say infrastructure what exactly do they mean

#

hardware? and libraries?

neat ingot
#

the system your bot runs on

#

just give them pc spex for the lolz

#

infrastructure: 1 core 1gb ram

earnest phoenix
#

nah i have enough

neat ingot
#

lol

earnest phoenix
#

half a core 256KiB ram

neat ingot
#

gtx 69o :p

paper phoenix
#

anyway im kinda dumb so when they say infrastructure what exactly do they mean
@earnest phoenix - I'm using Discord.js. It's running on a VPS provided by Vultr running Ubuntu vx.x.x.x. MySQL vx.x.x.x. Node vx.x.x. Etc

earnest phoenix
#

versions are probably optional right

#

might as well include it i guess

neat ingot
#

yea i wouldnt include versions

#

its useless info

paper phoenix
#

Helps. They don't want you using something with vulerabilities

neat ingot
#

if your running mongodb to store things, it doesnt matter the version

#

well yea i guess thats fair

#

but there are vunerabilities in thousands of things, and all database libs

paper phoenix
#

Yeah so just mention that you regularly audit when they ask about security

neat ingot
#
#

i could do on..

earnest phoenix
#

im using litedb

#

clearly

#

best db

#

ok so its a kinda niche bot so doesnt have to scale well anyway

ancient lichen
#

hey guys. Sorry to bother. Do you know where i can find on docs something like "get the user who invited the bot"? Cause i did not find anything (discordjs)

earnest phoenix
#

whatever sent the form

ancient lichen
#

ty

earnest phoenix
#

can you find out the user who invited???

paper phoenix
#

@ancient lichen - Redirect URI, yeah

earnest phoenix
#

@ancient lichen theres no endpoint that could tell you who exactly invited the bot

neat ingot
#

idk if you can, it'd be neat if you could

earnest phoenix
#

maybe audit log

#

who knows

neat ingot
#

redirect url shouldnt give user ids out like that i dont think

ancient lichen
#

cause i want to send a pm to the people who does

earnest phoenix
#

but i guess most bots cant access audit log

paper phoenix
#

Ofc they do

gritty bolt
#

How do I calculate the total number of members my bot serves?

empty owl
#

@earnest phoenix

steel drum
#

you can specific that the bot needs audit log perms

empty owl
#

it still returns bot.guilds.get(...).create is not a function

earnest phoenix
#

oh redirect uri huh

#

show the code again

steel drum
#

@empty owl what version of djs are you on

empty owl
#
bot.guilds.get("692557750940598323").create(`${type}-${user.username}`, {
  type: "text",
  parent: "714633231030419566",
  permissionOverwrites: [
     {
       id: message.author.id,
       allow: ['VIEW_CHANNEL'],
    },
    {
      id: message.guild.id,
      deny: ["VIEW_CHANNEL"]
    },
    {
      id: "693623178253041775",
      allow: ["VIEW_CHANNEL"]
    },
  ],
  
  
}).then(channel => { 
  bot.ticket.set(user.id, {
    userID: user.id,
    channelID: channel.id
  })
})
#

i updated to 12.2

#

wait

steel drum
#

bot.guilds.cache.get()

empty owl
#

i didnt

neat ingot
#

discord has no reason to include a user id in the redirect url cause when they rediurect to their site, the user is logged in automatically via cookies.

steel drum
#

oh

paper phoenix
#

@earnest phoenix - Supplying redirect URI will return whatever data you ask for. Username, ID, discrim

neat ingot
#

i mean, they might, but thats a bit of a security breach imo

earnest phoenix
#

@empty owl you forgot the .channels after the get

empty owl
#

gotit

paper phoenix
#

It's no different than using OAuth to log into Top.gg

#

Gives them your ID/username, etc

#

On redir

empty owl
#

when I update to 12.2.0 i get } catch {
^
SyntaxError: Unexpected token {

earnest phoenix
#

full error

empty owl
#

lemme try 12.2.0

paper phoenix
#

i mean, they might, but thats a bit of a security breach imo
@neat ingot - You can't just put any URI. It has to be one added in your own dev portal

empty owl
#
    } catch {
            ^
SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/rbd/pnpm-volume/360bef0c-b00e-4b72-bb55-b5b0a5690682/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/index.js:8:11)```
earnest phoenix
#

can you send the codeblock from line 41 of your Client.js

empty owl
#

i dont have a client.js

neat ingot
#

even if it did include that information

earnest phoenix
#

oh that an actual discordjs error

gritty bolt
#

How do I calculate the total number of members my bot serves?
@gritty bolt

neat ingot
#

your bot doesnt recieve that redirect

empty owl
#

@gritty bolt what lang

earnest phoenix
#

@empty owl can you try updating your nodejs version

empty owl
#

okay

gritty bolt
#

discord.js

empty owl
#

if js bot.users.size

paper phoenix
#

your bot doesnt recieve that redirect
@neat ingot - Your server does?

#

Forward that info to the Discord client

neat ingot
#

hmm maybe it could i guess

earnest phoenix
#

catch (e)? @empty owl

empty owl
#

what

earnest phoenix
#

idek tbh

neat ingot
#

that still feels like a breach of security to me

gritty bolt
#

so i can just do const userCount = bot.users.size()? @empty owl

earnest phoenix
#

what does? @neat ingot

paper phoenix
#

Not at all - that's how OAuth works. Lol

earnest phoenix
#

are you sure catch without (e) is valid

#

yea well

empty owl
#

yea

earnest phoenix
#

if you dont need the info dont use oauth

neat ingot
#

being able to have your client listen for who added all bots in your server? you dont think thats a breach? i do.

empty owl
#

there is no } catch {

earnest phoenix
#

simple as that

empty owl
#

@gritty bolt its not a functiojn

#

its just bot.users.size

gritty bolt
#

oh

earnest phoenix
#

weird

gritty bolt
#

ok

#

thanks

empty owl
#

np

earnest phoenix
#

nodejs wyd

#

@neat ingot thats kinda a breach ig

paper phoenix
#

Your bot knows the guild and all members, channels, topics, etc in the guild

neat ingot
#

only those its given accesss to*

astral yoke
#

how come this dosent work with the error TypeError: serverQueue.connection.play is not a function

neat ingot
#

i mean, idc either way tbh, it just seems like they would want to hide that data as much as possible

earnest phoenix
#

cant u set oauth scopes

empty owl
#

updating node works

neat ingot
#

and just letting anyone get access to that data, that in itself is a seecurity concern if not a breach.

earnest phoenix
#

if u cant just tell discord to up their game

#

updating node works
@empty owl yeah someone had that problem too, thats why i thought updating node might help

neat ingot
#

yea hes saying that the bot can pick up who invited the bot to the server

earnest phoenix
#

well as people have said if u usin oauth it's because you need that data no?

neat ingot
#

the bot wouldnt have your login oauth when your adding the bot via link

earnest phoenix
#

well

#

yea

neat ingot
#

like, it'd have your bot clients login, sure, but not the login details from your web browser where you clicked the link

earnest phoenix
#

you have to pick out the oauth scopes

#

idek

paper phoenix
#

Not login details. User ID and username

#

Same as gets supplied when you log into Top.gg

empty owl
#

ty

neat ingot
#

do you have an example of how your bot would get that information after the fact?

#

like, an example of getting the username of who invited the bot?

empty owl
#

oh wait

empty owl
#

now the messageReactionAdd doesnt trigger

paper phoenix
#

Identify scope + bot

neat ingot
#

...

paper phoenix
#
  • Redirect uri
earnest phoenix
#

@empty owl add logs

paper phoenix
#

(That URI is an example and will 404)

earnest phoenix
#

so yea it needs scopes

neat ingot
#

so then not your bot, but your website

earnest phoenix
#

and it will say on the invite page

neat ingot
#

your website url would get that call

earnest phoenix
#

your website generally is your bot

neat ingot
#

and you would have to forward it to your bot

earnest phoenix
#

well i guess

empty owl
#

the console.log("a")

#

doesnt work

paper phoenix
#

If your website has guild counts or anything else, it's connected to the Discord bot

empty owl
#

i also have raw events on

paper phoenix
#

Like when you edit your bot on Top.gg and it posts in this server

neat ingot
#

my website has that data, it is 100% not part of the bot

earnest phoenix
#

well i mean yeah

neat ingot
#

my bot sends pings to my website ip with that data like it does to top gg

earnest phoenix
#

with proper authorization right Thonk

neat ingot
#

ofc

earnest phoenix
#

i mean

#

well

#

no the bot gets access to api endpoints

#

based on oauth stuff

empty owl
#

i have raw events on

earnest phoenix
#

but yes, you have to forward oauth data to bot

empty owl
#


bot.on('raw', packet => {
    // We don't want this to run on unrelated packets
    if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
    // Grab the channel to check the message from
    const channel = bot.channels.get(packet.d.channel_id);
    // There's no need to emit if the message is cached, because the event will fire anyway for that
    if (channel.messages.has(packet.d.message_id)) return;
    // Since we have confirmed the message is not cached, let's fetch it
    channel.fetchMessage(packet.d.message_id).then(message => {
        // Emojis can have identifiers of name:id format, so we have to account for that case as well
        const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
        // This gives us the reaction we need to emit the event properly, in top of the message object
        const reaction = message.reactions.get(emoji);
        // Adds the currently reacting user to the reaction's users collection.
        if (reaction) reaction.users.set(packet.d.user_id, bot.users.get(packet.d.user_id));
        // Check which type of event it is before emitting
        if (packet.t === 'MESSAGE_REACTION_ADD') {
            bot.emit('messageReactionAdd', reaction, bot.users.get(packet.d.user_id));
        }
        if (packet.t === 'MESSAGE_REACTION_REMOVE') {
            bot.emit('messageReactionRemove', reaction, bot.users.get(packet.d.user_id));
        }
    });
});
``` this taken from diuscordbotguide thing
stark abyss
earnest phoenix
#

also that screenshot i posted. thats the endpoint for the requester that the bot gets access to

#

anyway

#

from people with similar problems

#

100% not a security issue

#

because it's listed very clearly when you're inviting the bot

empty owl
#

wait so

#

wait

#

what does it mean "partial"

#

how can u partially react

paper phoenix
#

Reaction to a message that's not cached

#

Which you'll need both message and reaction partials for

empty owl
#

wait but if i have raw events on doesnt it not matter if its cached or not

earnest phoenix
#

wdym

#

i mean i guess if you have raw events most of the time you'd already have the message???

empty owl
#

what

earnest phoenix
#

idk

astral yoke
#

it dosent give me an error and it does everything legit but it just dosent play

earnest phoenix
#

as+help

#

@earnest phoenix help

slender thistle
#

-botcommands

gilded plankBOT
#

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

quasi crater
#

Guy since i am very new to coding anyone can help me quick isnt it for changing the bot status something like this?

bot.on('ready', () => { bot.user.setStatus('available') bot.user.setPresence({ game: { name: 'with depression', type: "STREAMING", url: "https://www.twitch.tv/monstercat" } }); });

earnest phoenix
#

any error logs?

quasi crater
#

nope 😦

earnest phoenix
#

there has to be an error

quasi crater
#

Hmm it dont show me an error

earnest phoenix
#

you're missing a semicolon at the end of bot.user.setStatus('available')

quasi crater
#

Ay i see

#

Okey i changed it but i guess i do something wrong 😄

sudden geyser
#

Semicolons are optional in JavaScript.

#

@quasi crater are you using v11 or v12.

quasi crater
#

v12

sudden geyser
#

You can also set the status (online/idle/dnd/offline) in setPresence so bot.user.setStatus('available') is unnecessary/doesn't do much anyway.

quasi crater
#

@sudden geyser Thank you ❤️ Now its working

neat ingot
#

semi colons are not required.

#

oh, that was said already, my bad 😛

earnest phoenix
#

How to check my bots all servers list

sick cloud
#

if i have an object of key->values how do i map them out

#

simple dumb question but /s

pale vessel
#

in,?

cosmic girder
#

So anyone know how to make a login/register for html/css.

earnest phoenix
#

?

pale vessel
#

not possible

#

unless you want a non functioning one

cosmic girder
#

Wdym? Im talking about a form

earnest phoenix
#

😑

cosmic girder
#

Ok ill give a example of what i mean

earnest phoenix
#

Everyone ignored the 😓

cosmic girder
sick cloud
#

js @pale vessel

#

like i need to map out an object of queries to a string

pale vessel
#

can you give me the structure

sick cloud
#
{
name: 'value',
name: 'value'
}

// to

`?name=value&name=value```
#

make sense?

pale vessel
#

make a loop?

sick cloud
#

it has to be single line

#

as its in a ternary operator

cosmic girder
#

@pale vessel can it be in the morning or when u get on discord in tomorrow im not on my pc. I asked because i was wondering just to get a idea

pale vessel
#

that would be Object.keys(obj)

sick cloud
#

@cosmic girder i can show you lol

cosmic girder
#

Rn?

valid frigate
#

when did djs v12 come out again

sick cloud
#
<form>
  <input type="text" id="username" placeholder="Username" />
  <input type="password" id="password" placeholder="Password" />

  <button type="submit">Login</button>
</form>

<style>
form, input, etc {
  /* styling */
}
</style>
#

forms are really basic

#

also doesn't that only give the name @pale vessel or

pale vessel
#

then why don't you try map

#

make it an array

cosmic girder
#

Oh ok ty, i needed that for my website that i have for my bot its setup but i want to make a login/register .

#

Oh and is there any way that its like Sign In With Discord And ot signs you in with ur discord.

pale vessel
#

oauth

valid frigate
#

oh well luckily i was just working on the exact same thing

cosmic girder
#

Oh ok pretty simple

valid frigate
cosmic girder
#

Ty

sick cloud
#

lmao "pretty simple" yet you don't get the basics of html

valid frigate
#

solid advice tho, use auth code instead of implicit

cosmic girder
#

@sick cloud i do tho ill show all my code in html its just the form format is tricky

pale vessel
#

you can't-

smoky spire
#

@valid frigate v12 has been in development for years but it got pushed to stable in march

valid frigate
#

:bruh:

pale vessel
#

what

valid frigate
#

crazy how its been in development for years

#

actually no clue what they did but im checking out the repo cuz it looks interesting

pale vessel
#

d.js next soon xd

sick cloud
#

you can't create an oauth implementation just with html

pale vessel
#

ya don't say

sick cloud
#

auto scaling 101

#

just don't

valid frigate
#

well

pale vessel
valid frigate
#

actually the djs guide had a tutorial on how to implement oauth without a backend server

sick cloud
#

yeah but it's using js still

#

and it's sorta bad

#

since the token is exposed

pale vessel
valid frigate
#

yes

#

implicit grant

#

poop stinky

#

they do go on to explain later how to use the more traditional flow but its funny lol

#

considering that a lot of people start out there without learning it properly

sick cloud
valid frigate
#

sure

pale vessel
#

yes

#

i don't want a big picture on my face

valid frigate
#

thats a pretty standard way of doing it

desert orbit
#

Does anyone know how to scale a bot? I want to start a bot but I don't want to make it to where it could have 100k servers and I have no idea how to scale it to multiple servers.

sick cloud
#

depends what lib

valid frigate
#

wouldnt that be premature optimization

sick cloud
#

also scaling images is weird

#

bootstrap does it really weirdly

pale vessel
#

bulma

#

uikit

sick cloud
#

i'll move to element later ¯_(ツ)_/¯

desert orbit
#

@sick cloud I'm using discord.js

queen needle
#

idk if this is development per say but what is a discord bot dashboard

desert orbit
#

Are you talking about creating one for your bot or like the dashboard for you bot on discord.com?

valid frigate
#

a discord bot dashboard is simply a place where users can edit how ur bot behaves on servers they own

sick cloud
#

mee6.xyz is a good long standing example

valid frigate
#

mee6 stinky

sick cloud
#

@desert orbit kurasuta maybe

queen needle
#

is it like about yo'ur bot?

sick cloud
#

we just said what it is lol

queen needle
#

okay thank you

desert orbit
#

ty imma look into that

sick cloud
#

dumb design question time, search icon is for search and moon(goes to sun) is for light dark switcher
should it be search moon or moon search (positions)

hardy vector
#
var Owlbot = require('owlbot-js');
var owlclient = Owlbot("");
const { MessageEmbed } = require('discord.js')
module.exports =  {
    name:"define",
    description: "get a defintion",

    execute: async(client, message, args) => {
        let word = args.slice(0).join(" ")
        if(!word) message.reply("What word are you defining")
        if(word) {

        owlclient.define(word).then(function(result){
            let data = result
            let embed = new MessageEmbed()
            .setColor("RED")
            .addField("Definition", data.definition)
            message.channel.send(embed)
         });
        }
    }
}```when i do _define hello it sends the embed but it says undefined under definition
sick cloud
#

dunno what'd suit better

#

@hardy vector console.log(data)

#

tell us what it says

hardy vector
#

k

#

{

0|npm  |   pronunciation: 'həˈlō',
0|npm  |   definitions: [
0|npm  |     {
0|npm  |       type: 'exclamation',
0|npm  |       definition: 'used as a greeting or to begin a telephone conversation.',
0|npm  |       example: 'hello there, Katie!',
0|npm  |       image_url: null,
0|npm  |       emoji: null
0|npm  |     },
0|npm  |     {
0|npm  |       type: 'noun',
0|npm  |       definition: 'an utterance of â; a greeting.',
0|npm  |       example: 'she was getting polite nods and hellos from people',
0|npm  |       image_url: null,
0|npm  |       emoji: null
0|npm  |     },
0|npm  |     {
0|npm  |       type: 'verb',
0|npm  |       definition: 'say or shout â',
0|npm  |       example: 'I pressed the phone button and helloed',
0|npm  |       image_url: null,
0|npm  |       emoji: null
0|npm  |     }
0|npm  |   ],
0|npm  |   word: 'hello'
0|npm  | }```
#

@sick cloud it says this

#

wait what do i do

sick cloud
#

then there you go

#

definition is undefined because there's multiple

#

you could do either data.definitions[0].definition or map and show them all

hardy vector
#

oh

#

now this happens

#

0|npm | (node:58669) UnhandledPromiseRejectionWarning: Error: timeout of 5000ms exceeded
0|npm | at createError (/root/bot/node_modules/owlbot-js/node_modules/axios/lib/core/createError.js:16:15)
0|npm | at Timeout.handleRequestTimeout [as _onTimeout] (/root/bot/node_modules/owlbot-js/node_modules/axios/lib/adapters/http.js:217:16)
0|npm | at listOnTimeout (internal/timers.js:549:17)
0|npm | at processTimers (internal/timers.js:492:7)
0|npm | (node:58669) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

#

how can i stop this

sick cloud
#

get a better host

hardy vector
#

i use digital ocean

sick cloud
#

modify the lib's timeout then

hardy vector
#

how to do that

sick cloud
#

¯_(ツ)_/¯

#

read its docs

turbid bough
#

add a .catch

sick cloud
#

thats not going to do anything

turbid bough
#

it helps with the exception

sick cloud
#

but they don't want the exception at all

open oracle
#

why doesnt this work im trying to learn coding for discord bots:

const Discord = require('discord.js')
const client = new Discord.Client();

client.once('ready', () => {
  if (message.content === 'jsbot') {
    message.channel.send('Ree');
});

client.on('message', message => {
  if (message.content === 'jsbot') {
    message.channel.send('Ree');
}
#

wait

#

thats not it

#

one sec

#

that is it

cinder patio
#

is that everything? Do you login with your bot

open oracle
#

yes

cinder patio
#

client.login(Token)?

open oracle
#

yes

cinder patio
#

Well, inside your ready function, you have message but message is not defined in there

#

Also you are missing a }

open oracle
#

where?

cinder patio
#

And a )

open oracle
#

so

cinder patio
#

Your editor should tell you this

open oracle
#

why doesnt this work im trying to learn coding for discord bots:

const Discord = require('discord.js')
const client = new Discord.Client();

client.once('ready', () => {
  if (message.content === 'jsbot') {
    message.channel.send('Ree');
});

client.on('message', message => {
  if (message.content === 'jsbot') {
    message.channel.send('Ree');
})}
#

im using notepad bc im on laptop and its already slow enough xD

#

im testing it on my pc and typing the code on my laptop

#

but is that code right?

turbid bough
#

@sick cloud exactly

cinder patio
#

It's not

open oracle
#

i got it

turbid bough
#

visual studio code is pretty lightweight

sick cloud
#

learn js first

#

then read discordjs.guide

turbid bough
#
client.once('ready', () => {
  if (message.content === 'jsbot') {
    message.channel.send('Ree');
});

ok yeah thats not how this works at all

sick cloud
#

missing }, wrong event entirely

turbid bough
#

wrong event, and the event is already on the code under that part

earnest phoenix
#

!!help

gilded plankBOT
#

@earnest phoenix

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

twin pendant
#

best database for discord bots? i currently have one for guild settings (sqlite3 - enmap) and another for the economy (quick.db). i made the first one ages ago and didnt wanna interfere with it so i just got another db. should i combine them into one or just get a different db for both of them and transfer the data?
or do i already have a decent system going, idk much about databases.
thanks

earnest phoenix
#

mongo

modest maple
#

There isnt rlly a best DB

earnest phoenix
#

^ true

modest maple
#

it depends on your data sets

#

and how large they are

twin pendant
#

not too big but as my bot gets more popular they will gradually increase

modest maple
#

Mongo is easy to use and alot of people like it for that, but... its slow and requires caching. Postgres is Quick but requires SQL knowledge

twin pendant
#

ill look into mongo, thanks to both of yous

valid igloo
#

how to fix that the bot count the mention that by phone is multi arg?

#

as in the phone it will show like this:
@frozen willowample example#1234

earnest phoenix
#

by combining ClientUser#username and ClientUser#discriminator

valid igloo
#

how?

earnest phoenix
#

for example by using

message.channel.send(`${user.username}${user.discriminator}`)
#

something like that ig

#

dont take my word, i dont code in js

#

i just know how to read the docs

#

how can i check mentioned user badges ?

#

@earnest phoenix use user.user.tag

#

wrong method

#

thank you mobile very cool

#

oh they finally added the verified bot flag

#

nice

#

the flags on the user object from what you linked is only available when using oauth

#

and fetching the current user from the oauth token

pale vessel
#

i thought the verified bot flag was there all the time since it was added

earnest phoenix
#

nah i saw it just now

#

can i use node index.js > log.log 2> log_err.log in heroku ??

pale vessel
#

not sure

earnest phoenix
#

why

#

:()

#

:(o)

pale vessel
#

you can try

#

instead of asking

earnest phoenix
#

kk

#

dude i dont want to get ban xD

#

@pale vessel Now how i can read the log file :))

#

😢

#

you cant get banned from heroku for something you can enter in your console

#

they would restrict access to that if you couldn't

#

oof

#

shit

tight plinth
#

so I use vscode insiders with my js bot & pm2 and every time I save a file (like with ctrl+s) the bot restarts

#

whyy

#

happens with all the bots in the vps

cinder patio
#

maybe you have this on

tight plinth
#

idfk

#

maybe

earnest phoenix
#

@cinder patio but u have to pay to see ur logs

#

pm2 free version, give u only realtime logging

cinder patio
#

that was for Lumap

earnest phoenix
#

oh

#

ok