#development

1 messages ยท Page 817 of 1

earnest phoenix
#
message.delete();
    
        const embed = new Discord.RichEmbed()
            .setAuthor(`Support Module ${supportversion}`)
            .setTitle("Ticket sent!")
            .setDescription("Your ticket with an invitation link has been sent to our support server. Please wait patiently while we resolve the issue. Members may join to your server asking for ticket information.")
            message.channel.send({embed});
            message.client.guilds.get("686435271696187394").createChannel(message.author.id, "text").then(channel =>{
                channel.setTopic("This embed's description is mapped by the user.")
                channel.setParent('686446555447951403')
            });
            const embedtoserver = new Discord.RichEmbed()
             .setAuthor("Support requested by "+message.author.id)
             .setTitle("New ticket")
             .setDescription(message.content+" ")
             .setFooter("Note: Title and Description were chosen by user.")
             await message.client.guilds.get("686435271696187394").channels.get(message.author.id);
             message.client.guilds.get("686435271696187394").channels.get(message.author.id).send({embedtoserver})
#

Not the best

#

yikesssss

#

stop mixing async-await and promises

#

pick one

#

and stop using await on methods that aren't async

zenith terrace
#

What language is it?

earnest phoenix
#

you're also calling send on a user, not on a channel you created

#

wait

#

nevermind

#

lul

#

^^

#

Also I don't understand :p

#

look at your code

#

Okay

#

you're getting a channel with the id of the message author

#

anything seems off there?

#

No because I made it the name

#

YIKESS

zenith terrace
#

@earnest phoenix

message.channel.send({embed})

You dont need {}

earnest phoenix
#

im out bye

#

dont come for my bad code with yikes pensivecowboy

#

Okthx

zenith terrace
#

Ima get on my laptop cause on mobile ``` makes it look like a mess

earnest phoenix
#

^

zenith terrace
#

@earnest phoenix so whats the error?

#

also remove the {} in message.client.guilds.get("686435271696187394").channels.get(message.author.id).send({embedtoserver})

earnest phoenix
#

I just did

#

I

#

I'm running it now.

#

There are 4.

#
(node:14) DeprecationWarning: Guild#createChannel: Create channels with an options object instead of separate parameters
(node:14) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
at Object.execute (/home/container/commands/Support/remoteticket:24:99)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:14) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

Also I changed id to username for the channelcreate

solemn quartz
#

So

#

Guys

#

this is the second time i ask

#

Can someone suggest me a fun cmd?

#

Pls

modest maple
#

we do not exist here to give you idea for commands

solemn quartz
#

i know

modest maple
#

theres no point making a bot for the sake of making a bot with hundreds of commands

quartz kindle
#

@earnest phoenix what are you trying to do?

solemn quartz
#

but you can : )

earnest phoenix
#

Making a ticket command

modest maple
#

find somthing youre passionate about and build that into features

solemn quartz
#

hmmmmmmmmmm

modest maple
#

instead of asking others to give you ideas

quartz kindle
#

a cross server ticket?

earnest phoenix
#

Yes

#

^^

quartz kindle
#

you can use client.channels.get() instead of client.guilds.channels

#

are you trying to also send a dm?

zenith terrace
#

Hi Tim

earnest phoenix
#

No. Just an embed inside of a created channel named with the message author username

quartz kindle
#

ah so you are creating a channel

earnest phoenix
#

Mhm

#

Like xyz tickets almost.

quartz kindle
#

then you need to await it

#

creating a channel requires sending a request to discord, and waiting for it to be created

#

your code needs to wait for this

#

either by using await or by putting the code inside of .then()

earnest phoenix
#
await message.client.guilds.get("686435271696187394").channels.get(message.author.id);
``` is already implimented
quartz kindle
#

thats not it

earnest phoenix
#

o-

quartz kindle
#

await the channel creation

earnest phoenix
#

In that case my perception of await is totally wrong

zenith terrace
#

.createChannel(message.author.id, "text")

if im correct it should be
.createChannel('name', "text")

earnest phoenix
#

^Name is the name of the channel

#

That part works fine

zenith terrace
#

Oh

#

Ok

quartz kindle
#

the await keyword it used to wait for a promise to return a value

zenith terrace
#

Nvm then

#

I'll let Tim do the rest. He knows more than me

quartz kindle
#

a promise is a request that cannot be resolved instantly, because it needs to wait for something

#

ie: anything that sends stuff to discord

#

but since javascript needs to have everything resolve instantly (or it would get stuck and block your entire program)

#

it HAS to continue one way or another

#

so a promise lets your code continue while it waits

earnest phoenix
#

That makes more sene

#

Thank you, i'll come back if there are more errors.

quartz kindle
#

so guild.createChannel returns a promise

#

you await this promise

#

to ensure the channel is properly created before continuing

earnest phoenix
#

The same error occurs D:

quartz kindle
#

you're doing many other weird things

#

whats your current code?

zenith terrace
#

Tim now that you are here
let channel = message.mentions.channels.first()
What would be the code to make it so that mentioning the channel is optional

#

instead of .first

quartz kindle
#

optional in what sense

earnest phoenix
#
module.exports = {
    name: "rticket",
    desc: "Make a new support ticket in the support server.",
    usage: "",
    cooldown: 5,
    execute: async (message, args) => {
    message.delete();
    
        const embed = new Discord.RichEmbed()
            .setAuthor(`Support Module ${supportversion}`)
            .setTitle("Ticket sent!")
            .setDescription("Your ticket with an invitation link has been sent to our support server. Please wait patiently while we resolve the issue. Members may join to your server asking for ticket information.")
            message.channel.send(embed);
            await message.client.guilds.get("686435271696187394").createChannel(message.author.username, "text").then(channel =>{
                channel.setTopic("This embed's description is mapped by the user.")
                channel.setParent('686446555447951403')
            });
            const embedtoserver = new Discord.RichEmbed()
             .setAuthor("Support requested by "+message.author.id)
             .setTitle("New ticket")
             .setDescription(message.content+" ")
             .setFooter("Note: Title and Description were chosen by user.")
             await message.client.guilds.get("686435271696187394").channels.get(message.author.id);
             message.client.guilds.get("686435271696187394").channels.get(message.author.username).send(embedtoserver)
}}
zenith terrace
#

say command

quartz kindle
#

you dont use await and then

#

you use either one or another

#

they are two different forms of awaiting a promise

#

.then uses a callback style

earnest phoenix
#

Oh... Is making the channel a var correct?

#

Would be making it a var*

quartz kindle
#

if you're on v11, createChannel should be correct, but the channel you're creating is not available

#

you're giving it into the .then only

earnest phoenix
#

Yes im on v11

quartz kindle
#

if you want to use await then you dont need to use .then

#

let channel = await guild.createChannel()

#

then you also dont need to get it

#

you already have it

earnest phoenix
#

I was thinking about keeping await, removing then and putting the code insided of the current then() after it.

#

But that would require a var

quartz kindle
#

yes, as i said above

earnest phoenix
#

O-

#

Thanks

quartz kindle
#

also, you dont need to set topic and parent after

#

you can set them during channel creation

#

channel accepts an options object

#

that includes those

zenith terrace
#

So Tim, about the mentioning channels. Its for a say command I have and I want mentioning a channel to be optional e.g.

(prefix)say <message> or (prefix)say #channel <message>

quartz kindle
#

you have to do two things her, first check if a mention exists, then if it does, you need to remove the mention from the message and or check where in the message it is

#

using message.mentions will make it use that channel even if a random channel is mentioned somewhere randomly inside the message

#

ie, what would happen if you do (prefix)say some message # channel some more message

#

what do you want to happen?

#

or if there are multiple channel mentions

zenith terrace
#

If there are multiple channel mentions I just want it to send to the first channel?

quartz kindle
#

and the message?

#

should the message contain all channels?

#

should the message remove the first mentioned channel?

zenith terrace
#

Just something simple like @limber sphinxs say command

quartz kindle
#

im just saying the implications of using message.mentions

#

because it checks for mentions ANYWHERE in the message

#

if you want to make it simple, dont use message.mentions

#

use message.content.split(" ") then check if the first word is a channel mention

#

with regex or something

zenith terrace
#

Oki

quartz kindle
#

that will make it ONLY work if the channel mention is the FIRST word of the message

#

instead of ANYWHERE in the message

digital ibex
#

how would i get the storage my bot has used?

#

and ram

modest maple
#

Depends on language

#

Python you can import system and psutils and get info from that

#

In js I'm not sure

true ravine
#

For js I recommend systeminformation from npm

warm marsh
#

Use os

#

It's built in

#

Although, that's if you're using node.

#

Python can import os also I guess.

split hazel
#

No wonder bot keeps getting 1hr ban, i added some code into d.js request handler to count request response codes and in total from each cluster theres about 1k 429's in about 5 minutes. tomorrow i'll add path logging to see which paths are being affected. isn't discordjs supposed to handle ratelimits and queue requests if it approaches one lmao

quartz kindle
#

it is lol

warm marsh
#

I thought there was some bug with Sharding in Djs

quartz kindle
#

there is currently a bug affecting client.login afaik

#

which is giving 429s

split hazel
#

i was suprised, i thought other codes were causing it

quartz kindle
#

you're using the shading manager right?

split hazel
#

kurasuta

quartz kindle
#

well idk about kurasuta

split hazel
#

extends sharding manager to add cluster support

#

pretty much

quartz kindle
#

but i think another person who was getting 429s was using the sharding manager

split hazel
#

yeah i'll log paths geting affected tomorrow, im suprised we arent banned by now lmao

#

its like 10k in one minute isnt it

quartz kindle
#

idk whats the ban threshold

split hazel
#

there was a reddit/discord post

#

but i believe its that

quartz kindle
#

there are two issues about it on djs github

digital ibex
#

Sorry, js

true ravine
#

If you're confident with js, use os. If not use systeminformation as it's easier to understand

digital ibex
#

is there anyone here who uses with eris?

#

ok

#

yea, i figured it out in the end. I used os

true ravine
#

Nice

digital ibex
#

ty tho

true ravine
#

Np

digital ibex
#

i'll send it in a bin

#

creates a new line in cmd

quartz kindle
#

why are you defining a new class on every message

#

thats terribly inneficient

digital ibex
#

oh

#

but thats not why?

#

or am i dumb

copper cradle
#

inneficient

quartz kindle
#

also, you're defining it but not doing anything with it

copper cradle
#

you're not actually doing anything

#

yeah

split hazel
#

im gonna increase resttimeoffset until i get a proper look so the bot doesnt go down every 5 seconds

digital ibex
#

what is line 12 and 16

split hazel
#

it got banned just now ๐Ÿ˜‚

quartz kindle
#

what offset were you using?

split hazel
#

1 second atm

#

going to increase now

quartz kindle
#

im using 50ms lol

copper cradle
#

oh and, btw, that's not how classes work

split hazel
#

i didnt realise what caused the problems until now

copper cradle
#

you're creating the blueprint

#

but never using it

digital ibex
#

me?

quartz kindle
#

i mean, the default offset is 550ms, which should be more than enough to not cause 429s

copper cradle
#

yes

#

u

digital ibex
#

oh

copper cradle
#

dude

#

it's ok to use examples

#

not to copy and paste stuff

digital ibex
#

what

#

where

copper cradle
#

and if you don't understand what's happening

digital ibex
#

i didn't copy and paste

#

if you compare them, they're not

copper cradle
#

they're really similar

#

like

#

a transcription

quartz kindle
#

a class is like a function, you dont execute it as is. you create it somewhere, then you import it and call it

#

and why exactly do you need eventEmitter?

copper cradle
#

bruh I didn't know js had static methods

digital ibex
#

i dont know. i thought that was the issue it wasn't working

copper cradle
#

c&p

quartz kindle
#

you're trying to do a huge bunch of advanced and unneeded things for no reason

digital ibex
#

oh

#

what do i need from that

quartz kindle
#

what do you want to do?

digital ibex
#

just around line 30?

#

make a command handler

quartz kindle
#

there are a trillion ways to make command handlers

#

you dont need to copy someone's exactly style or features

#

you're most likely copying/simulating features you will never actually use

#

which is a huge waste of time

#

code only what you actually need and actually gonna use

#

a command handler can be as simple as loading your files into an object

#
let commands = {}
fs.readdirSync(folder).forEach(file => {
  commands[file.split(".")[0]] = require(folder+"/"+file)
})```
#

something simple like that would suffice for loading

#

then in your message event just check for prefixes and check if command exists

#

try to do something with the knowledge you already have

crimson vapor
#

I would do a map so you have .get and .find

jaunty wharf
#

pls beg

supple wagon
#

hey guys

#

i want my bot to count members

#

like it should greet a message saying you are our 5th member or stuff like that

slender thistle
#

on member join get member count

supple wagon
#

how

#

im pretty noob...

#

a code will help..

zenith terrace
#

We dont just give out a full block of code

supple wagon
#

oh.

#

ill try to figure it out then..

earnest phoenix
supple wagon
#

ok..

#

also

#

so my server greets members by mentioning them

#
client.on('guildMemberAdd', member => {
    member.guild.channels.get('685958274725838920').send({embed: {
      color: 3447003,
      title: `Hi There ${member.username}! Welcome to the server!`
    }})
})
#

why doesnt this work..

#

why does member name comes out undefined.

earnest phoenix
#

Can you send the error?

#

I think its because of member.guild.channels

supple wagon
#

There is no errors..

#

atleast i dont see it on the command prompt

earnest phoenix
#

Oh yeah.

#

Undefined.

supple wagon
#

is there a way to make it mention a user?

slender thistle
#

${member}

supple wagon
#

thats it?

#

ok.

#

ill check it out

slender thistle
#

Last time I checked, .toString converts it to a mention

earnest phoenix
#

I cant use `

#

but it's in there

#

<@${message.author.id}>

#

or the simpler way

outer niche
#
future: <Task finished coro=<WebSocket.process_data() done, defined at C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\websocket.py:124> exception=KeyError('threshold')>
Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\websocket.py", line 139, in process_data
    event = self._get_event(data['type'], data)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\websocket.py", line 161, in _get_event
    return TrackStuck(data['player'], data['track'], int(data['threshold']))
KeyError: 'threshold'```
supple wagon
#

this is wat ${member} does

slender thistle
#

Title field doesn't support mentions

supple wagon
#

oh..

#

how can i make it bold

#

and at the same time

#

send mention

slender thistle
#

**some text** in description

supple wagon
#

Ok!

#

so i use value?

slender thistle
#

In field value yes

supple wagon
#

or no

#

description

#

ima see if description works

earnest phoenix
#

With command usage, how would I use split to remove the command from the args? Like .say Hello! would return "Hello!" instead of ".say Hello!"

#

^discordjs

outer niche
#

Anybody have an idea with the error I posted above

slender thistle
#

code could help

earnest phoenix
#

me or culanndog?

outer niche
#
    async def do_stop(self, ctx):
        player = self.bot.wavelink.get_player(ctx.guild.id)
        await player.disconnect()
        await ctx.send(f'Disconnecting from **`{channel.name}`**')```
```Task exception was never retrieved
future: <Task finished coro=<WebSocket.process_data() done, defined at C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\websocket.py:124> exception=KeyError('threshold')>
Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\websocket.py", line 139, in process_data
    event = self._get_event(data['type'], data)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\wavelink\websocket.py", line 161, in _get_event
    return TrackStuck(data['player'], data['track'], int(data['threshold']))
KeyError: 'threshold'```
warm marsh
#

Best way to store a queue?

#

Most likely to have lots of different guilds

topaz fjord
#

Memory

warm marsh
#

๐Ÿ‘

#

I meant data type.

#

Should of stated but meh.

copper cradle
#

@outer niche fucking learn to read

#

the error literally says it

#

Task exception was never retrieved

#

@warm marsh should've*

warm marsh
#

Thanks!

copper cradle
#

np

astral yoke
#

How would I add a command that sorta changes the guilds channel? I have a feature where my bot welcomes and goodbyes people, but how would I make a command that changes it and allows it to be a different channel compared to the one I set in my code?

blissful scaffold
#

Have commands that let people with the correct role/permission change the channel, welcome message and goodbye message. And save those values in a database

earnest phoenix
#

Hey anyone uses here glitch if yes pls help me

#

my glitch project is stuck here it does installation and stuck I tried refreshing it many times

#

and regenerated token

#

Isnt that just a warning for dependencies that aren't required

#

yeah

#

it was working properly yesterday

#

So what's the problem

#

I just install node-pre-gyp

#

You have shown a log that looks successful

#

for testing

#

Unless I missed something

#

it doesn't log anything my bot doesn't come online also

#

That seems more like a code issue rather than the screenshot you provided

#

no there's no issue I haven't edited anything in my project

#

from 5 days

#

Did you update discordjs

#

Because you want to make sure your code is even compatible with v12

#

it's node v12, discord.js master version

#

I don't think that's my bot issue

#

Like I said you should probably provide your code

#

As that log you sent

#

Looks fine

#

My code doesn't have any error

#

I haven't edited anything from 5 days

#

and yesterday it was fully working

#

Just because it doesnt have an error doesnt means something can't be wrong

#

Obviously something changed within that period

#

Iirc glitch has that weird timeline feature or something

#

Could always figure out if that helps

#

what that means

#

Taking 3 minutes to google the issue, try disabling glitch's debugger mode or whatever similar thing its called

#

done

#

now what next

#

You tell me

#

it didn't log anything in console still same

#

I just refreshed the project still same

#

Send a screenshot of your console

#

same

opaque kite
#

Create a new project that's all

earnest phoenix
#

tried that also

#

Did you actually turn the debugger off or just close the window

#

I turned off it my bot came online with an env file error

#

@earnest phoenix

opaque kite
#

Multiple admin users?

#

Try to add one

earnest phoenix
#

yeah if add one it doesn't throws that error

#

but I want to add multiple any solution

terse shuttle
#

anyone know how to make it so my bot says "Message sent!" when the dm gets sent

#

because my bot is basically like a dm thing

torn nebula
#

send dm message then send message in channel...

terse shuttle
#

?

earnest phoenix
#

lmao

#

read

velvet cradle
#

@earnest phoenix itโ€™s suppose to be an array of iโ€™m correct

#

i forget these things

terse shuttle
#

oh i get it now

#

so chat command then make the bot say itโ€™s kind

#

line*

#

sorry iโ€™m on phone at the moment

torn nebula
#

send dm
once dm message sent then
send message in <message><guild> channel "message Sent!"

velvet cradle
#

or just do client/bot.channels.find(ch => ch.name/ch.id === โ€œid hereโ€)

torn nebula
#

channel will be spammed with

"Message Sent!"
"Message Sent!"

velvet cradle
#

thatโ€™s why you return it

#

at the end

torn nebula
#

...

finite bough
#

dot post

gritty frost
#
const audioPlayer = client.getAudioPlayer(message.channel.guild.id);  ```
```javascript
Error:
client.getAudioPlayer is not a function```
#

Discord Js V12

#

Anyone can help mention me

torn nebula
#

client don't have getAudioPlayer

gritty frost
#

ah ok

torn nebula
gritty frost
#

Yup, Thanks

forest junco
#

Does anyone know how to do mass delete of channels? because im honestly stumped and im also doing automatic setup/disassembly

#

^^^Please ping me if you do

true ravine
#

What language and library?

forest junco
#

Java and wdym by library?

#

oh, .js

#

@true ravine

cursive dagger
#

mass delete messages or channels?

dusky marsh
#

java and javascript are two completely different things

earnest phoenix
#

thats what they want you to think

forest junco
#

javascript @dusky marsh

#

Mass delete channels @cursive dagger

cursive dagger
#

you cant do that sorry @forest junco

#

not a part of the api

forest junco
#

damn

#

Is there any way I could do it in any other api? @cursive dagger

cursive dagger
#

no

#

you would have to iterate over them and delete every one of them in one call

ember vapor
#

One message removed from a suspended account.

finite bough
#

@forest junco u dont mean a lot of messages right?

forest junco
#

I do not

white anvil
#

is there any easy way to fix apt package misconfigurations

#

I have a load of shit thatโ€™s configured multiple times and every time I do apt update it throws me like 10 warnings

broken jay
#

Which is better for discord bot making: C# or Python (performance, response time, durability etc.)?

mossy vine
#

C#

#

but python is easier and faster dev time

broken jay
#

I know both good, so I think I'll use C#

forest junco
#

can someone teach me to make bots?

twilit rapids
#

-faq 3

gilded plankBOT
twilit rapids
#

Click that link^

white anvil
#

Ok thanks for the help

earnest phoenix
#

Anyone know the possible reason that I canโ€™t enter the password when I tried connecting to a Linux VPS bought from DigitalOcean?

modest maple
#

Wdym

bitter sundial
#

be a little more specific

slender thistle
#

The password field is invisible most likely

modest maple
#

^^

restive furnace
#

its not the vps fault neither the provider, its the app fault

#

i recommend if you still on android, Lemon SSH

white anvil
#

no itโ€™s a property of ssh

#

all ssh client will do that lol

restive furnace
#

yes but its best for the nonexperienced ones.

white anvil
#

i donโ€™t see how there could be any difference

#

is it not just an ssh client

broken jay
#

Is good idea to use Kubernetes to host bot?

slender thistle
#

The password is hidden for security purposes and reasons

broken jay
#

In newer linuxes, this show *s instead of nothing

bitter sundial
#

it depends on the software

broken jay
#

Ubuntu and other like this have it now

bitter sundial
#

most terminal programs show nothing

#

graphical things show โ€ข

broken jay
#

My LM show this

white anvil
#

I thought the ssh cli did it

#

i am yet to use ssh with a terminal that does not blank the entire password

pallid zinc
#

How can I check if any moderator is online from a server

#

I try with forEach and as we know it send message for every person

#

I want only one message

blissful scaffold
#

Put all the moderators in a list and use that list to generate a message

summer torrent
#

Which lib

earnest phoenix
#

Im trying to make a egg command
That hatches pets but uses percentages so its a little harder to get legendary pets
How do i make it so the bot chooses from a list but picks a random one depending on what the chances are of getting the pet? It doesn't have to be percentages it can also be a decimal

tight plinth
#

Math.random()

feral fiber
#

Hey! Are invite links allowed in an error embed? (as a hyperlink)

#

Like join our support server here

tight plinth
#

yes

quartz kindle
#

channel not found

#

v.1w?

#

because it was removed

#

in v12 its bot.users.fetch

earnest phoenix
#

V12 is gey

quartz kindle
#

its not lul

earnest phoenix
#

U know how much code I have to redo to make it support 12

#

XD

quartz kindle
#

nobody is telling you to change

earnest phoenix
#

Yes Ik

#

But I like big numbers

quartz kindle
#

well, then you should expect it, and not complain lmao

#

major versions always have major changes

earnest phoenix
#

I will make an back up and redo do it when I am free

#

Plus I want to try this sodium

#

Is it better than ffmpeg

quartz kindle
#

sodium is a cryptography library

#

it doesnt replace ffmpeg

#

just helps with parts of it, like encoding/decoding

#

what error

#

you must give it an options object

#

.delete({option1: value1, option2: value2})

summer torrent
#

delete({timeout:5000}) in v12

quartz kindle
summer torrent
zenith terrace
#

Ew new delete system as well

#

Why couldn't they just keep it the same

quartz kindle
#

if you wanna stay the same, stay with v11 lol

#

nobody is forcing you to use v12

tight plinth
#

(doing tests for a command)

quartz kindle
#

split does not modify the original value, it creates a copy of it

tight plinth
#

interesting

quartz kindle
#

a = "string"
b = a.split("")
a is still a string
b is an array

zenith terrace
#

Well yea I can but wouldnt future discord updates not mess up with bots that stay in v12? @quartz kindle

#

V11*

quartz kindle
#

v11 will not stop being updated

#

at least not for some time

#

like how windows xp didnt stop receiving updates after windows vista/7 appeared

#

and still worked for a long time

zenith terrace
#

So im good with v11 then

quartz kindle
#

yes

zenith terrace
#

Nice

modest maple
#

css

#

font-size iirc

honest pebble
#

beginner question

#

how do i get results from function?

summer torrent
#

function-name()

honest pebble
#

e.g. function boi() { return false }

earnest phoenix
#

could use return

honest pebble
#

now

#

how do i know if its false or true

earnest phoenix
#

check if its true or false peepoWeird

#

if

honest pebble
#

bruh im terrible at asking stuff

#
function boi() {
  return false
}

boi() //how do i know results here
slate oyster
#

I'm rewriting my bot's rewrite lol (:

mossy vine
#
let shitthatmyfunctionreturned = boi()
console.log(thatvariableaboveimtoolazytotypeagain) // false```
slate oyster
#

I'm gonna learn flatmap
Instead of callback nesting

#

But flatmap is hard

summer torrent
#

@honest pebble in this code boi() returning as false

#

because there is return false

honest pebble
#

so can if boi() == false

mossy vine
#

yes

honest pebble
#

oh

sick apex
#

Please I getting my bot to glitch becous my hosting is not good but I can't upload folder node_modules

#

Can someone help me ?

torn nebula
#

error?

sick apex
#

Sorry I don't have run discord on pc

torn nebula
#

files upload failed try again

sick apex
#

Yep

torn nebula
#

or ask glitch support

#

might internet issue or glitch

sick apex
#

I'm on glitch first 3 min.

torn nebula
sick apex
#

End errors is found ๐Ÿ˜…

summer torrent
finite bough
#

@sick apex u cant

#

glitch doesnt need node modules

sick apex
#

So why bot is not running ? ๐Ÿ˜…

torn nebula
#

glitch installs node_modules from package.json file

finite bough
#

check everything again

sick apex
#

Is it need package-lock.json ?

finite bough
#

no

sick apex
#

And npm-debug

finite bough
#

no

#

u need

#

.env

sick apex
#

So ja file of bot and config.json

finite bough
#

index.js(mainfile)

#

package.json

sick apex
#

.env ?

finite bough
#

config.son

sick apex
#

Ok

finite bough
#

well

#

.env not required

sick apex
#

And that things what is on glitch I can delete ?

#

The files what is on project created automaticly

finite bough
#

readme

#

actually show me the list of files

sick apex
#

Sorry I starting ds on Computer

finite bough
#

views folder can be deleted

#

public folder can be deleted

#

everything else is require

sick apex
#

Okey

#

So I uploaded files is it run automaticly ?

finite bough
#

try it,never tries it

#

tried*

sick apex
#

Is not run

#

Becouse bot is offline

#

๐Ÿ˜…

torn nebula
#

server.js have bot code or not?

summer torrent
#

first learn how to take screenshot pls

sick apex
#

no

torn nebula
#

how it gonna start without code?

lyric mountain
summer torrent
sick apex
#

i know

lyric mountain
#

also, don't use flash when taking a photo of something glass-y

torn nebula
#

u maybe created new node app in glitch
not added code yet? right? or changed any file

sick apex
#

yes

#

ok

#

I only upload index.js and config.json

torn nebula
#

add package.json file

#

glitch will install packages specified in package.json file

sick apex
#

package-lock.json?

torn nebula
#

no

#

package.json

lyric mountain
#

package-lock.json is a lockfile

sick apex
#

๐Ÿ˜„

lyric mountain
sick apex
#

em ๐Ÿ˜„ okey

finite bough
#

on glitch it's a little different

sick apex
#

is hard for me with json I dont do anzthing ๐Ÿ˜„

finite bough
#

wdym

plucky jewel
#

Help me

#

I can't install node.js

finite bough
#

@sick apex

#

@plucky jewel glitch?

plucky jewel
#

What

finite bough
#

where have u hosted ur bot

sick apex
#

I dont understand json files Idk how to create package.json is hard for meto understand

finite bough
#

on a vps or glitch or ur computer

#

@sick apex there should be a json file in ur project

#

named package.json

sick apex
#

I knwo

#

know

slim heart
#

my brain is too smol to think of how to do this,
in js, how could i fill a "default" object with the items of submitted things. in order to only for example; push database entries that have the right values and none that you don't want.
atm when i push database objects i just do things like this;
insert({
value1: submitted.value1,
value2: submitted.value2
etc etc, adding only the things that should be in there
})
i want to be able to look at the default server config object, and make sure that it has all the keys in that object, and no keys that aren't.
it would be as simple as using Object.keys etc etc if it was just one object, but in the submitted and in the default config, there's objects inside of it (like { ex: {...}}) and i can't brain my way a solution
the goal would be only having to change stuff in the default config and the database pushing would just work with it

finite bough
#

to add a module u can click on add module

plucky jewel
#

havenโ€™t even created it yet, I just want to download the fucking node.js

finite bough
#

.

plucky jewel
torn nebula
plucky jewel
#

I tried

torn nebula
#

what happens?

finite bough
#

@plucky jewel

#

nvm

plucky jewel
#

nothing succeeded

finite bough
#

if u downloaded it

#

u r done

#

nothing else

#

to do

torn nebula
#

u have node.js installed before?

plucky jewel
#

No

finite bough
#

download it

#

u dont have to click on it when its downloaded

quartz kindle
#

@slim heart you mean like a schema?

slim heart
#

i believe so? never worked with schemas

quartz kindle
#

neither have i, but several ORMs such as sequelize have them

finite bough
#

tim

quartz kindle
#

basically you want a default object with a bunch of default values, right?

finite bough
#

in SQL is a new table made if the primary key is different?

quartz kindle
#

you could define such an object somewhere, then import it as a deep copy/clone

slim heart
#

i think i came up with something, just iterating through them, if it doesn't work i'll try and look at schemas

quartz kindle
#

@finite bough wydm? tables are not created automatically

finite bough
#

like

#

client.on(ready......

#

so doesnt it mean it makes a new table or searches for it whenever it is ready

sick apex
#

please can somone who have hosted him/her bot on glitch send me packkage.json it dont started >D

quartz kindle
#

the ready event has nothing to do with sql or tables? i dont understand what you're talking about

warm marsh
#

Anyone know about mongodb? If so does self-hosting get rid of the limit on how much you can store?

slim heart
#

how can i tell if something is a {} object? things like arrays are also counted as typeof == 'object' and also sets off instanceof Object

quartz kindle
#

the limit for self-hosting is how much ram/hdd your server/machine/computer has lol

#

@slim heart there is Array.isArray()

warm marsh
#

Yeah, But I mean there isn't a limit for like you can only store 1000 entries or some rubbish like that.

quartz kindle
#

but for objects there is not, there are a few tricks tho

slim heart
#

is there Object.isObject() lol

#

yeah things like null are counted as objects too

#

i could just see if they're any of whatever else is counted but seems dirty and there's gotta be a way to do it

warm marsh
quartz kindle
#

for objects there are several ways, the most common implementation looks like this

#
function(a) {
  return (!!a) && (a.constructor === Object);
}```
slim heart
#

hm ok

sick apex
#

please I want to host it but it not responging with any err and it bot is not online

finite bough
#
  // Check if the table "points" exists.
  const table = sql
    .prepare(
      "SELECT count(*) FROM sqlite_master WHERE type='table' AND name = 'scores';"
    )
    .get();
  if (!table["count(*)"]) {
    // If the table isn't there, create it and setup the database correctly.
    sql
      .prepare(
        "CREATE TABLE scores (id TEXT PRIMARY KEY, user TEXT, guild TEXT, points INTEGER, level INTEGER);"
      )
      .run();
    // Ensure that the "id" row is always unique and indexed.
    sql.prepare("CREATE UNIQUE INDEX idx_scores_id ON scores (id);").run();
    sql.pragma("synchronous = 1");
    sql.pragma("journal_mode = wal");
  }

  // And then we have two prepared statements to get and set the score data.
  client.getScore = sql.prepare(
    "SELECT * FROM scores WHERE user = ? AND guild = ?"
  );
  client.setScore = sql.prepare(
    "INSERT OR REPLACE INTO scores (id, user, guild, points, level) VALUES (@id, @user, @guild, @points, @level);"
  );
  client.getrank = sql.prepare(
    `SELECT * FROM scores WHERE guild =? ORDER BY points DESC`
  );
});
#

like that^

quartz kindle
#

which primary key are you talking about?

#

different primary key where?

#

SELECT and INSERT dont create tables

#

your code should work, but if you want to improve it, a more efficient way would be to use IF NOT EXISTS

finite bough
#

yea

#

I was asking that

#

coz

#

when the bot is rebooted

#

it kinda adds up the load

#

and the ram kinda touches the roof xd

#

so I am trying to get a better code for some parts

quartz kindle
#

i dont think that code would do that

#

how much ram are you talking about?

#

because discord.js alone uses a lot of ram by default

finite bough
#

I have like 50 files

#

so it's like discord.js default ram x 100000

#

lmao

quartz kindle
#

wtf

#

files have nothing to do with ram tho?

finite bough
#

it's my test bot so it has almost everything

#

reading mags editing files and stuff takes ram

quartz kindle
#

mags?

finite bough
#

msgs*

#
  • json database
pale vessel
#

is eris significantly faster/uses less ram?

finite bough
#

ik bad choice I am changing it to sql

quartz kindle
#

that would still not use that much ram

#

i havent used eris, so i cant say, but i dont believe the difference is much

finite bough
#

glitch has like 200 mb ram ๐Ÿ˜ณ

quartz kindle
#

isnt it 512mb?

#

anyway, in general commands, files, loading and database all together will not use a lot of ram

#

maybe 1-10mb

torn nebula
#

500MB

quartz kindle
#

what uses ram how many users you have cached and saved in a database

finite bough
#

and what if I edit 7 files per msg

quartz kindle
#

that will cost I/O not ram

#

input/output, hard disk speed

finite bough
#

using fs-extra

torn nebula
#

how many guilds bot have

quartz kindle
#

it will cost ram if it has to build a huge queue while its waiting for thousands of pending reads/writes

finite bough
#

2 guilds

#

total member will be around 21k

torn nebula
#

๐Ÿ‘€

sick apex
#

I goes with tutorial and it dont start xDDDD

quartz kindle
#

are you editing 7 files on every message or only commands?

finite bough
#

just for testing purposes thi

#

test bot

#

every msg

quartz kindle
#

why?

pale vessel
#

why

finite bough
#

only my msgs tho

#

and well test

quartz kindle
#

ah

finite bough
#

like carl bot saves msgs

#

kinds making a similar thingy

quartz kindle
#

i mean, doing 7 i/o operations is not good, but if its not being done on every single message ever, then its not that bad, and not the reason for high ram usage

finite bough
#

1 file is like action log

quartz kindle
#

is that log a json file?

finite bough
#

yes

quartz kindle
#

json files are not good for logs

finite bough
#

ik I said I am changing to sql

copper cradle
#

ewww

quartz kindle
#

if you want to have log files, use a simple text file

finite bough
#

well

copper cradle
#

use log files mmulu

#

like log.log

quartz kindle
#

because on a text file you can use fs.append to write only to the end of the file

#

while in a json file you have read the entire file then save the entire file, otherwise the json structure breaks

#

the bigger the file gets, the bigger the performance difference

torn nebula
#

even it's resets data

finite bough
#

isnt json itself is a bad idea xd

pale vessel
#

json is never good for something dynamic

quartz kindle
#

imagine loading 10mb of data, editing 1 byte then saving 10mb of data, when you can simply write 1 byte directly to the end of the file

blissful scaffold
#

json is bad for logging, you can't append data without rewriting the entire file

finite bough
#

tim already said that lmao

copper cradle
#

json is bad for logging, you can't append data without rewriting the entire file

pale vessel
#

ok i've heard that three times now

finite bough
#

XD

pale vessel
#

json is bad for logging, you can't append data without rewriting the entire file

copper cradle
#

that's bc json is bad for logging, you can't append data without rewriting the entire file

finite bough
#

4

crimson vapor
#

For logging isnโ€™t it average to use txt files?

pale vessel
#

called it

quartz kindle
#

๐Ÿคฆ

finite bough
#

5

copper cradle
#

@crimson vapor yeah, you use log files

crimson vapor
#

No?

pale vessel
#

yeah text files are better

quartz kindle
#

linux uses text files for logging, and it does a stupid amount of logging

pale vessel
#

because you don't need to rewrite the whole file

finite bough
#

what if I want to get a info from txt file

slender thistle
#

Text files aren't the best logging practice but eh, if you do it right why not

#

ยฉ someone who doesn't log anything

quartz kindle
#

you get info by transversing the file using a stream

pale vessel
#

twitch?

finite bough
#

yt?

blissful scaffold
#

log files are not meant to get info from with the bot, they are only meant to have a log of errors and maybe some information for a human to read

copper cradle
#

pornhub?

pale vessel
#

no lol

quartz kindle
#

what is going on lol

pale vessel
#

well that escalated real quick

finite bough
#

quick log: from ram usage to streaming on pornhub

blissful scaffold
#

but where do you save your quick log?

pale vessel
#

on the stream

quartz kindle
#

anyway, depending on where your bot is hosted, it would probably be a better idea to log to console instead of files, but if you absolutely want to log things to files, use a text file and append data to it

#

then if you want to read this file, read it as a stream, you can even use node's built-in read-line module

#

that will enable you to process the file line by line without loading the entire file into memory

median ridge
#

I have a question, anyone can answer:
If you know the bot Tupperbox (runs on js or node.js), you would know that it makes "dummy" bots with various properties, also displayed as (BOT).
Is such thing possible to do in discord.py?

quartz kindle
#

you mean webhooks?

blissful scaffold
#

You mean like what happens in #bids ?

quartz kindle
#

webhooks are a message that appears as if written by a bot

pale vessel
#

those are webhooks

median ridge
#

And when you click the author of those written by Tupperbox, it shows a name and profile picture.

pale vessel
#

#0000

blissful scaffold
#

yes, it's webhooks

pale vessel
#

that would be the discriminator

median ridge
#

I need to figure out how it works more...

finite bough
#

tim

#

console doesnt stay forever

#

logs do

median ridge
#

So Tupperbox adds webhooks to every channel?

pale vessel
#

conclusion: logs can't be in the console

quartz kindle
#

a webhook is a way to send a message to discord without an account, it sends a message directly to a specific discord URL, that if allowed, will repost that massage in the according guild/channel

pale vessel
#

damn phone keyboard

quartz kindle
#

you can create a webhook in your guild settings

#

and then send data to the webhook url you created

median ridge
#

So how does Tupperbox send a message with a name and profile picture without said account

quartz kindle
#

a bot can do both, send data to this url, or create one if it has permissions and then send it

pale vessel
#

@median ridge webhooks.

#

my god.

quartz kindle
#

the data you send to the webhook includes ability to customize name and profile picture

median ridge
#

that makes more sense

#

Ok, I'll try my best to work it out on py

finite bough
#

@pale vessel I m ur god not webhooks

pale vessel
#

let me edit

quartz kindle
#

console logs dont stay forever, but usually logs are never meant to stay forever

slender thistle
#

discord.py has methods to send webhook messages with different names and images

finite bough
#

tim do u use css in astrobot

quartz kindle
#

a tiny bit

earnest phoenix
#

my bot is spamming welcome message

#
client.on("guildMemberAdd", async (member) => {
  const db = require("quick.db")
  var welcomechannel = await db.fetch(`welcomechannel_${member.guild.id}`)
  var Channel = member.guild.channels.find(c=> c.id === welcomechannel)
  if(!Channel) return;
  let embed = new Discord.RichEmbed()
  .setColor(config.Green)
  .setDescription(`Hello ${member.user.username}, and welcome to ${member.guild.name}!`)
  Channel.send(embed)
})```
quartz kindle
#

i didnt bother customizing the page much

earnest phoenix
#

why is it D:

finite bough
#

and canvas edit?

quartz kindle
#

ah you mean the image generation? it uses only canvas, js and fonts. no css

finite bough
#

@earnest phoenix have u ever used const db = require("quick.db") outside a code

earnest phoenix
#

umm probably

#

why?

copper cradle
#

yes

#

webhooks

finite bough
#

no I meant css and convas selerate

#

coz @earnest phoenix

#

either remove const inside the code

#

or use let in all the places instead

#

or var

#

ur wish

earnest phoenix
#

so i should not use const

#

just let or var

#

why is it ?

finite bough
#

const is used when u r declaring a common term for the whole file

quartz kindle
#

@earnest phoenix that is likely not the issue tho, show your message event

finite bough
#

which should not be changed

torn nebula
#

or maybe nested event

earnest phoenix
#

umm wait sending message event

#

oh wait let me fix somthing first

pallid zinc
#

How can I check if any moderator is online from a server
I try with forEach and as we know it send message for every person
I want only one message

pale vessel
#

??? @finite bough

quartz kindle
#

@pallid zinc wdym? explain better

finite bough
#

by their status ig

torn nebula
#

no

crimson vapor
#

You can filter the people with the MANAGE_MESSAGES perms and choose the first one?

earnest phoenix
#

just loop through the members, if their online and have moderator role, then add them to a list of online peeps

#

then do whatever you want with the list

finite bough
#

^

pallid zinc
#

Trying to make a mod-mail bot it's done but I want it to send a message if non of the moderator are offline

earnest phoenix
#

so.. you want them ALL to be onlline?

#

or at least one

finite bough
#

like an emergency system

earnest phoenix
#

oH

pallid zinc
#

Least one

earnest phoenix
#

yea so

crimson vapor
#

Ok

earnest phoenix
#

that'll do what you need

crimson vapor
#

So filter out the members that donโ€™t have perms and check if there are more than 0

earnest phoenix
#

if you dont wanna check for a role then check for certain permissions instead

crimson vapor
#

^

pallid zinc
#

If all moderator are off it send wait for some time

pale vessel
#

wdym?

earnest phoenix
#

Umm its fixed

#

what lang is this?

#

i had one of the codes in the message event by accident @finite bough

#

idk why

pallid zinc
#

@crimson vapor thanks I got it

pale vessel
#

oh. if all of the moderators are offline, it'll send a message telling to wait

crimson vapor
#

ok

pallid zinc
#

Yes flazepe

crimson vapor
#

D.js or py? Or java?

pallid zinc
#

Js

pale vessel
#

disgord

crimson vapor
#

v11 or v12?

finite bough
#

.presence.status

pale vessel
#

filter them to online and if it's empty, send the message

finite bough
#

if I would make a cmd to do that I will check if any of the mods have their status have dnd || online || idle

#

else message.channel.send(wait for some time)

pale vessel
#

or !== offline

finite bough
#

yes

earnest phoenix
#

pssst use \|

#

when you actually want a pipe

#

;p

pale vessel
#

|

#

\|

earnest phoenix
#

no i meant type it slash pipe

#

if they would have done dnd \| online \| idle

finite bough
#

endgame spoiler

pale vessel
#

he cba to do that

earnest phoenix
#

it wouldnt have happened ;p

#

it would have said dnd | online | idle

finite bough
#

reee

restive furnace
#

|ok|

#

||ok||

#

it only works with ||text||

earnest phoenix
#

ok then ||ok||

#

\ = character escape

#

\:) = :)

#

\*asdfasdf* = *asdfasdf*

#

etc

restive furnace
#

i can do without escape that :)

earnest phoenix
#

well yea

#

but

#

i have the switch on to autoconvert

#

lets me do both โค๏ธ and <3

#

<3 and \<3

small prairie
#

bot isnt responding

#

d.js

pale vessel
#

you gotta give more details than that man

slender thistle
#

details could help

small prairie
#

Yeah i'm getting on it man

slender thistle
#

good man

small prairie
#

the guildremove event gets fired everytime i restart the bot

#

no status

#

so i think

#

the ready event isnt firing

pale vessel
#

what that event for?

small prairie
#

guildDelete

pale vessel
#

yeah

small prairie
#

when the bot is remvoed from a server

pale vessel
#

I know

small prairie
#

So i log it in my console

pale vessel
#

I mean what does it do? Remove something from the database?

summer torrent
#

show your guildDelete code

pale vessel
#

oh

small prairie
#

nah just log in database

#

i mean

#

console*

pale vessel
#

can we see the code?

small prairie
#
client.on("guildDelete", guild => {
  console.log("Left a guild: " + guild.name);
});```
#

name is always undefined

#
Left a guild: undefined
earnest phoenix
#

cuz it already left

pale vessel
#

no

earnest phoenix
#

you cant get guild info if a guild you arent in tho?

small prairie
#

:/

pale vessel
#

it gives the guild data

small prairie
#

Yeah lmao

earnest phoenix
#

o

#

nvm then

small prairie
#

Lol

#

So any fixes?

#

I tried on vultr

pale vessel
#

try logging guild and see what it returns

small prairie
#

so i did a quick move to glitch

#

i mean when it wasnt working on vultr

pale vessel
#

try logging guild and see what it returns

small prairie
#

yeah doing it

#

@pale vessel Its back now
When i was asking for guild.name it was crashing
When i removed that and added just guild its working

#

I removed the full event

pale vessel
#

but it must return a collection

small prairie
#

It didnt fire when i edited

#

that guild didnt fire again

#

it might have got resolved

pale vessel
#

glad it worked out for ya

small prairie
#

Yeah thanks

plucky jewel
#

Guys

copper cradle
#

what

earnest phoenix
#

no

plucky jewel
#

Help me to downgrade discord.js

modest maple
#

What

copper cradle
#

npm i discord.js@<version>

#

first npm remove discord.js

pale vessel
#

11.6.1

earnest phoenix
copper cradle
#

then the other one

plucky jewel
#

What is a recommended version?

copper cradle
#

11.6.1

earnest phoenix
#

he just said

#

xD

plucky jewel
#

I understand

#

I installed node.js before

pale vessel
#

same

plucky jewel
#

Work!

#

Yeeeeboy

pale vessel
#

Nice!

#

yeah boiiiiiiiiiiiiiiiiiiiiiiiii

digital ibex
#

with eris

grim aspen
#

node [file]

digital ibex
#

ok

#

holy hell

#

that worked @grim aspen

#

time to see if the commands work

late hill
#

if you want node . to work make sure your package.json is configured properly

digital ibex
#

wait, i accidently done index.js which isn't my handler file

#

my handler file is bot.js

#

and same output

#

my bad

late hill
#

well

#

what is bot.js

copper cradle
#

@digital ibex show your index file

#

pretty sure you're not even authenticating

digital ibex
#

my index file is uh

copper cradle
#

copied again?

digital ibex
#

uh

#

no

copper cradle
#

show your file

digital ibex
#

literally two things were copied from that but ok

copper cradle
#

just

#

show your file

digital ibex
#

i am

copper cradle
#

so

#

run node index.js

pale vessel
#

easier, just show the directory tree

copper cradle
#

not really

#

if node isn't erroring it means the file exists

digital ibex
#

ok

late hill
#

that's the index file

digital ibex
#

it turns my bot online

#

yes

late hill
#

but you're saying you have an issue with bot.js

#

so like

#

post that instead

copper cradle
#

yeah

digital ibex
#

i did post my bot.js but i was told to post my index.js

pale vessel