#development

1 messages · Page 379 of 1

mental geyser
#

client.user.setPresence({ game: { name: on ${client.guilds.size} guilds, type: 0 }});

night imp
#

"type: 0"

#

look in the docs for that

mental geyser
#

:3

frail kestrel
#
embed = discord.Embed(colour=0xC29FAF) # colour code is changeable
embed.set_thumbnail(url=ctx.bot.user.avatar_url) 
embed.add_field(name="Dev", value="your_name", inline=True)
embed.add_field(name="Lib", value="discord.py", inline=True)
embed.add_field(name="Guilds", value=len(ctx.bot.guilds), inline=True)
embed.add_field(name="Support Guild", value="[Here](https://discord.gg/no)", inline=True)

await ctx.send(content="about the b0t", embed=embed)
jagged birch
#

How do I make it so if args(a number) has a m on the end it does something, but if the same args has a h on the end, it does something different, and if there is nothing on the end, it does something else (for example returns and says invalid usage) discord.js lib btw

earnest phoenix
#

can somebody help me?

#
@bot.command(pass_context=True)
async def promote(ctx, user):
    """ Promotes a member to the next rank"""
    if ctx.server.id == int("idhere"):
        member = ctx.message.author
        role = discord.utils.get(ctx.guild.roles, name=str)
        if role in member.roles:
            afterrole = ddrankroles[int(role[1:3]) + 1]
            if name == "None":
                await bot.say("There isn't anyone with this username")
            else:
                await member. add_roles(afterrole)
                await member. remove_roles(role)

ddrankroles = {1 : "L01. Stranger" , 2 : "L02. Young" , 3 : "L03. Earner",4:"L04. Pickpocket",5:"L05. Thug"
,6:"L06. Racketeer",7:"L07. Sender",8:"L08. Wise guy",9:"L09. Representative",10:"L10. Guider"
,11:"L11. Advisor",12:"L12. Don",13:"L13. Father"}    ```
#

..

pale light
#

error? library?

earnest phoenix
#

i have imported whatever needed

pale light
#

I said error and library

earnest phoenix
#

fix plz

#

i try 3 hours on this

#

😦

frail kestrel
#

We’re not gonna spoonfeed

#

Tell use your problem

earnest phoenix
#

I want to make a promote function

#

it will check if the server id is the right one

#

then if the one who did the command is admin

#

and then will promote the user

#

i dont know what to do to make it work

mental geyser
#

how can I make this so I can mention someone to get their avatar url?

#

if (message.content.startsWith(prefix + 'avatar')) { message.reply(message.author.avatarURL);

frail kestrel
#

well

#

You check if a user has been mentioned

#

And if so, send the user’s avatar(URL)

mental geyser
#

:/

#

I am confused

earnest phoenix
#

so any help?

frail kestrel
#

.

#

@mental geyser expect a code sample?

mental geyser
#

maybe :3

frail kestrel
#

ok

#

well I’m not gonna spoonfeed you, take what I told you and apply your knowledge of JavaScript to make it work

earnest phoenix
#

ok

#

sorry

frail kestrel
#

not you @earnest phoenix

mental geyser
#

.-. k

frail kestrel
#

if you don’t know js pls learn

#

this chat assumes u have working knowledge of the lang

mental geyser
#

I just want to know how to direct commands at other people so I can get their avatar @frail kestrel

frail kestrel
#

I told you how

#

And I’m not spoonfeeding

jagged birch
#

anyone know why this aint working?:

if(!msg.content.includes("m") && !msg.content.includes("h")) return msg.channel.send(incorrectUsageEmbed);```
it just returns but doesn't send the embed
frail kestrel
#

what’s incorrectUsageEmbed defined as

bitter sundial
#

returning stops the rest of the function from running

frail kestrel
#

oof

bitter sundial
#

oh nvm

jagged birch
#

yeah i know, but it should send the message too.

quiet bobcat
#

But that should send the embed 👀

bitter sundial
#

blame my monitor size

#

line breaks

frail kestrel
#

oof

quiet bobcat
#

same

jagged birch
#

same

bitter sundial
frail kestrel
#

same for me

bitter sundial
#

so if a message doesn't contain both m and h it sends an embed

#

but why that if?

frail kestrel
#

dbl m00t for auto embed!111!!11

jagged birch
#

because m is minute and h is hour so if the number doesn't get h or m after it it wont know what to do

quiet bobcat
jagged birch
#

oh the command has a m in it.. 🤦

#

nvm then

gusty topaz
#

the advert isnt centered hmmm

#

bizzare

bitter sundial
#

@quiet bobcat what happens

quiet bobcat
#

It has a grey inner box

#

don't like it

#

doesn't fit

topaz fjord
#

But

#

It's your opinion zoomeyes

quiet bobcat
#

let me ask you, does it look good to you?

topaz fjord
#

Yes

quiet bobcat
topaz fjord
#

I like it

quiet bobcat
#

fixed it

trim plinth
earnest phoenix
#

nothing

#

"SyntaxError: Unexpected token import
at new Script (vm.js:51:7)
at createScript (vm.js:138:10)
at Object.runInThisContext (vm.js:199:10)
at Module._compile (module.js:626:28)
at Object.Module._extensions..js (module.js:673:10)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
at Function.Module.runMain (module.js:703:10)
at startup (bootstrap_node.js:193:16)"

#

what is it ? ;-;

trim plinth
#

code please

#

an error isn't very descriptive

earnest phoenix
#

my code is so big ^^'

trim plinth
#

since you have shown multiple times that you use VSCode, look at where an error is shown and see what it says

earnest phoenix
#

i don't have a error :l

#

^^'

quiet bobcat
#

You do

#

scroll up in the terminal

trim plinth
#

actually yeah read your error carefully

#

they are meant to be read to help you find the problem

earnest phoenix
#

i know ^^'

#

"SyntaxError: Unexpected token import" :l

#

its my token

trim plinth
#

no

#

token =/ bot token

earnest phoenix
#

ok

trim plinth
#

I suggest learning terms for js syntax, it might help you figure out your errors better

#

or just learning js straight out

earnest phoenix
#

ok thx

prime geyser
#

Whats the error ? bot.on('message', message => { if (message.content.startsWith(prefix + "cchannel")) { let myrole = message.guild.member(bot.user).hasPermission("ADMINISTRATOR") let yourole = message.guild.member(message.author).hasPermission("ADMINISTRATOR") if (!yourole) { // si il n'a pas la permission message.channel.send("Tu n'as pas la permission 😕") } else { let cname = message.content.substr(prefix.lenght + 9) // on récupère le nom du channel message.guilds.createChannel(cname) // on crée le channel message.channel.send("✅ salon créé !") } } })

inner jewel
#

send the error message

#

we don't have crystal balls to guess what it is

prime geyser
#

There is no error message

#

Just the command does not execut

#

@Natan#1337

earnest phoenix
#

in a situation like the one below how do i get it to delete the invite?

inner jewel
#

if(msg.hasInvite()) msg.delete()

earnest phoenix
#

How can I get the message Id?

gilded blaze
#

what lib

topaz fjord
#

so quick question, can i readfile a file using fs that i got from sharex without saving it

plucky topaz
hushed berry
#

@plucky topaz What lib are you using?

#

JDA?

plucky topaz
#

Yes

hushed berry
#

What date do you want to set it to

#

current?

#

@plucky topaz

plucky topaz
#

For example in #mod-logs. There is the time in the footer. That's what I want

hushed berry
#

yes but

#

what date do you wnat to set it to

#

the methdo to set it is just

#

in the EmbedBuilder

#

setTimestamp(...)

plucky topaz
#

okay, I'll try it ^^

#

thanks

topaz fjord
#

anyone here using mongo grid-fs

drowsy falcon
#

how to make a vote command d.js?

marble copper
#

Can someone help me?
i want my bot to send me a Invite link to every discord server it joins

old glade
#

Well

#

if your bot does not have the good permissions

#

it won't be able to do so

marble copper
#

it sends me Server id's when it join

elder rapids
#

why would you want to do that

marble copper
#

dont question me...

elder rapids
#

No offense but I find bots very creepy when their owner has an invite link active for them to just randomly join your server

marble copper
#

well thats you

quasi marsh
#

I have ID's, names and membercount but if they ask me to troubleshoot I'll still need to join

#

For proof that they are actually admin

elder rapids
#

pfft I don't do that. I just trust my users. If something is sketchy then I won't do anything. Anything I do would still require them to have permission to do said item

quasi marsh
#

Kinda need too, can't trust anyone when your bot is used for security

elder rapids
#

Mines a moderation bot and I still don't?

quasi marsh
#

trust issues fam

topaz fjord
#

anyone use express and nginx

elder rapids
#

yus

#

I've used it

#

Although not an expert or know much with it

#

nginx is debatable. I don't use it much maybe like once

topaz fjord
#

i keep getting a 404

elder rapids
#

with?

topaz fjord
#

using them both

elder rapids
#

uhhh what now

topaz fjord
#

im asking if anyone knows how to fix it

#

but im 100% sure i have the stuff in the directory

elder rapids
#

I mean with express.... I can't see any reason 404 would come unless you put your wildcard at the top

abstract mango
#

how can I include jda in gradle with kotlin? (need spoonfeed for this one :P)

olive ridge
#

I have a add and remove role cmd on my bot

#

However it only adds and removes one role

#

¯_(ツ)_/¯

#

Here is da code

#
if (message.content.startsWith(config.prefix + "addrole")) {
    if(!message.member.roles.some(r=>["Admin", "Staff"].includes(r.name)) )
      return message.reply(":x: Admin Restriciton :x:");
  
    let role = message.guild.roles.find("name", "Staff");

    let member = message.mentions.members.first();

    member.addRole(role).catch(console.error);
  } else
      
  if (message.content.startsWith(config.prefix + "removerole")) {
    if(!message.member.roles.some(r=>["Admin", "Staff"].includes(r.name)) )
      return message.reply(":x: Admin Restriciton :x:");
  
    let role = message.guild.roles.find("name", "Staff");

    let member = message.mentions.members.first();

    member.removeRole(role).catch(console.error);
  } else
#

Do I use somthing like role.name instead of ``"Staff"`?

#

let role = message.guild.roles.find("name", "Staff"); this line

#

I know why it only does it for the staff role, I don't know what to replace it woth though

mental geyser
#

how can I make this so I can mention someone to get their avatar url?
if (message.content.startsWith(prefix + 'avatar')) { message.reply(message.author.avatarURL);

abstract mango
#

my previous question is fixed, I figured it out

#

now I'm just wondering which repo to use really

#

jcenter, or mavencentral

#

and nvm

vital lark
#

oof

earnest phoenix
#

What is the d.js code for removing and adding people to and from roles

frail terrace
#

okay how do I POST images to my website

#

like http post

mental geyser
#

how can I make this so I can mention someone to get their avatar url?

            message.reply(message.author.avatarURL);```
errant bone
#

what lang?

earnest phoenix
#

Looks like discord.js

mental geyser
#

discord.js @errant bone

errant bone
#

oh sorry can't help :/

olive ridge
#

probaly wont work

#

im shit at coding

#

USE THIS
let member = message.mentions.members.first();

heady zinc
#

actually mentions.users would be faster

olive ridge
#

hmm

#

So like message.reply(mentions.users.avatarURL);?

prime cliff
#

🤔 dont you need the .first()

brittle oyster
#

Does anyone use python on their bot?

olive ridge
#

Possibly Transmissions#0001

#

idk /s

#

¯_(ツ)_/¯

abstract mango
#

@brittle oyster what cha need

abstract mango
earnest phoenix
#

what is wrong with syntax

#
        if v.find("(GROUP)") != -1 or v.find("(GROUP NOTE)") != -1 or v.find("(GMOTD)") != -1  or v.find(" (ALLIANCE)") != -1 or \
            (v.find("DoM") != -1  and (v.find(" has warned ") != -1  or v.find(" has promoted ") != -1  or v.find(" has demoted ") != -1  or \
            v.find(" has kicked ") != -1  or v.find(" has joined ") != -1  or v.find(" has left ") != -1  or v.find(" invited ")) != -1 :
#

nvm

remote estuary
#

please help me

#

i want build discord bot on my website

frail kestrel
#

@remote estuary what

remote estuary
#

why?

low rivet
#

yes there's the discord developers documentation

#

if your bot isn't in >2000 servers and isn't a music bot, you probably don't need to know about it

austere meadow
#

@low rivet is there something particularly special about music bots that requires you to shard earlier zoomeyes

#

i just ask because im at about 1k guilds with music

#

unsure of when to shard

low rivet
#

idk i just know that dabbot has a lot more shards then ill ever hit

#

from what i heard, less servers/shard = better quality and all

austere meadow
#

i finally got lavalink working on my bot so im hoping that mem usage will go down a bit

low rivet
#

about 1k per shard

austere meadow
#

i might shard around 1250 then

low rivet
#

yeah GWproximThumbsUp

#

-bots @austere meadow noembed

gilded plankBOT
#

zBlake#0007's dblMod dblCertifiedDev bots:
@crystal jolt dblCertified

low rivet
austere meadow
#

ugh

#

need to fix my bots playing status

#

d.js added something recently where you can initialize your client with presence data included but im not sure how to use it

low rivet
#

search it up

#

@austere meadow pretty sure I've seen from other people's code that you can pass it into your run()

austere meadow
#

yeah you can its pretty easy but i think its cool the client way

gilded plankBOT
#
Mister_KoRo#0912
Bots

@proven wren

sacred crypt
#

-bots @sacred crypt

gilded plankBOT
#
jas777_PL#0261
Bots

@regal wasp

rustic cloud
#

Hey, is this where I would ask for help making a bot...? I'd like to make one, but I haven't a clue how.

languid dragon
#

we have a blog with some tutorials that may help you

rustic cloud
#

Okay, thank you!

earnest phoenix
#

How can I add a bot to auto role a specific role will be selected and given to new people when they arrive

languid dragon
#

ok

#

for starters

#

don't tag every mod

earnest phoenix
#

ok sry

gusty topaz
#

oof

steel heath
#

hey

earnest phoenix
#

how can I do it

austere meadow
#

what lib are you using

earnest phoenix
#

eggsy ne dedi bu

#

@steel heath

steel heath
#

hangi dili kullanıyorsun discord.js probably

earnest phoenix
#

js @austere meadow

#

discord.js

austere meadow
#

okay

earnest phoenix
#

ok

#

.would you help me with this

austere meadow
#

you'll want to add the guildMemberAdd event to your code https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-guildMemberAdd
and inside that code/event you will want to

  1. get the role you want to apply by using guild.roles.get([role id])
  2. apply the role to the member joining by using <guildMember>.addRole(<Role>)
    <Role> will be the role you define with step 1, and <guildMember> is the guild member received from the event args
earnest phoenix
#

@steel heath

#

ne dedi

#

ve

#

ona bunun hazır halını atabılırmısın diye sorarmısın

steel heath
#

Please stop tagging me karışık

austere meadow
#

@earnest phoenix can you make sure you keep other languages in #memes-and-media please

earnest phoenix
#

oh ok

austere meadow
#

👍

wraith burrow
#

Hi. If there is any discord.py developers, Should I use discord.Client() or discord.ext.commands.Bot()?

earnest phoenix
#

make me do it ?

#

auto role

#

and send to me

#

my english is bad :9

austere meadow
#

@earnest phoenix sorry i can't just spoonfeed you the code
its pretty straightforward though, you just add that guildMemberAdd event to your code, then use <Member>.addRole(<Role>)

earnest phoenix
#

okey

#

How can i fuckin deal with unicodes and characters

austere meadow
#

ok first of all calm down no need to swear GWchadThonkery

#

and whats the issue

earnest phoenix
#

Unicodedecodeerror

#

how can I ensure that I choose to label the role

austere meadow
#

@wraith burrow i dont code in python so im sorry if im not much help, but most people i see use discord.Client

earnest phoenix
#

client.on('guildMemberAdd', member => { <Member>.addRole(<Member>)

#

its ok ?

austere meadow
#

yeah but you need to replace <Member> with member in your code, and you can't addRole a member GWchadMEGATHINK

#

you need to put a Role object inside of addRole

#

you can get that by doing guild.roles.get([id])

#

replacing id with the role id

earnest phoenix
#

client.on('guildMemberAdd', member => { <Member>.addRole(<Power>)

#

id ?

austere meadow
#

what

earnest phoenix
#

where do i put

#

where do i write
id

austere meadow
#

client.on('guildMemberAdd', member => { member.addRole(member.guild.roles.get(PUT ROLE ID HERE)) }

earnest phoenix
#

i made a script that keeps logs from a file

#

but if someone put a shit character

#

i am fucked

austere meadow
#

a simple way i guess would be to use encodeURIComponent()

earnest phoenix
#

what does this do

austere meadow
#

it encodes unicode characters

#

you can also use encodeURI() which allows you to use characters like / ? : @ & = + $ # whilst encoding others

earnest phoenix
#

where do i buy the role id

#

encoding="utf-8"

#

i use htis

#

how can i do it in autorole h!autorol @ROLE NAME

austere meadow
#

@earnest phoenix you can get a roles id by putting a backslash before a role ping like \@Bot Developer

earnest phoenix
#

How can I choose to label

#

h!autorole @ bot developer and choose the role member add the role

#

how can I do

austere meadow
#

that's pretty tricky

#

you'd need a database to store the value (JSON, something like that you can learn some of that here https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/coding-guides/storing-data-in-a-json-file.html )
then use that value in the event instead of getting a role manually

#

it's not easy but yeah

inner jewel
#

don't ever save data in json files

earnest phoenix
#

why

austere meadow
#

its fine to use JSON for smaller projects

hushed oyster
#

@wraith burrow Use discord.ext.commands.Bot()

austere meadow
#

however if you plan on expanding your bot you can use sqlite or some other database thing

inner jewel
#

you should avoid saving data in raw files

#

use a database

#

they're made to store data and be concurrently modified

#

without corrupting

wraith burrow
#

@hushed oyster What advantages does it has over discord.Client() or reverse?

austere meadow
#

it's pretty overkill to use a database for an autorole thing but it depends on the use case

inner jewel
#

databases are never overkill if the data will be modified

hushed oyster
#

It makes everything easier

#

It's the recommended choice by most people

austere meadow
#

my friend makes a bot called @rotund orbit and although its only on ~120 servers they use JSON and it's not been corrupted
obviously he'll need to switch over soon (cough cough @white blaze) but the point is if you use it correctly and save the file within intervals you can get away with it ¯_(ツ)_/¯

white blaze
#

Mornin' sir

inner jewel
#

when @molten wren used json to save data, it'd get corrupted at least twice a week

austere meadow
#

g'day

inner jewel
#

before we moved to a real database

#

no data corruption after that

white blaze
#

How's your Tuesday so far Blake

austere meadow
#

i also experienced lots of JSON data corruptions, about the same as you

white blaze
#

I used to have issues

inner jewel
#

and the cost of running a database is fairly low

white blaze
#

But what I do now is I write it out twice to different files

inner jewel
#

redis takes about 1-2MB of memory here

white blaze
#

So like

#

When the bot saves

inner jewel
#

which is negligible compared to the bot's 400+

austere meadow
#

vic basically stores his settings within a variable then he saves the json file with intervals

white blaze
#

It saves to a backup file first

inner jewel
#

if it's only stored one time at once

white blaze
#

So if it crashes while it's writing the backup file you'll just lose the last 30 seconds of changes

inner jewel
#

it shouldn't get corrupted

#

but any reads while that write happens may be corrupted

austere meadow
#

isn't that what you do @white blaze

inner jewel
#

and if the bot crashes mid-write it's corrupted for good

austere meadow
#

you read once at start up

white blaze
#

Yes

austere meadow
#

i had that issue a lot lmao

white blaze
#

And I write to a second file first

#

Before writing to the main file

#

And then deleting the second file

#

If it crashes during the first stage then you'll just lose 30 seconds of data

austere meadow
#

but regardless of if its getting corrupted or not its not very reliable imo

inner jewel
#

write to second file -> rename main to eg main-old -> rename second file to the real name

austere meadow
#

thats why i think you should switch soon vic

inner jewel
#

that's the safest you can get with raw files

austere meadow
#

to something better

white blaze
#

It's going to be such a hassle to set up though

#

And to migrate

inner jewel
#

if you only write on an interval and only in one place

wraith burrow
#

Should I make every function async?

inner jewel
#

it'll be safe

wraith burrow
inner jewel
#

performance might take a hit

#

but corruption shouldn't happen

austere meadow
#

vic if i did it with postgres im sure you can do it
this was back when i literally didn't know what i was doing with linux

white blaze
#

Discord bots don't really need performance

#

I'll have to rethink it a lot when I move to pg

inner jewel
#

when you have a bot using 5k threads and 10GB of RAM they do

white blaze
#

Well my bot doesn't do that yet 😛

austere meadow
#

oof

white blaze
#

So far it's working alright

#

22 GB

austere meadow
#

whilst we are here i just wanted to ask; is there any difference in performance between postgres and redis or any other database provider

white blaze
#

Whew man

austere meadow
#

just curious

white blaze
#

At that point I wouldn't be using JS

inner jewel
#

redis should be somewhat faster

#

but it keeps all data in memory

white blaze
#

@austere meadow I have definitely had performance hits when I experimented with SQLite

inner jewel
#

if you have the default rdb-only save

#

you may lose data in case of a server crash

austere meadow
#

i dont think it should really matter at the end of the day, i was just wondering because i saw it on yorks guide

inner jewel
#

if you enable aof as well you shouldn't lose any data

#

also redis can be used as a cache

#

which it was designed for

#

and it's a k/v or k/k/v storage

austere meadow
#

ah okay

inner jewel
#

while postgres is SQL

#

redis can also run scripts in the database process

austere meadow
#

oh neat

inner jewel
#

which can atomically update any key

#

so you could eg have a counter incremented by 100 different processes at the same time and have always the correct number

austere meadow
#

thats pretty cool thinkW

inner jewel
#

(not the best example, since there's already a command to do that, but you could do it with scripts)

austere meadow
#

right now i use postgres w/ sequelize and im really happy with the performance

#

i can write/read pretty fast

inner jewel
#

it uses scripts for CAS and get+delete

austere meadow
#

thats cool

wraith burrow
#

Do I need to use aiohttp for HTTP requests or will requests be fine?

#

Python ^^^

#

?

low rivet
#

Requests is blocking, and it will make your bot to pause for the duration of the HTTP request. basically use aiohttp @wraith burrow

wraith burrow
#

Ok, thank you.

#

Does anyone has a simplified aiohttp class?

#

Nvm I can write it

languid dragon
#

hi @uncut slate

uncut slate
#

hi

#

mister

languid dragon
#

ill fix it for 25 smheckles

uncut slate
#

done

frail kestrel
#

nu shitposting

languid dragon
#

k 1 sec

uncut slate
#

.columns .bot-img {box-shadow: none !important;}

languid dragon
#

ok

uncut slate
#

euh

#

can't get that to work 👀

languid dragon
#

oh 1 sec

#

@tranquil frigate

uncut slate
#

wait nvm

#

it works

languid dragon
#

omFG

idle grail
#

Help

uncut slate
#

am just a dummo

idle grail
#

me

languid dragon
#

ask ur questions

idle grail
#

My bot isn't working because of it ;-;

inner jewel
#

you forgot a .catch

languid dragon
#

ur unauthorized

inner jewel
#

you can either do await promise or promise.then(/* stuff */).catch(/* handle error */)

idle grail
#

...

#

I am doing discord.js

gilded blaze
#

that is js

idle grail
#

i thought await was Java lol

elder rapids
#

Nope

inner jewel
#

nope

#

java has no async/await

#

"only" futures

elder rapids
#

And await is in many languages

inner jewel
#

^

idle grail
#

Oh

#

i am pretty sure thats whats causing the problem

earnest phoenix
#

how to detect a person up-voting a bot?

umbral pelican
#

webhooker

earnest phoenix
#

ok ty

#

imma try it myself

umbral pelican
#

-bots Telk

gilded plankBOT
#
Telk#2726
Bots

@umbral hearth
@lament sinew

frail kestrel
#

testing pls

idle grail
#

HALP ME

frail kestrel
#

unauthorised means u don’t have the perms for something and therefor is throwing that

idle grail
#

OH

frail kestrel
#

does that even make sense void

#

@frail kestrel stinky

idle grail
#

confused

frail kestrel
#

yes

idle grail
#

So

#

What is it not able to do

#

i can't find anything

#

Oh yeah

frail kestrel
#

well

#

what are you trying to do

idle grail
#

the lines mean every restart

frail kestrel
#

ok

idle grail
#

I am trying to get it to work

#

to actually respond to my command

#

wait can i invite it here

frail kestrel
#

no

idle grail
#

;-;

frail kestrel
#

submit

#

and wait for approval

idle grail
#

how long does that take lol

frail kestrel
#

idk

#

varied

idle grail
#

already submit like 30mins ago

frail kestrel
#

oh

idle grail
#

yeah look a bit up in Logs

inner jewel
#

newbot

#

not new

frail kestrel
#

o

idle grail
#

it said that @idle grail submitted @earnest phoenix Assistant

frail kestrel
#

ok

idle grail
#

Wot

inner jewel
frail kestrel
#

ye

#

I did a bad

idle grail
#

@inner jewel Already added it like 30 mins ago lol

frail kestrel
#

why r u pinging him

#

oh

topaz fjord
#

@idle grail then what's the problem

idle grail
#

HOW DO I FIX THIS HELP ME

#

I INSTALLED BOTH

frail kestrel
#

can’t find express

idle grail
#

IKIK

#

BUT I INSTALLED

frail kestrel
#

is it in ur package.json

idle grail
#

AND THE CONSOLE SAID

#

Yes

frail kestrel
#

oh

#

the fuck

idle grail
#

wtf how do i fix this

frail kestrel
#

Show package.json

idle grail
frail kestrel
#

thinking

idle grail
#

please help

gilded blaze
#

did you try uninstalling it and retrying?

idle grail
#

how do i uninstall

#

npm ui discord.js?

gilded blaze
#

npm uninstall <package name>

topaz fjord
#

Or npm RM <package name>

idle grail
#

Uninstalled and reinstalled

#

@gilded blaze

abstract mango
#

npm i

gilded blaze
#

^

abstract mango
#

try it again, just in case? lol

idle grail
#

i did

#

Yeah its npm i instead of install 😛

abstract mango
#

they're both the same, actually

#

npm i is just shorter

misty anvil
#

Hey guys, i have a q, if anyone could answer that would be awesome... I was wondering how to spread discord.js application through all of the threads on a cpu (because node is single) is there a way to spawn more processes

#

or even dedicate certain processes ? or split up your app using the same key?

umbral pelican
#

shards mmLol

inner jewel
#

you'll have to shard your bot

#

or do it the hard way and have a process connecting to the gateway and sending payloads for other processes to handle

gusty topaz
#

Get a more powerful CPU

#

Obviously

old glade
#

what is bot sharding ?

inner jewel
topaz fjord
#

anyone familiar with gridfs stream

pale light
#

nope

fleet mason
#
const config = require("../config.js");

exports.run = (client, message, args) => {
let guild = message.member.guild;
let Role = guild.roles.find('name', 'Member');

if(message.member.roles.has(config.memberRole)) {
    message.delete();
    message.author.send('\`You already have the \`member\` role!\`');
    client.channels.get(config.channelbotlog).send(`Command: \`!member\` User allredy have the role: \`@member\` User: \`${message.author.username}\``);

}
  else{
    message.delete();
    message.member.addRole(Role);
    message.author.send(`You just got the role: \`member\`, you are now allowed to speak in the text channels`);
    client.channels.get(config.channelbotlog).send(`Command: \`!member\` User just got a role: \`@member\` User: \`${message.author.username}\``);
  }
}
#

any one knows why it just stopped working?

#

i wouldent do the else line only the first

#

but when i restarted it it worked

#

now !clear isnt working

#

could this be a storage problem?

solemn obsidian
#

Is there a way to check if I can dm user with Eris?

elder rapids
#

By sending them a message

#

If it errors with 403 then you can't

solemn obsidian
#

I know that, but without actually sending the message

meager lintel
#

For people who use Eris but not the built in command client how did you guys go about making your own

inner jewel
#

normally it'd be a map of command name -> command

earnest phoenix
#

Whats wrong with this 'purge10': (msg) => { if (msg.guild.member(msg.author).hasPermission('MANAGE_MESSAGES')); msg.delete(10) msg.channel.send(`Success! Deleted 10 messages!`); else msg.channel.send(`You require the permission **MANAGE MESSAGES** to use this command!`); },

inner jewel
#

if (msg.guild.member(msg.author).hasPermission('MANAGE_MESSAGES'));

#

there's a semicolon there

#

what you want: js if(x) { y() z() } else { w() }
what you have: js if(x) {} y() z() else w()

earnest phoenix
#
    if (msg.guild.member(msg.author).hasPermission('MANAGE_MESSAGES'))
    msg.delete(10)
    msg.channel.send(`Success! Deleted 10 messages!`);
  } else {
    msg.channel.send(`You require the permission **MANAGE MESSAGES** to use this command!`);
  },```?
inner jewel
#

still wrong

#

you just have a dangling else there

earnest phoenix
#
    if (msg.guild.member(msg.author).hasPermission('MANAGE_MESSAGES')) {
     msg.delete(10)
     msg.channel.send(`Success! Deleted 10 messages!`);
  } else {
    msg.channel.send(`You require the permission **MANAGE MESSAGES** to use this command!`);
  },```
inner jewel
#

still missing one }

earnest phoenix
#

How tf do you get bot dev if u don't know how to use if else

frail kestrel
#

lol

earnest phoenix
#

@lethal otter sends me sum nsfw photo, i think

#

Yeah

#

Lol

#

I get messages from @lethal otter...

#

@inner jewel

trim plinth
#

WTF

earnest phoenix
#

I get that from @lethal otter

#

Sorry for nsfw

inner jewel
#

don't

#

fucking

#

send

#

gore

shy verge
#
await text.GetMessagesAsync(count).Flatten();

CS1061 'IAsyncEnumerable<IMessage>' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IAsyncEnumerable<IMessage>' could be found (are you missing a using directive or an assembly reference?)

shit

daring dust
#

guys i need help. i think that someone hacked my bot

#

please

trim plinth
#

was it on the vps

shy verge
#

regenerate token on dev page

trim plinth
#

IPad's VPS*

topaz fjord
#

lmao

#

hacked

daring dust
#

it spams "this bot has been hacked by apoda#5338"

shy verge
#

lmao

daring dust
#

spams a long list in every server

trim plinth
#

@daring dust reset your token then

topaz fjord
#

also what the fuck is a ipad vps

daring dust
#

ok

shy verge
#

reset token

trim plinth
#

@topaz fjord no IPad is the heck that got banned

daring dust
#

even the username got changed

#

i cant change it back because it shows the original name

#

please someone help

trim plinth
#

r e s e t t h e t o k e n

daring dust
#

i did

trim plinth
#

ok so it should be fine now

daring dust
#

it says the bot name on the top but the "username" above the token is the one that was changed by the hacker

elder rapids
#

uh wut

shy verge
#

🤦

#

tf

daring dust
#

screenshot

elder rapids
#

Oh jeez it's the iPhone character

shy verge
#

oh boy

elder rapids
#

You'll need to send a PATCH request to /users/@me to change that name

#

well you can do that via a library

daring dust
#

how do i do that

elder rapids
#

But that's how the libraries do it

topaz fjord
#

you can use postman

daring dust
#

;-; what is that

topaz fjord
#

google

daring dust
topaz fjord
#

google it

daring dust
#

i did and installing it

#

@topaz fjord what do i do now?

topaz fjord
#

send a patch request to the url to change the bot name

daring dust
#

which url are you referring to

elder rapids
#

/users/@me

daring dust
#

and how do i do a patch request

topaz fjord
#

@pale light no u

daring dust
#

please im bad at this

topaz fjord
#

google how to use postman

elder rapids
#

I actually don't use postman so I can't help you much

topaz fjord
#

¯_(ツ)_/¯

elder rapids
#

I use an electron app called Insomnia for all that

topaz fjord
#

i do but its hard to explain without the person being next to me

elder rapids
#

Which personally I love Insomnia

daring dust
elder rapids
#

oh

#

you need to uh

topaz fjord
#

you have to put in the discord api base url

elder rapids
#

https://discordapp.com/api/v7/users/@me

topaz fjord
#

and set a header

elder rapids
#

or just /api/users/@me

topaz fjord
#

with the bot token

elder rapids
#

That works too

topaz fjord
#

im currently in the progress of making a wrapper for the D-Api zoomeyes

daring dust
#

do i put the bot token after the @me?

topaz fjord
#

no

daring dust
old glade
#

Do you guys know how to register a .bot domain name with a discord bot ?

elder rapids
#

What are the types in that dropdown

daring dust
#

headers?

topaz fjord
#

@daring dust you have to set a header

#

click the header tab

elder rapids
#

Well

daring dust
#

yes

elder rapids
#

He's on Authorization tab

topaz fjord
#

for key you put Authorization

elder rapids
#

Just curious if that dropdown has anything useful

topaz fjord
#

and for Value you put Bot <token>

daring dust
elder rapids
#

yus

heady zinc
#

oh hey that insomnia thing looks cool zoomeyes

daring dust
#

there's no "value"

elder rapids
#

oh you're on the returned one

daring dust
#

?

#

😦 ill just delete it 😦

topaz fjord
#

oh my gerd postman has a dark theme

daring dust
#

there's no point anymore

abstract mango
#

@daring dust did you already delet

daring dust
#

no

#

@abstract mango

abstract mango
#

ok so

#

let me fire up postman

#

I'll make a example for you

daring dust
#

ok

abstract mango
#

@daring dust

daring dust
#

uh

topaz fjord
#

ew tilda

#

sending form data

abstract mango
#

I overrided it

topaz fjord
#

but it works

abstract mango
#

using content-type

#

lol

daring dust
#

i dont see the "body" dropdown

abstract mango
#

did you already send it

#

🤔

daring dust
#

oh wait, i was just blind but mine looks like this

pale light
#
{
    "code": 50035,
    "errors": {
        "_errors": [
            {
                "code": "CONTENT_TYPE_INVALID",
                "message": "Expected \"Content-Type\" header to be one of set(['application/json'])."
            }
        ]
    },
    "message": "Invalid Form Body"
}
daring dust
abstract mango
#

either the token is invalid or you didn't set auth header

daring dust
#

where do i put the token and where and what is the auth header. sry im stupid

pale light
#

you have to put Bot in front don't you

abstract mango
#

@daring dust so

#

create a new request

#

url same as before

daring dust
#

ok

#

i did

abstract mango
#

then go to the Headers tab

daring dust
#

ok

abstract mango
daring dust
#

how do i add them

abstract mango
#

(replace <your token> with your bot token>

daring dust
#

but how do i add them in the first place

#

;-;

abstract mango
daring dust
#

it doesn't let me do that

abstract mango
#

idk

daring dust
#

ima just delete it 😦

abstract mango
#

you're on the response

#

not the request

daring dust
#

how do i get to the request

abstract mango
#

it should be on the top??

#

usually it's split

#

one part is the request
one part is the response

daring dust
#

i got it

abstract mango
#

o

pale light
#

What do you put in the Body since I'm following along dblSmile

abstract mango
#
{
    "username": "whatever"
}
#

if there's a option for json ofc

pale light
#
{
    "code": 50035,
    "errors": {
        "_errors": [
            {
                "code": "CONTENT_TYPE_INVALID",
                "message": "Expected \"Content-Type\" header to be one of set(['application/json'])."
            }
        ]
    },
    "message": "Invalid Form Body"
}
#

oh ic

abstract mango
#

set the content-type header to application/json

pale light
#

yeah I did

abstract mango
#

hm

daring dust
#

i did it

abstract mango
#

oh wait I figured that out

daring dust
#

where is that dropdown

#

@abstract mango

pale light
#

ok

#

done

#

ty

abstract mango
#

body tab

daring dust
#

it shows the same thing that slowestloris had

#

thats it

abstract mango
#

that's the wrong part

#

you need to go to the request

daring dust
abstract mango
#

ye

#

click raw

#

then a dropdown should appear next to the options

daring dust
#

got it

#

what do i type

#

or nothing if that

#

@abstract mango

abstract mango
#

the bottom is what a successful request will look like

elder rapids
#

I'm stealing that token zoomeyes

abstract mango
#

the top is what the body should be

#

no u

daring dust
#

what do i put for the username and token

pale light
#

you only need to put username

abstract mango
#

the body should be

{
    "username": "what you want"
}
daring dust
#

so .json boune

abstract mango
#

no

daring dust
#

?

abstract mango
daring dust
#
{
    "username": ".json bourne"
}
abstract mango
#

this is how the body should look like

#

in the request

daring dust
#

so i put no u

#

literally

abstract mango
#

if you want that to be the username

daring dust
#

oh

#

so if i want my bot to go back to Dankbot then i do

{
    "username": "Dankbot"
}
abstract mango
#

yep

daring dust
#

send it now?

abstract mango
#

try it, ye

daring dust
#

kek it worked

abstract mango
#

lul

pale light
inner jewel
#

why not use your lib's wa of doing that?

#

way*

daring dust
#

dat spam

abstract mango
#

he's trying to recover from the ipad vps hacc

#

lul

daring dust
#

o

#

so what now

#

yay it changed back

abstract mango
#

yep

daring dust
abstract mango
#

you should be mostly good to go now

inner jewel
#

ipad vps lul

daring dust
#

so now, how do i fix the damage that Apoda#5338 did?

abstract mango
#

well I mean

inner jewel
#

you secure your token

abstract mango
#

you probably lost servers and all

#

and yes

#

please secure your token

daring dust
#

and how do i do dat

elder rapids
#

oh god

abstract mango
#

don't push it to github

inner jewel
#

running on a trusted machine

abstract mango
#

and yes

inner jewel
#

not pushing to VCS

#

locking eval commands

elder rapids
#

yup basically that

abstract mango
#

run on a machine you actually trust

daring dust
#

ok

abstract mango
#

and YeS

inner jewel
#

disabling root login

daring dust
#

so ill just host it off of heroku?

inner jewel
#

using ssh keys

#

changing ssh port

abstract mango
#

natan basically covering everything

daring dust
#

i have no idea how to do dat

abstract mango
#

@daring dust if that's where you want to go/can host

#

i've never hosted on heroku myself though

daring dust
#

where do you host tho?

#

locally?

abstract mango
#

vps

daring dust
#

oh which vps?

elder rapids
#

a paid one

abstract mango
#

friend's vps

meager lintel
#

What server do you run on the VPS?

daring dust
#

its mostly linux-based

ripe blade
#

Lmao

elder rapids
#

What server do you run on the virtual private server?

#

that makes no sense

abstract mango
#

proxmox with lxc of debian

ripe blade
#

testing new features on beta bot but using your prod one by accident

#

and not realizing for like 10m

abstract mango
#

same

ripe blade
abstract mango
#

test in production best

daring dust
#

lel

elder rapids
#

and how would you do that by accident

ripe blade
#

prefixes

daring dust
#

ignorance ;-;

ripe blade
#

muscle memory

elder rapids
#

I think it's physically impossible for me to do

daring dust
#

kek

ripe blade
#

you underestimate my abilities

#

*overestimate

elder rapids
#

Then again

#

My bot is compiled

#

and the token is in the environment

#

I would know if it's a test bot or not and can't run on a production bot

#

My test bot runs on my own machine

abstract mango
#

same

#

it's just the prefixes that get me

ripe blade
#

41 commits in 6 hours LoganIsUgly

daring dust
#

@abstract mango got it back up again and reconfigured everything. it should be fine now as i secured pretty much all access to any source

abstract mango
#

cool

vestal moth
#

I'm having trouble with the webhooks, so I put my webhook link in the api options of the edit bot page.

#

And i had a friend upvote the bot for testing, and there wasn't a post from the webhook.

#

Am I missing anything?

inner jewel
#

discord webhooks won't work there

vestal moth
#

Oh they wont?

inner jewel
#

webhooks aren't specific to discord

#

they're just a way of having a website send you data in a url

vestal moth
#

Ahhh.

#

ok.

elder rapids
#

I feel like it's time you specify that this isn't a Discord webhook on the page

inner jewel
#

^

pale light
#

Is it possible to add elements to a json object

Example:

let a = {}

Adding "derp" to a:

let a = {
    "derp": 123
}
inner jewel
#

derp: 123

#

a["derp"] = 123

#

a.derp = 123

hushed oyster
#

ok

#

@brittle oyster so

#

are you using async or rewrite

west current
#

I can help you for Node.JS

hushed oyster
#

ok

#

@west current he is using d.py

west current
#

I know

hushed oyster
#

@brittle oyster so

#

all you have to do is

#

bot.add_reaction(messageobject, emojistring)

#

or client.add_reaction(messageobject, emojistring)

#

whichever you use

#

for example

#

yes

#

but in quotes

#

then

#

here's an example

#

yes

#

if you were doing this in a command

#

pass context

#

yes

#

but

#

make sure to pass context

#

do you use the commands extension?

#

well

#
  1. You should be using it - it's way easier
#
  1. Can you show me one of your commands?
#

ok

#

ok

#

can you show me the code

#

ok

#

so here's how you would add a reaction

#
        client.add_reaction(message, "😂")
        await client.send_message(channel, "Test")
        print("t~test was used by " + str(author.name))```
#

that's not what I said

#

ok try that

#

i'm not good without the commands extension

#

but it should work

#

hold on a sec

#

here's an example bot with the extension

#

take a look at it

#

the entire thing

#

first off

#

btw

#

with the extension

#

a help command is built in

west current
#

This is a JS question, not really JS even.
What website do you use for your snekfetch images.

#

So when you use snekfetch to get an image, what's the best website for custom messages?

hollow copper
#

@late ridge can you tell me @shell shoal Roverseems ofcline and content deleted

late ridge
#

?

#

uh ._.

hollow copper
#

Rocer is. Content deleted

late ridge
#

i um

#

idk

#

.>

hollow copper
#

Oh

#

Thanks ;/

shy verge
#

any1 here do anything with the tracker network APIs?

#

they give zero documentation

#

angery

ripe blade
#

@shy verge miss me wit that shit

#

i guarantee you someone made a framework/lib for it

grizzled isle
#

Using Node.js version 8.4 or higher, lost track
I am trying to search through a database with the following code

let rows = await sql.all(`SELECT * FROM notes WHERE memberID = ${user} AND GuildID = ${message.guild.id}`) 
let username = []; 
for (let i=0; i < rows.length; i++) {
  username.push(`${rows[i].Username}`)
} 
const spaceuser = (username);
const longuser = spaceuser.reduce((long, str) => Math.max(long, str.length), 0)
for (let i = 0; i < username.length; i++) {
  finmes += `${username[i]}${' '.repeat(longuser - username[i].length)}|` + '\n'
}
message.channel.send(finmes)```
And it is not doing wha it should do, which is place a space after a username and it does what it does in the image. Any ideas?
olive ridge
#

I found a way to add a cooldown to my bot, but im not sure i like it.
here is it:

#
const talkedRecently = new Set();
if (talkedRecently.has(msg.author.id)) {
            msg.channel.send("Wait 1 minute before getting typing this again. - " + msg.author);
    } else {
//command
        talkedRecently.add(msg.author.id);
        setTimeout(() => {
          // Removes the user from the set after a minute
          talkedRecently.delete(msg.author.id);
        }, 60000);
    }
#

I believ you have to add it to every command.

#

can i just put it around muiltiple commands?

grizzled isle
#

You want a cooldown for every command? Place the entire code after you run the command in the message handler

#

@olive ridge

olive ridge
#

Is it wierd to have it on every command?

#

I guess certain commands'

#

would have a higer tolerance for use

grizzled isle
#

Like purge or ban

olive ridge
#

yeah

#

too lazy to do this

heady zinc
#

you could just put it in the message listener

#

you don't need to put it in every command

#

and as for custom "tolerance"

#

you would just need to export that as a command parameter and handle it in the message listener

#

if you have an actual command handler tho

olive ridge
#

hmm

olive ridge
#

I have the stupidest command

#

that can only add one single role

#

"staff"

#
if (message.content.startsWith(config.prefix + "addrole")) {
    if(!message.member.roles.some(r=>["Admin", "Staff"].includes(r.name)) )
      return message.reply(":x: Admin Restriciton :x:");
  
    let role = message.guild.roles.find("name", "Staff");

    let member = message.mentions.members.first();

    member.addRole(role).catch(console.error);
  } else
#

what can i relace with "staff"?

#

Is there a role.name?

olive ridge
#

Please dm if ya have an answer, i gonna leave soon, and this channel gets drowned in messages.

austere meadow
#

what are you asking

olive ridge
#

hm

#

well it only adds one role

#

obv

austere meadow
olive ridge
#

can i just use let role = message.guild.roles.find("name", role.name);

austere meadow
#

you'd need to define role previously somewhere

olive ridge
#

hmm

austere meadow
#

and it doesn't really make sense

olive ridge
#

;-;

idle grail
#

The id's are perfect

#

WHATS WRONG

#

WHY DOESN'T client.fetchUser(id) NOT WORK

austere meadow
#

it does

idle grail
#

THEN WHY

#

i has tested the ID's

languid dragon
#

is that d.js

idle grail
#

they are perfect

austere meadow
#

you're treating member like it's a Member object

idle grail
#

yes

austere meadow
#

when its actually a User object

languid dragon
#

isn't it client.users.get(ID)

idle grail
#

Nope

austere meadow
#

<User>.user isn't a thing

languid dragon
#

or guild.members.get(ID)

idle grail
#

Oh

austere meadow
#

remove the .user and it'll work

idle grail
#

@austere meadow I will try that

austere meadow
#

also ken it depends on what version of d.js you're using

#

thats only on master

#

actually i think it recently got added to 11.3 but idk

idle grail
#

@austere meadow Still didn't work... same error

languid dragon
#

what version u using

idle grail
austere meadow
#

if you do npm ls discord.js what do you get

idle grail
#

Ok i already updated it today but i will see what it does

austere meadow
#

updated today? you're probably on 11.3.1 then

idle grail
#

Yup

austere meadow
#

fetchUser is still a thing in 11.3 thinkW

#

hmm

#

on line 207, replace member.user.id with member.id

languid dragon
#

client.fetchUser(id).then((user)=>{

})

austere meadow
#

member is a User object

idle grail
#

wait a sec

#

Oh

#

frick

#

WHOA