#development

1 messages · Page 563 of 1

bright spear
#

you dont use Discord.Message

sick cloud
#

^

crude portal
#

In TypeScript I see someone doing js function rolesSetup(msg: Discord.Message){

sick cloud
#

thats typescript, you have to define what the interface is or it won't compile

#

Message is a class that contains everything for messages, you can't use it yourself

crude portal
#

Right...

#

Thanks!

crisp ledge
#

so yesterday i asked about why discordrb's play_dca was stuttering on heroku server

#

i have the metrics now

#

but idk how to read it

#

lol

sick cloud
#

because it's heroku

#

heroku is for web applications, not discord bots

crisp ledge
#

feels bad then i would host it on somewhere like digital ocean? lol

restive bough
#

Or vultr

#

Or ovh

crisp ledge
#

i have a droplet lying around so i can just use that

marble needle
#

if you have a vps lying around why deploy on free hosting

crisp ledge
#

bcus i am a newb web dev and when i wanna deploy heroku comes into mind

#

lol

restive bough
#

🙃

soft plaza
#

Can I use multiple machines to do sharding, or do all the shards have to run on a local instance?

late hill
#

You can

soft plaza
#

👌

pale marsh
#

That's the purpose of sharding to begin with

soft plaza
#

OK do you know if the sharding manager spawns a new shard, if it isn't online, or if it's not running on the local instance?

earnest phoenix
#

Which database is good```
Enmap vs RethinkDB

#

Enmap

#

oK

quartz kindle
#

lol...

late hill
#

I don't use a sharding manager so no idea

opaque eagle
#

Neither database is good tbh

sick cloud
#

enmap isn't a database

#

it's a provider wrapper

keen tinsel
#

selam kızlar sikim sızlar

amber fractal
#

Enmap does use sqlite for persistent storage, however

umbral field
#

@keen tinsel botun varmi

keen tinsel
#

yok

#

kardeş

#

senin sikin varmı

sick cloud
#

@amber fractal it can also use rethink, in memory, json, etc

gleaming glen
#

no turkish here omfg ANGEEERY

steel heath
#

>"senin sikin varmı"

slim heart
#

Nice

earnest phoenix
#

do you know them websites that tell you whether a website is safe? is something that does that but for discord users and discord servers against any discord api rules?

amber fractal
#

I mean I think they already exist

quartz kindle
#

yeah discord already has a url filter

amber fractal
#
Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.

earnest phoenix
#

not something on discord that tells you whether a website is safe. A website that tells you whether users and servers are good or bad.

slim heart
#

So like a list of servers that are bad and if it is it tells you or something??

quartz kindle
#

i think there were several attempts at doing that already

slim heart
#

It couldn’t be very good lol

#

There’s only so many servers that a bot will know is bad

amber fractal
#

You could make a report system

#

and base them off of user rep

marble needle
#

judging whether a server is "good" or not is very subjective. A server for black humour might be pretty lit for people who enjoy that type of humour but utter garbage for the ones who don't

amber fractal
#

But like I said I believe that already exists

last ferry
#

Is there a way I can easily see what part of my code is taking up cpu usage

#

Cause my bot’s cpu usage is pegged at like 80%-90% right now and I don’t know why

marble needle
#

probably some infinite loop that's hogging your cpu

#

just a wild guess though

last ferry
#

Ill have to go thru my code and see if I accidentally have any dead loops

#

Cause there shouldn’t be

inner jewel
#

using a profiler

earnest phoenix
#

I got a problem it says right hand side of instanceof is not an object

#

why

quartz kindle
#

post your code?

earnest phoenix
#

I copy someone’s file

#

So

marble needle
#

dont copy code you don't understand

#

as simple as that

earnest phoenix
#

:/

quartz kindle
#

@_@

#

copying code will not work 99% of the time, just so you know

#

because every piece of code depends on more code, and is designed specifically to work together with more code

#

you need to at least know how to connect pieces of code together

marble needle
#

copy all of the code = profit trollface

quartz kindle
#

even if you copy all code, it will still probably not work due to missing dependencies or environment mismatch

#

lmao

marble needle
#

tru

#

i mean, you can always resort to stackoverflow threads if you can't keep your shit together lillulmoa

quartz kindle
#

inb4 posts generic error on stackoverflow with no context

#

now im googling funny stackoverflow things

#
Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha```
marble needle
#

LOL

tulip ledge
#

Anyone who knows how I can set a background pic for the bot?

quartz kindle
#

with css

tulip ledge
#

Yeah

#

But what class/ID do I use to change it

quartz kindle
#

right click > inspect element

#

check the existing css structure

#

you can even add your css right there in the inspector to test it

silk elm
#

someone got a commando YTDL loop command I can borrow?

amber fractal
marble needle
#

how does one "borrow" code

silk elm
#

take it look at it and use some parts of it for its own

earnest phoenix
#

thats stealing

silk elm
#

how is that stealing if you ask for it

earnest phoenix
#

you didn't say ask for it

#

you said "take a look at it" ¯_(ツ)_/¯

silk elm
earnest phoenix
#

borrowing would imply you would return it

#

i wasn't referencing that

#

if i was, i would have quoted it

silk elm
#

why are you all making such a big deal for a loop command I can do it too but I just wanted to save time if someone would want some common code from me I would give it to him why not

earnest phoenix
#

ok

marble needle
#

the time you wasted arguing could've been invested into doing it yourself

silk elm
#

yeah 😦

earnest phoenix
earnest phoenix
#

How do u enable bots... anyone know??

marble needle
#

what does "enabling bots" mean in your context

earnest phoenix
#

I invited tickety and I don’t know who to make the commands work so I’m confused

quartz kindle
#

wrong server

marble needle
#

this isn't a bot support server

earnest phoenix
#

Oh okay sorry ;-;

sick cloud
#

@earnest phoenix type -help in the server

#

pretty sure ticket's prefix is still -

earnest phoenix
#

I tried that

#

But it didn’t work for me

#

@sick cloud it didn’t work for me

quartz kindle
#

check if the bot has enough permissions to read and write messages

earnest phoenix
#

Okay, I’ll try that... ;-;

#

Nope didn’t work ;-; @quartz kindle

quartz kindle
#

then ask in their support server

opaque eagle
#

Do you guys find the optional libraries for Eris to help with performance?

#

Like bufferutil, erlpack, zlib-sync, etc

quartz kindle
#

no idea, but i installed them

#

in d.js as well

opaque eagle
#

k

quartz kindle
#

the difference shouldnt be big though

opaque eagle
#

did u install all of them?

quartz kindle
#

the ones recommended

opaque eagle
#

wdym

#

There's no way to tell which one is recommended and which one isn't

quartz kindle
#

the ones that say its native and faster

opaque eagle
#

oh

quartz kindle
#

and zlib-sync instead of pako

inner jewel
#

native != faster fyi

opaque eagle
#

oh

inner jewel
#

it's not guaranteed to be faster

#

and there's the managed -> unmanaged gab which adds overhead

opaque eagle
#

When I tried out Eris for the first time, despite everyone saying it was faster, I found it to be kinda slow, in comparison to d.js

quartz kindle
#

well if they say its faster, they should have made extended tests on it to confirm no?

#

or would they just throw out words like that?

inner jewel
#

not saying it isn't faster

#

but assuming native is better is wrong

#

in fact, it's worse because you lose compatibility when you go native

quartz kindle
#

well i did say native and faster

#

but am i wrong in assuming that most often than not, native implementations should in theory be either faster or cost less resources because of not needing multiplatform/compatibility overhead?

#

if you're working on a server side system that isnt going to move anyway, going for native should be a good idea no?

inner jewel
#

if you got from managed -> unmanaged or unmanaged -> managed you always get overhead

#

managed = code that node fully controls

#

unmanaged = third party natives

#

if you never leave managed code node (or any other jit) is able to do more optimizations

quartz kindle
#

unless said code is orders of magnitude slower when performed by node

#

such as image compression/manipulation in pure js

#

another thing i found interesting was node/javascript's performance of searching arrays

#

i have a file with about 500k lines, and exec'ing grep is much faster than doing array.filter() with the entire file contents in memory (about 10mb)

inner jewel
#

because grep doesn't need to load it all in memory

quartz kindle
#

yeah, but i did the test with the file already loaded in memory

#

unless node swapped it out

inner jewel
#

depends on what your code is

#

¯_(ツ)_/¯

quartz kindle
#

i saved the array in a var, then timed the array filter function

inner jewel
#

eg if you compile the pattern on every iteration

#

it'll be slow

sick cloud
#

how do you fix that issue where your bot replies to any {x}-length prefix

inner jewel
#

you check if the content starts with the prefix

sick cloud
#

i do that but it replies to any of those length

inner jewel
#

then you're not checking if it starts with

sick cloud
#
const p = prf.find(pre => msg.content.startsWith(pre));
if (!p || msg.author.bot || !msg.guild) return;

like the default is -

#

but it replies to ! and all

quartz kindle
#

arent you going through all of your prefixes until it finds one that matches?

amber fractal
#

^

quartz kindle
#

lmao

amber fractal
#

Thats looking at everyones prefixes

#

not a specific guilds

#

unless prf is the prefix(es) of that guild

sick cloud
#

prf is that servers yes

#

thing is though it is checking

#

it matches

inner jewel
#

why don't you try using a debugger instead of guessing

sick cloud
#

because i can't really launch it right now while my internets being hugged up by a download

marble needle
#

input[0] is gonna be the prefix so you can compare that against the server's prefix

#

old code but does the job

sick cloud
#

i use find on an array because i have to check for multiple

#

so nothing i can change there

marble needle
#

ah rip

amber fractal
#

you can check if the array includes the prefix

sick cloud
#

thats what i'm doing already??

amber fractal
#

I mean what I just did worked but its ugly mmLol

restive halo
amber fractal
sick cloud
#

yeah

#

@restive halo what library is that

restive halo
#

Uses js though

marble needle
#

if only there were other options that are maintained

sick cloud
#

it's unratelimited and poorly designed

#

you can switch to discord.js

restive halo
#

How much code will I have to change for that

amber fractal
#

just about 100%

restive halo
#

Oh boy

amber fractal
#

Posting stats uses the token as authorization right?

#

Does it take a minute to work because I keep getting unauthorized

steel heath
#

"Authorization"

amber fractal
#

Yes

#

In headers

#

I know I've posted stats before

#

All working now, not sure what it's problem was

quartz kindle
#

it uses the dbl token, not the discord token

#

unauthorized means the token is wrong

amber fractal
#

I didnt use discord token

#

Its working now

#

I didnt change anything

marble needle
quartz kindle
#

LOL

earnest phoenix
#

How long does it take to make a bot? ;-; I don’t understand coding :/

#

as long as you want to code it

#

;-;

#

Ok

#

it actually depends on what type of bot you're making

quartz kindle
#

if you dont understand what you're doing, it will basically take forever

#

if you're very good at what you're doing, it depends on what kind of features you want, and how many

topaz fjord
#

@marble needle I mean it's EA

#

what did you expect

daring trellis
#

How to find out number of shards bot?

marble needle
#

Yea but damn how do you let this through onto prod, don‘t they review their code

zinc pawn
quartz kindle
#

target.member doesnt exist

#

target is already a member

#

you're doing member.member basically

zinc pawn
#

🤦

earnest phoenix
#

how can i make my bot play 1 specific youtube video in a voice channel with a command?

#

would it be something like await connection.playStream(https://www.youtube.com/watch?v=XAX-f4Q7If0, { filter: 'audioonly'}));

formal agate
#

In Discord.js I want to list every channel the bot can see. In order to do so I need to break up the following string but I have no clue on what to use. let guildArray = client.channels.array(); message.channel.send(guildArray);

quartz kindle
#

@earnest phoenix depends on what library/package you're using for audio

#

@formal agate every channel from all guilds?

#

btw dont send a message to all channels

formal agate
#

Can be per guild

quartz kindle
#

thats api abuse and might get you banned

formal agate
#

I’m not

#

That would be dumb anyways

quartz kindle
#

if you want the channels from the current guild, do message.guild.channels

amber fractal
#

just client.channels.map(c => c.name)

quartz kindle
#

to list them you need to create a string

formal agate
#

I need it to trigger outside of a message event

#

Ok

#

Umm

earnest phoenix
#

i guess im using ytdl

quartz kindle
#

then do client.guilds.get(id).channels

amber fractal
#

Oh he wanted perguild?

formal agate
#

I still need to break it up because it quickly gets over 2k characters

amber fractal
#

allow splitting

formal agate
#

Which is the main issue

amber fractal
#

Its an option in messages

formal agate
#

?

quartz kindle
#

you can break the message up using the split options

amber fractal
#

{split:true}

#

defaults to newline split

quartz kindle
#

.send(message,{split:{splitoptions}})

#

or split:true

formal agate
#

Split breaks up per 2k?

quartz kindle
#

default is 1950

formal agate
#

Hmm ok

amber fractal
#

or what you specify

formal agate
#

Ok

#

I never knew that

#

That you

amber fractal
earnest phoenix
#

Hey how could i make my bot leave a voice channel after a certain amount of time?

#

so like 15 seconds

marble needle
#

look into setTimeout

quartz kindle
#

from the beginning or after it stops playing?

earnest phoenix
#

15 seconds from when it starts

quartz kindle
#

use setTimeout

earnest phoenix
#

probably better if i do it for when it stops playing though for future refrences

quartz kindle
#

you can also use setTimeout for when it stops playing, but you should also use clearTimeout to cancel it if it starts playing again before leaving

earnest phoenix
#

okay thanks

#

Problem is , im not trying to timeout the command , im trying to run a different command after a certain amount of time

marble needle
#

thats literally what setTimeout does

#

runs a function after a certain time

amber fractal
#
//whatdo
}, ms)```
earnest phoenix
#

oh so i guess im using it wrong

marble needle
#

you're not supposed to timeout your entire command

#

only the part you want to delay

quartz kindle
#

check w3schools and mozilla dev website

#

they explain very well how to use setTimeout and clearTimeout

earnest phoenix
#

okay ill check it out so i can learn more about it and thanks bentley that helped

amber fractal
#

No problem, Bentley; here to help.

restive halo
marble needle
#

missing the second '

earnest phoenix
#

Lmao

restive halo
#

Oh fuck I'm blind lol

marble needle
#

you can take screenshots ya know

earnest phoenix
#

Yes i'm agree

#

You're blind

restive halo
#

Not on the OS I'm using

#

My windows broke and the linux distro I'm using is weird

sick cloud
#

kshare exists iirc

#

the distro should come with some kind of ss tool

hazy flame
#

so I'm trying to create a very basic command for a more or less test command for what my goal is to be a reminder bot.

#

I keep getting an error in the file for the command it class saying that client is undefined.

amber fractal
#

then client isnt defined

#

is this all in the same file

#

or is it seperate files

hazy flame
#

for the command

amber fractal
#

Yes, is it in a different file than your main file?

hazy flame
#

Yes it is but I should have it so that it extends properly

amber fractal
#

What lang/lib are you using?

hazy flame
#

JavaScript discord commando

amber fractal
#

you have client defined as your new Discord.Client() then?

hazy flame
#

yes

amber fractal
#

Alright

#

I dont use Commando

#

Ill look up some stuff in a sec

steel heath
#

i'd really like to know how they make those const, var, let things italic

amber fractal
#

wym

hazy flame
#
 commandPrefix: '!', ```
steel heath
#

@amber fractal you can see it on your screenshot up there

#

its italic

hazy flame
#

sorry I can't get the formatting for the codeblock right but you get the idea.

amber fractal
#

Yes it is

#

thats just my editor

#

Its an online one because Im forced to use chrome os

hazy flame
#

oof

amber fractal
#

and I cant download any actual programs/apps

steel heath
#

uh thats sad

amber fractal
#

Ik

steel heath
#

cant you install another os to chrome devices?

amber fractal
#

Its a school chromebook

inner jewel
#

making it italic isn't that hard after you have a proper editor for <lang>

hazy flame
#

oof

steel heath
#

im talking about editing my current theme

keen drift
#

aren't chrome devices arm

amber fractal
#

I'm saving up for my cpu for my pc rn

hazy flame
#

there we go fixed the code block

fierce trail
keen drift
#

gonna need to show code buddy

#

did you wrap it in quote

inner jewel
#

you need to make the token a string

#

you're doing .login(TokenGoesHere) but it should be .login("TokenGoesHere")

amber fractal
#

unless you're using a defined variable that is a string

restive halo
#
    throw err;
    ^

SyntaxError: /home/marv/config.json: Unexpected string in JSON at position 74```

Getting this now
fierce trail
#

`import discord

client = discord.Client()

@client.event
async def on_ready():
print("The bot is ready!")
await client.change_presence(game=discord.Game(name="Making a bot"))

@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content == "Hello":
await client.send_message(message.channel, "World")

client.run("my token is here")`

now im getting an error that says
The bot is ready! Ignoring exception in on_ready Traceback (most recent call last): File "C:\Users\trevor\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 227, in _run_event await coro(*args, **kwargs) File "C:/Users/trevor/Downloads/testbot.py", line 8, in on_ready await client.change_presence(game=discord.Game(name="Making a bot")) TypeError: change_presence() got an unexpected keyword argument 'game'

amber fractal
#

@restive halo at position 74, you have an unexpected string

keen drift
#

TypeError: change_presence() got an unexpected keyword argument 'game'

ruby dust
#

if you are using the correct version of discord.py, game is deprecated and is replaced with activity

restive halo
#

Not sure what the unexpected string could be, its just got the token and prefix in

keen drift
#

The problem is on this line await client.change_presence(game=discord.Game(name="Making a bot"))

amber fractal
#

there may be an extra string or a key without a value or a value without a key

fierce trail
#

so i was using the tutorial as a guide, but then i just copy pasted the tutorials code exactly how it says how to do it, and got that error

amber fractal
#

then its outdated

ruby dust
#

yes, read my message

hushed berry
#

can someone help me run my bot on my chromebook

fierce trail
#

so just change game to acitvity

ruby dust
#

yes

keen drift
#

b0 t um 0n chr0meb00k

restive halo
#

Checked over it a couple times (had an equals instead of : but that hasnt fixed it) made sure the token was correct but its still saying the same error

#

Does json not like "%" or something?

fierce trail
#

works now, thanks

lucid yacht
#

any idea why the bot list says my bot is offline, or rather grey w/ "???"

amber fractal
#

@restive halo can you show your json file, omit the token obviously

ruby dust
#

it means it's not in this server for some reason

#

luca is not able to fetch your bot's status

vernal rivet
lucid yacht
#

interesting, not sure why that would happen

hushed berry
#

check mod-log

amber fractal
#

It could be kicked

#

could've been*

ruby dust
#

I checked for him, there are no logs

amber fractal
#

@lucid yacht can you ping the bot?

vernal rivet
#

Nik you can use codenvy.io to create and run a bit on a chromebook

hushed berry
#

i was memeing korean

vernal rivet
#

Oof, but it still works

lucid yacht
#

I don't have a ping set up, it's working in every other server though

restive halo
#
        "token":""
        "prefix":"%"
}```
inner jewel
#

missing a comma

amber fractal
#

no comma

inner jewel
#

values are comma separated

vernal rivet
#

Oof

inner jewel
#

{"k1": "v1", "k2": "v2"}

#

vs

#

{"k1": "v1" "k2": "v2"}

amber fractal
#

@lucid yacht not like that I mean @mention it

restive halo
#

Ah, didn't know that, only had one value in the json previously

ruby dust
#

it's no here, I checked

amber fractal
#

Then theres the problem

lucid yacht
#

nah, it's not in the list

#

weird, wonder why it was approved but not added

ruby dust
#

ask a mod

lucid yacht
#

okay

#

well the rules are a little confusing, it says I shouldn't tag them so I have no idea how to ask them

sick cloud
#

mention a mod

vernal rivet
#

If your ping them for a good reason then your fine

lucid yacht
#

@loud salmon you look cool, I choose you

amber fractal
#

Spider is a pokemon now

lucid yacht
#

I'm having an issue with my bot not being on the server, but was approved

vernal rivet
#

goes offline

sick cloud
#

spoods is on mobile

#

@gleaming glen do you wanna help

lucid yacht
#

poor guy is coding, I wanted to leave him alone

vernal rivet
#

Don't ping multiple mods at once

#

Just ping one, and wait for them to reply to you

fierce trail
#

line 15, in on_message
await client.send_message(message.channel, "My commands are test! help")
AttributeError: 'Client' object has no attribute 'send_message'

@client.event async def on_message(message): if message.author == client.user: return if message.content == "test! help": await client.send_message(message.channel, "My commands are test! help")

sick cloud
#

@ moderators

gleaming glen
#

It does not seem like it got kicked

vernal rivet
#

Oof that's py bot, I don't do py

lucid yacht
#

yeah I'm not sure what happened, it was tagged in the log when I was approved which (I assume) means it was in here at one point

restive halo
#

Got it running again but the commands wont work now

gleaming glen
#

I think the mod who approved it forgot to add it here, because there's no modlog cases

hazy flame
#

so I am trying to create a basic coin flip class for my bot bc I am real new to this, but it keeps saying client does not exist

lucid yacht
#

oh okay

hazy flame
#

I have intialized client properly

gleaming glen
#

I added it. Next time you can use #general or dm a mod for this kinda stuff

lucid yacht
#

Gotcha, very good to know, I was confused about how to go about it thank you

vernal rivet
#

What language mjolnirs

hazy flame
#

Js

vernal rivet
#

I would just use the math.random method, with parameters of 0 and 1, and have coin equal the result, and if coin equals 0 then have it send a message saying it's head, and if it's equal to 1 then have it send a message saying it's tail. That's what I would do

quartz kindle
#

he said his problem is that client doesnt exist

hazy flame
#

It says it doesn't exist, when I've intialized it properly

quartz kindle
#

show your code?

hazy flame
#

Just a sec.

vernal rivet
#

Oh oof, do you const client = Discord.Client();

hazy flame
#

const client = new CommandoClient and changing the command prefix to exclamation point, and with the owner id

vernal rivet
#

OwO, tim you can handle this, I never worked with commando

quartz kindle
#

me neither, but lets see

#

can you post your full code?

earnest phoenix
#

Hey im working on a command rn , im not getting any errors but my bot doesnt add songs to a queue instead it just stops what its playing and plays the next song. can someone help me find whats wrong? https://hastebin.com/sibefegapa

vernal rivet
#

Did you push the song that's been requested?

hazy flame
#

(this is the way the discord documentation for commando sets it up as well)

earnest phoenix
quartz kindle
#

@hazy flame thats not what is says here

#

for v11 at least

#
const Commando = require('discord.js-commando');

const client = new Commando.Client({
    owner: '1234567890'
});```
#

missing the dot

hazy flame
#

oh fair

#

I just changed my font because it was hardly readable

inner jewel
#

const { Client } = require(commando) works too

#

then you can do new Client()

quartz kindle
#

@earnest phoenix everytime the command is run you are creating new variables, so your command never sees any queue

#

because it creates a new empty queue every time

blazing star
#

yes

#

this is why maps r gud

earnest phoenix
#

hmm

blazing star
#

or extend the base client

hazy flame
#

even changing this to what is shown in your codeblock does not fix the issue

#

...

inner jewel
#

also fix your indentation

quartz kindle
#

@hazy flame did you change your commando variable too? you created it as CommandoClient instead of Commando, so if you want to keep it that way, you have to use new CommandoClient.Client()

inner jewel
#

const { X } = y is different from const X = y

#

first one is const X = y.X

topaz fjord
#

^

hazy flame
#

ohhh ok

inner jewel
#

const { Client } = require("discord.js") works for example

blazing star
#

circular json

#

wait no

inner jewel
#

because require("discord.js").Client is valid

blazing star
#

but not the proper way

#

object destructuring is

quartz kindle
#

wait, then the way he was doing it fom the beginning should have worked

fierce trail
#

line 15, in on_message await client.send_message(message.channel, "My commands are test! help") AttributeError: 'Client' object has no attribute 'send_message' @client.event

async def on_message(message):
if message.author == client.user:
return
if message.content == "test! help":
await client.send_message(message.channel, "My commands are test! help")

blazing star
#

i s t h a t d . py

#

bruh

#

is that stable or rewrite

#

or async

inner jewel
#

@quartz kindle CommandoClient isn't exported by commando

blazing star
#

too many branches

quartz kindle
#

wait no

#

if he wants to destructure it, he has to call the correct name, not an arbitrary name

inner jewel
#

what he was doing is equivalent to const CommandoClient = require(commando).CommandoClient

#

yes

blazing star
#

it’s possible

#

const { value: someName } = obj

quartz kindle
#

yeah so either { Client } or whatever then whatever.Client()

earnest phoenix
#

how can i stop my command from running new variables?

blazing star
#

👏

inner jewel
#

let {key: variableToBind} = value;

quartz kindle
#

you need to save something outside of your function

inner jewel
#

let/const

blazing star
#

or

#

add it to the Client instance

#

<Client>.key = value

earnest phoenix
#

okay looks like this is going to be a fun project LOL

quartz kindle
#

@earnest phoenix either create an object when your bot starts, then save and retrieve data from it, or assign a storage area to an existing object that you can access from the function, such as client

fierce trail
#

can someone pm me to help me with python

quartz kindle
#

for the record

#

the commando issue was this

earnest phoenix
#

someone know a autoreload ?

quartz kindle
#

what do you mean an autoreload?

amber fractal
#

instead of doing a reload command, changes are applied automatically?

keen drift
#

so a hot-reload?

inner jewel
#

you'll need to watch the fs for changes

quartz kindle
#

or just use something like pm2 --watch

inner jewel
#

pretty much every OS you'll use has a method for that

#

pm2 watch restarts the whole process

#

which may not be the wanted behaviour

quartz kindle
#

clear cache and re-require the file everytime a command is run, like some dude was doing lmao

#

this is a joke

topaz fjord
#

I only clear cache and re-require when an update happens to a command

#

but I do it manually

#

fun fact wsl doesn't like to work when you log in and out

inner jewel
#

just don't log out

keen drift
#

fun fact, it still doesn't work with docker

#

so I'm sad

inner jewel
#

it does

#

you can't run dockerd in wsl

#

but you can run docker for windows

#

and use it from wsl

keen drift
#

yeah I need the daemon

inner jewel
#

just run docker for windows then

#

¯_(ツ)_/¯

keen drift
#

also the kitematic for docker for windows is broken

inner jewel
#

just use the command line

#

¯_(ツ)_/¯

#

docker ps, docker container ls --all

#

docker image ls

keen drift
#

I use it to browse the docker repos/w/e

earnest phoenix
#

help me host a bot on linux

earnest phoenix
#

Can someone make a discord bot?

#

for cheep?

sick cloud
#

if you wanna post a job talk to oliy

earnest phoenix
#

@earnest phoenix how much

#

and what does it do?

slim heart
#

how can i use Date to get the full "january" word
like i got new Date().toString()
but that'll give me Jan

sick cloud
#

use an object of names?

amber fractal
#

Convert jan to January

sick cloud
#

'Jan':'January'

amber fractal
#

^

slim heart
#

theres no auto way of doing it?

amber fractal
#

Unless you wanna download a package for it, which would be pointless

#
'Jan':'January',
'Feb':'February'
//...
}
convert["Jan"] // "January"```
slim heart
#

h ok

lusty dew
#

how could I write data to a file?

#

then send the file

#

to a specific channel

#

using fs

amber fractal
#

fileStream?

#

Oh

sick cloud
#

why write it though

amber fractal
#

It may be too big to send

#

but you could split it tho

#

but might annoy some people

lusty dew
#

The file will be sent to a dev channel

amber fractal
#

do you know how to attach files to a message?

lusty dew
#

Nope

amber fractal
#

What lib are you using?

lusty dew
#

D.js

amber fractal
#

has some examples

lusty dew
#

I haven't used D.js in so long I forgot there was a Docs

amber fractal
#

Lol

lusty dew
#

Also

#

how would I actually write the data to the file

#

I had an example before

#

and I asked if it was correct and someone said no

#

even though I did what the docs said

amber fractal
#

should be what you want

lusty dew
#

Mk

#

Also

#

How I can attach a file to an embed

sick cloud
#

embed, files

lusty dew
#

sendFile is depricated

sick cloud
#

just add it alongside

#

send

amber fractal
#

wait you can embed files?

#

Like a text file?

lusty dew
#

Think so

#

using the

#

.attachFile

#

or .attachFiles

amber fractal
#

Thats a thing

lusty dew
#

Mhm

#
fs.writeFileSync(`${code}.txt`, err.stack)
#

Is this how i'd do it?

amber fractal
#

you're writing an error then?

#

Should do

lusty dew
#

Mk

#

Should I make it a variable?

#

so I can do

amber fractal
#

no, it returns undefined

lusty dew
#

Hm?

amber fractal
#

writeFileSync returns undefined

#

it wont have a valut

#

value*

#

You in dev tony

sick cloud
#

i can take a pic of mine actually if wanted

#

whatwhat

lusty dew
#

Nice shirt

#

xd

amber fractal
lusty dew
#

Also

#

what do you mean it can't have a value?

amber fractal
#

If you try and save that as a var it will be undefined

sick cloud
#

oh i see

lusty dew
#

Oh ok

#

should I use

sick cloud
#

gg channel switcher

lusty dew
#

writeFile instead?

#

if I want to save it as a var

amber fractal
#
class Shirt extends Tony{
constructor(tony, shirt){
super(tony)
this.shirt = shirt
}
}```
#

Wait

quasi forge
#

You'll have to write and then read again @lusty dew

amber fractal
#

^

#

if you just want to send the file

sick cloud
#

bad

amber fractal
#

just send it as an attachment

quasi forge
#

^^

lusty dew
#

read the file?

amber fractal
#

you dont need to read it if you're just sending it as an attachment

lusty dew
#

Well I was going to have it save to a folder as well

amber fractal
#

yes

lusty dew
#

just in case if it doesn't send to channel

#

it will be in a folder

amber fractal
#

after you write it just send it as an attachment

lusty dew
#

Mk

#

But can't I also just use writeFile?

#

what is the difference between writeFile and writeFileSync?

amber fractal
#

WIll fs write to a file that doesnt exist to create it?

quasi forge
#

I think what you're trying to do is save the logs in a txt file just in case

#

Yes @amber fractal

amber fractal
#

writeFile as a callback iirc

#

has*

lusty dew
#

Ye

#

it does

quasi forge
#

Fs automatically creates a file if u try to write in a file that doesn't exist

#

If u use writeFileStream tho

amber fractal
#

then you can use writeFile, but it wont make a difference as you'd be sending it as an attachment anyways

lusty dew
#

Yea I know

amber fractal
#

and the callback is only an error

lusty dew
#

and I am writing an error to the file

#

hm doesn't make sense lel

quasi forge
#

WriteFileSync is more appropriate as when your app has many tasks at hand writeFile usually messes up whatever it has to write

lusty dew
#

ima just use fs.writeFileSync

#

I wanted to like

#

save the file to a folder as well then send to a channel

amber fractal
#

writeFile is for if (err) throw err; type of stuff

lusty dew
#

so in case it doesn't send to a channel hopefully it will save to a folder

quasi forge
#

Oh

#

K

amber fractal
#

you could just try and catch then write on catch to save space

quasi forge
#

^^

lusty dew
#
            try{
                let format = "tc!poll <title> <question(s)>"
                let title = args[1]
                if(!title){
                    return message.reply(`Didn't supply a Title! : ${format}`)
                }
                let question = args.join(' ')
                if(!question){
                    return message.reply(`You didn't supply a question(s) : ${format}`)
                }

            }catch(err){
                if(err){
                    let code = Math.random(s)
                    fs.writeFileSync(`${code}.txt`, err.stack)
                }
            }
#

I am doing a try and catch

#

lele

quasi forge
#

Oof

#

Nice

amber fractal
#

Oh

lusty dew
#

Yea I always use try and catches when messing with errors

amber fractal
#

if its a promise you can just use .catch()

#

(reply is a promise right?)

lusty dew
#

Hm

#

forgot about that

slim heart
#

yees

lusty dew
#

Gotta change that to channel send

slim heart
#

channel send is also a promise

amber fractal
#

<channel>.send is also a promise

#

wait Im late

lusty dew
#

Oof didn't know

slim heart
#

👀

lusty dew
#

that

#

I only knew reply was a promise

#

fuck meh

amber fractal
#

it doesnt matter tho

lusty dew
#

Really?

#

I thought i'd have to resolve the promise or smth

slim heart
#

reply is just a fancy channelsend that adds @ User,

amber fractal
#

no

lusty dew
#

Yea

amber fractal
#

Well yes

#

no to Panda

lusty dew
#

That is why I usually use reply

amber fractal
#

you dont need to resolve it

sick cloud
#

i use send

amber fractal
#

it would be good to use await tho

#

if your function is async

slim heart
#

i use reply when there are unexpected errors cuz im too lazy to write out the whole thing that would likely only be seen by me so idrc if it looks perty

amber fractal
#

I use await on just about every line mmLol

lusty dew
#

Mk

#

Hm

#

ima try and figure out how to save the file to a folder

amber fractal
#

./path/to/${code}.txt

quasi forge
#

instead of file_name.txt u use folder/file.txt

#

don't use ./ in fs

slim heart
#

or ./ if ur paranoid

#

excuse u

amber fractal
#

Wot

quasi forge
#

lol

slim heart
amber fractal
#

./ goes the the processes file

slim heart
#

yes

#

if ur paranoid

amber fractal
#

./entire/path/that/you/want/i/dont/actually/care/${code}.txt

quasi forge
#

u don't need ./ in fs.writeFileSync

slim heart
#

because sometimes fs just does stupid shit and goes to a different directory and screws up

amber fractal
#

I prefer to do that tbh

slim heart
#

bentely thats just exaggeration

amber fractal
#

because all my files come from that

quasi forge
#

fs automatically prepends the directory

slim heart
#

have fun thanks

lusty dew
#

how would I read the file so I can send it to a channel as well?

slim heart
#

readFileSync

amber fractal
#

you're right, my bad it should be ./this/is/a/file/path/because/you/wanted/a/real/path/for/some/reason/and/this/is/definitely/a/real/path/${code}.txt

slim heart
#

or readFile if u know how to do calls

#

its more like ./path/maybe-another/${code}.txt

lusty dew
#

so basically

quasi forge
#

I'll be going

lusty dew
#
fs.readFileSync('errors/${code}.txt')
quasi forge
#

^^^

amber fractal
#

read it in utf8

lusty dew
#

Mk

#

should I also write it in utf8?

quasi forge
#

doesn't actually matter cuz that's default

amber fractal
#

it defaults to utf8

#

read doesnt

lusty dew
#

Mk

amber fractal
#

does it?

quasi forge
#

read too lol

#

both default to utf-8

amber fractal
quasi forge
#

hmm

amber fractal
#

default null

slim heart
#

you have to parse it

#

i think

amber fractal
#

no just do fs.readFileSync("path", "utf8")

lusty dew
#
fs.readFileSync(`errors/${code}.txt`, 'utf8'
#

then I can do something like

#

.send right

#

or

slim heart
#

yea sure

quasi forge
#

utf-8 not utf8

lusty dew
#

I would get the channel I want it to send to then send it

amber fractal
#

no its just utf8

quasi forge
#

its utf-8

slim heart
#

just do var = fs.readFileSync etc.
then .send(var after whatever formatting if any

quasi forge
amber fractal
lusty dew
#

It is utf8

slim heart
#

they both work guys

amber fractal
#

the node docs use utf8

slim heart
#

calm ur tits

lusty dew
#

Yea

#

xD

#

I was about to say

#

utf8 or utf=8

#

utf-8*

amber fractal
#

Use utf8 or die

slim heart
#

utf=8

amber fractal
quasi forge
#

why have I been doing nothing this entire time

#

Oh, I used readFile not readFileSync

amber fractal
#

message.channel.send(fs.readFileSync("path", "utf8"))

#

my bad a better way to put it would be <Channel>.send(fs.readFileSync(`path/${code}.txt`, "utf8"))

quasi forge
#

sorry wrong channel

lusty dew
#
                if(err){
                    let channel = message.guild.channels.get('540406836311097374')
                    let code = Math.random(s)
                    fs.writeFileSync(`errors/${code}.txt`, err.stack)
                    channel.send(fs.readFileSync(`errors/${code}.txt`, 'utf8'))
                }
#

I just did this

amber fractal
#

yep that should work

lusty dew
#

Mk

#

Lets test it xd

amber fractal
#

but if your sending what you wrote why not just send err.stack

#

?

lusty dew
#

?

quasi forge
#

lol yea

amber fractal
#

your sending what you wrote

#

which is err.stack

#

channel.send(err.stack) would be identical

quasi forge
#
                if(err){
                    let channel = message.guild.channels.get('540406836311097374')
                    let code = Math.random(s)
                    fs.writeFileSync(`errors/${code}.txt`, err.stack)
                    channel.send(err.stack)
                }
amber fractal
#

wait

#

wot

#

err.stack isnt his file mmLol

quasi forge
#

my bad

lusty dew
#

But if the error exceeds 2000 character limit

amber fractal
#

then it wouldnt send anyways

#

your not attaching it as a file

lusty dew
#

Hm?

amber fractal
#

when you read the file, you're getting the contents of the file i.e err.stack

lusty dew
#

Mk

#

I am trying to send the file to the channel

amber fractal
#

if you want to attach it, then send the file

lusty dew
#

That has nothing in it about attaching files

#

except

#

sendFile

#

and sendFiles

amber fractal
lusty dew
#

which are depricated

#

deprecated*

amber fractal
#

it has an example on how to send files

#

what I just sent isnt depracated

#

deprecated*

lusty dew
#

Mk

#
                    channel.send({
                        files: [{
                            attachment: `errors/${code}.txt`,
                            name: `${code}.txt`
                        }]
                    })
amber fractal
#

Should do

lusty dew
#

K

#

Thanks

amber fractal
#

Test and come back if it fails

lusty dew
#

Now time to try and find out how to make an error uwu

amber fractal
lusty dew
#

Hm?

amber fractal
#

Thats how you throw errors

#

if you just want it to go to catch

#

thts mdn's example code

#

you can just throw new Error("Blob")

lusty dew
#

Mk

trail trout
#

how to make an api wrappers on html?

#

is there any tutorials, i want to learn it

mossy vine
#

@trail trout what

trail trout
#

kinda like...

#

websocket

mossy vine
#

you want to make an api?

trail trout
#

yes

mossy vine
#

look into express

trail trout
#

ok now?

mossy vine
#

???

trail trout
#

well get it

mossy vine
#

you can make a webserver with express, and you can use it as an api

trail trout
#

many examples here on the express github

mossy vine
#

i have an example for it, give me a sec

trail trout
#

ok

mossy vine
#
var express = require('express')
var app = express()

app.get('/', (req, res) => {
    res.send('Hello World')
})

app.get('/randomnumber', (req, res) => {
    res.send(`${Math.random()}`)
})

app.get('/418', (req, res) => {
    res.sendFile(__dirname + '/images/teapot.jpg')
})

var server = app.listen(8081, () => {
    var host = server.address().address
    var port = server.address().port
    console.log("Example app listening at http://%s:%s", host, port)
})```
#

@trail trout

trail trout
#

hmmm...

#

kinda...

mossy vine
#

so basically

#

app.listen starts the webserver

#

app.get('destinationorwhateveryoucallit', callback) will be a GET request

#

so when you use this api

#

but you can do like

#

app.post and it will need a POST request

#

you get it

trail trout
#

Ohhhh

#

I get it now

restive halo
#

Was wondering for allowing prefix changes. Could I store server ID and the prefix they use in a separate json file?
Then access it like file.serverID

marble needle
#

you should look into databases (spoiler: json is not a database)

#

you could store it as a json object but there are better alternatives

restive halo
#

Fair point. I'll look into it in a bit

grim aspen
#

How do I keep my bot from pinging other bots and users when it’s not allowed to? I’ve looked through my codes multiple times and nowhere does a script tell it to ping random users and bot

restive halo
#

What library are you using?

grim aspen
#

Discord.js

marble needle
#

what causes your bot to ping people, is it a command or any message?

grim aspen
#

It does it when I tell another bot to tell a command

marble needle
#

mind sharing your message handler

#

if its too long hastebin it

#

your <client>.on('message' (msg) => {}}); code

grim aspen
#

example code:

#

client.on('message', msg => {
if (msg.content === '!Lksjjd Are you online?') {
msg.reply('Im online');
}
});

marble needle
#

is this your code or example code you just came up with

grim aspen
#

one of the codes

marble needle
#

alright so 1.)choose a different prefix, ! is way too common and you'll run into issues down the road
2.) ignore messages sent by other bots
3.) ignore messages that don't start with the prefix you chose

quartz kindle
#

@grim aspen .reply() always pings the person its replying to

#

use .send() instead

marble needle
#

wait it does? damn

#

what a meme lib

grim aspen
#

thonkku k 👍

quartz kindle
#

its the same as if you hit the reply button on any other social media website, such as facebook, twitter, youtube comments, etc... it will always mention the user you're replying to

grim aspen
#

i'll get back with results

marble needle
#

the more you know i guess, will keep that in mind thank tim

grim aspen
#

that might've actually fixed the problem

#

it did

daring trellis
#

How to change the name of the voice channel with a specific ID?

marble needle
#

which lib

daring trellis
#

Javascript

marble needle
#

language != lib(rary) heavythonk

daring trellis
#

?

marble needle
#

which library are you using

#

discord.js? eris? what is it?

#

javascript is not a library

daring trellis
#

discord.js)

marble needle
#

guild.channels is a collection of all channels in said guild, loop through that to get the VoiceChannel you need and use <channel>.setName() to change its name

daring trellis
#

Thanks

grim aspen
#

it says "message.send" isn't a function

#

but it somehow stopped replying to other bots

amber fractal
#

<Channel>.send

#

where <Channel> is a TextChannel object

grim aspen
#

k

#

so do i put what you said exactly?

amber fractal
#

No

#

It changes per basis

#

whatever you textchannel object is

#

You're using discord.js right

grim aspen
#

yes

amber fractal
#

Then yes, <Channel>.send

grim aspen
#

k

quartz kindle
#

if you're working on a received message, just get the channel from the message

#

like message.channel.send

grim aspen
#

oh wait

#

i put message.send

#

it doesn't recognize "message"

#

nevermind

marble needle
#

it's message.channel.send

grim aspen
#

it worked finally

quartz kindle
#

missing permissions doesnt tell you which line, you have to figure out on your own

daring trellis
#

How to write a message to a channel with a specific ID?) I'm really noob

earnest phoenix
#

provide your lib and lang

grim aspen
#

Anyway to keep my bot online?

#

24/7

earnest phoenix
#

buy a vps

grim aspen
#

K

earnest phoenix
#

providers like DigitalOcean, OVH, Scaleway etc. should be good enough

quartz kindle
#

@daring trellis if you're using discord.js, its channels.get(id).send()

#

you can get channels either from client or from guild

signal prairie
#

@earnest phoenix I actually host my bot for free tho

#

And it wont go offline

earnest phoenix
#

your bot is bad then

signal prairie
#

You know crysto bot right?

earnest phoenix
#

it's a fact that bots hosted on free hosting are mostly unpopular and trash because their owners are cheapskaters

signal prairie
#

Well... Your saying that to a 15 years old Boy with no money

daring trellis
#

@quartz kindle thanks

quartz kindle
#

i mean, you dont need to waste money on resources if your bot doesnt need them

#

a free hosting can easily run a small bot

#

with a few hundred servers

signal prairie
#

But actually... The hosting is a code from the website tho

earnest phoenix
#

being 15 is not an excuse, i'm 15 too, you're supposed to slowly start funding yourself and not live from your parents, i earn my own money by working in retail

#

well, worked

#

have no time for a job because of school

#

not only that, but there are a quite a few providers which are willing to fund your servers if you're a student

#

so, no excuse

signal prairie
#

But still... Firs t... I can't work until i'm 18 years old so I can legaly work but i'll go to college so i still will not get a job

keen drift
#

18?

earnest phoenix
#

that's plain false

keen drift
#

Where you live

earnest phoenix
#

mcdonalds hires teens

#

anywhere in the world

keen drift
#

Just get working paper, you can start working at like 16 in my state

signal prairie
#

I live in Portugal Fishy

keen drift
#

I'd invest in a pi, I bought it with my allowance

signal prairie
#

Ok... Let's start not arguing about things ok?

quartz kindle
#

a pi would run on your own network though, which is most likely much worse than any vps out there

earnest phoenix
#

yeah, you can get an rpi, but it depends on your internet connection too much, you'd need to ensure that it's stable and fast enough

signal prairie
#

Ok... But let's not argue about it and talk about another thing ok?

cold niche
#

does anybody know a way to "request" any image through Discord's proxy without sending the original image URL as a message/embed?

#

or how would you actually hide your server's IP when you need to request the image without exposing your IP and without using a VPN or a real SOCKS proxy

quartz kindle
#

well, you can download the image and then send it as an attachment in your embed, instead of using the original image url (which will upload a new version to discord's media server, an create a new image url)

#

as for hiding your IP, i dont think thats possible without vpn

earnest phoenix
#

how to add wallet to discord and amount to it ?

keen drift
#

what, stop asking in multiple places

#

what wallet

#

what amount

earnest phoenix
#

bot wallet

amber fractal
keen drift
#

what bot wallet

amber fractal
#

I dont think you got the right place

earnest phoenix
#

ah yeah let me just pull out 3 bots out of my wallet

amber fractal
earnest phoenix
#

i really thought i could get help from here but only what i get here is sarcasm thx

keen drift
#

i mean you are not elaborating on anything

earnest phoenix
#

because you're being vague

amber fractal
#

I thought the question was a joke

keen drift
#

soooo, high iq much?

earnest phoenix
#

i was asking how can i add bot like it could be !transfer @quartz kindle 200 and how can i add amount to bot ?

keen drift
#

Are you asking how to create an economy bot? Or are you asking for help on an existing bot?

earnest phoenix
#

existing bot

keen drift
#

This isn't bot support, and you never specified which bot either. Ask in the bot's support server

restive bough
#

i think he wants to make his own

keen drift
#

I just asked if he wants to make one or it's for an existing, he said existing

amber fractal
#

^

restive bough
#

on his existing bot

keen drift
#

¯_(ツ)_/¯

slim heart
#

how do i remove an event listener in djs

amber fractal
#

delete the code?

#

Wym?

slim heart
#

like client.removeListener

amber fractal
#

I still dont understand, my iq is big low

idle mountain
#

they mean to dispose of the object

amber fractal
#

Imma just leave cuz I am not smart enough to understand

idle mountain
#

lmfao

amber fractal
#

the way Im taking that is deleting an object

#

but I dont think thats what you mean

idle mountain
#

that is what i mean

#

i think?

#

do you know what disposing means

amber fractal
#

do you?

#

Yes

idle mountain
#

do you know what it means to dispose of an object

amber fractal
#

but he said remove an event listener

idle mountain
#

im 97% sure they mean that, how do you do that to an event listener