#development

1 messages · Page 1274 of 1

autumn aspen
#

When did I ask
@thin turret when did someone ask u to put that ^^

sage bobcat
#

One message removed from a suspended account.

thin turret
#

🐸

autumn aspen
#

<Ok no fight bois

#

chillac

#

x

#

🐸
@thin turret Im srry ok

autumn aspen
#
const Discord = require("discord.js");

module.exports.config = {
    name: "ban", 
    aliases: []
}
    
module.exports.run = async (client, message, args) => {
    if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send(':x: **You don\'t have permission to run this command!** :x:')
    if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send('I don\'t have the right permissions.')

    const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);

    if(!args[0]) return message.channel.send('Please specify a user to ban.');

    if(!member) return message.channel.send('Can\'t seem to find this user. Sorry about that!');
    if(!member.bannable) return message.channel.send('This user can\'t be banned. It is either because they are a mod/admin, or their highest role is higher than mine.\n\`Or:\`\nthe bot you trying to ban with, owner, etc!');

    if(member.id === message.author.id) return message.channel.send('You can\'t ban yourself!');

    let reason = args.slice(1).join(" ");

    if(reason === "") reason = 'Unspecified';

    member.ban(reason)
    .catch(err => {
        if(err) return message.channel.send(':no_entry_sign: **Something went wrong!** :no_entry_sign:')
    }) 

    const banembed = new Discord.MessageEmbed()
    .setColor(0x75ff58)
    .setTitle('Member Banned')
    .setThumbnail(member.user.displayAvatarURL())
    .addField('User Banned', member)
    .addField('Kicked by', message.author)
    .addField('Reason', reason)
    .setFooter('Time baned', client.user.displayAvatarURL())
    .setTimestamp()

    message.channel.send(banembed);


}
#

Why anyone help?

thick gull
#

because theres an error

#

quite literally cannot tell you the issue if we dont know the error

viscid badger
#

make spscific variable maybe?

thick gull
#

do you understand what this is doing

#
    .catch(err => {
        if(err) return message.channel.send(':no_entry_sign: **Something went wrong!** :no_entry_sign:')
    }) 
autumn aspen
#

yeah it catches errors

thick gull
#

yeah

#

so there's an error

#

what's the error

autumn aspen
#

It doesnt pop on my terminal

thick gull
#

cause your catching it

autumn aspen
#

how can I seeit?

thick gull
#

log it

autumn aspen
#

delete the command

thick gull
#

log the err

autumn aspen
#

but can I delete it too?

thick gull
#

if you delete it and theres an error your bot will most likely go offline

autumn aspen
#

if you delete it and theres an error your bot will most likely go offline
@thick gull so it can pop up on my terminal

#

where do I put console.log then

#

console.log(err)

thick gull
autumn aspen
#

or with //

#

bro just tell

#

lol

#

I will delete the command and put it back after

#

@thick gull

thick gull
autumn aspen
#

:facepalm:
@thick gull how can <i consolelog it got dammit

thick gull
#

learn the basics of js pls

autumn aspen
#

oh

#

wait

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sweet ruin
#

then what's the point of making a disc bot lol

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sweet ruin
#

no but i mean like

#

who would even make a disc bot and think. OH IM JUST GONNA STEAL PEOPLES CODE AND NoT LEARN ANYTHING

sage bobcat
#

One message removed from a suspended account.

sweet ruin
#

Ardor why i deserb to be beeat

sand thicket
#

Nah you don't

#

I was agreeing with you, they deserve to be beat

sweet ruin
#

0-0

#

xDD

#

but yeah can anyone help me anyways?

zenith knoll
#

@autumn aspen i use const and let 😎
@thin turret let gang lets go lmao

thin turret
#

Lul

zenith knoll
#

and copy and paste shit without knowing what its doing
@sage bobcat at first i thought he actually knew js and was trolling, considering he knows how to ban, get multiple args, and check perms

#

but then i remembered he copied it

thin turret
#

The code: const num = 10;
The guys code: 10 = num + const();

sweet ruin
#

XDD

zenith knoll
#

let Endph = {"definition": "Someone who steals code", "userexampleid": "722434956202344499"}

#

let let = let

autumn aspen
#

let Endph = {"definition": "Someone who steals code", "userexampleid": "722434956202344499"}
@zenith knoll ha..ha...ha

zenith knoll
#

const const = const

autumn aspen
#

ha...ha...ha

zenith knoll
#

var var = var

autumn aspen
#

u done?

#

ha...ha...ha

zenith knoll
#

u done with learning js?

autumn aspen
#

yes

zenith knoll
#

nice

#

what does this code do

thin turret
#

He's just gonna pop it in the IDE and paste the result

#

🐸

sand thicket
zenith knoll
#
const json = require("./jsonexample");
console.log(Object.keys(json).length);

IF the jsonexample.json looks like

{
  id: "101001",
  something: "idk"
}
#

@autumn aspen what does this return in console?

obtuse jolt
#

vv this person is an absolute weeb vv

thick gull
#

/\/\ mirror /\/\

obtuse jolt
#

mmm

thick gull
#

then what's the point of making a disc bot lol
@sweet ruin because he wants to feel like he made something

zenith knoll
#

yes

thick gull
#

people don’t realize that programming is not just copy pasting everything

zenith knoll
#

theres no fun in it

thick gull
#

or following a tutorial

zenith knoll
#

if u copy

thick gull
#

sure you can look at those as examples

faint prism
#

Yeah, it's all docs

thick gull
#

but that’s not what it really is

#

when I was starting JS I looked at other peoples code and etc

#

never copied it

faint prism
#

Never?

#

Not once? smirk

thick gull
#

i mean

#

i did in like

#

2017

#

but I also didn’t know what JSON was

zenith knoll
#

search it up

#
thick gull
#

2017

ionic dawn
#

Is join/leave channel or role manage rate liimited?

zenith knoll
#

everything is

umbral zealot
#

pretty much everything is ratelimited

zenith knoll
#

relategd dto discord functions

umbral zealot
#

and if it's not, it is, because global ratelimits

zenith knoll
#

like sending, getting, (not fetching idk y)

thin turret
#

@autumn aspen what does this return in console?
@zenith knoll wouldnt it return an error because the filetype wasnt specified?

#

Or does require automatically get filetypes for js and json files

zenith knoll
#

i quit

#

@zenith knoll has left the chat

thin turret
#

🐸

zenith knoll
#

its a json object

umbral zealot
#

there is no such thing as a json object

zenith knoll
#

idk

#

what its called

umbral zealot
#

There are objects. And there is json.

zenith knoll
#

all i knmow is

#

it prints 2

misty sigil
#

json is literally an object

umbral zealot
#

No, JSON is a string.

zenith knoll
#

^

#

oop

misty sigil
#

i guess

umbral zealot
#

The only place that tries to call something a "JSON Object" is w3schools and their site is shit.

stark abyss
#

what are some reasons not to use quickdb

thin turret
#

Outdated

umbral zealot
#

quickdb is one of the slowest database wrappers

thin turret
#

W3 still uses document.write()

umbral zealot
#

Compared to the leading brand™

thin turret
#

🐸

misty sigil
#

what are some reasons not to use quickdb
@stark abyss its slow

stark abyss
#

ic

misty sigil
#

compared to mongodb

umbral zealot
#

Other than that, it's very functional for what it does.

stark abyss
#

i am having trouble with mongodb

misty sigil
#

i feel like mongodb is the standard for discord bots

#

idk why

umbral zealot
#

Though, biased opinion here, enmap is better than quick.db if you want something easy to use 😛

misty sigil
earnest phoenix
#

Quickdb slow but my rewrite which is never gonna be finished isn't

misty sigil
#

KEK thats me

umbral zealot
#

quickdb can be as fast as enmap if it keeps imitating enmap pogey

earnest phoenix
#

Why would I wanna imitate enmap :yert:

thick gull
#

i feel like mongodb is the standard for discord bots
@misty sigil because you can get free 500MB in their site

misty sigil
#

god this is a straight up war

thick gull
#

and bots store like strings

umbral zealot
#

Because you already did by switching ot better-sqlite3 after I did 😛

misty sigil
#

@thick gull and its easy to host your own clusters

thick gull
#

yea

umbral zealot
#

Friendly competitive jabs guys, nothing to see here, move along

misty sigil
#

and it works well for the data that most bots are storing

umbral zealot
#

tbh "mongo is the standard" is only true because "every blogger uses mongo because every blogger uses mongo"

tight plinth
#

if you use quick.db, just learn sql[ite]

umbral zealot
#

Cargo culting at its best.

ocean iris
#

Hey cane were help me?
I wanna make a welcome message with image manipulation (pillow)
Maybe cancel were help me? (Python)

digital ibex
#

why is atlas the first thing people think of when it comes to mongodb?

umbral zealot
#

Because it's an official tool, as in, it's made by the mongo team, so it's often linked, and has high rankings because of this.

misty sigil
#

buht

#

mongodb server

digital ibex
#

valid point ig

misty sigil
#

also the entirety of mongodb

#

its not just atlas

earnest phoenix
#

i'm trying to find the username closest to the value entered, but it doesn't work. where am i doing wrong

message.guild.members.cache.find(m => m.user.username.toLowerCase().includes(args.join(' ')) === args.join(' ').toLocaleLowerCase())
#

ex: /avatar aprox
return: aproxthethat

thick gull
#

error?

earnest phoenix
#

No error

#

it just doesn't work

sage bobcat
#

One message removed from a suspended account.

thick gull
#

toLocaleLowercase

#

?

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#
Cannot read property 'user' of undefined
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

thick gull
#

yea

sage bobcat
#

One message removed from a suspended account.

thick gull
#

i wanted to see if you had an error first 😛

sage bobcat
#

One message removed from a suspended account.

thick gull
#

websites

#

just use toLowercase()

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

im a just remind that there is different versions of js

#

a client side js

#

used in chrome browsers and others

thick gull
#

that’s for clients; e.g. websites

earnest phoenix
#

and theres node js

#

which is server side

thick gull
#

node is just a runtime

umbral zealot
#

There are also other JS engines 😛

earnest phoenix
#

that is what discord .js is for

#

yeah there is extensions to node like nwjs

umbral zealot
#

didja know there was a Java javascript engine? It's called Rhino.

earnest phoenix
#

which is more of a framework

umbral zealot
#

There's also JScript which is the core Windows engine

#

been around since windows 98 I think

sudden tulip
#

can someone help me with a simple purge command that deletes an remakes channel with same perms in discord.js pls

umbral zealot
#

Simple. channel.clone() and then channel.delete()

#

That's all you need to do.

flat arrow
#

Thanks

sudden tulip
#
    else (cmd === "clean")
    {
        channel.clone
        channel.delete
    }
#

literally just this

#

shit

#

forgot ()

umbral zealot
#

I mean, you have to target whatever channel you want

#

y'know, like... define it...

sudden tulip
#

it doesnt exicute in the channel

umbral zealot
#

It could if you want it to

#

it's up to you

thick gull
#

you have to define the channel:)?

sudden tulip
#
    class purgechat : BaseCommandModule
    {
        [Command("pc")]
        [Aliases("purgechat")]
        [Description("Purges chat")]
        [RequireRoles(RoleCheckMode.Any, new string[] {"gang", "OWNER" })]
        public async Task Pc(CommandContext ctx)
        {
            DiscordChannel channel = ctx.Channel;
            await channel.CloneAsync();
            await channel.DeleteAsync();
        }
    }
#

is how its done in c#

#

<pc is done

#

in that channel

earnest phoenix
#

< interesting prefix

sudden tulip
#

yea

#

its the development version of my main bot

#

with the prefix of >

#

whitch has 4chan greentext

#
>greentext
#

greentext

thick gull
sudden tulip
#

its jank bc its uses css codeblocks

#

but whatever

#

how do i make it run in the current channel

#

like i said

#

c# and py gang

stark abyss
#

how do I not loose my mind while coding

sudden tulip
#

dunno

stark abyss
sudden tulip
#

but @umbral zealot how do i make it so it looks for the channel its exicuted in

stark abyss
#

@sudden tulip message.channel

sudden tulip
#

😐

stark abyss
#

no?

silver lintel
#

how to get a specific thing out of an array? ive tried .splice(5, 5) but sometimes it cuts the rest of the array

thick gull
#

he’s not using JS

sudden tulip
#

no i am

thick gull
#

oh

umbral zealot
#

I mean this isn't much different from C#. You still have to define stuff to use it.

stark abyss
umbral zealot
#

it can't guess what you mean

shy turret
#

"😉".length == 2 and '⛳'.length help me

#

why does

#

js be like that

umbral zealot
#

because unicode.

shy turret
umbral zealot
#

emojis are unicode characters that take up two ascii character slots.

sudden tulip
#

Bruh

shy turret
#

how do you check if the string is a single emoji

sudden tulip
#
    else if (cmd === "clean")
    {
        message.channel.clone()
        message.channel.delete()
    }
shy turret
#

google is being bad

umbral zealot
#

that's a simple question with a very hard answer.

#

@sudden tulip well how did you define your message variable

#

at the top

earnest phoenix
#

@silver lintel im kinda dumb when it comes to js but isnt the second 5 how many elements it’s deleting

umbral zealot
#

did you call it message? msg? flkjasldkjfsadf? What?

shy turret
#

that's a simple question with a very hard answer.
@umbral zealot ikr, i found a very useful answer but it wasnt in nodejs so i couldnt use it

sudden tulip
thick gull
#

msg

sudden tulip
#

unless im stupid

#

oh bruh

umbral zealot
#

yeah it's called msg.

sudden tulip
#

yes im bigdumb

umbral zealot
#

you're just inexperienced, and you should get aquainted with JS before making a bot in it

sudden tulip
#

true

#

1 last question, how do i do a kick command

shy turret
#

<member>.kick()

sudden tulip
#

😐

#

makes sense

thick gull
#

I suggest checking docs

shy turret
#

you can get mentions using..

sudden tulip
#

fairnuff

shy turret
#
message.mentions.members.first();
thick gull
#

assuming your using Djs ; https://discord.Js.org

shy turret
#
message.mentions.members.first().kick();

i think

#

it will kick the first mentioned user

thick gull
#

yea

sudden tulip
#

screw it

#

c# im going to stay with for now

#

lmao

umbral zealot
#

¯_(ツ)_/¯

sudden tulip
#

yea

#

c# has shitty youtube api integration thats why i want to do in js

#

but nvm

shy turret
thick gull
#

inb4 shitty node package with an array of every Unicode Character

shy turret
#

i can use .match() and check if the output is null and/or the .length is 1

#

inb4 shitty node package with an array of every Unicode Character
@thick gull inb4?

thick gull
#

in before

shy turret
thick gull
#

as in i am calling it

shy turret
#

?????

thick gull
#

what

shy turret
thick gull
#

I can’t tell if you don’t know what inb4 means or

shy turret
#

k

solid citrus
#
        System.out.print("Created!");
    }``` doesn't work when I create a channel. Anyone know why? The class is added as listener and extends ListenerAdapter
unique patio
#

Not overly familiar with C# but could google emmit event listeners

#

Those are responsible for pinging on events

sudden geyser
#

That's Java.

unique patio
#

Yeah java too then

#

lmfao

#

I should have gathered that at print... D:

#

basics

solid citrus
#

I tried google and nobody has had this issue

#

I have two other event listeners in this class and they work fine. This is the only one not working

sudden geyser
#

I don't see anything for onChannelCreate

unique patio
#

Not familar but is there an emit for channel create lite?

#

not sure if it's contained in the recieved message or another handle

sudden geyser
#

There are only "emitters" for the specific channel, but not one for any channel create

#

Emitters in JDA work by extending a class (abstract class called ListenerAdapter).

#

You then override the method which will be called, which acts as the event listener.

unique patio
#

ahh

#

Haven't explored its eventlisteners fully only care for the few events.

#

Good to know

solid citrus
#

textchannelcreate

sudden geyser
#

The signature for text channels would look like as followed: java @Override public void onTextChannelCreate(@NotNull TextChannelCreateEvent event) { // ... }

solid citrus
#

got it working I think

#

yes

#

ty @sudden geyser

sudden geyser
#

yeah np

zenith knoll
#

The only place that tries to call something a "JSON Object" is w3schools and their site is shit.
@umbral zealot thats where i used to self learn my js oop

quickdb is one of the slowest database wrappers
@umbral zealot im leaning into rethinkdb idk y

umbral zealot
#

I mean, they're different things. quick.db and enmap are wrappers around sqlite, and you can use them without instlaling a server or stuff

ripe quest
#

python sus

fluid basin
#

rethinkdb doesn't have that much support anymore

#

community updates have been really slow

solid citrus
#

How come e.getGuild().getMemberById() works on my private server but doesn't work on a another server? On mine it prints "FunkyMoneyman" with some other stuff but on the big server it prints "null"

fluid basin
#

which library

sudden geyser
#

rethink went deprecated then came back I think

earnest phoenix
#

How come e.getGuild().getMemberById() works on my private server but doesn't work on a another server? On mine it prints "FunkyMoneyman" with some other stuff but on the big server it prints "null"
@solid citrus what library are you using

sudden geyser
#

They're using JDA

fluid basin
#

rethinkdb doesn't have that much support anymore
community updates have been really slow
uh basically it lost commercial company backing

earnest phoenix
#

jda

#

why

sudden geyser
#

The user may or may not be cached.

earnest phoenix
#

^

#

cache is always an issue in discord

sudden geyser
#

A while ago JDA I think was caching everything by default and couldn't be configured, but it now can.

solid citrus
#

how can I make it work regardless of server then?

sudden geyser
#

one option would be to fetch the member with one of the methods that start with retrieve

earnest phoenix
#

no

#

@glad charm

glad charm
#

?

oak cliff
#

i got it

solid citrus
#

I'm trying e.getGuild().retrieveMemberById(user.toString()); but idk if that is the correct way to do it lite

glad charm
#

Thanks

solid citrus
#

also doesn't work

#

https://i.gyazo.com/6a0f00aa600e21c4e484e3487b0cdbb3.png public void onTextChannelCreate(@Nonnull TextChannelCreateEvent e) throws IllegalArgumentException { System.out.println(e.getChannel().getTopic()); System.out.print(e.getGuild().getMemberById(e.getChannel().getTopic()) + " | " + e.getGuild().getMemberById(e.getChannel().getTopic().toString())); I can't do retrieve because that gives me a restaction and U can't use rest actions @sudden geyser

sudden geyser
#

So you're trying to get a member in the guild by the channel name's topic?

solid citrus
#

I put their id in the topic name

#

so I could pull it

sudden geyser
#

Yet e.getChannel().getTopic() is returning null 🤔

solid citrus
#

no its returning the id fine

#

look at the top photo. It prints the ID

sudden geyser
#

oh I'm blind

solid citrus
#

getMemberById is returning null on one server but not another

sudden geyser
#

Is that user in that other server as well?

solid citrus
#

that user is me

#

so yes

drifting wedge
#

If I were to do a dashboard? How would I add mongo support?

unique patio
#

getTopic is returning fine in your upper console

#

is topic even a member ID?

solid citrus
#

yes

#

it works on my private server for some reason and u said cuz its cashed or something but a bot shouldn't have to rely on that

sudden geyser
#

Hmm, could you try something like this instead: java e.getGuild().retrieveMemberById(e.getChannel().getTopic()).queue(member -> { // print `member` }, err -> { /* handle error*/ })
This is what I was talking about before about retrieving.

solid citrus
#

there is lots of red I dont know how to fix

unique patio
#

()?

#

() => {

sudden geyser
#

What does hovering over the red give you

unique patio
#

That'd error on my language of choice

solid citrus
#

Lambda expressions are not supported at level 5

sudden geyser
#

uh

solid citrus
#

ok

#

well I set lamba language to 8

#

and I can't undo it

#

so hopefully its worth it

#

red is gone

unique patio
#

Ah it should be changeable that option but glad that solved it.

#

I deal wit hthat in a few languages going from their lower levels to higher

solid citrus
#

ok it printed out MB:FunkyMoneyMan(U:FunkyMoneyMan(199995281121607682) / G:Private(703287729303060540))

fluid basin
#

lambdas are only supported in java8+

sudden geyser
#

I had a similar issue in the past but it was a different error

#

Then you found the user now

fluid basin
#

and why are you even on level 5 in the first place

unique patio
#

Nice funky

solid citrus
#

so why does coding it this way work but the other one doesn't

sudden geyser
#

You weren't in the cache for that large guild

unique patio
#

Uhhhh may be awaiting a call

solid citrus
#

and why are you even on level 5 in the first place
wasn't my choice it was set to 5

sudden geyser
#

Java doesn't have async/await btw

solid citrus
#

so why did this fix it?

unique patio
#

I mean not necessarily can you go and do a function in function call to pass to parameter

#

need to calc it ahead of time some cases

#

I'd try putting topic to variable then passing it through

#

prior way and see if that does it

solid citrus
#

what do I put inside handle error

unique patio
#

You'd write err to console

#

if any pass through on the catch

sudden geyser
#

If you want to ignore the error put nothing, but if (and you should) want to handle the error, log it to the console or tell the user that the user couldn't be found.

unique patio
#

Yeah^

sudden geyser
#

retrieveMemberById works by looking in the cache for the user. If it's found, it'll immediately return. If it can't find them, it'll send an HTTP request to Discord for the guild member. If it's found, it'll be returned. Else you'll get an error as it couldn't be found.

unique patio
#

Very helpful them catches for making solid bots/software

opal plank
#

logging errors likely a bad design tbh

#

put somewhere that notifies you

#

be it dumping on your support server in a hidden channel or something else

sudden geyser
#

or just use some logger module/package

opal plank
#

or just send it to a channel

unique patio
#

It's built in

opal plank
unique patio
#

most modules

drifting wedge
#

With a website dashboard, how can I connect it to mongo?

opal plank
#

installing dependencies for every little thing is hella wasteful imo

unique patio
#

You use it for early dev, and build you way to prolific statements to prevent such

opal plank
#

plus you dont learn anything from it

fluid basin
opal plank
#

wtf is that for?

fluid basin
#

installing dependencies for every little thing
that package tbh

#

486k weekly downloads

solid citrus
#

e.getReaction().removeReaction(e.getUser()); I've also had issues with this not working at all even on my server

opal plank
#

yikes

sudden geyser
opal plank
#

486k weekly downloads, and then you take a look at the majority of the discord bots(specially d.js) and tell me about quality @fluid basin

#

¯_(ツ)_/¯

earnest phoenix
#

Hi

slender thistle
#

How does sentry work btw

fluid basin
#

no my point is that installing dependencies for little things happen all the time mmulu

earnest phoenix
#

How to get 16 letters in $randomString??

#

what

#

$randomString

#

what language is that

slender thistle
#

Seems to be some bot maker thing

opal plank
#

and my point being by doing that you dont learn anything from it

fluid basin
#

sentry? isn't that an analytics/monitoring framework/platform

sudden geyser
#

I don't think installing a dependency for logging is a bad thing though. Have it pretty print for your console messages (trace/debug/info/warn/error/fatal), ability to write to a file for the logs, no need to make network requests to store it instead, all the wonderful bits

slender thistle
#

Possibly, but my question may be invalid because I'm not familiar with it in any way

opal plank
#

you missing my point lite

unique patio
#

dollar signs is PHP

#

?

slender thistle
#

I'll probably take a look later myself

opal plank
#

im not against logging stuff, im against not writing your own handller and relying on small packages

#

php uses a lot of $

#

$_USER

fluid basin
#

@slender thistle what will you need it for anyways

unique patio
#

I have a log/time module I made to just include in a utilities folder

#

no problem with that, keeps me informed.

opal plank
sudden geyser
#

It depends on what it does really. For example, some packages have it set up where one dependency can also set up a logger and your project can configure which logs you want to see and how it's all formatted. If it's just you wanting to log what you want, then yeah go ahead and write your own.

opal plank
#

my point being you shouldnt rely on packages whenever its possible

#

that might be only me opinion however

unique patio
#

I have to use a fancy logger for WebRTC

opal plank
#

you are free to ignore it

unique patio
#

like that Lite; it's boggy

#

😛

opal plank
#

if its some complicated package, you are wasting time

sudden geyser
#

It's the dev's choice imo. There are very good reasons to rely on dependencies, regardless of how small it appears.

opal plank
#

if it is something repetitive, you wasting time

#

if it something you already done, you wasting time

#

else, its good to write your own

dense nest
#

Hellu. I have come to steal your cocolate chip cookies

sudden geyser
#

can't steal something I don't have

opal plank
dense nest
#

Lmao

rocky hearth
#

What you guyz were discussing?

sudden geyser
#

dependencies

slender thistle
#

@fluid basin not sure if I will need it tbh, it was more of a random curiosity question

#

:p

opal plank
#

@slender thistle shiv have you dicked with koa?

#

i seen you do some web stuff before

solid citrus
#

what is the code to send a primate message to a player I legit can't find it

opal plank
#

private*?

#

and user* ?

solid citrus
#

ok

opal plank
#

those were questions not statements

#

anyway, you need to provide more info

#

which language and library?

solid citrus
#

no you solved it for me

opal plank
#

Erm, you welcome, i guess?

opaque hawk
#

first of all, have users ever been referred to as players

#

Second of all, how would I check for a certain Reddit user using their API

opal plank
#

with the docs

#

stonks

#
opaque hawk
#

I used the discord.js urban dictionary example but seeing as that is urban and not Reddit it didn’t work as it applies term=${args[1]} to the end of https://www.reddit.com/u/

#

ok

opal plank
#

thats such a janky way of doing it

#

they have an api

#

use it

opaque hawk
#

Alright

slender thistle
#

@opal plank koa? No, I haven't even used socket.io enough to use it for my websites. My websites are mostly static or everything is handled by Bootstrap

opal plank
#

hmmm i see

#

kinda was looking at my dashboard and wondering if i should work on it a bit

#

cuz i havent done that at all

slender thistle
#

What's koa?

opal plank
#

to put it very bluntly

#

express 2.0

slender thistle
#

Why not play with it if you can?

opal plank
#

thinking about it tbh

#

i got apache already hosted locally

#

should be somewhat easy to get it done

slender thistle
#

I'd say go for it

opal plank
#

wondering if i should use boiler templates or make something from scratch

slender thistle
#

What do you think might be better in the long term?

opal plank
#

very good question actually

#

using a boiler helps me mow down time on the development of the bot since i get it over with quicker, but on the other hand i'll be using given tools, i'd prefer to learn it rather than useing pre-made's

slender thistle
#

Is time critical in this case?

opal plank
#

not critical, but motivation starting to get into me these past few days

#

i've got 7 different projects tied with the leviathan

slender thistle
#

Could go with the latter option then

opal plank
#

Youtube bot, Discor dbot, Twitch bot, Dashboard, Metrics dashboard 1 and 2

slender thistle
#

wew

opal plank
#

yeah 1 person handling all that been getting on my nerves

rocky hearth
#

Erwin I've excluded node_modules in tsconfig.json, but it is still showing error from there? What should I do

opal plank
#

no clue

#

i might try going for a boiler for starts and then do my own thing later

hazy sparrow
#

How to unban in d.js?

gleaming marten
#

Can someone be my friends here? It's my first time using discord😅

quaint mulch
#

😂

hazy sparrow
#

This is not #be-my-friend-pls

rugged river
#

💀

worthy glacier
#

how do i use https get to an image url from a website using a query input from discord like /type/category when the website returns { "url": "image link" }

fluid basin
worthy glacier
#

i want the user to define type and category

#

and it to return the image link

compact oriole
#

as I like my site a lot (and used alot of effort into it) so i want it to be visible

#

but the iframe is less than 300 characters

pure lion
#

Ah

slender thistle
#

A lot of comments

#

Or one big comment

#

Just slap comments in

pure lion
#

Yeah

compact oriole
pure lion
#

<!-- oh hello mods how are you doing -->

#

@compact oriole it's fine just put a copypasta in comments /s

compact oriole
#

:)

slender thistle
#

The way I went with my server count test app is shuffled the lorem ipsum copypasta and used it as my description

compact oriole
#

well time to make a long comment

slender thistle
#

Hold A ftw

pure lion
#

Gnu plus linux

compact oriole
#

is this good?

<div style="width: 100%; height: 100%">
<!-- English: Dear mods, this comment is used to inflate the character count as my site is fully inside the provided Iframe. -->
<!-- STANDARD GALACTIC ALPHABET: Dᒷᔑ∷ ᒲ𝙹↸ᓭ, ℸ ̣ ⍑╎ᓭ ᓵ𝙹ᒲᒲᒷリℸ ̣  ╎ᓭ ⚍ᓭᒷ↸ ℸ ̣ 𝙹 ╎リ⎓ꖎᔑℸ ̣ ᒷ ℸ ̣ ⍑ᒷ ᓵ⍑ᔑ∷ᔑᓵℸ ̣ ᒷ∷ ᓵ𝙹⚍リℸ ̣  ᔑᓭ ᒲ|| ᓭ╎ℸ ̣ ᒷ ╎ᓭ ⎓⚍ꖎꖎ|| ╎リᓭ╎↸ᒷ ℸ ̣ ⍑ᒷ !¡∷𝙹⍊╎↸ᒷ↸ i⎓∷ᔑᒲᒷ. -->

<iframe src="https://trivia.wtf/" title="Trivia Bot Homepage"></iframe>
</div>
slender thistle
#

Why the div though

compact oriole
#

idk

slender thistle
#

Can't you technically just apply style to the iframe directly?

compact oriole
#

true

#

well time to wait for approval LUL

ionic shard
ionic shard
#

what u guys think?
https://hastebin.com/ecumogacuw.js

    hasPermission: function(permission, message) {
        if (!message.member.hasPermission(permission)) return 1;
        if (!message.guild.me.hasPermission(permission)) return 2;
    },
next arrow
#

what are u trying to do?

ionic shard
#

kick

#

check the hastebin

next arrow
#

hold on

#

it should be ok

ionic shard
#

humm

dense nest
#

Who knows python

next arrow
#

well i don't

manic sage
#

hi guess my bot not joining on a channel while deploy on heroku while works fine on my pc anyone,can anyone help?

next arrow
#

hi guess my bot not joining on a channel while deploy on heroku while works fine on my pc anyone,can anyone help?
@manic sage what?

#

can u explain it a little bit better

manic sage
#

so i deployed my bot on heroku and while i type the join command its not joining the channel but when i run it on pc it works fine

next arrow
#

can u send the code?

#

and i recommend u to not use heroku

#

it will ask u for a credit card later

#

and u will have limited hours

#

till u have to pay

slender thistle
#

@dense nest feel free to ask your questions straight away

manic sage
#

i know but its a different issue

slender thistle
#

Heroku

next arrow
slender thistle
#

Oh God

#

Good luck hosting music bots on that

next arrow
#

Good luck hosting music bots on that
@slender thistle ye bro

slender thistle
#

There's no native support for those whatsoever

next arrow
#

it's more for like web development

slender thistle
#

yup

#

Heroku is literally intended to be used for web apps

next arrow
#

yea

#

by example in repl.it u also got python node.js html

#

java

#

a lot of stuff

slender thistle
#

mhm

next arrow
#

and u can use uptimerobot too so ur bot is always 24/7

slender thistle
#

repl.it is an online testing environment with an IDE but

#

they don't mind uptime robots

next arrow
#

repl.it is an online testing environment with an IDE but
@slender thistle it's still kind of better

#

yea

slender thistle
#

Which is why I'm in favor of using repl.it over Glitch or Heroku

#

Hell, you can probably make your own script ping itself every once in a while

next arrow
#

and u can import from github and all that stuff

#

😎

slender thistle
#

😎

next arrow
#

o i realized heroku can too

#

but whatever

slender thistle
#

While the other two are decent enough, I consider repl.it the most decent online service for hosting small bots

next arrow
#

but the sad thing is u cannot have private projects

slender thistle
#

VPS if all else fails

next arrow
#

like glitch or heroku

slender thistle
#

Ehh

next arrow
#

and u always gotta have random names

#

or they can steal ur code

slender thistle
#

I have Github student pack so sike

next arrow
#

they go like

#

O

#

and they guess the name

#

or whatever

slender thistle
#

I wouldn't specifically care if someone stole my code, I just cba to make my official bot's code open-source 😂

next arrow
#

I wouldn't specifically care if someone stole my code, I just cba to make my official bot's code open-source 😂
@slender thistle that's also true

#

but whatever let's stop talking about hosts

slender thistle
#

Some people might mind it, yeah, but that's someone else's headache

next arrow
#

ye

slender thistle
#

it's not really prohibited as hosts are somewhat related to development ¯\_(ツ)_/¯

#

But sure, my head isn't feeling well atm

next arrow
#

i remembered that i once followed a tutorial incorrectly and i tried to host my bot in heroku with github and i leaked my bot's token

#

cuz i had a config.json file

frail ocean
#

Well 😂

slender thistle
#

kek

next arrow
#

and that was when discord didn't tell ya if u leaked it

slender thistle
#

Man, good old times

next arrow
#

yea

#

i actually started to make bots in discord.js in the 11.4.2

#

at least that's what i see on my old bot's project

#

the one i leaked

slender thistle
#

Oh boy

#

All my homies create their own libraries

next arrow
#

well i don't

#

i'm too lazy

#

and i already got acostumbrated to discord.js

#

idfk if it's acostumbrated or not

#

but whatever

slender thistle
#

nah I'm just joking haha

#

accustomed?

next arrow
#

no

#

i already got the use to discord.js

#

that

#

that that that

slender thistle
#

used to

next arrow
#

ye

#

exactly

slender thistle
#

aye

next arrow
#

cuz i speak spanish and i don't know a lot of english

#

so i should be checking google translate

obtuse niche
#

^

next arrow
#

woah

#

brother

west agate
#

how do i get the number roles in a discord server?

next arrow
#

how do i get the number roles in a discord server?
@west agate message.guild.roles.size

#

try that but i'm not that sure that it works

west agate
#

yeah i figured it out

#

thanks

next arrow
#

oh

#

srry for responding late then

west agate
#

no its okay

next arrow
#

:)

#

it said cat smile

#

and it isnt a smile

west agate
#

the real question is

next arrow
#

bad emoji

west agate
#

how do i get a servers owner?

next arrow
#

the user of the owner or the id?

west agate
#

user

next arrow
#

try message.guild.owner

pale vessel
#

guild#ownee#user

next arrow
#

😎

#

guild#ownee#user
@pale vessel u spelled it wrong

#

and yea

#

message.guild.owner.user

pale vessel
#

mobile moment

next arrow
#

bad phone

west agate
#

i tried message.guild.owner.tag

pale vessel
#

user.tag

next arrow
#

message.guild.owner.user.tag

west agate
next arrow
#

yw

pale vessel
#

my name is jeff

west agate
#

oop

next arrow
#

my name is jeff
@pale vessel ma nem i ñe

dense nest
#

So im getting a api, and i need help splitting it into variables to send. So far, ive got:

import requests
import json

url = 'https://api.2b2t.dev/prioq' 
response = requests.get(url)
thingy = response.text
def my_function(food):
  for x in food:
    print(x)

fruits = thingy```
west agate
#

imma try make a translation

restive furnace
#

how do I could handle that when someone reacts 🇽 to my message, I would delete the message sent by the bot?

west agate
#

bot

pale vessel
#

lolritter pog

next arrow
#

why u putting food and fruits though

west agate
#

@restive furnace make a react collector and delete message

next arrow
#

awaitreactions

dense nest
#

@pale vessel pog lolrittter dosent know python or hed help me .-.

west agate
#

^or that

next arrow
#

i think u got it on discordjs.guide

restive furnace
#

fetch the message and delete it, but how i can check if the user is the user who ran the command?

next arrow
#

how to make an reaction collector

west agate
pale vessel
#

i'm sure you have to parse it as json first, if the api returns json

dense nest
#

Helppp

#

I have no idea how

#

Lol

next arrow
#

fetch the message and delete it, but how i can check if the user is the user who ran the command
@restive furnace if (reactor == message.author) //do ur thing

placid iron
#

Response.json

west agate
#

message.react('👍').then(() => message.react('👎'));

const filter = (reaction, user) => {
return ['👍', '👎'].includes(reaction.emoji.name) && user.id === message.author.id;
};

message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();

    if (reaction.emoji.name === '👍') {
        message.reply('you reacted with a thumbs up.');
    } else {
        message.reply('you reacted with a thumbs down.');
    }
})
.catch(collected => {
    message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
});
next arrow
#

idfk if it's reactor

pale vessel
#

you can google how to parse json in python lul

west agate
#

^ I copied from the site it self

next arrow
#

exactly

restive furnace
#

@restive furnace if (reactor == message.author) //do ur thing
reaction collectors only works for some time only, i want it to last like forever

pale vessel
#

why did you send that

placid iron
#

@pale vessel requests does it for you. It's response.json

next arrow
#

reaction collectors only works for some time only, i want it to last like forever
@restive furnace change the time in time: 60000 then

#

there's no way to make it forever

pale vessel
#

don't use reaction collectors for those

next arrow
#

what then

pale vessel
#

i don't use those for mine

placid iron
#

There is, if you use raw reaction

restive furnace
#

raw reaction listeners?

pale vessel
#

yes, raw listeners

placid iron
#

But yes I would just use on reaction then check if it's a X and the message is by the bot and if so then try to delete

#

Easiest way

restive furnace
#

and fetch the above message to check if the user who made the reaction has sent the command, right?

silent cloud
#

Yoooo

#

Thats me again lol

placid iron
#

@restive furnace oh yeah and that too

restive furnace
#

alright

silent cloud
#

Why i have an error with queu

west agate
#

how do i unban members?

pale vessel
#

i'm sure you mean message.client, assuming you attached the queue to your client

silent cloud
#

bot.queue = new Map();

placid iron
#

Guild.unban(Id) ?

pale vessel
#

yeah, message.client

silent cloud
#

i'm sure you mean message.client, assuming you attached the queue to your client
@pale vessel yes, client it bot

west agate
pale vessel
#

that's just how it works

placid iron
west agate
#

oh..

#

lemme try rq

pale vessel
#

bot is client, that's why you should name your client as client to avoid confusion

silent cloud
#

I have this

#

const bot = new Discord.Client();

pale vessel
#

yes

#

it's client internally

#

bot is just what you defined it as

west agate
dense nest
silent cloud
#

So..i need to write client?

pale vessel
#

yes, message.client

#

that would be the bot instance

silent cloud
#

Ok let me try

west agate
#

why?

silent cloud
#

Yay

#

It working

#

Thx @pale vessel

dense nest
#

So how do i parse this into a json table lmao

pale vessel
#

rovi told you how

dense nest
#

Its not formatted at all

pale vessel
#

that doesn't look like json though

dense nest
#

Its not

next arrow
#

So how do i parse this into a json table lmao
@dense nest u are trying to turn a json table in an array

#

¿

dense nest
#

This is what i habe so far

west agate
next arrow
#

what does the error say

#

put ur mouse in the part where it says succ and it should say the error

west agate
#

it just says succ is not used

next arrow
#

i mean where it says succ

west agate
#

thats it

placid iron
#

@dense nest did you try .json

west agate
next arrow
#

ohhhh

dense nest
#

@placid iron how?

placid iron
#

Request.json

next arrow
#

bruh why u using then succ if u are not gonna use the variable succ

placid iron
#

Rather than request.text

west agate
#

when i remove it it gives a hell lot of erros

next arrow
#

what do the errors say

west agate
pale vessel
#

are you using a tslint for js or something

west agate
#

i am

pale vessel
#

why

#

it's for ts?

west agate
#

ts?

placid iron
#

Typescript

#

Typescript isn't JavaScript

dense nest
placid iron
#

Wtff

dense nest
#

Tbh its like 3am and im super tired

placid iron
#
response = requests.get(url)
json_data = response.json()```
dense nest
#

And im determined to get this done

placid iron
#

It's a function then

#

You don't even need to import json for this

dense nest
placid iron
#

Yes

#

That is a list

#

You can use json_data[0] to get the first thing

dense nest
#

Omg o love you

#

@placid iron tysm

#

Sorry ive had a long day

placid iron
#

Np

dense nest
#

My great grandma is moving from the house she bought in '89

#

And its a massive property

#

Lots of tears shed today hehehe

#

Anyway tyvm

placid iron
#

Oh ahaha, yeah no problem. Have a good day

dense nest
#

You too

#

@placid iron can you freind me?

#

And another question

#

How would i send info to the api

#

Ex. A username

pale vessel
#

if you mean lolritter's api, it uses query strings so just append ?username=<username> to the url

dense nest
#

Oh

#

@pale vessel how do i get the data sent?

#

I tried

#

print(json_data['seen'])

pale vessel
#

try json_data[0]["seen"]

dense nest
#

Ah

#

Ty

#

Im retarted

#

Im learning apis! :D

pale vessel
#

all good, you'll get there haha

honest perch
#

Flaz

autumn aspen
#

guys how do I add require 'ms' bc is it a package

#

?

pale vessel
#

ms is a package

#

you have to install it first before requiring it

autumn aspen
#

how to I setup it

#

bc I have fs

pale vessel
#

assuming you have npm, you can use npm i ms

#

fs is built in, you don't have to install it

autumn aspen
#

So if I install it now I will have it on my bot right?

pale vessel
#

yes

autumn aspen
#

oh thx

#

but do I type npm i ms
then code . do I have it or do I go for desktop or cd in commandprompT?

#

@pale vessel

pale vessel
#

in your bot's directory

autumn aspen
#

in your bot's directory
@pale vessel oh its terminal right?

pale vessel
#

yes

autumn aspen
#

oh lmao forgot

#

thx

#

yes
@pale vessel ok so I installed it do I just need to put the require ms in a js file?

pale vessel
#

yeah

autumn aspen
#

thats it?

#

Thx

pale vessel
#

yep

autumn aspen
#

yep
@pale vessel thx man helped alot

restive furnace
#

I got one question more about that "react with X, bot deletes the message". So if the server is very active, like 100 messages/min on one channel, do I just have to fetch more than 1 message on the channel and check its content && author matches the user who reacted?

autumn aspen
#

yep
@pale vessel do I need a ms.json or smh

pale vessel
#

nope, it's already installed

autumn aspen
#

ir in index

#

wow

pale vessel
#

it puts it inside package.json for you

autumn aspen
#

so it auto added to my command handler'?

#

OHSWEET

pale vessel
#

no, for that you have to require it and use it

autumn aspen
#

no, for that you have to require it and use it
@pale vessel like in a js file right?

pale vessel
#

yes

autumn aspen
#

gg

#

then if I add it like that its gonna be in my command handler

#

right-?

pale vessel
#

yes

#

in any .js file

autumn aspen
#

WOW

#

thx dude

#

so the fs is alrdy insttaled

#

installed?

pale vessel
#

yes, because it's built in

autumn aspen
#

oh ok

#

thx

pale vessel
#

@restive furnace the reaction event provides message, the way i do is by detecting the mention inside the message via message.content and check if the id is the same as the person that reacted. that's why my bot always mention members when replying to them

restive furnace
#

ah

#

thanks

opaque seal
#

Is it useles to use await in this case?

module.exports = {
    name: 'setvoting',
    description: 'Choose if voting is required for commands.',
    dev: true,
    async execute(message) {
        message.client.voting = !message.client.voting;
        if(!message.client.voting) await message.reply('*Voting disabled.*');
        else await message.reply('*Voting enabled.*');
    },
};
pale vessel
#

yes but it's a good practice

#

source: vysion

opaque seal
#

Why is it good practice?

#

I mean, what changes from not using await?

restive furnace
#

it resolves the promises before continuing.

#

i almost every where use async in my bot atleast

carmine summit
#

client.guilds.cache.get('699877474925936680').members.length this dont work??

autumn aspen
#
var muteRole = message.guild.roles.cache.get('Muted', 'muted');

Is this working?

#

lmao

#

client.guilds.cache.get('699877474925936680').members.length this dont work??
@carmine summit what u tryna do?

carmine summit
#

get howmany members

#

in my server

#

||which is arround 11,000||

opaque seal
#

client.guilds.cache.get('ID').members.cache.size @carmine summit

#

Shouldn't this wait until a return is given from the client.request() function?
const requestResults = await message.client.request(message, request);

eternal osprey
#
if (message.content.startsWith(prefix + "feed")) {
    if (message.channel.id == "735243676460253225") {
      const args =
        " " + message.content.slice(prefix.length).replace(/^feed/, "").trim();
      queueMessageText =
        "**The twitter feed has been searched and sent by this/these keyword(s): **";
      queueMessageText +=
        " " + message.content.slice(prefix.length).replace(/^feed/, "").trim();
        setInterval(T.get, 60000);
      T.get("search/tweets", { q: args, count: 10 }, function (
        err,
        data,
        response
      ) {
        console.log(data);
        status = data.statuses[0];

        data.statuses.forEach((status) => {
          const embed = new Discord.MessageEmbed();
          embed.setTitle("Twitter Feed Poster");
          embed.setDescription(`${status.text}`);
          embed.setImage(`${status.user.profile_image_url}`);
          embed.setFooter("Command created for Pokehub!");
          embed.setColor("#FF0000");
          embed.setAuthor(
            "@" + `${status.user.screen_name}\n` + `${status.user.name}`
          );
          embed.setURL(
            `https://twitter.com/${status.user_screen_name}/status/${status.id_str}`
          );
          message.channel.send(embed);
        });
      });
      message.channel.send(queueMessageText);
    } else {
      message.channel.send(
        "You can only use this command in the #general channel!"
      );```
return this.request('GET', path, params, callback)
              ^

TypeError: this.request is not a function
#

could anyone help me?

carmine summit
#

client.guilds.cache.get('ID').members.cache.size @carmine summit
@opaque seal why the cache?

eternal osprey
#

it changed in v12 @carmine summit

#

you have to do that otherwise it won't work.

opaque seal
eternal osprey
#

could anyone please help

#

with my problem.

compact oriole
#

I wish I could use js on my bot site

#

as I can't rezise the Iframe without it

#

no way in css...

#

but at least on pc it works now

#

just when it goes to mobile, it brakes

earnest phoenix
#

give me your bot adress (on top.gg)

compact oriole
#

@earnest phoenix it's on my local pc

earnest phoenix
#

oh ok

compact oriole
#

I just copied the site to my local pc to emulate it

#

and quickly update it

earnest phoenix
#

then add

body {
height: 100%;
}
compact oriole
#

also why tf does top.gg use !important css tag on the shadow of the bot image

#

no

#

it's an iframe

earnest phoenix
#

oh

compact oriole
#

that won't work

#

and the site isn't simple, so I can't just put it there

#

the site itself is React/NextJS compiled js/css/html

#

and I can't use js yet

honest perch
#

you can hide everything on the bot page

compact oriole
#

you can hide everything on the bot page
really?

#

I thought that was not allowed

honest perch
#

well

#

not sure if its allowed or not

compact oriole
#

I wish it was allowed

#

as I would be happy just to include my site

honest perch
#

@weak parrot could probably confirm or deny if its true

weak parrot
#

You can iframe your website as long as it doesn't contain anything against our rules

honest perch
#

epik

compact oriole
#

to just have my site on the page

split hazel
#

You're not allowed to hide the navbar, that's one of the things you definitely can't remove

compact oriole
#

(iframed)

#

ye navbar there of course

honest perch
#

@split hazel but can you edit its css

weak parrot
#

What exactly are you planning on doing just putting it in description or do the whole page?

honest perch
#

or hide it and remake it

#

oh nvm

#

that would hide ads

split hazel
#

@honest perch you can just make sure every button name is the same and works

compact oriole
#

I would plan to remove everything else than the navbar

#

and ads

split hazel
#

just look at iaras page

honest perch
#

yep ive seen that

#

im not sure about the ads though

split hazel
#

cutest website on earth award

weak parrot
#

Yeah removing navigation elements ads and essentials buttons (report and so on) are a big no no

split hazel
#

you can't remove ads

compact oriole
#

could I redo them?

#

like hide default stuff and do it again with my style in the box

honest perch
#

whats the html element for the ads

weak parrot
#

Sure you can remake them as long as functionality of the buttons is still there

compact oriole
#

ok pog

#

time to remake top part

earnest phoenix
#

hot take

honest perch
#

i turned on ads

#

jesus

earnest phoenix
#

dbl makes revenue off your bot page and you don't get any of it lol

compact oriole
#

I can add ads to my iframe LUL

#

but I won't

#

as I don't like ads

honest perch
earnest phoenix
#

to have a cherry on top, those are google ads which means trackers everywhere

eternal osprey
#

does dbl really have that much ads?

compact oriole
#

I use Brave

#

blocks all stuff

honest perch
#

brave bad

eternal osprey
#

opera gx

#

is hot

honest perch
#

use firefox and ublocker

#

origin

compact oriole
#

opera is good but opera is a shit company