#development

1 messages ยท Page 974 of 1

chrome garden
#
if __name__ == '__main__':
    for filename in os.listdir('./Cogs'):
        if filename.endswith('.py'):
            bot.load_extension(f'Cogs.{filename[:-3]}')```
#

Quite basic at the moment

slender thistle
#

It's not exactly necessary

#

just... easier to navigate between files

#

I don't see why you would need anything advanced to load extensions really. Hell, even I do it like that

chrome garden
#

Is your bot public

slender thistle
#

One was and I loaded extensions the same way

plucky harness
#

am confused how do u specify bucket type
is it type = BucketType.user?

slender thistle
#

How do you import BucketType

plucky harness
#

i dont think its a module

#

or is it

earnest phoenix
#

ok so, does anyone knows how to avoid Youtube API quota exceeded?
tried submitting a form to increase my quota but everytime i try, it says "Try again" or somethin like that and wont let me submit it xd
For music command ofc

#

or anything else i can use for playing musics?

shy turret
#

So, my Discord bot @worldly lily won't login in some host i'm using

#

f

vale garden
#

hello

shy turret
#

hey

vale garden
#
const Discord = require('discord.js');
const bot = new Discord.Client();

module.exports = {
  name: 'servers',
  description: "displays all the servers of the bot, for owner's use only",
  execute: (message, args) => {
    message.channel.send(`Serving ${bot.guilds.size} servers: `);
    message.channel.send(bot.guilds.map(g => g.name).join("\n"));
  }
}
#

so this is my command

earnest phoenix
#

hmm? it will be gud is you elongate the problem with errors and all @shy turret

shy turret
#

bot.guilds.cache.size @vale garden

vale garden
#

and it says bot.guilds.map isnt a function

#

lol

#

what about the bot.guilds.map

#

what do i do

hasty sparrow
#

d.js v12?

vale garden
#

ye

#

it is from v11 ik

shy turret
#

@earnest phoenix i was debugging it and console.log("this works"), but then "Bot is ready!" doesn't display, so that means the bot isnt logging in

hasty sparrow
#

bot.guilds.cache.map(...)

vale garden
#

kk thx

shy turret
#

no error

#

but another bot im hosting on the same host works

#

discord.js v12

vale garden
#
Cannot send an empty message
#

im getting this error

shy turret
#

console.log() the msg

#

above

message.channel.send(bot.guilds.map(g => g.name).join("\n"));
#

add

console.log("Debuging: " + bot.guilds.map(g => g.name).join("\n"));
#

try running the same thing and check the console

#

my best guess is that the variable's empty

#

@vale garden

vale garden
#

ok

shy turret
#

I'm gonna get so mad if my alpha ver of my discord bot turns on but stable doesnt WTF

#

ok

vale garden
#

theres an error so it cant be logged

#

lol

wide ruin
#

im trying to render something in blender, is anyone here good with it?

shy turret
#

@vale garden put return before message.channel.send temp so the error doesnt run

#

I also recommend adding try {} catch(err) {}

earnest phoenix
#

how to pass a glitch project to VSC??

#

ping me

shy turret
#

discord hates my bot...

#

Discord: Invalid token, I know...
Discord: If token's discord user id is not 716102473718169680, works
Discord: My bot token, FU USE ANOTHER ONE OF YOUR BOTS

I'm not even kidding... I tried regenerating my bot token

misty sigil
#

how to pass a glitch project to VSC??
@earnest phoenix theres a glitch extension

earnest phoenix
#

i have the extension installed

honest perch
#

ctrl p

#

glitch: open project

misty sigil
#

@earnest phoenix There isn't much you can do without vsc, node and cmder
Although you could use BotGhost you will not be accepted by the moderators.

earnest phoenix
#

๐Ÿ˜ฎ

#

ctrl p
@honest perch gracias amigo te la como toda

#

guapo

honest perch
#

@misty sigil modified versions are allowed

#

as there are a couple botghost bots on top.gg

misty sigil
#

ah, ty

#

you could use botghost

#

aslong as it's modified

#

Cool, you're hosting on glitch right?

earnest phoenix
#

misly

#

i press cntrl+p

summer torrent
#

Ctrl + Shift + P

#

install glitch extension first

shy turret
#

why does my bot use so much cpu

#

my bot uses 59.2% CPU

mossy vine
#

what lib

shy turret
#

discord.js

#

no commands ran

quartz kindle
#

are you using intents?

earnest phoenix
#

How to send and edit messages outside loop

#
   const broadcast = client.voice.createBroadcast();
   const channelId = message.member.voice.channel.id;
   const channel = client.channels.cache.get(channelId);
   channel.join().then(connection => {
   broadcast.play(discordTTS.getVoiceStream(args.join(' ')));
   const dispatcher = connection.play(broadcast);
   dispatcher.on('finish', () => channel.leave());
        })``` anyone know why the client doesn't leave?
summer torrent
#

isn't it channel.disconnect() ? Thonk

#

lemme check docs

earnest phoenix
#

i have already

summer torrent
earnest phoenix
#

yes i have already

summer torrent
midnight blaze
#

not sure if this here is the right place, a question, is it possible for other people to know my name/address if they whois my url?

earnest phoenix
#

what url

#

@slender thistle

#

How to send and edit messages outside loop

#

Python

slender thistle
#

Could you please elaborate on the "outside loop" part?

midnight blaze
#

@earnest phoenix it is a .dev url

earnest phoenix
#

idk then

#

try it

#

and see what results u get

midnight blaze
#

I have did it and there are no information about me, but I am sure there are people who know better than I do, how to use whoami tools

tight plinth
#

i have a problem witha bot i made. I enabled the partial messages in the client, but if i delete a message that is partial and if i ty to fetch it i get a DiscordAPIError: Unknow Message error. How can i fix it?

pale vessel
#

@midnight blaze you most likely had a guard on so don't worry

tight plinth
earnest phoenix
#

ok

midnight blaze
#

@pale vessel you are right, I have actually a guard,I just didnt know it

#

thanks

earnest phoenix
#

does anyone here use Tiktok Scraper?

#

Could you please elaborate on the "outside loop" part?
@slender thistle ? Didn't understood what r u telling

slender thistle
#

what do you mean by "outside loop"?

lime jungle
#

i'm using puppeteer and i want to zoom out from the page (ctrl + minus) because by default the image is too big, how can i do that ? i tried the .setViewport({deviceScaleFactor:0.5}) option but nothing changes :/

#

and then take a screenshot but thats ok

#

because it just zooms out the page and not the element

#

idk if you understand me :/

quartz kindle
#

@tight plinth pretty sure you cant fetch deleted messages

tight plinth
#

oof

lime jungle
#

i'm using puppeteer and i want to zoom out from the page (ctrl + minus) because by default the image is too big, how can i do that ? i tried the .setViewport({deviceScaleFactor:0.5}) option but nothing changes :/
nvm fixed it i'm too dumb

#

just had to change the image size

#

smh

quartz kindle
#

@tight plinth and your message update event is probably logging embed updates

#

hence why new content is empty

tight plinth
#

apparently it was a webhook message

#

weird

sudden hawk
#

Someone help me to see the servers where my bot is?

heavy marsh
#

I am trying to edit a voice channel every 60s using d.js - v12

bot.on('ready', () => {

const times = {
    "1": "๐Ÿ•",
    "2": "๐Ÿ•‘",
    "3": "๐Ÿ•’",
    "4": "๐Ÿ•“",
    "5": "๐Ÿ•”",
    "6": "๐Ÿ••",
    "7": "๐Ÿ•–",
    "8": "๐Ÿ•—",
    "9": "๐Ÿ•˜",
    "10": "๐Ÿ•™",
    "11": "๐Ÿ•š",
    "12": "๐Ÿ•›"
}

var time = bot.guilds.cache.get(`611881570202025986`).channels.cache.get("706504532854833172");
time.setName(`${times[String(moment().format('LT')).charAt(0)]}Server Time: ${moment().format('LT')}`).then((vc) => {

setInterval(function() {
vc.setName(`${times[String(moment().format('LT')).charAt(0)]}Server Time: ${moment().format('LT')}`);
}, 60000 )
});

});

But it doesnt do it well and no errors

quartz kindle
#

editing channel name/description can only be done 2 times per 10 minutes

heavy marsh
#

Its a new thing now?

quartz kindle
#

yes

heavy marsh
#

...

#

@quartz kindle Where was it said?

quartz kindle
heavy marsh
#

OOh thank you

jade jungle
earnest phoenix
#

Hey! So I want to use this module for my bot. I read over the documentation and never really understood how to use it

#

Is there a certain way to read the docs or ?

honest perch
#

what module

earnest phoenix
#

My bot opening very late. When I try it with another token, it opens instantly but my bot opening very late. It has 810 servers.

#

Discord.js: v12

unique nimbus
#

bruh

earnest phoenix
#

what module
@honest perch Tiktok Scraper

latent light
#

Was wondering how long it's gonna take to verify my bot. I didn't receive any updates for 1.5 weeks I think.

haughty night
#

2-3weeks

latent light
#

Thanks

spark breach
#

Uhm, so I noticed that my bot responds to 'please help' while it isn't suppose to. Is there an way I can fix this?

    let args = message.content.substring(PREFIX.length).split(" ");

    switch(args[0]) {
        case 'help':
            const Embed = new Discord.MessageEmbed()
            .setTitle('Helper Embed')
            .setColor(0xFF0000)
            .setDescription('Current commands available: help, command-info picture, user-info, meme, play (youtube link), skip, stop')
            .addField("Learn more?", 'You can type command-info to know more what every command does!');

        message.author.send(Embed);
        break;```
latent light
#

Now I can rest in piece

#

What's ur prefix?

haughty night
#

startsWith()

#

You can use that

spark breach
#

'Beaver'

latent light
#

And yea use startWith

#

startsWith

spark breach
#

oh oki thanks @haughty night

haughty night
#

Np

spark breach
#

and anonymous guy xD

latent light
#

Np

spark breach
#

message.startWith.substring(PREFIX.length).split(" ")

Does it need to be that then?

#

or does the substring also need to go away?

latent light
#

Nonono

#

message.content.startsWith(prefix)

ancient lichen
#
if (!message.content.startsWith(PREFIX)) return;

try this

spark breach
#

ohhh ok

#

ty, I'm new to coding srry xD

haughty night
#

startsWith({$prefix}help)

#

Yae

latent light
#

Np lol

ancient lichen
#

btw anyone know how to fix err 429 on ytdl-core?

jaunty junco
#

that didnt happen-

white anvil
#

stop sending so many requests

placid iron
#

๐Ÿคฃ

ancient lichen
#

i mean

#

๐Ÿคฃ

#

but there are no request rn... and this happened randomly LUL

earnest phoenix
placid iron
#

You should send negative request then

earnest phoenix
#

can someone help me?

#

My bot opening very late. When I try it with another token, it opens instantly but my bot opening very late. It has 810 servers.
Discord.js: v12

jaunty junco
#

maybe its because of all the servers its in?

ancient lichen
#

are you loading some sort of server list?

spark breach
#

if (!message.content.startsWith(PREFIX)) return;
@ancient lichen this gave me an error,

2020-06-15T17:26:17.897869+00:00 app[Worker.1]: switch(args[0]) {
2020-06-15T17:26:17.897870+00:00 app[Worker.1]: ^
2020-06-15T17:26:17.897870+00:00 app[Worker.1]:
2020-06-15T17:26:17.897871+00:00 app[Worker.1]: ReferenceError: args is not defined

ancient lichen
#

try using it as the first thing in the event

#

idk how your bot is structured LOL

feral aspen
#

Hey Guys

#

Question

spark breach
#

oof k

feral aspen
#

The .first() is in the old versions

#

what is the command for the v12?

ancient lichen
#

The .first() is in the old versions
@feral aspen what are you trying to do?

feral aspen
#

?

#

I want to make this either a!bal <username>

#

so whats the new one for .fist()

#

*.first()

jaunty junco
#

oh god, welp i cant help with that since i only know lua xd

feral aspen
#

Please help guys.

ancient lichen
#

get the first element of an array?

#

i can't understand D:

vague ravine
#

lol

feral aspen
#

yes.

#

Wait.

ancient lichen
#

array[0]?

feral aspen
#

Listne

#

*listen

ancient lichen
#

k

feral aspen
#

Before.. it used to be .first() remember?

#
        var user = message.author;
    } else {
        var user = message.mentions.user.first() || bot.users.cache.get(args[0]);
    }```
ancient lichen
#

ohhh!!!

#

w8

feral aspen
#

the .first() wont work ๐Ÿ˜ฆ

#

Im on v12

#

so I need to know whats the new one .

ancient lichen
#

so you need the id of the tagged person right?

feral aspen
#

Yes.

#

that one is for the a!bal

#

I am creating a money system

ancient lichen
feral aspen
#

so I dont want it only viewing my balance

#

Look..

Im creating a money system.
When I do a!bal.. it shows my balance.
Now when I make a!bal <user.id>, it says cannot read property .first() cause Im in v12

#

so How can I make it from .first() to new version?

earnest phoenix
#

message.mentions.users.first() bear in mind this is a user property not a member property

#

for a mention ^

hardy vector
#

how can i make a bassboost cmd with erela.js

earnest phoenix
#

check their docs

#

@feral aspen for id message.guild.members.cache.get(args[0])

#

maybe its because of all the servers its in?
@jaunty junco how can i fix it?

jaunty junco
#

you see

#

idek

earnest phoenix
#

are you loading some sort of server list?
@ancient lichen if you are talking about me, no. I am using eval command

jaunty junco
#

im just pointing out a possible problem

feral aspen
#

@earnest phoenix .. the message.mentions.users.first() doesnt work

#

Im in v12

earnest phoenix
#

still works in v12

feral aspen
#

so it will say its not a property

#

no it doesnt sadly

earnest phoenix
#

???

#

it does, I use it

feral aspen
#

Its literaly saying cannot read property of first

earnest phoenix
#

instead of users change it to members

#

and that doesn't mean it doesn't work in v12

feral aspen
#

Ill try something one sec.

earnest phoenix
#

yeah yeah

jaunty junco
#

@earnest phoenix on second thoughts, it might be that the bot is running out of memory, or the host is running out of memory.

reef nest
#

Are there any rust libraries for discord bot development?

earnest phoenix
#

Oh sorry

#

๐Ÿ˜„

quartz kindle
#

i believe the rust lib is called serenity

#

or something

reef nest
#

Ah okay, thanks :)

#

I've started learning rust language so thought of doing some practice by building a bot maybe

still merlin
#

in discord.js how do you check if the person exucting a command is a bot. I cant find it in the docs? would

if(message.author.bot) return ```
work?
quartz kindle
#

yes

still merlin
#

ok tysm

quartz kindle
#

doesnt matter really lol

earnest phoenix
#

wot

#

^

reef nest
#

Your bot needs to be on at least 75 servers to get certified bot dev tag or are there any other requirements for that?

earnest phoenix
#

yes

#

but above it

quartz kindle
#

no, certified is a top.gg program

hardy vector
#

check their docs
@earnest phoenix theres nothing on erela docs for bassboot

quartz kindle
#

its a special thing in top.gg only

earnest phoenix
#

oh I thought he meant Discord Dev

silent berry
#

Using eval, how can i identify how many bots are in a server i specify.

discord.js v12.2

quartz kindle
reef nest
#

Oh okay

earnest phoenix
#

@earnest phoenix theres nothing on erela docs for bassboot
@hardy vector equalizer

quartz kindle
#

although i believe the certification program is on hiatus

#

or at least people have been waiting over 3 months for a response lol

hardy vector
#

oh

#

there are two properties for it .band and .gain?

feral aspen
#

Hey auric.. thanks a lot for the help as it worked!

hardy vector
#

which one

earnest phoenix
#

Hey auric.. thanks a lot for the help as it worked!
@feral aspen np

reef nest
#

Aight

#

Thanks :)

quartz kindle
#

@silent berry you need to loop over the cached members of said server and filter out non-bots

#

but it only works on cached members

reef nest
#

I need to refine code of my not first for faster performance XD

quartz kindle
#

so offline/inactive bots wont be counted

silent berry
#

ok thanks

radiant estuary
#

how can i center my p tag in my div tag vertically?

quartz kindle
#

vertically? explain pls

#

make the text appear like
t
h
i
s
?

topaz fjord
#

oh god

#

display flex is the best

slender thistle
#

Probably what they meant is if you did align-content: center in a flexbox with direction set to row

quartz kindle
#

wait did i misread

slender thistle
topaz fjord
#

@quartz kindle yes

quartz kindle
#

i swear to god the word "center" was not in that sentence when i read it

radiant estuary
#

when i user text-align: center; it has the same space left and right. but i want that it has the same spaces top and left

sry for my bad eng

quartz kindle
#

you can use vertical-align:middle

#

but it only works with inline-block

#

and depends on how your css is organized

topaz fjord
#

@slender thistle you could also set direction to column and justify it to the center

slender thistle
#

Mhm, something Tim taught me sometime ago

topaz fjord
#

I had to learn flex display myself

#

but likd

#

it's nice

slender thistle
#

Flexbox is heavenly

topaz fjord
#

but I can't figure out one thing

#

my div contains three elements and they're spaced evenly between

#

the second div has elements that expand and whenever I expand all and close them, the third div moves up

#

and then pops back to its original position

quartz kindle
#

they expand vertically or horizontally?

radiant estuary
#

i use this:

                position: absolute;
                right: 25px;
                top: 25px;
                border-radius: 10px;
                background-color: rgb(255, 166, 0);
                color: #fff;
                height: 120px;
                width: 300px;
            }

            #warn p {
                text-align: center;
                vertical-align: middle;
            }```

and get this:
#

#warn is the div

#

i think i am to bad xD

quartz kindle
#

i mean, if you have fixed height, just use a fixed margin/padding, or just replace the height with padding

topaz fjord
#

@quartz kindle vertically

#

so it's

nav

body
     expandable
     expandable
     expandable

footer
#

if I expand all then close them the footer comes up with them then pops back down

quartz kindle
#

ah its one of those sticky footer thingies?

#

does it use js or how does it work?

radiant estuary
#

and how can i center this? Sry but i am very bad :/

quartz kindle
#

remove height and width from #warn

#

and give padding: 50px 20px to #warn p

radiant estuary
#

thank you very much ๐Ÿ˜„

halcyon ember
#

whats the way to check if a user's id is in an object

#

or array

quartz kindle
#

depends what exactly you want to do, for example these all work in different situations to find one item in an array or object
array of ids -> array.find(item => item === id)
array of objects -> array.find(item => item.id === id)
object -> Object.values(object).find(item => item.id === id)

still merlin
#

I'm finally making a command handler and I was doing research and fs is required, What is fs?

quartz kindle
#

if you have an object indexed by ids, you can simply check if(object[id])

halcyon ember
#

like if my bot is in multiple servers, I want an admin to be able to access a certain command

quartz kindle
#

fs is node.js's built-in module to work with your local file system, ie: access files and folders, etc...

earnest phoenix
#

How to get your bot verified and get yourself verified bot developwr badge

still merlin
#

Ok thanks

#

@earnest phoenix Get your bot in 100 serves (or 75 or more) and apply.

quartz kindle
#

@halcyon ember is this admin unique per server?

halcyon ember
#

admin should be universal

quartz kindle
#

so like a bot admin

halcyon ember
#

so that say my ID was added to the object and I joined another server, I would still be able to access

#

yea

earnest phoenix
#

How can I get the id of the voice channel a user just left? I tried newMember.member.voice.channelID but that shows the ID on joinjing

halcyon ember
#

not local server, if it was local server I could do the roles lol

quartz kindle
#

you can make an array of admins accessible in your files

#

for example const admins = [id1,id2,id3] at the top of your file

spark breach
#

Uhm, so I noticed that my bot responds to 'please help' while it isn't suppose to. Is there an way I can fix this?

    let args = message.content.substring(PREFIX.length).split(" ");

    switch(args[0]) {
        case 'help':
            const Embed = new Discord.MessageEmbed()
            .setTitle('Helper Embed')
            .setColor(0xFF0000)
            .setDescription('Current commands available: help, command-info picture, user-info, meme, play (youtube link), skip, stop')
            .addField("Learn more?", 'You can type command-info to know more what every command does!');

        message.author.send(Embed);
        break;```

(I have asked this before but these solutions didn't work: ```if(!message.content.startsWith(PREFIX)) return;``` and ```message.content.startsWith(prefix)```
halcyon ember
#

oh

quartz kindle
#

@earnest phoenix when a user leaves a voice channel, you get an old state and a new state in your voiceStateUpdate event

#

the old state should contain a channel, while the new one should not have a channel

#

which means the user left the channel

earnest phoenix
#

How can i get the id of the user, set it as the name of the variable, then export the variable to another file? I want to make a level system for my bot like mee6

#

can i pass oldState through

#

Plus check if a variable for that person already exists

quartz kindle
#

wdym pass oldState through

earnest phoenix
#

I only need the id of the voice channel the user left

golden condor
#

@spark breach if(!message.content.startsWith(PREFIX) return; at the top

earnest phoenix
#

)

quartz kindle
#

get it from the old voicestate in your voiceStateUpdate event

spark breach
#

Like this? Cuz if yes it gives me this error:
2020-06-15T17:26:17.897869+00:00 app[Worker.1]: switch(args[0]) {
2020-06-15T17:26:17.897870+00:00 app[Worker.1]: ^
2020-06-15T17:26:17.897870+00:00 app[Worker.1]:
2020-06-15T17:26:17.897871+00:00 app[Worker.1]: ReferenceError: args is not defined

earnest phoenix
#

oldMember.member.voice.channelID

#

is null

flat obsidian
#

Why my bot give kick permission to everyone

quartz kindle
#

@earnest phoenix is that from a voiceStateUpdate?

#

or from a memberUpdate?

earnest phoenix
#

voiceStateUpdate

#
module.exports = async (bot, oldMember, newMember) => {

return console.log(oldMember.member.voice.channelID)

quartz kindle
#

then why are you using member?

#

voiceStateUpdate gives you voiceState objects

#

not Members

#

by accessing member, you're acessing the updated voice state, not the old one

earnest phoenix
#

I dont understand how i can acces the old voice state

#

that should be oldMember right

spark breach
#

Why my bot give kick permission to everyone @flat obsidian
You need to lock the command to people with only admin perms

quartz kindle
#

no

#

its a voiceState object

prime cliff
quartz kindle
#

you can directly do oldWhatever.channelID

#

there is not need to access members

earnest phoenix
#

thanks king

spark breach
quartz kindle
#

your oldMember and newMember are not members, they are voicestates

spark breach
#

but when i typed 'please help' that also worked instead of the prefix + help

earnest phoenix
#

yes i understand now

#

I think so

#

thanks

prime cliff
#

Add that let args = code bellow your message.content.startsWith

earnest phoenix
#

hello

#

i need reaction role command

#

if anyone have it

pale vessel
#

we don't spoonfeed

spark breach
prime cliff
#

You forgot the prefix check too message.content.startsWith

earnest phoenix
#

PREFIX.length

spark breach
#

ohhhh

prime cliff
#

Wait

#

Why are

pale vessel
#

uh no

spark breach
#

ill check if it works with the .length

#

Why are
?

pale vessel
#

no-

next remnant
#

I have had 5 session invalidations + reIDENTIFYs in the past <24 hours. This isn't something that happens normally for me

#

anyone else?

ivory fox
#

guys, what do you prefer you to use, postgresql or sqlite? I know that sqlite is better for small db and postgresql for large, but I don't quite understand what it means exactly
I wanted to use postgresql because I'm hosting on heroku right now, but it has 10k row limit, so game is not worth the candle I guess

earnest phoenix
#

i need reaction role command
if anyone have it

#

so...

pale vessel
#

PostgreSQL is really good

next remnant
#

sqlite won't work on heroku either...

pale vessel
#

we don't spoonfeed for god's sake

earnest phoenix
#

Ok

prime cliff
#

If you don't know how to code maybe you should learn first instead of trying to do complicated stuff

pale vessel
#

i'd say keep Postgres because sqlite won't be supported on heroku anyway if you're planning on using it for a while

earnest phoenix
#

i know but i tryied to make this code

#

and i gived up

quartz kindle
#

reaction roles are not an easy thing

prime cliff
#

Guess you need to learn some more then, tip use add reaction events and per-server data

quartz kindle
#

you need to know how to use a database and many other things

earnest phoenix
#

ye

ivory fox
#

sqlite won't work on heroku either...
@next remnant yeah, I do know, but if postgresql has 10k row limit, I shouldn't stay on heroku and should transfer to some paying vps

next remnant
#

you answered your question

earnest phoenix
#

Lol

#

I wanna detect if i react with a certain emoji so my bot edits the message.

#

For a help command

next remnant
#

there are free vps' out there. Free tiers of AWS, GCP, Azure can provide those@ivory fox

earnest phoenix
next remnant
#

you need a paginator

ivory fox
#

i'd say keep Postgres because sqlite won't be supported on heroku anyway if you're planning on using it for a while
@pale vessel is transfer from one db to another hard? I didn't work with db before and I can't rate the scale

prime cliff
#

@earnest phoenix if you have a static help menu that's fairly easy just do a list of embed pages and then track for each message that is a help embed

jaunty junco
#

I wanna detect if i react with a certain emoji so my bot edits the message.
@earnest phoenix you could just make a second help command smh

pale vessel
#

if it's the same type of db then not really

next remnant
#

@earnest phoenix what library are you using?
discord-ext-menus is your answer if you're on dpy

quartz kindle
#

there are many ways to use reactions, its not an easy thing either. you can use the reactionAdd event or you can use message.awaitReactions, or a reaction collector

pale vessel
#

if you're using postgres right now, then you wouldn't need sqlite because postgres is better (imho)

ivory fox
#

there are free vps' out there. Free tiers of AWS, GCP, Azure can provide those@ivory fox
@next remnant so it doesn't matter what rdbms I'll choose? I missed it

pale vessel
#

it doesn't

#

it's a vps, you can install anything

quartz kindle
#

transfering from one database to another is not easy, it often involves reading all rows from one db and writing them to another

earnest phoenix
#
  if(message.author.bot)
    {
      
      if(message.embeds)
        {
          const embedMsg = message.embeds.find(msg => msg.tittle === 'Choose A Bot');
          if(embedMsg)
            {
              embedMsg.message.react('722072274219434078')
              .then(reaction => console.log("Reacted with " + reaction.emoji.name))
              .catch(err => console.erros);
              
            }
        }
      return;
    }
    if(message.content.tolwerCase() === '$react') 
  {
      message.channel.send('**Click Here To Choose Your Bot!!**')
  const embed = new Discord.RichEmbed()
    .setTitle("Choose A Bot")
    .setDescription(`:soul:*`)
    .setColor('GRAY');
    
        message.channel.send(embed)
}
});


client.on('message', message => {
  if(message.author.bot)
    {
      
      if(message.embeds)
        {
          const embedMsg = message.embeds.find(msg => msg.tittle === 'Choose A Bot');
          if(embedMsg)
            {
              embedMsg.message.react('722072241621172335')
              .then(reaction => console.log("Reacted with " + reaction.emoji.name))
              .catch(err => console.erros);
              
            }
        }
      return;
    }
    if(message.content.tolwerCase() === '$react') 
  {
      message.channel.send('**Click Here To Choose Your Bot!!**')
  const embed = new Discord.RichEmbed()
    .setTitle("Choose A Bot")
    .setDescription(`:soul:*`)
    .setColor('GRAY');
    
        message.channel.send(embed)
}
});

it's good ?

pale vessel
#

hastebin my dude

quartz kindle
#

tolwerCase() lmao

next remnant
#

if(message.author.bot)
pretty sure you meant if (!message.author.bot)

pale vessel
#

also, message.tittle lmao

next remnant
#

get a good ide

earnest phoenix
#

Ok

pale vessel
#

i love my npp

next remnant
quartz kindle
#

you mean its re-identifying instead of resuming?

next remnant
#

yes

quartz kindle
#

which lib?

next remnant
#

dpy

quartz kindle
#

could simply be discord craping out

next remnant
#

it resumes too

quartz kindle
#

if its inconsistent you can assume its discord's fault

next remnant
#

it only started re identifying today

#

so ig its discord being discord

quartz kindle
#

yup

topaz fjord
#

does it use js or how does it work?
@quartz kindle wdym

#

I'm using react but onclick I add a class to expand it

earnest phoenix
still merlin
earnest phoenix
#

you didn't close your for loop

still merlin
#

where do I put the bracket tho at the end it just gives me 800 errors (not really like 4)

pale vessel
#

or just remove {

earnest phoenix
#

figure it out

#

syntax is so basic that you shouldn't be making a bot if you haven't got that figured out yet

pale vessel
#

sadly have to agree with this

urban olive
#

hello

#

i cant submit my bot to the site

#

submit button aint working

topaz fjord
fiery hill
#
const onlines = client.guilds.cache.
        map(guild => 
            guild.members.cache.
                filter(member => 
                    member.presence.status !== 'offline' &&
                    !member.user.bot &&
                    client.guilds.cache.
                        filter(guild => 
                            guild.members.cache.get(member.user.id)
                        ).size < 2
                ).size
            ).reduce((a, b) => a + b)```
Hey! I made this to count the sum of all unique online members accross all guilds the bot is in, do you have any simpler way in mind?
#

this code seems unhealthy x)

quartz kindle
#

by unique you mean only members that exist in only a single guild?

#

so a user that is in 2 guilds would not be counted?

fiery hill
#

yep

quartz kindle
#

you could probably simplify it by using client.users as a starting point

fiery hill
#

yeah, was my first step, but doesn't a bot only cache a user if it receives a message from it?

quartz kindle
#

same with members

fiery hill
#

so then the number will be wrong, cause if one doesn't message, he will not be counted right?

quartz kindle
#

messages are not the only things that cache users

#

presence updates do too

#

and memberAdd, memberUpdate, userUpdate

fiery hill
#

oh

quartz kindle
#

and messageUpdate

#

and probably more

earnest phoenix
#

je recher un gรฉnรฉrateur d'images random meme

paper phoenix
#

Assuming you have those intents or are < 100 servers

fiery hill
#

since i use free hosting, i think i can't handle > 100 servers, so it's okay

paper phoenix
#

yeah, was my first step, but doesn't a bot only cache a user if it receives a message from it?
@fiery hill - Or fetchAllMembers: true with DJS, no?

quartz kindle
#

a free hosting can handle it if done correctly

glossy elk
#

If I applied and back then I didnโ€™t use partials but now I do.. what do I do?

quartz kindle
#

you mean the verified developer application?

glossy elk
#

Yes

quartz kindle
#

partials doesnt matter

#

unless you mean intents

glossy elk
#

Alright

#

Hm

#

Nope

#

Partials

quartz kindle
#

then they dont care, partials have nothing to do with the api

#

its just a way discord.js works

glossy elk
#

Then what does

#

Intents?

quartz kindle
#

they only care if you use GUILD_MEMBERS and GUILD_PRESENCES intents

glossy elk
#

I use partials for reactions role I was just making sure

quartz kindle
#

aka the privileged intents you need to enable in your developer portal

glossy elk
#

How long is verification

quartz kindle
#

took 3 weeks for me

glossy elk
#

To get your app reviewed

#

Oof

#

Not bad tbh

paper phoenix
#

Think they're down to 5 days now

glossy elk
#

If it only took 1 week to get on DBL then it doesnโ€™t really matter for discord

#

Discord probably has a big coming in

#

Bit*

quartz kindle
#

ye

glossy elk
#

I applied on the 9th I think

#

Ye

#

Think they're down to 5 days now
@paper phoenix so if that was true itโ€™d have probably been reviewed

earnest phoenix
#

m

glossy elk
#

M??

earnest phoenix
#

-bots @earnest phoenix

glossy elk
#

Wrong channel

earnest phoenix
#

sorry

glossy elk
earnest phoenix
#

thanks ๐Ÿ™‚

north hollow
#

can someone help for a kick and ban command

acoustic kiln
#

hello friends im little suffering to make a bot like pokecord..

discord.js
i need a bit help on How to make auto spawns
And make em catch it

please dm or ping me here and reply

lyric mountain
#

@acoustic kiln use Math.random() to randomly generate a value, then set a threshold and check if that value is above it (like if Math.random() * 100 > 75 then spawn)

#

note that you'll need a database to store the spawns

acoustic kiln
#

thank you

lyric mountain
#

ok, fixed the example ๐Ÿ™„

#

no, you did read

quartz kindle
#

i mean

lyric mountain
#

I wrote it wrongly

quartz kindle
#

just make it if Math.random() > 0.75

lyric mountain
#

yeah, that'd be better

north hollow
#

I need help for a kick and ban command

#

ya

coarse topaz
#

Hello, I'm making a simple logs system for when someone uses a specific command, and, I would like to retrieve the ID of the channel where the command was used. How could I do it? I'm using discord.js :p
This is my current code:

        .setDescription(`**!say** command was used by ${message.author.tag} in <#${HereShouldBeTheChannelID}>`)
        .setColor('GREEN')
  bot.channels.cache.get("433948592433266688").send(logMessage); //The bot will send that embed to the logs channel
      }
    }
  }```
urban olive
#

hello

#

i made a bot that plays the DK rap in your server

sudden geyser
#

[JDA/Kotlin] I'm having issues trying to return a value from this queue member function for the findUser member function. I want to retrieve a user by their ID, but within the lambda, I can't use return directly. It only allows for return@queue which doesn't seem helpful. I also tried declaring a local variable and assigning it later in the lambda, but it never changed it. Does anyone know how I could get the user from the lambda? kotlin // For the record, I know I'm missing return. This is just to show. open fun findUser(context: CommandContext, userID: String): User? { context.jda.retrieveUserById(userID).queue({ // I need to return `it` (a User instance) as the value from the member function. }) { /* Expected if it wasn't found. */ } }

north hollow
#

I need help

#

I need help for a kick and ban command
@north hollow

lyric mountain
#

[JDA/Kotlin] I'm having issues trying to return a value from this queue member function for the findUser member function. I want to retrieve a user by their ID, but within the lambda, I can't use return directly. It only allows for return@queue which doesn't seem helpful. I also tried declaring a local variable and assigning it later in the lambda, but it never changed it. Does anyone know how I could get the user from the lambda? kotlin // For the record, I know I'm missing return. This is just to show. open fun findUser(context: CommandContext, userID: String): User? { context.jda.retrieveUserById(userID).queue({ // I need to return `it` (a User instance) as the value from the member function. }) { /* Expected if it wasn't found. */ } }
@sudden geyser you can't extract a value from a lambda

#

just do whatever you need to do inside it

sudden geyser
#

In Kotlin they talk about closures and having access to local variables, but yeah it seems I can't do that here. I wanted findUser to just be a helper so would I really to remove it and just do that in my command code (what's shown above is an abstract command class)?

lyric mountain
#

like, you "can" extract a variable from inside a lambda, but it'd be too much work to be worth it

coarse topaz
#

Btw, just tried it and it worked. Thank you so much, @earnest phoenix! ^^

sudden geyser
#

hmm

lyric mountain
#

instead of using .queue() you could use .complete() or .submit()

#

.queue() is async, so the code inside it 99.9% of the time will run after a certain delay

earnest phoenix
#

i need help

lyric mountain
#

the other two will return u the value returned by .retrieveUserById(userID)

earnest phoenix
#

when i use the .give command, it says that sum is invalid

lyric mountain
#

so you can handle it without a lambda

#

idk how to use bot makers, you'll need to be a little patient

#

someone might appear here to help u

earnest phoenix
#

Hey! I'm trying to work with a module but don't know how

#

is anyone free to help?

quartz kindle
coarse topaz
#

How could I get a message's URL? :p

summer torrent
#

right click message

coarse topaz
#

Bruh, but I mean in the bot's code

topaz fjord
#

your syntax is wrong

pale vessel
#

self explanatory

summer torrent
#

@coarse topaz which lib

coarse topaz
#

Discord.js

quartz kindle
#

message.url

summer torrent
#

<Message>.url

coarse topaz
#

oh, thanks GWkyooTohruThumbsUp
I was silly and used message.channel.url x)

rotund ridge
#

๐Ÿ‘

summer torrent
#

channel's url lul

coarse topaz
#

Yeah lol

#

Dumb moment

quartz kindle
#

i mean, a channel's url is simply the same thing without the message id

#

just goes to the channel

summer torrent
#

https://discord.com/channels/server ID/channel ID

quartz kindle
#

its kinda weird that its /channels/serverID

#

why not /guilds/serverID

lyric mountain
#

why not guildID

#

discord is becoming a normal chat

quartz kindle
#

discord is a gaymer chat

summer torrent
#

gay

still merlin
lyric mountain
#

where is that error happening?

still merlin
#

my index.js

lyric mountain
#

no, I mean, line number

#

maybe showing the whole code would help

still merlin
#

31

quartz kindle
#

show full code

misty sigil
#

how do i make bot change status every 120 second
LIB: djs

pale vessel
#

scope

summer torrent
#

use setInterval

still merlin
#
const Discord = require("discord.js");
const client = new Discord.Client();
const token = "000000000000000000000000";
const PREFIX = "-";

const ms = require("ms");

const fs = require("fs");
client.commands = new Discord.Collection();

const commandFiles = fs
  .readdirSync("./commands")
  .filter((file) => file.endsWith(".js"));

for (const file of commandFiles) {
  const command = require(`./commands/${file}`);
  client.commands.set(command.name, command);
}

client.login(token);

//client.on("debug", console.log); debugging thing

client.on("ready", () => {
  console.log(`Logged in as ${client.user.tag}`);
});

/*if(message.author.bot) return - ingores messages from bots
 example: if a bot does <ban or <kick ETC the bot will not respond */

client.on("message", (message) => {
  let args = message.content.substring(PREFIX.length).split(" ");

  switch (args[0]) {
    case "kick":
      client.commands.get("kick").execute(message, args);
      break;
  }
});
misty sigil
#

maybe u should uncomment message.author.bot
its useful

pale vessel
#

oh my goodness what is that

lyric mountain
#

hm, looks like copied code

still merlin
#

Sks i'm trying to remember it

quartz kindle
#

which line is line 31?

pale vessel
#

the switch

#

why

still merlin
#

the client.on thing for kick

quartz kindle
#

looks fine, whats the full error?

still merlin
#
  client.on("message", (message) => {
    ^

ReferenceError: client is not defined
    at Object.execute (C:\Users\Jon\Desktop\Manager Bot\commands\kick.js:6:5)
    at Client.<anonymous> (C:\Users\Jon\Desktop\Manager Bot\index.js:36:35)  ```
quartz kindle
#

the error is in kick.js line 6

still merlin
#

not used to writing in a command handler and accidently forgot to remove a client.on- (copying my bots old code into command handler) im so fricking smart ;-;

north hollow
#

I need help for a kick and ban command, if you can help me dm me

#

Or tell me here

misty sigil
#

so i have it working

#

but the server status and the user one shows 0 servers and 0 users

#

statuses or setint

#
const statuses = [
  "with " + client.guilds.cache.size + ' servers | ab!help',
  "with the Javascripts",
  "with " + client.users.cache.size + "users"
]```
#

the funny thing is. the status works before that

#

ooof wouldn't that take

#

alot of processing stuff

urban olive
#

discord.js gang

misty sigil
#

discord.js gang

north hollow
#

@earnest phoenix can you maybe help me . I need a kick and ban command. Pls I need help

viscid lodge
#

Greetings, my bot is on the glitch platform and in some way I don't know why, the modules are wiping / loading itself again without stopping. What can cause this?
Google Translate using.

misty sigil
#

Ok i was just being stupid

#

moving the const of statuses into the function

north hollow
#

I do not have a code for the command

#

What that it

#

So

#

Where do I put that

#

Am new to node.js

#

Ah

#

And this code is not working

#
client.on('message', message => {
  if(message.channel.startWith('${prefix}clear'))
      if(message.member.roles.some(r=>['ADMIN'].includes(r.name))) {
        message.channel.bulkDelete(100).then(() => {
          message.channel.send("Delete 100 messages.")
          .then (message => {
            message.delete(5000);
          })
        })
      }
      else {
        message.channel.send ("Did you really think you could do that?")
      }
      return;
})
#

That the code

misty sigil
#

what is the

#

the error

#

we need the error

north hollow
#

It won't work and there is no errors

proven swan
#

stupid question, but does the bot have admin perms
or at least the manage_messages perm

north hollow
#

Yes

proven swan
#

oh

#

i know

#

if(message.channel.startWith('${prefix}clear'))

#

if you want to use ${}, you need to use `` to make your string

#

not ''

misty sigil
#

every 10 seconds doesn't count as API abuse right?

proven swan
#

if you write '${prefix}clear' and not `${prefix}clear`

earnest phoenix
#

Guys oh my god i have 1633 ping

proven swan
#

then you'd literally need to write ${prefix}clear for it to work

#

so, in sum
at line 2

- if(message.channel.startWith('${prefix}clear'))
+ if(message.channel.startWith(`${prefix}clear`))
#

@north hollow

flat obsidian
north hollow
#

O ok thx

earnest phoenix
#

guys this code i need it to send 2 reactions not 1 but how

#
var emojiname = ["soul"];

var rolename=["Soul"];


client.on('message', message => {

if(message.content.startsWith(prefix+"reaction3")){
  if(!message.channel.guild) return;
  for(let n in emojiname){
  var emoji =[message.guild.emojis.find(r => r.name == emojiname[n])];
  for(let i in emoji){
   message.react(emoji[i]);
  }
 }
}
});



client.on("messageReactionAdd",(reaction,user)=>{
  if(!user) return;
  if(user.bot)return;
  if(!reaction.message.channel.guild) return;
  for(let n in emojiname){
  if(reaction.emoji.name == emojiname[n]){
    let role = reaction.message.guild.roles.find(r => r.name == rolename[n]);          
    reaction.message.guild.member(user).addRole(role).catch(console.error);
  }
}
});```
#

what is this?

#

platform

#

share huge chunks of text without cluttering the chat and filling up everyone's screen

north hollow
proven swan
#

yep

dapper compass
#

Hi,
discord.py
Please how do we send a webhook ?
A simple python await ctx.send(webhook="https://top.gg/api/widget/705373559299637278.svg") doesn't work ?

dapper compass
#

Thanks! ๐Ÿ’š

north hollow
#

<member>.kick & <member>.ban
@earnest phoenix this is all the code for

#

So that all the code that I need or is there more code

wicked pivot
#

hello I have a problem, someone uses glitch to host it's bot?

north hollow
#

@earnest phoenix this is all the code that I need for the kick and ban ```js
<member>.kick or ban

#

Is that right

earnest phoenix
#

Yesn't

north hollow
#

What

summer torrent
flat obsidian
north hollow
#

@mihz0 this is all the code that I need for the kick and ban
<member>.kick or ban

raven yarrow
#

Pretty sure i did it a while ago, but cant remember how. I want a bot to remove a role if someone has another - so if i give someone "moderator" it would remove there "member" role. this is just an example, for the real one i need it to be automatic. Not for my own bot, but more curious if thereโ€™s a main stream bot like dyno or yagpd that does this

misty sigil
#

status change every 60 second allowed?

sick cloud
#

could someone help me with the website css to move my avatar image to the centre of the page

radiant estuary
#

Hey guys,
What can I do, when somebody stole my whole Code?

north hollow
#

Idk tell them y did you stole my whole code

radiant estuary
#

Ibdid it

#

He did it 2 Times or more

#

And he is continue using the bot

grizzled raven
#

anyone used git before?

rancid fiber
#

If it is a commercial product you can consult your lawyer about legal action. Otherwise, there is not much to do about it.

misty sigil
#

thats nice

radiant estuary
#

Okay, thank you. How can I check that this is commetcial? I am not good in English sry

misty sigil
#

Hey guys,
What can I do, when somebody stole my whole Code?
@radiant estuary don't share it in general

#

i mean unless its open source and u put it out there

rancid fiber
#

@radiant estuary if you sell it or make money out of it. It is commercial.

misty sigil
#

then it's really not stolen

#

[@grizzled raven] i use the gits for everything what u need?

radiant estuary
#

I dont't have it her. The First time it was my mistake. So I did nothing and changed it. I sayd, he is not alles to do this again.

grizzled raven
#

@misty sigil where do i start lmao

#

okay so

misty sigil
#

downloading the git client

grizzled raven
#

how do i push to a repo

#

comit*

misty sigil
#

did you make a repo?

#

if not then you probs cant commit

rancid fiber
#

Maybe this is a proper place to ask. I'm trying to write a bot. When attempting to create a new application it tells me "You need to verify your e-mail in order to perform this action." Although it is already verified (and even has 2FA enabled). Has anyone else encountered this before?

misty sigil
#

try re-verifying the email

grizzled raven
#

like to an existing repo

misty sigil
#

I'm sure you could look it up

grizzled raven
#

stuff on github
hey lets dwnload git
how do i commit to my github repo i used to work on

rancid fiber
#

try re-verifying the email
@misty sigil All I've ever found on the subject is using the verify function in my profile. However it is not there because my e-mail is already verified.

misty sigil
#

contact discord support?

#

or maybe these guys
[check DM's]

sullen salmon
#

There is a good amount of git guides out there, most are for the terminal-based Linux version of git though so I recommend using git bash if you're on Windows which essentially emulates that @grizzled raven

grizzled raven
#

hm

rancid fiber
#

@misty sigil thanks for the help. A relog fixed it xD

misty sigil
#

typical [@rancid fiber]

placid iron
#

That one line, it fills me with pride

sick cloud
#

@radiant estuary is your bot on github

misty sigil
#

mine is

#

but private git

sick cloud
#

discord has some prevention methods

#

so they can help

misty sigil
#

report the bot

#

and make ur git private [@radiant estuary]

sick cloud
#

if your bot is oss you should have a license or some sort of clause against it

north hollow
#

Hi

#

I need help

sick cloud
#

ie. on public bots i do, i usually follow MIT but extend it

misty sigil
#

yes [@north hollow ]

north hollow
#

Do you know how to make a kick and ban command

misty sigil
#

it's probably simple

north hollow
#

I really need

misty sigil
#

but im not into mod bots. sorry bout that

north hollow
#

And am new to node.js

weary ridge
sick cloud
#

@north hollow what dks version

#

djs

misty sigil
#

@north hollow What Library?

sick cloud
north hollow
#

O use v12.2.0

topaz fjord
#

it would be funny if the d.js site disabled copying

#

I would live to see how much people will complain

#

*love

north hollow
#

if your on djs v12 use this https://discord.js.org/#/docs/main/stable/examples/moderation
@sick cloud thx you so much

sick cloud
#

np

weary ridge
#

can i get help?

north hollow
#

And do you know how to make a music bot

weary ridge
sick cloud
#

music bots are complex

north hollow
#

O ok

weary ridge
#

No there no lol

north hollow
#

O how

#

๐Ÿคจ

sick cloud
#

shit, low quality ones are easy

#

actually decent bots are complex

north hollow
coarse topaz
#

Hi, I'm making a !say command, and I would like the bot to get the <#ChannelID> of one of the arguments, so it can know where it musts send the message :p
Does this should work? ```if (cmd === say) {
if (!message.content.startsWith("mm!")) return;
if (message.author.bot) return;
let channel = args[1];
let text = args.slice(2).join(" ");
if (!text){
return message.channel.send(Wrong command usage!);
} else {
message.delete()
bot.channels.cache.get(channel).send(text);
}
}

sick cloud
#

args 1 would be the first word of the content

#

args 0 would be the channel mention

fiery stream
#

Hey what should i use for rest api mongodb or firebase

#

I know both of โ€˜em

#

Kinda

#

I do know mongo fully but yea still

sick cloud
#

does your api need to store data

digital ibex
#

hi, is it ok if i ask a question about github and its webhook system thingy here?

fiery stream
#

Yes

sick cloud
#

never used firebase but mongo scales well

fiery stream
#

Okay for example i need to save data of contries

#

Like contry id lat, long and stuff

digital ibex
#

use mongo, thats what i use for my api and bot. never used firebase because i've never had to use it

fiery stream
#

K cool Iโ€™ll

#

One more question who do you guys use for mongo db provider

digital ibex
#

like a host?

sick cloud
#

just mongodb?

fiery stream
#

Yea

#

Mongo db isnโ€™t like premium ish

digital ibex
#

wym?

fiery stream
#

The web ui is kinda ugly

digital ibex
#

im confused, whats ur question again?

coarse topaz
#

@sick cloud I just modified it and it just deletes my message, but it doesn't send the content to the channel I said if (cmd === `say1`) { if (!message.content.startsWith("mm!")) return; if(message.author.bot) return; let channel = args[0]; let text = args.slice(1).join(" "); if (!text){ return message.channel.send(`Wrong command usage!`); } else { message.delete() bot.channels.cache.get(channel).send(text); } }

digital ibex
#

like what do u mean by it

sick cloud
#

i just install it on my server lol

#

that's all you need to do

digital ibex
#

same

sick cloud
#

there's no web ui or shit

fiery stream
#

The ui you look at in website of mongo atlas

digital ibex
#

oh

#

i use localhost, atlas annoys me lul

sick cloud
#

atlas is the paid edition for companies

#

just host it urself

digital ibex
#

u don't need to worry about atlas too much, all u need from it is just the url

earnest phoenix
#

Why is it saying add is not defined?js const user = message.mentions.users.first(); user.roles.add(await message.guild.roles.cache.find(role => role.name === "Muted"))

digital ibex
#

unless ur bot is quite big

sick cloud
#

do any of you use typescript also

digital ibex
#

yas

#

i do, ts is cool

sick cloud
#

@earnest phoenix users don't have roles, members do

#

ok cool could you help me with a small error

digital ibex
#

sure

earnest phoenix
#

ok

sick cloud
digital ibex
#

i don't think i can help much lol, ur got the certified dev role ๐Ÿ˜“

coarse topaz
#

@earnest phoenix Use member.roles.add() instead ๐Ÿ˜›

sick cloud
#

@coarse topaz no, he's trying to use a mentioned user

#

but hes using user

#

not member

#

<message>.mentions.members.first

coarse topaz
#

Oh alright

north hollow
#

Who use heroku to host there discord bot

#

โ…˜

digital ibex
#

r u using strict mode tonybo?

sick cloud
#

er i think so

digital ibex
#

hm

sick cloud
#

i really don't use typescript much lol

digital ibex
#

like in that file ur editing, do u have 'use-strict' ?

earnest phoenix
#

@sick cloud Same

#

error

sick cloud
#

show code

#

er

#

no not in the file @digital ibex

#

ts conf has "strict": true,

#

lol ts conf has errors also

earnest phoenix
#

oof

#

i didnt read ur second msg

digital ibex
#

hmm

sick cloud
#

but yeah it has strict

digital ibex
#

can u show ur tsconfig

#

oh right ok

sick cloud
#

lol

earnest phoenix
#

Anyone know why my warn thing isnt working?js et user = message.mentions.users.first(); if (!user) { message.channel.send(`You did not mention a user!`); return; } if (!args.slice(1).join(" ")) { message.channel.send(`You did not specify a reason!`); return; } warns.findOne( { Guild: message.guild.id, User: user.id }, async (err, data) => { if (err) console.log(err); if (!data) { let newWarns = new warns({ User: user.id, Guild: message.guild.id, Warns: [ { Moderator: message.author.id, Reason: args.slice(1).join(" ") } ] }); newWarns.save(); message.channel.send( `${user.tag} has been warned with the reason of ${args .slice(1) .join(" ")}. They now have 1 warn.` ); } else { data.Warns.unshift({ Moderator: message.author.id, Reason: args.slice(1).join(" ") }); data.save(); message.channel.send( `${user.tag} has been warned with the reason of ${args .slice(1) .join(" ")}. They now have ${data.Warns.length} warns.` ); } } );

digital ibex
#

is that ur whole tsconfig.json file?

earnest phoenix
#

Ping me if u know whats wrong

sick cloud
#

that's it

digital ibex
#

im not sure if this will change anything, but in the ts file, add 'use-strict' i don't think it will since u've already enabled it but shrug

sudden geyser
#

ThatTonybo by and chance should module: "commonjs" be CommonJS?

#

eh nvm doesn't look like it makes a difference

sick cloud
#

no lol

#

i might just drop typescript

gaunt sand
#

``${user.tag} has been warned with the reason of ${args`

#

u forgot the }

#

wait dw i read it wrong

sick cloud
#

what error

gaunt sand
#

^^

earnest phoenix
#

1 sec

#

No error

#

Doesnt send a msg

sick cloud
#

then your bot is broken else where

earnest phoenix
#

where?

#

It;s somewhere in that peice of code

digital ibex
#

we don't know your code. you need to show it

digital ibex
#

is it erroring?

earnest phoenix
#

No

#

It isnt sending a message

digital ibex
#

okay

earnest phoenix
#

that i have warned the user

digital ibex
#

lets get on the same page here, what have you already tried?

earnest phoenix
#

I tried !warn @ user#1111

digital ibex
#

no i mean, what debugging have u already done?

earnest phoenix
#

oh

#

I moved the returns

gaunt sand
#
+ client.users.cache.get('123456789012345678');```
Ok so all my friends use v11 atm, they do client.users.get('id') to grab the users information but i cant seem to get the v12 way of doing it working:( anyone got any ideas?
earnest phoenix
#

client.users.cache.get

gaunt sand
#

returns undefined every time or Cannot read property of undefined

weary ridge
#

Yo anyone using .py And Can help me?

#

@gaunt sand for some reason v12 is just messed up so i switched to python

gaunt sand
#

nah sorry

#

yeah legit

#

thats what i would if i was fluent in py

digital ibex
#

use eris, not d.js

#

if you don't know python anyways

weary ridge
#

well i learnt python in 2 days

digital ibex
earnest phoenix
#

I added console.logs for each and every function,

digital ibex
#

so where does it break

earnest phoenix
#

idk

weary ridge
#

lol

digital ibex
earnest phoenix
#

lemme check again

weary ridge
#

the best thing about .py is you don't need to add ```.js {[

]} ```

earnest phoenix
#

isnt even going after |```js
warns.findOne(

digital ibex
#

right ok

earnest phoenix
#

Im using glitch :p

digital ibex
#

still debugging lol

#
    if (!args.slice(1).join(" ")) {
      message.channel.send(`You did not specify a reason!`);
      return;
    }``` theres ur issue
earnest phoenix
#

?

#

whats wrong here

digital ibex
earnest phoenix
#

ik

gaunt sand
#
if (!args.slice(1).join(" ")) {
     return message.channel.send(`You did not specify a reason!`);
      
    }```
earnest phoenix
#

ok

gaunt sand
#
Migrating from v11-v12 docs:
- client.users.get('123456789012345678');
+ client.users.cache.get('123456789012345678');```

Ok so all my friends use v11 atm, they do client.users.get('id') to grab the users information but i cant seem to get the v12 way of doing it working:( anyone got any ideas? client.user.cache.get returns undefined every time or Cannot read property of undefined
digital ibex
#

you've already been answered

gaunt sand
#

did u not see my response

#

client.user.cache.get returns undefined every time or Cannot read property of undefined

digital ibex
#

because thats not what he said

gaunt sand
#

what

coarse topaz
#

Could someone please help me with this? The command usage should be mm!say1 #channel content So the bot would find at the channels of the server and get the ID from the one I #mentioned... However it isn't working right now, it just deletes my message, but doesn't send the message :p````if (cmd === say1) {
if (!message.content.startsWith("mm!")) return;
if(message.author.bot) return;
let args1 = message.content.split(" ");
let channel = args1[1];
let text = args1.slice(2).join(" ");
if (!text){
return message.channel.send(Wrong command usage!);
} else {
message.delete()
bot.channels.cache.get(channel).send(text);
}
}```

earnest phoenix
#

Same

#

result

digital ibex
#

look at what you sent and what he sent

earnest phoenix
#

I used my eval and got illegal return

gaunt sand
#

@digital ibex he didnt even respond after i said that

earnest phoenix
#

i did

gaunt sand
#

where

earnest phoenix
#

.

#

.

#

.

#

bruh

gaunt sand
#

ok just be arrogant then

earnest phoenix
#

@coarse topaz because the argument isn't a channel object, it's a string, specifically a mention

#

you need to extract the id out of the mention

coarse topaz
#

Didn't I do it with this line? bot.channels.cache.get(channel)

earnest phoenix
#

kind of

gaunt sand
#

@digital ibex what was his response i actually cannot find it after i said client.user.cache.get returns undefined every time or Cannot read property of undefined

earnest phoenix
#

what you're telling the code is bot.channels.cache.get("<#id>")

#

which is obviously incorrect

#

you need to get the id out of the mention

north hollow
#

I need help how to make a warn bot

coarse topaz
#

And how could I get it, @earnest phoenix? :p

earnest phoenix
#

either with regex or by manipulating the string

#

d.js has built in regex for mentions iirc

coarse topaz
#

What about only having the ID?

#

Like mm!say channelID <content>

#

Would it work in that way?

earnest phoenix
#

yes

#

you would not need to parse then

coarse topaz
earnest phoenix
#

but if you want to use the mention method, you have to extract the id out of the mention

coarse topaz
#

I think just having the ID is a better and easier idea x)

#

What were you meaning with Parsing? :p

earnest phoenix
#

extracting the id out of the mention

coarse topaz
#

Oh, alright

earnest phoenix
#

is this how u split a mention from the rest?js args.split(args[0]);?

coarse topaz
#

Well, if I don't need to change anything in the current code, that's ok then

earnest phoenix
#

if you want to use just the id, then yeah, your current code is valid

coarse topaz
#

But I just tested it and it didn't send the message to the correct channel :/

#

a

earnest phoenix
#

log the id

#

debug

coarse topaz
#

alright

sick cloud
#

@earnest phoenix learn js before making a bot

#

bc that's not how you split

earnest phoenix
#

sorry i meant slice

sick cloud
#

also not how you slice

#

Objects/Array/slice

#

on mdn

gaunt sand
#
+ client.users.cache.get('123456789012345678');```
Ok so all my friends use v11 atm, they do client.users.get('id') to grab the users information but i cant seem to get the v12 way of doing it working:( anyone got any ideas? client.users.cache.get('123456789012345678') always returns undefined or cannot read property of undefined
sick cloud
#
  • is client defined
  • are you actually using v12
gaunt sand
#

yes and yes

sick cloud
#

if it returns undefined it means the user doesn't exist
if it returns cannot read property of undefined then the user collection doesn't have the cache

#

iirc, try client.users.fetch

#

with an await

#

that'll fetch the user from the api if the bot doesn't have them cached

gaunt sand
#

ah someone whos not a smart ass for once, thank you will try now

sick cloud
#

lol ok

coarse topaz
urban olive
#

hello

coarse topaz
#

It logs the ID but also displays an error

#

Wait I think I discovered the why of the error

#

But it doesn't work

#

And it still keeps logging the channel's ID, and also the same error is being displayed

weary ridge
#

help

#

Bot won't join vc

#

it accepts it as a cmd but doesn't join

digital ibex
#

does anyone know how i can fix this error?

north hollow
#

I need help how to make a mute and unmute command

autumn summit
#

anyone know the exception for MissingRole? discord.py

indigo flax
#

for python

#

i did

spare iron
#

@autumn summit Are you talking about error handler?

indigo flax
#

and this happened

autumn summit
#

yeah @spare iron

indigo flax
#

File "bot.py", line 117
async def on_command_error(self, ctx, error):
^
SyntaxError: invalid syntax

autumn summit
#

this is what i have so farpy except MissingRole: await ctx.send("You need PT | Staff role to run this command") return

#

doesnt seem to be working

indigo flax
#

@autumn summit u know python?

autumn summit
#

yes

indigo flax
#

File "bot.py", line 117
async def on_command_error(self, ctx, error):
^
SyntaxError: invalid syntax

autumn summit
#

can you give the full code

spare iron
#

commands.MissingRole

autumn summit
#

k thx

indigo flax
#

im using carlbot

#

self host

autumn summit
#

no

#

can u send the command

#

like the @commands.command or @bot.command