#development

1 messages · Page 751 of 1

blissful scaffold
#

there should be something like message.channel or similar depending on what library you use
when you find that and read the manuals it should be pretty easy ^^

white sequoia
#

Thanks

west raptor
#

Is this a good idea? rs results.into_iter().nth(0).unwrap_or_else(|| { create_guild(guild_id); get_guild(guild_id) }) basically if (for some reason) the guild is not in the database it creates the guild and calls it self (get_guild)

#

could this cause major issues?

#

and is so it there a better way to do this

#

unwrap_or_else basically says: if the type of .nth(0) is None run this code and if it's not None go ahead and return the value/guild

#

the only issue is it that it calls it self which could be recursive is something goes wrong (i.e there's an error inserting the guild into the database, which there shouldn't I think I've handled all the possible errors that could occur there)

blissful scaffold
#

Everywhere where an error can occur an error will occur eventually
From my experience especially at places where it is "impossible" 😦

#

but yeah, if you handle all DB errors then it should be ok i guess?

west raptor
#

as long as it's in(serted) into the db it should be fine

#

but y'know that's where something goes wrong 🙃

blissful scaffold
#

I think I set up my bot to restart if something with the DB goes wrong.
Throw up your hands, run away and try it again after a restart 😄

#

and after 3 tries it will just shut down till I take a look at it

west raptor
#

the only db errors I could think of is:

  1. the guild is already in the database which get_guild would not have any issues with
  2. postgres for some reason isn't running, except I have it as a service so it should be fine
blissful scaffold
#

In the year that my private bot runs it only had 1 DB error, but that was because I was messing around with the sqlite DB while the bot was running

west raptor
#

hmm

blissful scaffold
#

make sure the guild ID has to be unique in the DB
in the worst case it will throw an error of a duplicate guild id and it doesn't add the guild a 2nd time

west raptor
#

Well I shouldn't be getting those errors either way

#

because if the guild is already in the database it shouldn't be going through create_guild again

#

also it worked so [2019-12-20T23:26:29Z INFO rin::db] guild 657724679691173908 inserted into the database successful

atomic quarry
#

Ok so I don't know how to make it so only a "Certain role or the account id of the person" can use the bot can someone help?

sudden geyser
#

what language and library

blissful scaffold
#

if only 1 person is allowed to use the bot then check the id of the person that uses the account and only execute the command if it is the correct user id

#

if you want to bot to only react to people with a role then check what roles the person has that uses a command and see if it has the wanted role

atomic quarry
#

Ok....

#

@sudden geyser I'm using Node.js

sudden geyser
#

check if the user ID is the same as the ID you want that certain person you want to use, like if (theUserID === "264811613708746752") {...} (264811613708746752 being the actual user to restrict it to). As for roles, you'll need to get the role object and see what members have it (filter).

atomic quarry
#

ok

earnest phoenix
#

i love it when they ok their way away in confusion

sudden geyser
#

"I see" eyesLeft

blissful scaffold
#

Next question will be why theUserID is undefined

sudden geyser
#

or the syntaxerror for three dots

tropic shuttle
#

how can i make the bot create channels in a catgory and doesnt make all channels like this

west raptor
#

what

tropic shuttle
#

i want to make the channels like this when i type the command make the channels in log category

#

when i do it make the channels in random places

west raptor
#

d.js?

#

@tropic shuttle

tropic shuttle
#

yes

#

@west raptor

west raptor
tropic shuttle
#

thx

earnest phoenix
#

Everytime i try to do this:

var rr = args.join(" ")
var roleinfo = rr.split(" | ")
var permission = roleinfo[2].toUpperCase().split(", ")
message.guild.createRole({
       name: roleinfo[0],
       color: roleinfo[1].toUpperCase(),
       permissions: permission
})

it returns:

(node:3949) UnhandledPromiseRejectionWarning: RangeError: Invalid permission string or number.
steel tinsel
#

Try using discord.js's permission constructor

#

You can't pass a string like that

surreal sage
#

how to make dis work? js if(command === undefined) { message.delete() const errore = new Discord.RichEmbed() .setAuthor('Error', 'https://cdn0.iconfinder.com/data/icons/shift-free/32/Error-512.png') .setDescription(`I don't know wich command that is! \nPlease try again.`) .setColor('#36393F') message.channel.send(errore) }

#

or does it work?

#

cuz i tried and it didnt

restive furnace
#

if (!command)

#

cause sometimes it can be null instead of undefined

surreal sage
#

ah

#

thanks

#

nope

#

wait this? @restive furnace js if (!command === null) {}?

restive furnace
#

if (!command) just

#

show me urs normal command

#

and it needs to be else if, if u have like 10 cmds or more on the same place

#

if (cmd1)

#

else if (cmd2)

#

else if (cmd3)

#

else

surreal sage
#

i tried !command onl;y

restive furnace
#

show me urs whole msg handler

#

whit that if(!command)

surreal sage
#

i dont have a msg handler

#

does not work at my cmds

#

and i use // to find my commands

restive furnace
#

if u dont have its not suprise that it wont work

#
client.on("message", (message) => {
   //so you dont have this?
});```
surreal sage
#

i do

#

@restive furnace

#

i just tried and it didn't work

earnest phoenix
#

i hope you're aware

#

that if there is something after the prefix

surreal sage
#

y

earnest phoenix
#

the command will always be defined

surreal sage
#

so its not possible?

earnest phoenix
#

i- thats not what i said at all

surreal sage
#

k

earnest phoenix
#

your logic just went off the rails so I'm telling you that the command will always be defined

surreal sage
#

yeah ok

grizzled raven
#

unless you have a command handler

#

which you get the command from a collection, and if its not set, it returns null

quartz kindle
#

unless his handler keeps commands in an object or array, then it will return undefined lul

modest maple
#

speaking of object, what are peoples thoughts on having one master object, e.g one object that is created that has the client object, command, message, user object, message obect in one

#

rather than passing seperate parameters to a function you just pass the one object and get from it what you need from there

warm marsh
#

That's completely personal preference. afaik there isn't any change in performance etc...

quartz kindle
#

the whole interpreter is basically one master object

#

global in node and window in browsers

#
// in browser
const abc = "something"
console.log(window.abc) // something```
#

although not all browsers expose this

modest maple
#

yh

quartz kindle
#

in node you can do global.abc = something

#

then use global.abc everywhere, without needing to pass objects through functions

late hill
#

What do you people do with requests (mainly message sends) timing out and/or 500 server errors (when discord goes poopy mode)
Do you just ignore them, do you retry the request (if so, what if the retry fails too)? Do you handle a timeout differently than a 500 error?

earnest phoenix
#

fire and forget

#

if you get a 500 just forget about it

#

there isn't anything much you can do about it

restive furnace
#

What is best place to find color palettes for bots?

modest maple
#

wdym

restive furnace
earnest phoenix
#

what

modest maple
#

colours for bots r just hex codes

restive furnace
#

i know

modest maple
#

just get the hex code of the colours you want

modest maple
#

welp we finally got selenium opening new tabs properly now how to close them Thonk

static sorrel
#

hi

modest maple
#

hi

#
RuntimeError: no running event loop
C:\Users\ChillFish8\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py:1772: RuntimeWarning: coroutine 'AsyncManager' was never awaited
  handle = None  # Needed to break cycles when an exception occurs.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
#

argggggggggggggggggggggggggggggggggg

#

i hate async somtimes

shy turret
#

how would you make a compile command with discord.js?

earnest phoenix
#

what does that even mean

shy turret
#

I've seen some bots with !!compile and ofc !!eval.

earnest phoenix
#

yes but what does it do

#

i can't read your mind

shy turret
#

how do you make a compile command?

earnest phoenix
#

what

#

do you know how to ask questions properly

shy turret
#

more like idk how a compile command works, but i heard it is better than eval

#

sometimes

earnest phoenix
#

yes

#

but

#

what the fuck does it do

shy turret
#

it's like eval but better

earnest phoenix
#

you have to understand i can't read your mind

shy turret
#

i honestly don't really know

#

google shows nothing

modest maple
#

mostly cuz its completely pointless making a compiling command just to do the same task as eval

shy turret
#

ok ... i guess im dumb...

#

honestly, whats the point of compiling then.

modest maple
#

why would you need a command to compile code? which eliminates the entire point of eval

#

there is no point unless your pushing changes and updates to run

restive furnace
#

@shy turret some bots are made in c++/c# and thats what they call their eval as compile and some bots are just files and eval is their eval.

shy turret
#

oh thanks

#

is it possible to make a public function (command handler)

#

im just not gonna command handlers then..

restive furnace
#

on d.js i just fetch all cmds, check if its command and if yes then fetch the file and cmd.run(client, message, args);

#

oof my bot is on 5 guilds and ram usage is 500 (maybe cuz my while loop)

modest maple
#

jesus what while loop r u doing

restive furnace
#

trick to get ur process ram like 5gb on nodejs js let stopped = true; stopped = false; while(!stopped) { message.channel.send("true") }

#

that did make my bot ram usage so high

modest maple
#

thats just api abuse if ur spamming true

restive furnace
#

ik, i just used my eval cmd and see what happens

modest maple
#

just dont do it aura_shrug

restive furnace
#

k

#

but how then i could do that it awaits for reaction before sending msg in logs, ex if he presses thumb down, then it wont send it, and if yes, then it sends cuz rn it sends it before reacting anything

modest maple
#

wait_for()

restive furnace
#

my code rn js https://hastebin.com/uwetopuwuy.js

#
  • its js
#

not py

modest maple
#

js async still has a wait_for()

#

but in terms of looping

#

any loop creates hang and is 'blocking' code

restive furnace
#

k

#

i have very limited ram 528mb

modest maple
#

you could create a new task and have it in a loop waiting for it to stop it blocking the rest of the code

#

and with 528mb ram u might be screwed

restive furnace
#

yeah gotta get better vps

modest maple
#

you have a vps with 528mb ram!?

restive furnace
#

yes

#

1$/month

modest maple
#

jesus christ

sudden geyser
#

"trick to get your process ram like x on nodejs":

while (true) setInterval(() => {}, 0);```
restive furnace
#

thats better

#

wow 900mb increasing/sec

#

rip my ram

#

k vps crashed

sudden geyser
#

wait you actually ran that nepyikes

restive furnace
#

yes cuz i wanted to see how much it takes my ram

modest maple
#

bruh

#

u have 528MB ram

restive furnace
#

yes

#

but its shared vps

#

and i have 520mb ram of the shared vps

modest maple
#

its like 4$ for 4GB ram vps

restive furnace
#

yea

west raptor
#

that's not enough to run anything

#

I seriously recommend getting a better vps

modest maple
west raptor
#

why are you using 10gb of ram

#

wtf are you running

restive furnace
#

i just dont know but idle it uses 10mb ram

modest maple
#

2 Main bots 3 Private bots and a multi code webhandler

west raptor
#

ah ok

modest maple
#

80% of that ram usage is the webhandler xD

west raptor
#

my bot uses ~5mb at idle

modest maple
#

xD

west raptor
#

im actually surprised at that but kinda not

restive furnace
#

is the embed type on d.js-master rich, or message or what?

modest maple
#

its an object

restive furnace
#

yeah but in the object

#

MessageEmbed.type is undefined, but what is it when its sent

west raptor
#

MessageEmbed?

restive furnace
#

its on d.js master

west raptor
#

im aware

earnest phoenix
#

No error

#

This is weird

west raptor
#

oh i see what you're asking now

earnest phoenix
#

🤔

west raptor
#

@restive furnace Fetch the message and see what the property embeds gives

#

MessageEmbed#type shouldn't be undefined

earnest phoenix
#

This code doesn't contain any error(RIP my bad english)

west raptor
#

what code

restive furnace
#

kk

earnest phoenix
#

Oops

restive furnace
#

yey got working my reason cmd

lapis merlin
restive furnace
#

you need to do !msg.member.hasPermission and msg.member.hasPermission

lapis merlin
#

hasPermission is deprecated

restive furnace
#

no.

#

hasPermission** s** is depreactedd

lapis merlin
earnest phoenix
#

you still can use it

restive furnace
#

oh webhooks

#

idk cuz i dont use em

lapis merlin
#

,-,

sudden geyser
#

what specifically "can I do this"

lapis merlin
sudden geyser
#

have you tried it

lapis merlin
#

.has

#

I have to use permission.has or has.permission?

warm marsh
#

<Permission>#has

lapis merlin
#

ok

#

thanks :3

nimble creek
#

Hello so I was wondering what url I should use for my bot since I don't have a website for it.

mossy vine
#

dont put anything in that field

nimble creek
#

I haven't added it to my server either

#

I'm trying to figure that part out

mossy vine
#

are you talking about submitting the bot to top.gg?

nimble creek
#

Yes so I can add it to my server

mossy vine
#

thats not how it works

#

you need to code your bot first

nimble creek
#

Okay

mossy vine
#

top.gg is only for listing your bot, not for creating or hosting it

nimble creek
#

What would you recommend use to create and host it

mossy vine
#

creating - literally any programming language with literally any code editor
hosting - a vps

nimble creek
#

Okay

modest maple
#

have you ever coded before?

earnest phoenix
#

i guess no

nimble creek
#

I only did basic java along time ago

modest maple
#

i would advise then:

#

Go back learning the basics well

#

js basics**

nimble creek
#

Okay thank you @modest maple

modest maple
nimble creek
#

Hey chill how do you add it to your server

modest maple
#

have you programmed it and have it running?

earnest phoenix
#

What do I have to do that my bot comes in the Discord bot list

blissful scaffold
#

Add the bot to top.gg and have a lot of patience ^^

#

Then after 2 weeks you re-add your bot because the detailed description was not detailed enough

earnest phoenix
#

Ok, do I have to do the description in English or do other languages ​​go?

modest maple
#

what ever just as long as it isnt:

a) Just HTML/CSS

b) Look like this:

p[ ikhudfgpokjdtrgha poji  erta

gihudhfgsapoij]sghfdoij[hsgfd
]=adrg;iuhdhfaspo]k#sfgh
][

im doing this to get over the 300 min requirement```
vital lark
#

any language can go

earnest phoenix
#

ok

daring gorge
#

Can someone make a bot where someone types "100" in a channel, the bot deletes the message and puts a reaction on the last post with the emoji name also being "100"? If they type "asdgfafs" it shouldn't work but if the emoji exists it should work

modest maple
#

yes someone could make a bot like that

#

no they will probably not do it for free

loud salmon
#

-hardrequest @daring gorge

gilded plankBOT
#

@daring gorge

You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.

daring gorge
#

O_o seems like it would only take 5 minutes lol

loud salmon
#

yep

#

which is why its better to just go there

#

as people willing to do a 5 minute job for 10 bucks are a dime a dozen

modest maple
#

yh

#

in terms of size it would be alot of C+P unicodes

restive furnace
mossy vine
#

@daring gorge isnt that already builtin with +:emoji:

earnest phoenix
#

@restive furnace

Are you Saving the Channel by ID or Name?

restive furnace
#

id

#

@earnest phoenix

earnest phoenix
#

let modLog = message.guild.channels.find(c => c.id === tag.get("mod_logs"))

#

Tho, are you copy and pasting Commands?

restive furnace
#

no?

#
  • message.guild.channels.get(id) should work fine.
#

it worked until i made if (!modlog) {}

daring gorge
#

+😎

restive furnace
#

k got working, i just needed to add .catch after the thing and remive if (!modlog)

#

so now it ignores if no modlogs channel setupped

#

its k if not much guilds

outer niche
#
            await sondageMessage.add_reaction(":thumbsdown:")```
#

Can't figure it out why this is not putting the reactions on the message

modest maple
#

have u assed sondageMessage to somthing

#

and Ignoring that

#

u need to Unicode instead of the \👎 version

prime cliff
#

Wait what language is that isn't it suppose to end with ; for each function

restive furnace
#

idk

#

im using pure js

#

(w node.js)

#

(so not pure)

amber fractal
#

Semicolons arent required in js

#

I was referring to chillfish

modest maple
#

what

outer niche
#

I'm very confused don't want to do with that because I've never heard of Unicode

modest maple
#

its legit what all the defualt emoji's r

outer niche
#

So the emojis that come with Discord

modest maple
#

yh

#

or any decive / messaging platform

mossy vine
#

thats not very accurate

outer niche
#

That is what I have used

mossy vine
#

not accurate at all

#

Unicode is a computing industry standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard is maintained by the Unicode Consortium, and as of May 2019 the most recent version, Unicode 12.1, contain...

modest maple
outer niche
#

I still don't get it what do I need to do to fix it

mossy vine
#

replace :thumbsup: with its unicode equivalent

#

you can get it with \:thumbsup:

#

\👍

quartz kindle
#

a unicode character is a character like any other character, you can copy paste it, use it in text, in code, etc

#

there are many emojis who have a unicode version of it

outer niche
#

So I put a slash in front of it

tacit stag
#

\👍

#

Escape char or \

#

This is also useful to get user ID and channel id

outer niche
#

That did not fix it

modest maple
#

code

outer niche
#
async def poll(ctx, *, args):
        await ctx.message.delete()
        if not len(args) > 0 :
            None
        else :
            questionSondage = "".join(args)
            dictEmbed = {
                "title": ":bar_chart: Poll",
                "description": \
                                f"""
                    
                        {questionSondage}
                        
                    """
            } 
            sondageMessage = await ctx.send(embed = discord.Embed.from_dict(dictEmbed))
            await sondageMessage.add_reaction("/:thumbsup: ")
            await sondageMessage.add_reaction("/:thumbsdown: ")```
modest maple
#
  1. well atleast we now know ur defo on python
#

thats not what they ment

#

D.py basically wants the emoji like: \u23EE

outer niche
#

This is confusing I don't know how to turn 👍 into something like /u233EE

modest maple
#

or python discord

#

if you go there

#

and into playground or bot commands

#

you can do ?charinfo <emoji> and it will give you the unicode

outer niche
#

Ok thx

#

await sondageMessage.add_reaction("\:U0001f44d: ")

#

So it needs to be something like this

modest maple
#

remove the ::

#

just take the straight up unicode characters

#

as the bot gives you

outer niche
#

Ok

modest maple
#

but you'll need all of the parts if it send them to you so you just put them all togethert

outer niche
#

That's all it sent

modest maple
#

yh so u should be fine

outer niche
#

It is only adding one

modest maple
#

code

#

await sondageMessage.add_reaction("/:thumbsdown: ")```
#

that part^^

#

re send it

outer niche
#
async def poll(ctx, *, args):
        await ctx.message.delete()
        if not len(args) > 0 :
            None
        else :
            questionSondage = "".join(args)
            dictEmbed = {
                "title": ":bar_chart: Poll",
                "description": \
                                f"""
                    
                        {questionSondage}
                        
                    """
            } 
            sondageMessage = await ctx.send(embed = discord.Embed.from_dict(dictEmbed))
            await sondageMessage.add_reaction("\U0001f44d")
            
            await sondageMessage.add_reaction("\U0001f44e")```
modest maple
#

that should work

sudden geyser
#

that description...

outer niche
#

It does not work

modest maple
#

any error or is it just not adding it?

outer niche
#

that

modest maple
#

what version of d.py r u using?

outer niche
#

1.2.3

modest maple
#

right update it to 1.2.5

#

its now quite and old bug

#

but discord changed their API

outer niche
#

How do I update Discord PY

modest maple
#

which caused any d.py bots which is on a earlier release than 1.2.5 crashes on animated emojis

#

r u on pycharm or somthing else?

outer niche
#

IDLE

modest maple
#

i cant remember cuz i use pycharm so i can just click a button xD

outer niche
modest maple
#

think so yh

outer niche
#

Yep got it Thank you

modest maple
#

it should stop having that error now

outer niche
#

Yeah it's good now

modest maple
#

👍

sudden geyser
#

@outer niche by the way reset your token

modest maple
#

this did even notice

blissful scaffold
#

bad token leak

modest maple
loud salmon
#

ugh

#

@outer niche for big stuff like that use triple backticks ----> ``` big text shit here ```

outer niche
#

kk

modest maple
#

did you reset your tokeN?

outer niche
#

yes

modest maple
#

cool cool

valid frigate
#

legitimate question does discord reset tokens after a few months/years? a lot of my apps got their tokens regenerated

earnest phoenix
#

nope

valid frigate
#

lmao weird

modest maple
#

ik if you upload to github code with your token it automatically become invalid

valid frigate
#

i haven't done that since like 2 years ago lul

earnest phoenix
#

the only way it can get forcefully reset is what chillfish said and api abuse

valid frigate
#

hmm

#

my bots process wasrunning for 11 days and it could read messages but not send any

#

token regen fixed that

#

definitely not api abuse

modest maple
#

if your token is invlid it will kick you off the API completly

#

Instant crash and program ends

earnest phoenix
#

well uh

#

no

#

it depends on how you handle it

valid frigate
#

odd

modest maple
#

if you catch the error when the token is invalid it wont

valid frigate
#

weirdest thing is jda was logging shard reconnection events and no errors involving an invalid token

modest maple
#

but i dont exactly know why you would do that, cuz well you kinda wanna know when the token is invalid or not

valid frigate
#

discord is strange

modest maple
#

reactions have a delete property (it might be remove) and you can pass the user as a arg for it to delete

#

so it only removes the user's reaction

#

yh

#

well your getting the reaction and user from the bot.on()

#

so you have the two object you need

quartz kindle
#

what people usually do is count the reactions and if bigger than 1, remove it

modest maple
#

tbf i dont remove them cuz people often dont give the bot manage reactions perms and it just dicks u

#

also stops people spamming somthing like a paginator

quartz kindle
#

yeah, better just use djs master and listen to the reaction dispose event (if doing stuff like interactive menus)

outer niche
#

Does anyone know how to make a discord login or a website

blissful scaffold
#

you mean like the top.gg website?

lusty dew
#

Probably talking about discord oauth2 flow

outer niche
#

Something like that

blissful scaffold
outer niche
#

Ok

#

I don't get it cuz when I put identity in it does not do anything

earnest phoenix
#

What should I do

warm marsh
#

Read the error

earnest phoenix
#

Kk

restive furnace
#

Whats weird happening w embeds... they are sending as [Object object] on d.js

#

(on dms)

#
const emb = new Discord.MessageEmbed()
 .setColor(0xea411d)
 .addField( "You have been warned in **" + message.guild.name + "**", `Reason: ${reason}` ) 
.setFooter("Moderator: " + message.author.tag)

let User = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]); 
User.send(emb+ "basic mark(​)").catch(e => { 
message.channel.send( `**${user.tag}** has DMs disabled, so he wont get warn message.` );
})```
mossy vine
#

why are you trying to concat an object and a string

restive furnace
#

otherwise it said cannlt send empty msg

#

but i fixed by deleting embed

fluid basin
#

wot

#

embeds are part of a message

#

but not part of the text

restive furnace
#

ik

surreal sage
#

how to let this... uhh work? js if(message.author.id === blacklist.users) return;

compact oriole
#

do you know how json works?

#

(or js)

surreal sage
#

yes

compact oriole
#

then that should be easy for you

surreal sage
#

wasy basy

#

okok

#

@compact oriole json "users":[ "id", "id2" ]

compact oriole
#

cool

surreal sage
#

wdym cool

compact oriole
#

you sent a json, cool

surreal sage
#

ah ok

#

it was that space at users:(space)[]

#

right?

compact oriole
#

it doesnt matter

surreal sage
#

uh ok

#

but must there be more then 1 property?

#

of users *

compact oriole
#

you should know this stuff, the answer is no, it can be empty

surreal sage
#
{
    "users":[
        "564309687189635087"
    ]
}``` i had this the whole time
#
{
    "users":[
        "564309687189635087",
        "id2"
    ]
}```
#

^^^^ not that

#

but it still didnt work

#

that guy is banned

#

for testing

#

but it does react

earnest phoenix
#

@surreal sage use a db not .json

#

json is a shit database lol

surreal sage
#

idc

earnest phoenix
#

if u want it getting Corrupt all the Time then ok

#

Use lowdb or Enmap

surreal sage
#

i caaannnnt

#

my vps cant do it

#

ripppp

compact oriole
#

is it heroku xddd

surreal sage
#

i have to wait for it

compact oriole
#

and yes, it can

earnest phoenix
#

Omg

surreal sage
#

nooo

#

it isnt

#

it is a other vps

#

its named

#

Cubes.host

#

gotcha :P

earnest phoenix
#

Lmao

compact oriole
#

not that shit

#

oh no

earnest phoenix
#

Lmao

compact oriole
#

its not a vps

earnest phoenix
#

Dafuq

surreal sage
#

it is

compact oriole
#

its a bad host

#

ITS NOT

earnest phoenix
#

Even glitch is better

compact oriole
#

You dont have root access

earnest phoenix
#

@earnest phoenix YEAH DUDE

#

Yes

#

kmskms

#

glitch is the better actually

surreal sage
#

idc about root

compact oriole
#

@surreal sage Its not a vps if you dont have access to root

surreal sage
#

i just want hosting

compact oriole
#

Its not vps

surreal sage
#

idc

compact oriole
#

You have full access to vps

surreal sage
#

im here for something else

earnest phoenix
#

"bot hosting"

compact oriole
#

You use some cancer shit

earnest phoenix
#

lmao

#

lmaooo

compact oriole
#

You are here for copy pasta

surreal sage
#
if(message.author.id === blacklist.users) return;```
```json
{
    "users":[
        "564309687189635087"
    ]
}```
earnest phoenix
#

there is no such host that is free

compact oriole
#

You only copy other peoples stuff

earnest phoenix
#

tutorial alert

surreal sage
#

@west raptor Can you please stop them naming them me as "copy pasta"

earnest phoenix
#

copy pasta

surreal sage
#

dont be a dick

#

this is being a dick

earnest phoenix
#

im not a dick

surreal sage
#

yes you are

compact oriole
#

no hes not xd

earnest phoenix
#

no u

#

how is this being a dick fam

#

u use a fucking json database

#

yeah we're helping you smh

surreal sage
#

Affax got warned cuz he did this

#

cuz he was being a dick

earnest phoenix
compact oriole
surreal sage
#

haha

earnest phoenix
#

LOl

surreal sage
#

no

earnest phoenix
#

@compact oriole LMFAAOOOOO

surreal sage
#

@west raptor please

earnest phoenix
#

exp0szddd

surreal sage
#

IM NOT A COPY PASTA

#

OK

earnest phoenix
#

@surreal sage what you are doing, is Unnessasy staff pinging

compact oriole
#

Then code that yourself

surreal sage
#

I DID

compact oriole
#

Even people that coded for 7 days its easy

earnest phoenix
#

probaly not

surreal sage
#

@west raptor im crying now CUZ I WANT HELP

earnest phoenix
#

lmao

#

bro

surreal sage
#

and i dont get it

compact oriole
#

HoW cAn I fIlTer ThRoUgH aN aRrAy

surreal sage
#

stop them being a dick

#

please

earnest phoenix
#

@compact oriole even i can do it

#

you can ping a mod once

#

bro

compact oriole
earnest phoenix
#

you know google exists

surreal sage
#

😭

earnest phoenix
#

dude stop acting

#

its annyoing

surreal sage
#

no im not

#

IM NOT ACTING

#

I WANT HELP

#

AND STOP NAMING ME COPY PASTA

#

CUZ IM NOT

earnest phoenix
#

my man

#

copy pasta

#

chill

surreal sage
#

STOOOOOOOOOPPPPPP

earnest phoenix
#

Acting is the key 🗝

surreal sage
#

@west raptor PLEASE

earnest phoenix
#

hes kinda agressive

compact oriole
earnest phoenix
#

^^^

opal halo
#

Pasta, how bout this

surreal sage
#

@twilit rapids Please 😭

earnest phoenix
#

stop crybaby-ing over json

compact oriole
#

Oh hey @opal halo, ur bot got accepted! 😄

earnest phoenix
#

like fking json

opal halo
#

Yup

compact oriole
#

Good job!

opal halo
#

Thanks!

earnest phoenix
#

@twilit rapids
The User CDeveloper#0001 is agresieve and constantly pinging Dream#9849.

surreal sage
#

i just want fucking help and now your letting me cry

opal halo
#

I'm making another bot rn

earnest phoenix
surreal sage
#

cuz i dont want to be named like that

earnest phoenix
#

@opal halo whats its name?

surreal sage
#

AGAIN

compact oriole
#

KK Pasta

opal halo
#

N00b

earnest phoenix
#

@surreal sage well cause you're obviously trying to get spoonfed so whyy should we help you

#

^

#

the rules said that we cannot spoonfeed

surreal sage
#

NO

earnest phoenix
#

soooo deal with it my man

#

calm down

surreal sage
#

I just want to know my problem so i can try to fix

opal halo
#

Bruh

earnest phoenix
#

Ok we saw that all

surreal sage
#

ok idc

#

i just want help 😭

earnest phoenix
#

your problem is you're not filtering the array correctly, so now fix it

#

we no give codes

#

sorry

opal halo
#

Then don't call us bitches

earnest phoenix
#

@spare goblet we just got called bitch by @surreal sage

surreal sage
#

i do if you dont stop beng a dick

earnest phoenix
#

@surreal sage DUDE STOP YOU BEING A DICK

#

Damn dude

#

also stop with the attitude

#

my man

opal halo
#

Bruh I never even said anything

earnest phoenix
#

u know you can just calm down and be cooperative and probably we'll help you

#

@earnest phoenix probaly thats his Attitude

opal halo
#

^^^

surreal sage
earnest phoenix
#

bro

opal halo
#

Ok

earnest phoenix
#

what kind of retarded logic is that

#

Now whats so wrong about that

surreal sage
#

just stop

#

wtf stop

#

I DONT LIKE THIS

opal halo
#

Ok

surreal sage
#

JUST STOP

opal halo
#

Jeezus

earnest phoenix
#

You are asking to get Spoonfeeded.

#

Saying people trying to copypasta are being dicks? Wtfffff

surreal sage
#

NO

opal halo
#

Shut mouth

earnest phoenix
#

lmaoaoooaoaoaaooa

lean pike
#

Hi

earnest phoenix
#

kms

#

kms

#

finaly someone peaceful @lean pike

hello

compact oriole
earnest phoenix
#

^^^

compact oriole
#

Didnt I already say

earnest phoenix
surreal sage
#

STOPPPP

earnest phoenix
#

DUDE THATS THE BEST THING EVER @compact oriole

compact oriole
#

❤️

lean pike
#

Guys i Need random anime picture

earnest phoenix
#

@lean pike google for it

#

random anime pfp

quartz kindle
#

jesus christ guys what the fuck

earnest phoenix
#

ikr

opal halo
#

Ikr

lean pike
#

I want to make one link that gives you a random photo

quartz kindle
#

@surreal sage your blacklist is an array, so you need to check if the array contains a user id. you do that by using array.includes(id)

earnest phoenix
#

this guy is telling us that we're being dicks for saying that he is using copypastas

#

@quartz kindle that dude @surreal sage is kinda agressive

surreal sage
#

ok thx

#

STOP NAMING ME LIKE THAT

earnest phoenix
#

copy pasta

#

👍

surreal sage
#

FUCK UP

earnest phoenix
#

ok chill now he gave you the solution

surreal sage
#

Just stop naming me like that

earnest phoenix
#

@surreal sage Toxic Copy Pasta

quartz kindle
#

guys shut up please

lean pike
#

Yes

surreal sage
#

RAAAAAAAAAAAAAAAAAAAAAAAAAA

#

RAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAA

#

v

#

b

#

RAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAdfsdnfgbkm

opal halo
#

Omg

surreal sage
#

sstoootoppspototposootppws

lean pike
#

😂

surreal sage
#

@west raptor

earnest phoenix
#

ikr

#

@surreal sage @earnest phoenix stop

opal halo
#

Ya know there is such thing as a block button

surreal sage
#

NO YOU

opal halo
#

Omfg

earnest phoenix
#

what did i do lol

surreal sage
#

I just want to be calm

earnest phoenix
#

then calm

#

jesus

surreal sage
#

And you insult me

earnest phoenix
#

i swear when my bot gets Accpepted i do an module for him that when he caps locks something that it sends an dm to him:

copy pasta

#

i didn't

surreal sage
#

AGAIN

earnest phoenix
#

lmao

surreal sage
#

@compact oriole did

#

@earnest phoenix did

quartz kindle
#

stop it script

earnest phoenix
#

@earnest phoenix please

#

Ok chill

surreal sage
#

and Affax

#

cuz im really crying

earnest phoenix
#

Affax don't do anything tbh

opal halo
#

Bruh ur crying because of copy pasta...

earnest phoenix
surreal sage
#

STOOPPPPPPPP

#

IM NOT A COPY
PASTA

earnest phoenix
#

whats a copt pasta?

#

we didn't say anything

surreal sage
#

STOP

#

PLESASAA
SA
E
AS

#

e

#

ASeas

#

e

#

as

earnest phoenix
#

chill out

#

stop spamming

#

lol

opal halo
#

HOLY FUCK

surreal sage
#

You stop being a dick

earnest phoenix
#

i screenshot everything :)

#

what did i do lol?

surreal sage
#

and i you @earnest phoenix

earnest phoenix
#

what

quartz kindle
#

please stop adding fuel to the fire, move on, go to other channels, block people, go do something else please, im out

spare goblet
#

Hi

opal halo
#

Thats what I'm trying to tell him

#

To block

spare goblet
#

Please stop fighting and take this to DMs, this is #development. If you want to block each other then please do so

#

This is not the time nor the place. Any one who continues to fight will be muted for 1 month.

earnest phoenix
#

@spare goblet axyx was calling us a bitch

opal halo
#

^

spare goblet
#

Move on please

surreal sage
#

Sorry

#

But just please

earnest phoenix
#

@opal halo what is your bots prefix?

opal halo
#

N!

#

It's not online rn

earnest phoenix
#

l

#

k

restive furnace
#

mines "!" w/o quotes

#

(default prefix i mean9

glad charm
#

Mine has to be mentioned. prefixes got annoying.

modest maple
#

How did prefixes get annoying xD

restive furnace
#

© might be a good prefix

glad charm
#

I use to have it customizable.
I annoyed myself is the tldr

restive furnace
#

™ = good prefix

glad charm
#

is best

earnest phoenix
#

Best bot prefix for 201o

#

2019*

surreal sage
#

@quartz kindle With that array.include
my array = blacklist
but that didnt work
i tried blacklist[users].include
didnt work either
What to use there?

slender thistle
#

As a random guy just showing up, is blacklist[users] an array?

surreal sage
#

or i have to use blacklist['users']

#

?

slender thistle
#

Or is blacklist an array?

surreal sage
#

blacklist is

#

my json

#

dont comment on it

slender thistle
#

So you're accessing a users key of a JSON value of which is an array

#

Am I correct

surreal sage
#

think so

slender thistle
#

Then yes, that should be correct

surreal sage
#

with ' or without?

#

cuz without didnt work

slender thistle
#

Try with apostrophes then

surreal sage
#

whats that?

slender thistle
#

'

surreal sage
#

ah

#

${}

#

?

indigo geyser
#

uh js

surreal sage
#

``

#

this ^^^^?

slender thistle
#

Wrong symbol, the apostrophe is '

surreal sage
#

this: '

#

or `

slender thistle
#

Yes

surreal sage
#

first?

slender thistle
#

'

surreal sage
#

ok

slender thistle
#

Can't you use Google for that instead of asking

surreal sage
#

i'm dutch and i dont know the names of symbols 🤣

slender thistle
#

` is backtick, ' is apostrophe

modest maple
#

It would of bean easier to say quote marks

surreal sage
#

ok

#

yeah...

slender thistle
#

That would be " which wasn't precisely correct

surreal sage
#

(node:11) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined

#
if(blacklist['user'].includes(message.author.id)) return;```
slender thistle
#

plural

#

users, not user

surreal sage
#

oh lol

slender thistle
#

Proofread what you write ty :^)

surreal sage
#

y sry

late hill
#

If it's not a dynamic key and doesn't contain special characters why not just use .users ?

surreal sage
#

Thanks!

#

It works

#

no adding your banned msg

#

now*

earnest phoenix
#

Aye nice, you got it fixed

static surge
earnest phoenix
#

how does my bot get verified

warm marsh
#

By time

quartz kindle
#

@static surge your function does not return anything

#

move the function outside of the scope, so you dont redeclare it every time you run the command, and you dont need async here

#

create the canvas, then return it

static surge
#

@quartz kindle And how to make it return?)
This is my first time working with Canvas

modest maple
#

That's basic programming

#

And @earnest phoenix #commands please and common prefixes are muted

quartz kindle
#
module.exports.run = async () => {
  ...
  let buffer = profile(...);
}

function profile(...) {
  return new Canvas(...).toBuffer();
}
static surge
#

@quartz kindle And the very sending far?

    const attachment = new Discord.Attachment(buffer, 'welcome-image.png');
    await message.channel.send(attachment);
quartz kindle
#

.send({ files: [attachment]});

#

or

#

.send("message",attachment);

#

the way you did it should also work, test it

vagrant stream
#

Hm...

#

Working local attachment:

const attachment = new Discord.Attachment('./card_images/sample.png', 'sample.png');
const embed = new RichEmbed()
        .setTitle('Wicked Sweet Title')
        .attachFile(attachment)
        .setImage('attachment://sample.png');
message.channel.send({embed}).catch(console.error)
quartz kindle
#

if you want it in an embed, yes

glacial mango
#

How do I check if a message contains an attachment?

restive furnace
#

message.attachment[0]?

glacial mango
#

does not work

earnest phoenix
#

rtfd

static surge
#

Help pls

restive furnace
#

can u do eval message and send me the logs

static surge
#

@quartz kindle Listen ... I see you understand a lot of things ... I’ve done something like it’s necessary, but my avatar is not shown

.addCircularImage(member.displayAvatarURL, 85, 90, 64)
earnest phoenix
#

the docs are your haven

#

go read them

#

to both of you

modest maple
glacial mango
restive furnace
#

k then its message.attachments[0], i think

earnest phoenix
#

@vagrant stream for the attachment you can use the links

glacial mango
restive furnace
#

what the message.attachments says?

#

w/o [0]

glacial mango
restive furnace
#

message.attachments.first() maybe

modest maple
#

👏 Read 👏 the 👏 docs 👏

quartz kindle
#

attachments is a Collection, which is an extension of Map. Maps do not have numbered indexes like arrays

#

they have keys, like objects

#

@static surge canvas does not download images, you need to download them before you can use them

earnest phoenix
modest maple
#

ask glitch

earnest phoenix
#

Ok

static surge
#

@quartz kindle
Um ... And this is my profile picture in what plan to download?

#

I tried so, it gives an error

  const result = await fetch(member.user.displayAvatarURL.replace(imageUrlRegex, "?size=128"));
  if (!result.ok) throw new Error("Failed to get the avatar.");
  const avatar = await result.buffer();
earnest phoenix
#

what err

static surge
#

Failed to get the avatar

quartz kindle
#

show full code

quartz kindle
#

you didnt await it

#

also, if you're doing that inside a function, you need to make it async

static surge
#

Did and the error did not go away

#

@quartz kindle ⬆️

quartz kindle
#

what did you do ?

static surge
#

Just added async

quartz kindle
static surge
#

I did not understand you ...

modest maple
#

You need to await it

quartz kindle
modest maple
#

Async 101

static surge
#

...

#

@quartz kindle
Lord ... Elementary, thank you very much 🙂

earnest phoenix
#

@earnest phoenix glitch can use canvas yes

static surge
#

@quartz kindle And I also wanted to know either how it calls it, or just how to do it ...

#

This is how to make a strip

#

Only I need it around the avatar, and not as an example.

earnest phoenix
#

@earnest phoenix do they also support es6

#

Oh Nice

#

Dany?

#

Yes?

restive furnace
#

@earnest phoenix fp glitch is node.js developement thing... so it supports every npm package

earnest phoenix
#

ok lets try it

surreal sage
#
    if (command === "enable") {
        const args = message.content.split(' ').splice(1).join(' ');
        if(args === "clear") {
            if(clear === 0) {
                clear = 1;
                message.reply("I've enabled **clear**!")
            }
        } else {
            if(args === "lockdown") {
                if(lockdown === 0) {
                    lockdown = 1;
                    message.reply("I've enabled **lockdown**")
                }
            } else {
                if(args === "kick") {
                    if(kick === 0) {
                        kick = 1;
                        message.reply("I've enabled **kick**")
                    }
                } else {
                    if(args === "ban") {
                        if(ban === 0) {
                            ban = 1;
                            message.reply("I've enabled **ban**")
                        }
                    }
                }
            }
        }
    }```
#

im doing this but its hard

#

i know i can do: ```js
if(args === 0) {}

#

im not sure*

#

but can i do args = 1;

#

cuz if args is like a variable stored somewhere

#

would it pick the job from that variable and store something in it?

sudden geyser
#

you're checking if a string is a number. why do you want to re-assign args specifically?

surreal sage
#

wdym

sudden geyser
#

wdym by what

surreal sage
#

what will happen if i do that*

sudden geyser
#

do what specifically

surreal sage
#

what?

blissful scaffold
#
if(args === 0) {}

This will always be false because args is a string and will never be 0

surreal sage
#

where is args 0?

blissful scaffold
#

i know i can do:
if(args === 0) {}

surreal sage
#

??

#

thats what i want

#

there is nothing defined as args

#

well there is

#

but no 0

#

these others are vars

quartz kindle
#

btw you can do else if()

surreal sage
#

idc

quartz kindle
#

no need for js else { if() }

surreal sage
#

ik

#

and idc

mossy vine
#

else if is literally that tho

surreal sage
#

ik

#

but idc

restive furnace
#

lol

#

its easier than else {if(){}}

quartz kindle
#

what is the problem anyway? i dont understand what you need

surreal sage
#

i have to do every thing of this http://prntscr.com/qea1hn in enable/disable i want like 10 lines of code and not hundreds, i want that if the args have the name of a variable it changes the variable value

Lightshot

Captured with Lightshot

#

so i can have it short

sudden geyser
#

a command handler sounds much easier to manage, or an object/collection

quartz kindle
#

the best way to do that would be to put all of those inside an object

surreal sage
#

but how to change then?

quartz kindle
#
const values = {
  warn: 1,
  report: 1,
  etc: 1
}```
#

then you can do

surreal sage
#

how to change them then

quartz kindle
#

values[args[0]]

surreal sage
#

y

#

but how to change them

quartz kindle
#

if you are working with true/false, you can do values[args[0]] = !values[args[0]]

surreal sage
#

i want that i can change them

quartz kindle
#

if you strictly need to work with 1/0 and not true false, then you need to do js values[args[0]] = values[args[0]] ? 0 : 1

#

the basics of it is like this

surreal sage
#

nvm

#

im tired

quartz kindle
#

you have an object, ie values = {test:1}

surreal sage
#

so im gonna continue this

quartz kindle
#

so you can access it by values["test"] and it will give you 1

surreal sage
#

ik

quartz kindle
#

and you can change it by doing values["test"] = 0

surreal sage
#

ok thx

#

thats what i wanted to here

#

hear

quartz kindle
#

and if you are working with true and false, there is a shortcut

#

for example

#

values["test"] = !values["test"]

surreal sage
#

nvm

quartz kindle
#

if values["test"] is true, it becomes false, if its false, it becomes true

#

values["test"] EQUALS NOT values["test"]

#

this is the easiest way to switch something between true and false

surreal sage
#

il take your first example

quartz kindle
#

and what you wanted is to use args directly, right? so you can use the value of args directly in there

#

values[args]

surreal sage
#

ik

#

i did that earlier

slender thistle
#

@quartz kindle isn't there a way to .toBoolean or something

quartz kindle
#

yeah there is

#

Boolean(something)

static surge
quartz kindle
#

i dont understand what you want desert

static surge
#

@quartz kindle Do you see the strip below?

#

Depending on the user's XP, it changes...

#

I want to do something like this

blissful scaffold
#

you make 2 bars, the one in the background always has the full length and the bar in the foreground is a limited length depending on the XP

quartz kindle
#

^ and convert the experience percentage into the pixels needed to fill the bar

static surge
#

@quartz kindle @blissful scaffold
I’m saying that I’m a beginner can show how to do it

blissful scaffold
#

I know the theory, but I'm not a JS dev so I can't really help you with any details

#

I would say read the documentation related to canvas, making rectangles is usually pretty easy and i think rounded edges are also not too hard

static surge
#

Can I drop a link to it? Because I really didn’t find anything.

blissful scaffold
#

The few times that I had to work with JS I usually used the Mozilla docs

quartz kindle
#

@static surge you see how you did addRect to create a rectangle?

opaque eagle
#

Has anyone used typeorm with mongodb?

#

I don't wanna use mongoose for its lack of TS-ness

#

and callbacks... yuck

static surge
#

@quartz kindle Saw.

quartz kindle
#

havent used any mongo, nor any orm, nor ts lmao

opaque eagle
#

lol

quartz kindle
#

@static surge so basically its the same thing

#

you create a background rectangle for the bar

#

and another rectangle on top for the xp fill

#

the rest is all math

#

rectangles are created from 4 values: X position, Y position, Width and Height

#

so in those numbers you need to define where the rectangle should start (X and Y)

#

both of your rectangles should start at the same position

#

then you need to define the rectangle width in pixels

#

one rectangle should be the full width, the second should be a partial width

#

you need to use math to calculate the correct width

#

then the height, both rectangles should be the same height

#

for the width math, you can use the following formula

#

xp bar width = currentXP * full bar width / totalXP

delicate zephyr
#

Whats the easiest way to create an image in node.js

modest maple
#

canvas probs

opaque eagle
#

I use canvas, it's neat

fluid basin
#

@delicate zephyr jimp for the easier-to-use-but-much-slower one or canvas if you used html canvas before

delicate zephyr
#

I need it for node

#

since I'm gonna use a web server to give images after generated

#

since I also want it to embed in discord mmulu

#

@fluid basin

lusty dew
#

Canvas can still be used can’t it

opaque eagle
#

yeah

fluid basin
#

yeah node-canvas

delicate zephyr
#

Yea

#

ok

fluid basin
#

well honestly idk but afaik the nodeJS libraries for image manip are quite slow

sudden geyser
#

it's an image

opaque eagle
#

I use golang for image manipulation

#

but in node i like node-canvas

pale steppe
#

how long does it take for a bot to be verified?

sudden geyser
#

a week or more

pale steppe
#

ok

lusty dew
#

It really depends

modest maple
#

atm it around 2 weeks

lusty dew
#

Depends on how backed up their queue is and how many mods are available to test

delicate zephyr
#

@opaque eagle how would you send it through express when using express?