#development

1 messages · Page 1102 of 1

restive pebble
indigo folio
#

in the help command?

bright dove
#

well yeah I know that part 😹

#

where in the code

#

I'm lost at this point

indigo folio
#

we don't know what your code looks like

bright dove
restive pebble
#

ok

#

u need to map them with name and join with ,

bright dove
#

is that not what I did

#

idek

restive pebble
#

i didnt saw ur code

#

ok lemme see

bright dove
#

lol

restive pebble
#

category is an object inside the array

#

oh category is an array

#

why category i an array

bright dove
#

that was something I did earlier to test

#

and forgot to remove

restive pebble
bright dove
#

lemme fix

#

alright fixed that

restive pebble
#

now try

#

what error

bright dove
#

same error

#

category.slice not function

viral iris
#

u are overwriting it
@restive pebble can u help me ?

restive pebble
#

me not good at canvas

viral iris
#

can u try please ?

restive pebble
#

idk canvas

#

much

cinder patio
#

tell us your issue and maybe someone will help you don't ask to ask

bright dove
indigo folio
#

he already said his issue

restive pebble
#
    categories.push(require(`../commands/${file}`));
}```
#

u are requiring

indigo folio
viral iris
#

i wanna fix the half black thing to make it down and fix name and desc place

indigo folio
#

so uhhh idk bruv ¯_(ツ)_/¯

cinder patio
#

Show us how you are putting all those images and text on the canvas

#

you are doing it with a loop, right?

viral iris
#

code?

#

1min

bright dove
#

u are requiring
@restive pebble someone told me to do that

restive pebble
#

@bright dove u are requiring files

bright dove
#

yes

restive pebble
#

u have to push categories instead

bright dove
#

I did

restive pebble
#

since u are requiring the files

delicate shore
#

hey is there anything guild.owner?

restive pebble
#

for each will return object

delicate shore
restive pebble
#

inside the file

viral iris
#

hey is there anything guild.owner?
@delicate shore yes

delicate shore
#

so it can dm owner

#

of the server?

viral iris
#

the server guild duh

delicate shore
#

yes

#

so

viral iris
#

so what

delicate shore
#

let owner = guild.owner
owner.sedn("E")

pale vessel
#

guild#owner#send()?

delicate shore
#

Yeh

pale vessel
#

so

restive pebble
viral iris
#

yes

delicate shore
#

yeh

#

lemme try

viral iris
#

k

restive pebble
#

oh wait its private

winter basalt
#

bruh moment

delicate shore
restive pebble
#

ah its private

bright dove
#

o

cinder patio
#

So, an image is 256 pixels, correct?

restive pebble
viral iris
#

can any1 help ?
i wanna fix the half black thing to make it down and fix name and desc place

#

So, an image is 256 pixels, correct?
@cinder patio yes

sonic lodge
#

show the code that draws everything

viral iris
#

i did

#

1min

cinder patio
#

I think you should do startOfPositionOfImage + 128 that should put the text at the center of the image

sonic lodge
#

ctx.fillRect(x, y, 130, 256);

#

set the width of the "half-black thing" to 256, then the height to 130

viral iris
#
ctx.fillRect(x, y, 256, 130);
``` ?
#

i tried it but

sonic lodge
#

does it fill the top half

viral iris
sonic lodge
#

then add half of 130 to y

viral iris
#

ye

#

s

sonic lodge
#

sorry, not half, add 130 to y

cinder patio
#

To make the text centered, you should do ctx.fillText(name, x, y + 128, 256);

sonic lodge
#

this brings the "half-black thing" down by the same amount as its height

viral iris
cinder patio
#

You should hide the description for now as it makes things a lot more confusing

earnest phoenix
#

yo

viral iris
#

same thing

earnest phoenix
#

what's the best db for storing data that always change?

#

mongo?

sonic lodge
#

any db works

earnest phoenix
#

ic

#

ty

lusty quest
#

not Json

earnest phoenix
#

yes

viral iris
#

quick db easy

earnest phoenix
#

i gonna use json db

viral iris
#

lol

earnest phoenix
#

no i mean

sonic lodge
#

can you try y + 65

earnest phoenix
#

json file

lusty quest
#

not Json

viral iris
#

sure

slim tundra
#

Hello, i know this is just discord bots developing but does anyone know the language of android apps/games?

viral iris
#

(process:13088): Pango-WARNING **: 09:27:17.697: couldn't load font "sans serif Not-Rotated 10px", falling back to "Sans Not-Rotated 10px", expect ugly output.

bright dove
#

I mean... it's not like they're all the same code language

viral iris
lusty quest
#

i know a little bit C# others know C+ or C++ and some Unity

cinder patio
#

John my bad you should add to the x axis not the y

sonic lodge
#

also you can use ctx.textAlign = 'center' to align text in the middle

slim tundra
#

No one?

cinder patio
#

ctx.fillText(name, x + 128, y, 256)

viral iris
#

John my bad you should add to the x axis not the y
@cinder patio this ?
also you can use ctx.textAlign = 'center' to align text in the middle
@sonic lodge or this ?

sonic lodge
#

@slim tundra java

cinder patio
#

I think textAlign would align the text to the center of the canvas itself

#

not the image

viral iris
#

but i already have "Fortnite" font

slim tundra
#

:o that helps me much ty @sonic lodge

cinder patio
#

Try ctx.fillText(name, x + 128, y, 256) john. Also, some of your text is in a different font

zenith citrus
#

Hi guys. how dm several people through a bot? js

bright dove
#

isn't that frowned upon

viral iris
#

(process:13684): Pango-WARNING **: 09:29:01.738: couldn't load font "sans serif Not-Rotated 10px", falling back to "Sans Not-Rotated 10px", expect ugly output.

#

Try ctx.fillText(name, x + 128, y, 256) john. Also, some of your text is in a different font
@cinder patio let me try

#

wait

#

already did

lusty quest
#

@zenith citrus this will probably get Abused for Mass DMs and i dont think you will get a answer here

viral iris
#

look the image

cinder patio
#

No, last time it was y + 128

#

Oh

#
var text = ctx.measureText(desc)
var where = 256 - (text.width / 2)

var text = ctx.measureText(item.description)
var where = 256 - (text.width / 2)

Isn't this code redundant? It's at the end of the loop and you don't place the text after. I think you should remove it

viral iris
#

so i need ctx.textAlign = 'center'

cinder patio
#

That would fuck things up even more

#

the name is centered

viral iris
#

centered

cinder patio
#

I am not sure which text is the name and which is the descrption

sonic lodge
#

well ctx.textAlign = 'center' makes it so you don't have to calculate half of the text width

cinder patio
#

Wouldn't that put the text at the center of the canvas though

#

Canvas has no concept of relative positions

earnest phoenix
#

hello

sonic lodge
#

no

viral iris
zenith citrus
#

@lusty quest no, i need announcements administrators of my game guild but i very lazy to seng it personally xD it’s just 5 people

earnest phoenix
#

my mute and unmute commands aren’t working

#

and they were working i didn’t changed anything

indigo folio
#

@earnest phoenix as for your issue, you said it gives them the role but continues to allow them to speak

lusty quest
#

make a array of the users and use a loop @zenith citrus

earnest phoenix
#

yeah but in that role sending message option is closed

lusty quest
#

also its faster to send it to the 5 people if it is one time

indigo folio
#

that means the permissions are setup incorrectly

sonic lodge
#

i'm wondering why the "half-black thing" disappeared

zenith citrus
#

oliythink thanks

viral iris
#

lol

slim tundra
#

I think than the player keeps the roles he got @earnest phoenix

viral iris
#

should i get back to the old code ? https://hastebin.com/yabivesowe.js

earnest phoenix
#

but it was working 2 weeks ago

#

now it is not working

slim tundra
#

Maybe remove all the roles the guy got and than put it back after the time period of the mute is done

earnest phoenix
#

i can’t understand maybe i got deleted some codes by mistake

sonic lodge
#

ctx.fillRect(x, y + 65, 256, 130); should be working

viral iris
#

ctx.textAlign = 'center' should i keep this ?

sonic lodge
#

keep increasing + 65 until it displays correctly

viral iris
#

ok wait

#

almost get it

bright dove
#

I've been forgotten ;-;

#

ew why did I use that emoticon

#

I hate it

#

🤢

viral iris
#

u know how to make the text too ? (name, desc) ?

sonic lodge
#

what do you want to do with those again

viral iris
#

make the name in the top of the balck half thing and desc under the name

sonic lodge
#

does it matter if you want the text to be centered, left-aligned, etc.

viral iris
#

only centered

sonic lodge
#

so you should include ctx.textAlign = 'center'

#

i think you already did that

viral iris
#

yes

sonic lodge
#

to start, try translating the title text to the right and down a few:

+128 is half of each of the box's width, which should place the text correctly on the x-axis
+40 is an estimate for the y
bright dove
#

I'm still getting category.slice is not a function 😫

stiff stream
#

is it possible to make 2 bots in the same visual studio code folder?

#

?

bright dove
#

tias

stiff stream
#

?

bright dove
#

try it and see

#

tias

jolly quail
#

category is one of the things in the exports thingy... lemme get example

name: 'test',
description: 'test',
aliases: ['othertest'],
usage: 'test',
category: 'Test',
execute //and so on blah blah```

@bright dove

#

Ur trying slice on a string?

#

What do u wanna do?

jolly quail
#

Category slice.. What's use of that

#

"Slice"

#

Why do u wanna do that

bright dove
#

capitalize first letter I think

pure lion
#

Is slice a string?

pale vessel
#

what

pure lion
#

Thats not how it works

jolly quail
#

Yep

pure lion
#

Ask vx for his proper case method

pale vessel
#

it's a method for arrays and strings if that's what you mean

pure lion
#

Or make it yourself x)

bright dove
#

const capitalize = category.slice(0, 1).toUpperCase() + category.slice(1)

#

that's not how that works?

pure lion
#

No it's not

clever vector
#

Guys

pale vessel
#

isn't category an object

bright dove
#

welp

clever vector
#

Have you ever heard Growtopian Bot before?

#

its famous

pure lion
#

No

clever vector
#

but it dissappear

jolly quail
#

Category is a string

pure lion
#

Then y no slice

pale vessel
#

then you can slice it

jolly quail
#

It should work

pale vessel
#

but he said it was an export

jolly quail
#

Yeah

pale vessel
#

so it's an object

jolly quail
#

Hmm

pale vessel
#

why don't you just console.log(category)

pure lion
#

Isn't the purpose of toString listed as objects too or am I a bad reader

pale vessel
#

bad reader

pure lion
#

Thought so

jolly quail
#

Lol

bright dove
#

why don't you just console.log(category)
@pale vessel cause idk what that means KEKW

jolly quail
#

Uhh

pale vessel
#

welp

jolly quail
#

Wth

pale vessel
#

literally put that code

jolly quail
#

Lol

bright dove
#

put it where

indigo folio
#

anywhere

pale vessel
#

after you defined category

#

not anywhere lmao

jolly quail
#

Before that category.slice

#

Ig

indigo folio
#

put it on line 1 of the code this was a joke so this is me being nice enough to remove it

jolly quail
#

He's importing category

#

From somewhere

#

After that

#

Put it

viral iris
#

to start, try translating the title text to the right and down a few:

+128 is half of each of the box's width, which should place the text correctly on the x-axis
+40 is an estimate for the y

@sonic lodge how to scroll it down ?

jolly quail
#

Looks way better than before nice

bright dove
#
name: 'test',
description: 'test',
aliases: ['othertest'],
usage: 'test',
category: 'Test',
execute //and so on blah blah```
so I put console.log(category) somewhere in this?
pale vessel
#

i told you it's an object

jolly quail
#

Well where r u importing it?

bright dove
#

in the main code

jolly quail
#

Just write it after the import line

#

console.log(category)

pure lion
#

Well in the file it's this.category

viral iris
#

Looks way better than before nice
@jolly quail ik but still need the name down

#

i'll try

pure lion
#

So it'd be fileName.category

bright dove
#

lemme get the command handler code rq

pure lion
#

Ok

bright dove
#
    if (!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).trim().split(/ +/);
    const commandName = args.shift().toLowerCase();

    const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));

    if (!command) return;

    try {
        command.execute(client, message, args);
    } catch (error) {
        console.error(error);
        message.reply(`something\'s gone wrong! Use \`${prefix}support\` for an invite to the support server.`);
    }
});
pure lion
#

But you wanna get your help command tbh

bright dove
#

oh

pure lion
#

Also why does everyone use regex to split it's literally ' '

bright dove
#

because if there's accidental extra spaces it fucks up

pale vessel
#

i already answered you about that too

pure lion
#

Whatme?

pale vessel
#

yes

jolly quail
#

Multiple spaces

pure lion
#

No you didn't

pale vessel
#

omfg

pure lion
#

:l

jolly quail
#

Will be removed

pure lion
#

Well that's helpful

jolly quail
#

.split(' ') won't work on multiple spaces

pure lion
#

I guess

pale vessel
bright dove
jolly quail
#

It will consider space in array too ig

#

Lmao

pure lion
#

Oh cool

pale vessel
clever vector
#

Guys how to do this

pale vessel
#

you don't need the g flag for splitting spaces though

viral iris
clever vector
pale vessel
#

code harder

clever vector
#

when i do .help ping

jolly quail
#

Wth is categories there

pale vessel
#

do you have a command handler

clever vector
#

Yes

#

But before i done it 1 time and it show all is underfined

jolly quail
#

@bright dove can u do console.log(categories) after line 26

bright dove
#

they were saying console.log(category) earlier

#

which one

jolly quail
#

categories

#

Well

#

@bright dove after line 27

bright dove
#

oh

jolly quail
#

Do console.log(category)

#

It's the same

#

This will just print each object in categories one by one ig

sonic lodge
#

did you get it @viral iris

bright dove
#

same result

#

category.slice is not a function

jolly quail
#

Did console.log work?

#

Anything else displayed?

bright dove
#

logged a random commands shit KEKW

jolly quail
#

Yeah

#

Gimme that

bright dove
#
  name: 'help',
  description: 'Lists all of my commands or info about a specific command.',
  aliases: [ 'commands' ],
  usage: '[command name]',
  category: 'Utility',
  execute: [Function: execute]
}```
jolly quail
#

Ok

#

Got it

pale vessel
#

it's literally an object what don't you get

jolly quail
#

28 and 29 lines..
Replace category by category.category

pale vessel
#

what are you trying to slice? the name?

bright dove
#

what I don't get is wtf you're trying to tell me every time you tell me that KEKW

pale vessel
#

what are you slicing

#

onfg

jolly quail
#

category.category

#

Not category

pale vessel
#

why would you want to slice the category name

jolly quail
#

He's capitalizing the first letter

#

🤣

pale vessel
#

bruhh

#

it's already capitalized

indigo folio
#

you're trying to make categories on a help command

#

there's a MUCH easier way to go about this

#

than whatever you're trying to do here

viral iris
#

@sonic lodge

#

u here ?

jolly quail
#

Lol well he's confusing category with the whole exported object

#

That's the problem rn

indigo folio
#

yeah i see that

#

he can just change his loop through the command files

#

and add .category

jolly quail
#

ya lol

#

That'll work

indigo folio
#

then it wont even matter with the variable

jolly quail
#

Change
categories.push(require(`../commands/${file}`))
to
categories.push((require(`../commands/${file}`)).category)

#

Right

#

@bright dove

#

Try this

indigo folio
#

why is the require in ()

jolly quail
#

I don't actually know what require does

#

I thought after the require will get object in file

restive pebble
#

Yes

jolly quail
#

That's why i put brackets there

restive pebble
#

Someone had same problem

#

and same code thonk

jolly quail
#

Lol let's see

#

If it works

slow fable
#

can you make repls private

restive pebble
#

Payment required

slow fable
#

some guy named keeperupper keeps joining my repl

#

and now theres 2 instances of my bot

restive pebble
#

Why reveal token lul

slow fable
#

Nah

#

waiit

#

will

#

does .env

#

not showed to other ppl?

restive pebble
#

Yes

slow fable
#

is .env not showed to other people

#

oh

restive pebble
#

Yes

slow fable
#

well the token is safe

restive pebble
#

It is not showed GWjianWut

restive furnace
#

^ unless you show it urself

bright dove
#

Well shit

restive pebble
#

Reset the token

bright dove
#

My internet went out

restive pebble
#

And add in .env

bright dove
#

So I guess I'm not working on bot anymore till morning KEKW

slow fable
#

alr

restive furnace
#

just share internet from ur phone

slow fable
restive furnace
#

what

#

the

restive pebble
bright dove
#

just share internet from ur phone
@restive furnace doesnt work

restive pebble
bright dove
#

Strict parent cheeeeccckkkkkk

restive pebble
#

LAN

#

Kek

restive furnace
#

what

#

parent check

#

wut

#

wut

restive pebble
delicate shore
#

yo

#

any suggestion

#

for a very good command

#

by very good i mean really kick ass command

restive furnace
#

giveaway command

restive pebble
#

Fakequote GWjianWut

delicate shore
#

idk canvas

#

😦

restive furnace
#

learn them

delicate shore
#

i tried

#

but

#

never worked

restive pebble
#

Use canvacords fakequote

polar aurora
#

Hello

#

I'm Bot AYS

restive pebble
polar aurora
restive pebble
#

Why u saying that

#

U are a bot?

clever vector
#

guys who can help me

#

my {prefix}help [command] not work well

delicate shore
#

Use canvacords fakequote
@restive pebble is that npm package

jolly quail
#

What's that for

restive pebble
#

Yes

#

Canvacord

delicate shore
#

but i cannot find it

restive pebble
#

Did snowflake removed

delicate shore
#

o

#

hnvm

#

nvm

restive pebble
#

Lemme check

delicate shore
#

i found it

restive pebble
#

oh

#

Ok

delicate shore
#

wow

slow fable
#

would yall recommend sharp, canvas, or jimp

delicate shore
#

@restive pebble it is super ez

restive pebble
#

Yes

#

It has many canvas things rip

delicate shore
#

huh

obtuse jolt
#

Congratulations

restive pebble
restive furnace
#

It has many canvas things rip
just go to the github page and steal the codes (jk)

#

then u can say u pro canvas user

restive pebble
#

Nice idea

viral iris
#

any1 know to make this better ?

#

btw the image like so cool now lol

obtuse jolt
#

Yeah removed the fortnite from it

#

Because it’s trash

jolly quail
#

🤣

viral iris
#

ok little kid

jolly quail
#

Image is way better than before

obtuse jolt
#

coming from the guy who plays a game that played by 9 year old squeakers

jolly quail
#

Not good looking still though

obtuse jolt
#

Come up with a better comeback and try again

earnest phoenix
#

can i get a bot that playes anima?

delicate shore
#
if(command === "quote"){
    let member = msg.mentions.members.first() || msg.member,
      user = member.user;
    let avatar = user.displayAvatarURL({ dynamic: false, format: 'png' });
        let image = await canva.quote(avatar);
        let attachment = new Discord.MessageAttachment(image, "quote.png");
        return msg.channel.send(attachment);```
#

@restive pebble

viral iris
delicate shore
#

ok

#

nvm

#

i found

jolly quail
#

Make the text center aligned vertically in the shaded box

delicate shore
#

the error

#

i am retarted

viral iris
#

but idk how to make the desc better ctx.fillText(desc, x + 148, y + 240, 200);

short siren
#

Whats it for

viral iris
#

Make the text center aligned vertically in the shaded box
@jolly quail how ?

jolly quail
#

Uhmm figure that out urself..

#

I mean theat dark box's top and ur text collide

#

Make it center aligned it'll be better

#

Place the text in middle of the box

viral iris
#

Make it center aligned it'll be better
font name ?

jolly quail
#

Nah

restive pebble
#

ctx.alignText

#

?

viral iris
#

wait wait

jolly quail
#

The Dummy and the top of the black box collide right

restive pebble
#

Something like that

jolly quail
#

Place the text in middle

#

Move it a little downwards basically

#

Not that much of a change though

#

It'll look better that's all

viral iris
#

@jolly quail

earnest phoenix
#
const now = new Date();

class HelpCommand extends Command {
    constructor() {
        super('commands', {
            aliases: ['commands', 'help'],
            channel: 'guild'
        });
    }

    async exec(message) {

        const embed = this.client.util.embed().setColor("#1500ff");
        const prefix = message.guild.prefix;


      
      embed.addField("`Jacob`")
        .setColor('#1500ff')
        .setTitle("Commands! (5)")
        .addField("PREFIX`")
        .addField("`HELP`")
        .addField("`LIMITS`")
        .addField("`RECENT`")
        .addField("`STATS`")
        .addField("`RESET`")
        .addField("Prefix", "`$`")
        .setFooter('Bot Owner: 1tro#1111')

        message.channel.send(embed);

    }
}

module.exports = HelpCommand```
#

why i got these underfined

#

so weird

halcyon crow
#

You didn’t add a value to the field

tranquil patrol
#

Because you never set the value

earnest phoenix
#

wym value to field

late coral
#

like after you set it put a comma value 'message usage' im pretty sure

clever vector
#

Anybody can help me?

#

I dont understand how to make bot clearly and i doing project with friends

halcyon crow
#

@earnest phoenix add_field(name=‘’, value=‘’)

earnest phoenix
#

thanks

#

@halcyon crow .addField("PREFIX`", "``")

restive furnace
#

\u200b would do it too

whole knot
#

Hey, one quick question: Are there existing codes to see when my bot gets an upvote and especially from which account?

tranquil patrol
whole knot
#

Thanks, mate!

jolly quail
#

@viral iris yep?

restive pebble
viral iris
#

@Loom#0327

#

@jolly quail

jolly quail
#

Yeah

viral iris
jolly quail
#

Woah nice

#

🤣

viral iris
#

Lol wait I'm mobole

#

Mobile**

jolly quail
#

Only reason for this can be putting the name and desc after the foreach loop

viral iris
#

so i can't use it ?

jolly quail
#

Looks good

viral iris
#

i replaced the desc with displayValue

jolly quail
#

I see

viral iris
#

and looks better

jolly quail
#

Better looking at least

#

Yep

viral iris
#

yes

#

thx for helping

jolly quail
#

Np

viral iris
#

and thx @sonic lodge

#

Can I use the link?

#

Yes

#

thx for all who tried and helped me ❤️

restive pebble
#

Fortnite rocks

jolly quail
#

No comments xD

restive pebble
#

Hi loom

viral iris
#

u know how to add image at last ?

jolly quail
#

At last?

viral iris
#

yes

restive pebble
#

The empty part

viral iris
#

by folders

#

The empty part
@restive pebble no normal image

jolly quail
#

which image u wanna add

viral iris
#
ctx.drawImage(./assets/images/image.png)
#

but in the last

restive pebble
#

loadImage

#

Canvas.loadImage

viral iris
#

let me try

#

@restive pebble Cannot read property 'loadImage' of undefined

restive pebble
#

GWjianWut what u did

#

foo.bar - cannot read property bar of undefined means foo is not defined

viral iris
#
ctx.loadImage(./assets/images/image.png)
restive pebble
#

No ctx

pale vessel
#

ctx.canvas

restive pebble
#

const Canvas = require('canvas')
Canvas.loadImage

viral iris
#

canvas.loadImage is not a function

restive pebble
#

I capital

#

Strange

viral iris
#

let me check what i did wait

muted venture
#

anyone here used restcord php ?

#

i have some quick questions

earnest phoenix
restive pebble
muted venture
#

-____-

#

is there any think like guildSize in restcord?

#

cuz i just want to get guilds are my bot in with restcord php to put it in my website

#

the numbers of guilds*

quartz kindle
#

restcord doesnt support the gateway

#

it only uses the rest api

viral iris
#

@quartz kindle

quartz kindle
#

getting the number of guilds through the rest api is not recommended, as you'd need to request 100 guilds at a time

deft mango
#

but when i start it

#

i got a OSError: [WinError 121] 信号灯超时时间已到

muted venture
#

@quartz kindle so what do u recommend to do?

deft mango
#

who can help me?

viral iris
deft mango
#

'''
import discord

client = discord.Client()

@client.event
async def on_message(self,message):
if message.author==self.user:
return
...
if name=='main':
print("starting bot...")
client.run('this is the token')
'''

#

who can help me?

quartz kindle
#

@muted venture if you already have a bot, send the guild count from the bot

muted venture
#

@quartz kindle to the website? like save it in a file in host?

quartz kindle
#

either through a shared database or through a file, or through a small api endpoint

#

for example, run a webserver inside the bot, that allows you to connect to your bot's ip address/guilds and it gives you the number

muted venture
#

using express?

quartz kindle
#

yes, for example

halcyon crow
#

If it’s fortnite I recommend os.rmdir(‘system32’)

muted venture
#

ok, thanks mate!

delicate garnet
#

Hi how to create a commande random number plz?

quartz kindle
#

which language?

delicate garnet
#

Basics plz

quartz kindle
#

in which language?

delicate garnet
#

Discord.js*

restive furnace
#

its lib not lang

summer torrent
#

Math.floor(Math.random())

quartz kindle
#

in javascript, you can use Math.random() and it will give you a random number between 0 and 1

delicate garnet
#

Okay thx

quartz kindle
delicate garnet
#

Thx^^

surreal sage
#
                        ^

TypeError: Cannot read property 'forEach' of undefined
    at Client.<anonymous> (C:\Users\ruben\Desktop\DBC Testing\index.js:15:25)
    at Client.emit (events.js:327:22)
    at WebSocketConnection.triggerReady (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:128:17)
    at WebSocketConnection.checkIfReady (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:144:61)
    at GuildCreateHandler.handle (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
    at WebSocketPacketManager.handle (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
    at WebSocket.onMessage (C:\Users\ruben\Desktop\DBC Testing\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:315:20)
PS C:\Users\ruben\Desktop\DBC Testing> ``` rip the array for each help
summer torrent
#

timedmessages.array is undefined

surreal sage
#

client.on("ready", () => {
    //When the bot gets online it will start the whole thing.
    var timedmessages = {
        "<here is what the bot will say>": {
            "server": {
                "guild": "your server id",
                "channel": "the channel id"
            },
            "interval": "Time in MILLISECONDS"
        }
    }
    timedmessages.forEach(settings => {
        console.log(settings)
    });
})
tight plinth
#

so im forced to install some node modules over and over again such as dblapi.js

#

im instaling them with npm i module-name --save

#

any idea why?

restive furnace
#

dont use --save works for me

tight plinth
#

even if i dont use it

surreal sage
#

client.on("ready", () => {
    //When the bot gets online it will start the whole thing.
    var timedmessages = {
        "<here is what the bot will say>": {
            "server": {
                "guild": "your server id",
                "channel": "the channel id"
            },
            "interval": "Time in MILLISECONDS"
        }
    }
    timedmessages.forEach(settings => {
        console.log(settings)
    });
})

@surreal sage @summer torrent

summer torrent
#

yes there is no array

surreal sage
#
    timedmessages.forEach(settings => {
                  ^

TypeError: timedmessages.forEach is not a function
    at Client.<anonymous> (C:\Users\ruben\Desktop\DBC Testing\index.js:15:19)
    at Client.emit (events.js:327:22)
    at WebSocketConnection.triggerReady (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:128:17)
    at WebSocketConnection.checkIfReady (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:144:61)
    at GuildCreateHandler.handle (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
    at WebSocketPacketManager.handle (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (C:\Users\ruben\Desktop\DBC Testing\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
    at WebSocket.onMessage (C:\Users\ruben\Desktop\DBC Testing\node_modules\ws\lib\event-target.js:120:16)```
#

@summer torrent

summer torrent
#

you can't use forEach on object

surreal sage
#

its an array

bold dock
#

{} is not an array

summer torrent
#

timedmessages is not an array

surreal sage
#

oh y

#

but how to make it like

#

for each

#

sort of

bold dock
#

With Object.keys

surreal sage
#

that doesnt exist

bold dock
#

It does.

#
Object.keys(timedmessages).forEach(key => {
  const settings = timedmessages[key];
  // ...
});
surreal sage
#

oh that

#

nvm

#

thanks tho

earnest phoenix
#

Do anyone knows how can my bot send a message when I am live?

surreal sage
#

yes?

#

use <client object>.on("ready", () => {

})

#

and fetch the guild and the channel and send

#

send is with channel.send

swift void
#

Hey, erm, how do I store the channel ID of the channel a command was ran in?

surreal sage
#

we cant spoil the code

swift void
#

@surreal sage yeah but I wanna store the channel ID of the command channel

surreal sage
#

use quick.db and store it?

#

but that is once

#

else you have to use a db

#

like quick.db

swift void
#

any message tho a

#

every time a command is run, it stores the channel id

quartz kindle
#

what do you want to do with the id after its stored?

swift void
#

check and see if it matches with another variable

#

aka ===

quartz kindle
#

what is this other variable?

jolly quail
swift void
#

another channelID

#

like, I wanna restrict the command to one channel

jolly quail
#

Hmm

quartz kindle
#

you dont need to store ids for this

delicate shore
#

how to get discrim of person

#

who is pinged

swift void
#

Then how would I do it?

quartz kindle
#

storing implies using them later, you dont need to store anything if you're using it now

#

just compare the ids directly

swift void
#

What about the every single command run part?

#

Every single time the command is run, it performs it

quartz kindle
#

if you put it in your message event, it will apply to all messages

swift void
#

ah

#

ty

jolly quail
#

Store the const channel globally

delicate shore
#

hey

#

how to get the #tag of person

jolly quail
#

Just console.log the object

#

U will see where is discrim

swift void
#

How would I stop everything else after the sentence

blazing portal
#

member.user.discriminator @delicate shore

delicate shore
#

alr

#

thanks

jolly quail
#

How would I stop everything else after the sentence
@swift void no idea what u mean

swift void
#

@jolly quail like

#

stop everything

jolly quail
#

Everything?

#

To stop everything just delete all the code xD jk

swift void
#

:/

jolly quail
#

Be clear

swift void
#

Like ermmmmm

#

nothing else runs

#

the rest of the code doesn't run

earnest phoenix
#

What does ngrok do?

jolly quail
#

return at that point

#

Ig

#

@swift void

swift void
#

Return?

jolly quail
#

return from the function?

earnest phoenix
#

stop everything
@swift void do a then statement and type process.exit()

delicate shore
#
  if(command === "changemymind"){
  let boomer = args.splice(1).join(" ")
    let img = await canva.changemymind(boomer);
canva.write(img, "img.png");
    
  }```
#

this is not working

#

no error

earnest phoenix
#

Canvas

#

Misspell

jolly quail
#

Lol

earnest phoenix
#

Splice

#

Bruh

#

@delicate shore you always have the dumbest errors

delicate shore
#

ok

jolly quail
#

200 IQ

delicate shore
#

what

jolly quail
#

🤣

delicate shore
#

splice isn't correct?

#

i use same for quote command

#

and it works

#

and @earnest phoenix it is canva only

#

as i defined it

#

like that

swift void
#

@earnest phoenix I meant to uhhh stop the code sequence

#

Not exit

jolly quail
#

return

#

Ig

swift void
#

Kk

slender wagon
#

should it be slice? XD

mild flower
#

if bot.guilds.cache.size shows the number of servers the bot is in
what will be the tag to show the name of the servers?

#

@ me

slender wagon
#

this is a logger

#

bot.guilds.cache.forEach(guild => {
    console.log(" - " + guild.name, +guild.memberCount);
  });```
mild flower
#

hmm

#

ok

slender wagon
#

use that if ur bot is not in too many servers

tight plinth
#

elseu 'll die

mild flower
#

no, i dont think i will

#

trying to keep it as lightweight as possible

#

was just wondering if there was a tag for it or not

tight plinth
#

nope

tranquil patrol
#

Cancelled is in a promise

earnest phoenix
#

because you're returning in another function, a promise

obtuse jolt
#

yeah thats not helpful

#

in any way

earnest phoenix
#

yes it is

obtuse jolt
#

its really not

earnest phoenix
#

it is

obtuse jolt
#

i clearly knew it was a promise and it says to do that online so its not useful

earnest phoenix
#

you're just incompetent to understand what was said

#

tldr follow async/await pattern fully

#

dont mix async/await and promises when you need sequential execution

tranquil patrol
#

The promise is run when the reaction is done but also will go straight through to your next code

#

I'm on mobile lol

lime pumice
#

Does anyone know how do i make a bot server logger step by step?

earnest phoenix
#

elaborate

lime pumice
#

Wdym

misty sigil
#

guildCreate/guildDelete events in discord.js

lime pumice
#

I wanna make a server logger but i don't know how to do so

quartz kindle
#

explain what a server logger is supposed to be

misty sigil
#

I think

earnest phoenix
slender wagon
#

log the server names and membercount?

misty sigil
#

he means bot joins server

#

he logs it into a channel

slow fable
#

prolly like when someone sends message it goes into console

lime pumice
#

log the server names and numbercount?
@slender wagon yea

misty sigil
slender wagon
#

i just posted that

#

like a while ago

lime pumice
#

No whenever my bot joins a server it tells me

slender wagon
#

bot.guilds.cache.forEach(guild => {
    console.log(" - " + guild.name, +guild.memberCount);
  });```

@slender wagon d.js V12 logs it in the console

misty sigil
#

T H A T S W H A T T H A T E V E N T D O E S

#

unless you mean something else mmulu

summer torrent
#

@lime pumice which lib

lime pumice
#

@summer torrent discord.js

summer torrent
#

listen to guildCreate and guildDelete events

obtuse jolt
#

i fixed it and what you said didn't help in any fucking way

earnest phoenix
#

you're just incompetent to understand what was said
@earnest phoenix

#

help vampire

quartz kindle
#

lmao

void vale
#
var date = new Date();
console.log(date.getMonth()) //result: 6

Now 7 month
But in the console writes 6

earnest phoenix
#

the month is 0 indexed

void vale
#

thx

inland aurora
#
module.exports = {
    name: 'newcursed',
    description: "new cursed image command similar to new meme",
    execute(message, args) {
      const Discord = require('discord.js');
      const bot = new Discord.Client();
      const embed = new Discord.MessageEmbed()
      const got = require('got');
      got('https://www.reddit.com/r/cursedimages/random/.json').then(response => {
        let content = JSON.parse(response.body);
        let permalink = content[0].data.children[0].data.permalink;
        let memeUrl = `https://reddit.com${permalink}`;
        let memeImage = content[0].data.children[0].data.url;
        let memeTitle = content[0].data.children[0].data.title;
        let memeUpvotes = content[0].data.children[0].data.ups;
        let memeDownvotes = content[0].data.children[0].data.downs;
        let memeNumComments = content[0].data.children[0].data.num_comments;
        embed.setTitle(`${memeTitle}`)
        embed.setURL(`${memeUrl}`)
        embed.setImage(memeImage)
        embed.setFooter(`👍 ${memeUpvotes} 👎 ${memeDownvotes} 💬 ${memeNumComments}`)
        message.channel.send(embed);
      })}}```
#

I have an error which shows "TypeError: Cannot read property 'data' of undefined" sometimes when using this command

#

but it works with the exact same code but for r/memes

earnest phoenix
#

debug and inspect your variables

#

see the array contents and the object structure

inland aurora
#

the only difference is that its r/cursedimages and not r/memes

#

but it works all the time for the other one

earnest phoenix
#

debug and inspect your variables
see the array contents and the object structure

#

content[0] is returning undefined, up to you to find out why

inland aurora
#

so whats the point of this channel then

earnest phoenix
#

or it might be children[0]

#

i'm not a computer, i cannot evaluate your code on demand

#

that's a runtime issue

#

learn to do shit yourself

#

i'm simply telling you where the the issue is coming from

#

as i defined it
@delicate shore why the hell you won't have problems but we'll have problems trying to solve your dumb problems

delicate shore
#

DUMB?

#

that was not dumn

#

if u don't wanna help me then don't

#

anyone else will help me\

alpine smelt
#

Guys. When i try to do my bot, i coded it so it turns online and everything but then it turns offline when i get off my computer. What do i do? I mainly use discord on my phone and i want the bot to stay online 24/7

So how do i do that?

delicate shore
#

just don't be salty

digital ibex
#

use a host, ultra

inland aurora
alpine smelt
#

Hmm. Im pretyy noob at this tbh so u guys gotta probs take it slow

#

Alright, ill search that up

tranquil patrol
inland aurora
#

yeah

#

but you can hide the token

delicate shore
#

how can u host

#

24*7

inland aurora
#

useing uptimerobot

inland aurora
#

look it up how to host discordbot on repl.it 247

earnest phoenix
#

on repl.it
fork my repl then edit the files and use uptime robot to ping your project done basically glitch but you have to pay for private projects

#

and they allow ping services and bot

#

@delicate shore

slow fable
#

$("div").hide();

inland aurora
#

idk how it works but you setup some kind of server and then UptimeRobot pings it keeping it online

digital ibex
#

uhhhhhhh

#

ok

earnest phoenix
#

idk how it works but you setup some kind of server and then UptimeRobot pings it keeping it online
when you nail something without knowing it

#

that's exactly how it works

#

you have to setup an expressjs server

inland aurora
#

i know but I just followed a tutorial so

earnest phoenix
#

and ping it using uptimerobot

inland aurora
#

yeah

earnest phoenix
#

bruh

digital ibex
#

whats so bruh

earnest phoenix
#

idk

#

is it good to put a try{spaghetti} catch(err){} statement on everything inside bot.on("message",message => {spaghetti});?

#

i just did

#

no

#

@halcyon crow uptime robot can ping it

slender thistle
#

Depends on what you do

earnest phoenix
#

yeah

halcyon crow
#

no no i messaged wrong channel

#

lol

earnest phoenix
#

lmao

slender thistle
#

I don't use try-except in Python unless I'm sure I need to handle an exception differently

halcyon crow
#

oop i use try except a lot

earnest phoenix
#

i used it so if there are errors it replies with oopssssssssssssssss

slender thistle
#

In cases where I need to see that traceback myself, I remove try-except catshrug

earnest phoenix
#

and logs the error

halcyon crow
#

except Exception as e:

earnest phoenix
#

try catch eats up memory so you should avoid it unless really necessary

#

i should make a testing version of the bot

halcyon crow
#

await message.channel.send(f'Error: {e}')

earnest phoenix
#

try catch eats up memory so you should avoid it unless really necessary
my bot uses 10 out of 512 mb of ram

#

max

slender thistle
#

Parzival, I prefer to see the full traceback and I cba to use the traceback module for that

halcyon crow
#

fair enough

earnest phoenix
#

the cpu usage is always atleast 60 tho

slender thistle
#
  • it might go over 2k characters limit at some point
halcyon crow
#

I use try except quite a bit in my bot

earnest phoenix
#

on a small scale try catch doesn't seem like anything

#

once you scale it up you'll regret having it in your code

halcyon crow
#

but its mainly for creating and deleting files

earnest phoenix
#
  • it might go over 2k characters limit at some point
    i log it in the console not in some channel
#

once you scale it up you'll regret having it in your code
dank memer: i have 200 commands and i use a try catch statement MUAHAHAHHAHHA

halcyon crow
#

try except I use for creating/deleting files, thats it tbh

earnest phoenix
#

bruh

#

idk what's bruh

halcyon crow
#

Can I post a repo and you guys review my code or is that a nono

earnest phoenix
#

lemme just go throw an eror

#

Can I post a repo and you guys review my code or is that a nono
yes

#

give it to us on hastebin

#

not on a git repo

halcyon crow
#

oh

earnest phoenix
#

and i'll see stuff

halcyon crow
#

its really simple repo

earnest phoenix
#

(hope it's javascript)

halcyon crow
#

its python

earnest phoenix
#

f

halcyon crow
#

I just started work on this 3 days ago

#

I used try except quite a bit :/

digital ibex
#

what do u need?

halcyon crow
#

code review

earnest phoenix
#

i thought your pfp was a goat but now i realized it's a monkey...

digital ibex
#

confusion

#

oh

halcyon crow
#

its a baby sloth @earnest phoenix

quartz kindle
#

Discord Go
Uses python and not go

digital ibex
#

i dont know python that well but :p

halcyon crow
#

@quartz kindle referring to Go, the ancient chinese board game

earnest phoenix
#

h

halcyon crow
#

which is what this is

earnest phoenix
#

u

#

h

digital ibex
#

oh

quartz kindle
#

why not make it in go as well

earnest phoenix
#

oops pressed enter instead of space

quartz kindle
#

a go bot made in go lang

halcyon crow
#

Go is an abstract strategy board game for two players, in which the aim is to surround more territory than the opponent. The game was invented in China more than 2,500 years ago and is believed to be the oldest board game continuously played to the present day.
A 2016 survey b...

#

true that

earnest phoenix
#

DUDE

halcyon crow
#

cos idk go lang haha

earnest phoenix
#

HOW THE HECK DID YOU MAKE IT

digital ibex
#

use codacy

#

to review ur code

#

its free and really good

halcyon crow
#

bruh moment @earnest phoenix calm it down

earnest phoenix
#

kaboom brain.exe has stopped

#

lol

halcyon crow
#

@digital ibex thanks will check it out

earnest phoenix
#

imma go make a tic tac toe game for my bot just need to learn awaitMessage

#

someone link me the docs

#

asap

digital ibex
#

np

earnest phoenix
#

¯_(ツ)_/¯

quartz kindle
#

abusing collectors is not really a good thing

earnest phoenix
#

huh

#

i said a tic tac toe game

halcyon crow
#

Go is pretty complex i use a lib for the logic

#

mostly

#

coding it yourself is a nightamre, i did it with a mate a few weeks ago but it was spaghetti

earnest phoenix
#

spaghetti

#

you could have made a spaghetti generator

halcyon crow
#

bug generator

earnest phoenix
#

potato generator

#

NITRO generator

#

^^against tos

#

^^the last one only

#

^^potatoes are allowed

halcyon crow
#

awow you gone sicko mode every since i spoke about go

quartz kindle
#

reminds me of hikaru no go

halcyon crow
#

you know hikaru no go?

#

I've seen that, it got me into go

quartz kindle
#

yes, i've read the manga

halcyon crow
#

awesome

mild flower
#

it says undefined when i mention a user

earnest phoenix
#

my brain is going weirdo for some reason

digital ibex
#

manga? isnt that anime porn or something?

earnest phoenix
#

it says undefined when i mention a user
do message.mentions.users.first()

quartz kindle
#

no... manga is comic books

digital ibex
#

oh

halcyon crow
#

/s ?

earnest phoenix
#

@digital ibex you maniac watches anime and porn

#

ban ban ban
idk

#

¯_(ツ)_/¯

digital ibex
#

i dont watch anime

#

i hate it

earnest phoenix
#

proof

quartz kindle
#

@mild flower you'll need to show code, otherwise we cant help

slender thistle
#

dev

digital ibex
#

???

earnest phoenix
#

show a pic of you beating an anime character

digital ibex
#

what

earnest phoenix
slender thistle
halcyon crow
#

watch Spirited away by studio ghibli and you change your mind entirely @digital ibex

slender thistle
#

👀

earnest phoenix
#

sorry mods

digital ibex
#

???????

mild flower
earnest phoenix
#

@mild flower it's const

#

can't be changed

halcyon crow
#

its related because hikaru no go is about go which is a game which I made using python in a discord bot

mild flower
#

oh oof

earnest phoenix
#

it will forever stay the same value

#

lemme fix it

#

types..

#

not gonna spoonfeed

digital ibex
#

what

#

its still gonna be the same with let or const

mild flower
#

??

#

yes

#

its the same

quartz kindle
#

@mild flower displayName is not available on a User object, only on a Member object

digital ibex
#

with his case its not gonna change anything

mild flower
#

hmm

quartz kindle
#

do message.mentions.members.first()

mild flower
#

k

#

ok it worked

earnest phoenix
#
var theEmbed = //put your stuff here;
//when someone runs it
let user = message.mentions.users.first()
theEmbed = //put da stuff here again but add in the user variable ^^^^^
message.channel.send(theEmbed);
#

i taiped it

quartz kindle
#

also, the args[1] will probably give you an error

#

if you try to specify an id

earnest phoenix
#

e

mild flower
#

lemme check that

halcyon crow
#

more ppl use python plz

#

i dont like all this js stuff

mild flower
digital ibex
#

im learning python

mild flower
#

if it hasnt specified a member it just goes to me

#

so thats all good

digital ibex
#

im not good at it though

quartz kindle
#

so you dont need the args[1] part

#

you can remove it

mild flower
#

k

earnest phoenix
#

yes

#

can someone rate my bot because...