#development

1 messages · Page 1077 of 1

signal wagon
#

And if she can't read the docs which clearly state what properties and what methods User has what are you supposed to do

pale vessel
#

use the dm channel id

digital ibex
#

yeah

#

but

#

oh

still merlin
#

I can read the docs I just forgot some brackets yeash?

digital ibex
#

oki, thanks

earnest phoenix
signal wagon
#

You were told like 3 times that it's a method, not a property, and you ignored that

earnest phoenix
#

@still merlin well it's good to remember this

But methods do end with ()
(It's listed if they're a method or not)```
#

Typing some long shit

#

(Btw it's called methods because they're bound to a property or another function, methods are functions bound to something)

still merlin
#

Will you just stop getting mad at me, I'm trying to multitask so I didn't see the "its a method not a property" message, And don't get mad at me for stating my gender, If you don't know someones gender just call them by they/them, And I don't want to be spoonfed I just simply wanted to know why it wasnt working

pale vessel
#

he's trying to help you...

earnest phoenix
#

I called it

#

Typing some long shit
@earnest phoenix

slender thistle
#

Y'all better chill

earnest phoenix
still merlin
#

Thankyou Shivaco

earnest phoenix
#

I think he said that to you too

#

He said "all"

still merlin
#

I just simiply said thanks?

earnest phoenix
#

Thanks for what

slender thistle
#

drop it

earnest phoenix
#

Case dismissed

#

It really disappoints me when people get in here to get help but everything turns into an argument all of a sudden smh

delicate shore
#

I wanna make a custom welcome msg command

opal plank
#

command?

earnest phoenix
#

Auto message he means i think

opal plank
#

you'd wanna hook it on guildMemberAdd

#

evemt

#

yeah command usually implies !command

earnest phoenix
#

Wont work in other servers tho

#

Unless you do it manually

#

Like

opal plank
earnest phoenix
#

You create a different one for all0

opal plank
#

GUILD_MEMBER_ADD

earnest phoenix
#

A different fucntion

opal plank
#

that'd be running a script, but i get what he meant

earnest phoenix
#

Its like guildmemberadd send message to "channel id "

opal plank
#

that SHOULD return guildMember, which he can prob get channel from that

earnest phoenix
#

If you want to set the welcome message channel and for every guild seperately, be sure to save channel id, guild id and custom message to a database and listen to the guildMemberAdd event

#

If guild and channel id exists in the returns member's guild object

#

How to do it seperately for each server its in

#

Send the welcome message

#

Use a database

#

Basically

opal plank
#

it returns in the guildmember

#

guildmember is part of A guild

earnest phoenix
#

Yes

#

Uhh, what i said?

opal plank
#

if user joins guild A, it shouldnt log on B

#

not taht voltrex

#

this

#

i assumed that question was him thinking it returns a user, not a guild

earnest phoenix
#

Oh

#

I see, it's hard to know sometimes about who is talking to who

#

Lol

opal plank
#

indeed

earnest phoenix
#

I know mentions exist but people get mad when you mention them mostly LULW

inner quarry
#

GUILD_MEMBER_ADD
@opal plank
Which intents it need?

earnest phoenix
#

I mean not realy mad on a bot mention if they ask for it

opal plank
#

@inner quarry intents?

#

thats a WS event

#

its emitted when a guild adds a member

inner quarry
#

Ok. So I don't need to add any intents?

opal plank
#

i dont think so, no

inner quarry
#

X to S ame.

#

X

opal plank
#

what?

pulsar forge
#

If need help coding BDFD ping me

digital ibex
#

noted

delicate shore
#

@opal plank hey my phone died I couldn't complete question it was that I have a welcome msg for specific server in specific channel but I had problem with custom msg per server like if they do s!custommsg {user} just joined and now server has {mcount} members etc how can I allow them to use {user} as user ping and mcount as member count

digital ibex
#

replace

earnest phoenix
#

replace

opal plank
#

replace

delicate shore
#

I couldn't figure it out

#

How tho ?

earnest phoenix
#

Both split/join and replace would work

delicate shore
#

Ok

#

Thanks

#

I will try

#

Can I declare it as a var

opal plank
#

let/const

earnest phoenix
#

var?

opal plank
#

no var

#

var bad

delicate shore
#

Ok

digital ibex
#

declare what as a variable?

delicate shore
#

And if they use it as ${mcount}

#

It will replace it automatically right ?

opal plank
#

isnt define a keyword too?

#

holdon

delicate shore
#

Ok

digital ibex
#

no

#

and wdym

opal plank
#

nah

delicate shore
#

I did let mcount = "Your mum"

If the person types
Welcome perosn ${mcount}

#

So will it replace the mcount with your mum or the specific code ?

opal plank
#

'something hello'.replace('hello', 'funny') => 'something funny'

delicate shore
#

Ok

opal plank
#

reminder, thats global

digital ibex
#

if u do 'bob is a fatty shit'.replace('fatty shit', 'nice person'); its gonna be bob is a nice person (invalid syntax but :p)

opal plank
#

i'd use regex or split if i were you

delicate shore
#

Ok

#

Thanks

opal plank
#

and return on first match

#

split(indexof)

earnest phoenix
#

Regex should be avoided if possible but i still suggest using it

#

OMEGALUL Idk why i said this cuz i always use it

digital ibex
#

i've only used it twice in my biggest project

#

the other times its just .split.join kek

earnest phoenix
#

The thing is, that split().join() replaces every single match but with replace() you can decide to replace the first match or all

sudden geyser
#

You can set a limit.

#

I'd still use .replace though.

#

As you probably don't need to go String -> Array -> String

cobalt spruce
#

.

austere axle
empty owl
#

you do it

earnest phoenix
#

You can set a limit.
@sudden geyser i don't think you can set a limit

empty owl
cobalt spruce
#

@dudeee#0626 just go to top.gg and login and add ur bot

sudden geyser
#

However, it shouldn't be used (like you said) as leftovers are not included.

earnest phoenix
#

You meant to split()?

#

i was talking about replace()

delicate shore
#
msg.content.slice(2).join("")```
#

it says this is not a function

sudden geyser
#

Then yes, you can't set a limit.

warm marsh
#

Because it's not.

sudden geyser
#

You're calling .slice on a string.

delicate shore
#

it's not?

warm marsh
#

msg.content.substr(2).split("").join("");

sudden geyser
#

It'll just return a string with some characters removed.

elder loom
#

hi

delicate shore
#

msg.content.substr(2).split("").join("");
@warm marsh what substring?

sudden geyser
#

You don't even need the .join part.

delicate shore
#

ok

warm marsh
#

It substrings the string.

delicate shore
#

``` db.set(welmessage_${msg.guild.id}, msg.content.slice(2).join(""))

#

this is my code

warm marsh
#

You don't need .join

delicate shore
#

ok

elder loom
#

so i have a bot with economy commands it works all fine if i host it on my pc but when i host it on heroku it doesn't save the changes when a user earned money it's in python btw

warm marsh
#

That's a method for arrays and certain iteratables.

digital ibex
#

are you getting an error?

delicate shore
#

me?

digital ibex
#

no

delicate shore
#

ok

digital ibex
#

hacker man

elder loom
#

i'm not getting errors

#

it just doesn't save

#

for example i run work and i earn 100 it doesn't save that

digital ibex
#

are u using a vps or a vm? or a shared vps

elder loom
#

nope

warm marsh
#

heroku

elder loom
#

heroku

digital ibex
#

which one?

#

oh

elder loom
#

like

#

on my pc it works

digital ibex
#

are you connecting to the db?

elder loom
#

but on heroku it doens't

digital ibex
#

does it connect*

elder loom
#

yea

#

i think

earnest phoenix
#

@delicate shore slice() returns an string with specified amount of chars removed

elder loom
#

anyways

#

i want to purchase a paid vps in the future

earnest phoenix
#

Earlier we were talking about split().join() not slice().join()

elder loom
#

from example vultr

#

but i feel like it's not gonna work on that either

warm marsh
#

What database are you trying to connect to?

empty gust
#

how do i get that VERIFIED DEVELOPER thing

warm marsh
#

Get verified.

sudden geyser
delicate shore
#

wait

#

i got a warning

#

wbhat is dis

sudden geyser
#

It means you added 11 guildMemberAdd event listeners somewhere in your code, which may be a memory leak.

delicate shore
#

what

#

how

#

i never

#

i added only one

sudden geyser
#

An example of adding many event listeners is running a block of code multiple times. For example, nesting events.

delicate shore
#
  let chx = db.get(`welchannel_${member.guild.id}`); //defining var
  let msgfin = db.get(`welmessage_${msg.guild.id}`)
  if(chx === null) { //check if var have value or not
    return;
  }

  let wembed = new Discord.MessageEmbed() //define embed
  .setAuthor(member.user.username, member.user.avatarURL())
  .setColor("#ff2050")
  .setThumbnail(member.user.avatarURL())
  .setDescription(`${msgfin}`);
  
  client.channels.cache.get(chx).send(wembed) //get channel and send embed
})
#

this is only

sudden geyser
#

You probably added more unknowingly. You could show us the entire file it's in.

restive furnace
#

but is that inside another event?

delicate shore
#

but is that inside another event?
@restive furnace yes manyy

restive furnace
#

thats the problem.

delicate shore
#

You probably added more unknowingly. You could show us the entire file it's in.
@sudden geyser i searched through file and i didn't find it

#

thats the problem.
@restive furnace should i take it at top

sudden geyser
#

that's not the point

warm marsh
#

Send the entire file in pastebin

pure lion
#

YoooOo game engine update I drew a square that can move

delicate shore
#

ok

pure lion
#

And shoot lines

sudden geyser
#

nice

delicate shore
#

see

warm marsh
#

Move the client.on("guildMemberAdd"... outside of the message event

restive furnace
#

YoooOo game engine update I drew a square that can move
ok, i draw a squares which can move from node.js server with python client (bad english yes)

warm marsh
#

Every time a message is sent a new event listener is subscribed to.

delicate shore
#

then it says message is not defined

#

oo

#

k

sudden geyser
warm marsh
#

You have to get the data another way.

delicate shore
#

alright

sudden geyser
#

also why is bot and client different.

delicate shore
#

they are not ?

warm marsh
#

Using member

restive furnace
#

copy pasta or spoonfeeded code spoonfeed? hmm

delicate shore
#

no only music part

#

rest i did myself

#

though tutorials

#

and so

sudden geyser
#

You should look into making your code modular.

#

Your index file is very large.

delicate shore
#

ik

#

but i don't wanna write

#

everything again

warm marsh
#

You wouldn't be writing everything again.

#

Just the core parts.

sudden geyser
#

It's a small price to pay.

pure lion
#

Well I did and it made me sexy

#

So do it

delicate shore
#

You should look into making your code modular.
@sudden geyser i tried but it was difficult and more over args are gonna be a problem

pure lion
#

It's worth it

#

And it's not hard

#

You just need to pass in stuff

sudden geyser
#

If you know the fs module's basic readdir function and module.exports, you'll know how to make your code modular.

they are not?
@delicate shore yes, they are. You only need one of these 99% of the time.

delicate shore
#

alridht

#

alright

empty owl
#

You only new two if ur running two bots

#

on the same index file

#

Which you can do from different files with require

delicate shore
#

maybe i will shutdown my bot for 2 days and make command handler

#

because it will take atleast that much time

sudden geyser
#

You don't need to shut it down.

#

Just work on it locally.

delicate shore
#

ok

empty owl
#

2 days?

warm marsh
#

At best a couple hours.

empty owl
#

Yea it’s not that complicated

warm marsh
#

control c + control v

#

Most of it.

empty owl
#

Copy pasting code bad unless u understand it

#

I think

warm marsh
#

I meant the code from index.js

empty owl
#

Oh yea

delicate shore
#

ok

#

i have one question

#

how do i make it locate

#

command file

#

in glitch

#

because glitch is bitch

warm marsh
#

The same way you'd do it locally.

delicate shore
#

and idk how to do that ../commands/music etc

warm marsh
#

Using something like fs to get all files in the specified dir then store them inside a collection or map.

slender wagon
#

It is called command handler i think

warm marsh
#

An if statement is also a command handler.

opal plank
#

@sudden geyser omg

#

what is that pic

sudden geyser
#

hi

#

"Tonikaku Cawaii"

opal plank
#

const a = 1, b=2 ,c =3

#

no need to const every variable

sudden geyser
#

it's more of a preference

warm marsh
#

There's no benefit to either.

opal plank
#

also the depenencies

#

holy shit

#

why not require them on the command files?

sudden geyser
#

There's no benefit to either.
@warm marsh yes there is. It makes your code safer by you saying "all of this can't be changed unless I set it to var/let"

warm marsh
#

...

#

I meant to how you use const.

#
const a = 10;
const b = 25;

// Is the exact same as
const a = 10,
      b = 25;
opal plank
#

indeed

sudden geyser
#

ah

warm marsh
#

I know the difference between var, let, and const.

delicate shore
#

hey

opal plank
#

thats what i meant

warm marsh
#

PG?

delicate shore
#

hey

#

i had one query

#

do i need to bring async function as well

#

in the command file

#

of modules.export?

#

because it says cannot use await

warm marsh
#

Depends if you need it or now.

delicate shore
#

without async

#

so what do i need to bring then

warm marsh
#
module.exports = async () => { };
// Or non async
module.exports = () => { };
#

If you need it add before.

delicate shore
#

alr

#

thanks

#

no

#

error

warm marsh
#

What error?

delicate shore
#

it says unexpected token

#

async

opal plank
#

execute async

warm marsh
#

How did you use it?

opal plank
#

not module export async

delicate shore
#

i tried executing

#

but

#

still

#

error

opal plank
#

module.exports = {
async execute(params) {}

}

delicate shore
#

i have 2 questions there

#

do i need to place my whole code in {} of params

#

i mean async

misty sigil
#

depends what the commandhandler does

delicate shore
#

or not

misty sigil
#

yes

delicate shore
#

ok

#

thanks

opal plank
#

functio(param) {code}

delicate shore
#

ok

#

parm like 'message' , msg?

restive furnace
#

yes

delicate shore
#

k

restive furnace
#

it can be anything

delicate shore
#

thnx

#

k

#

i am having confusion

#

so

#

const Discord = require("discord.js")

module.exports = {
    name: 'meme',
    description: "this is a ping command!",
    execute(message, args){
    if (recentcmd.has(msg.author.id))
      return msg.reply(
        `**You are on cooldown you can use this cmd once in 3 seconds. This is to prevent rate limting**`
      );

    
    
 //  msg.reply("Command temporarily disabled ")
   
    const subReddits = ["meme"]
    const random = subReddits[Math.floor(Math.random() * subReddits.length)];
    const img = await randomPuppy(random);

    const embed = new Discord.MessageEmbed()
    .setImage(img)
    .setColor("RANDOM")
    .setTitle(`From /r/${random}`)
    .setURL(`http://reddit.com/${random}`)

    msg.channel.send(embed);
msg.channel.send("**If you don't get a meme try command again in 3 seconds because our API has been malfunctioning now-a-days**")


    
    //, "me_irl", "dankmeme"
  
        recentcmd.add(msg.author.id);
        setTimeout(() => {
          recentcmd.delete(msg.author.id);
        }, 3000);
      ;
    console.log();    }
}```
#

i am already executing message and args

#

so i can add it in that field only ?

#

if yes then how

warm marsh
#

What?

#

Also you're asking for message but use msg.

restive furnace
#

correction, you are passing message as the parameter while you use message.

warm marsh
#

Yes, this floor is made of floor.

delicate shore
#

😭

#

i hate command handler

#

how to use async

#

like

#

see

warm marsh
#

prepend async to the execute method.

#

async execute() { }

delicate shore
#

ye

#

finnaly

#

it worked

#

thanks

#
if (command === "meme") {
    
            client.commands.get('meme').execute(msg, args);

    
  }```
#

alright so here

#

i will leave it like this onky

#

only

#

or do i have to add async here?

warm marsh
#

No.

delicate shore
#

leave it like that?

warm marsh
#

yes

delicate shore
#

ok

#

lemme try it

mint cypress
#
const puppeteer = require('puppeteer');
const { BOT_ID, COOKIE } = require('./config.json');
if (!BOT_ID) throw new Error('BOT_ID not provided');
if (!COOKIE) throw new Error('COOKIE not provided');

const vote = async () => {
    console.log('Trying to vote');

    const browser = await puppeteer.launch({ headless: false, args: ['--window-size=0,120'] });
    const page = (await browser.pages())[0];

    await page.setCookie({ name: 'connect.sid', value: COOKIE, domain: 'top.gg', path: '/' });
    await page.goto(`https://top.gg/bot/${BOT_ID}/vote`);
    await page.click('#votingvoted');

    console.log('Successfully voted');

    setTimeout(() => browser.close(), 1000);
    setTimeout(vote, 1000 * 60 * 60 * 12);
    console.log('Waiting 12 hours');
};
vote();```
#

pls i want COOKIE

pale vessel
#

uhhhhhhhhhhhhhh

#

don't do that

#

oh my fucking god

delicate shore
#

holy fucking god omg

#

it worked

#

my command handler worked

woven sundial
#

Error :

at Object.exports.run (/home/container/commands/covid-19.js:7:17)```

my code :
```js
const { NovelCovid } = require("novelcovid");
const track = new NovelCovid();```
How can I solve that ![pandathink](https://cdn.discordapp.com/emojis/718044090196951131.webp?size=128 "pandathink")
delicate shore
#

holy

#

holy

#

moly

sudden geyser
#

Icero does the novelcovid package export a function or class called NovelCovid

delicate shore
#

novel covid is not working

#

now

#

they said to shift to their latest

#

one

mint cypress
#

can anyone help me ?

delicate shore
#

it is working

woven sundial
#

oh what's their last @delicate shore ?

delicate shore
#

but they said to shift to latest as it will be discontinued

pale vessel
sudden geyser
#

_1Master you have to be specific

mint cypress
#

ERROR:

at Object.<anonymous> (/app/index.js:4:20)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)```
delicate shore
#

oh what's their last @delicate shore ?
@woven sundial i don't remeber one min

mint cypress
#

if (!COOKIE) throw new Error('COOKIE not provided');
^
Error: COOKIE not provided

pale vessel
#

@mint cypress don't automate votes, it's against the rules

mint cypress
#

in ?

pale vessel
heavy marsh
#

Does anyone know how to change the default help command in discord.py rewrite? In the old discord.py, all you had to type was something like this:

client.remove_command('help')```
This doesn't work in rewrite.
mint cypress
#

OK @pale vessel

slender thistle
#

@mint cypress You are not allowed to automate voting for ANY bot

mint cypress
#

oh ok im sry idk

slender thistle
#

@heavy marsh Any errors you get?

woeful pollen
#

MongooseError: Mongoose 5.x no longer supports `mongoose.connect(host, dbname, port)

heavy marsh
#

About 50-100 errors.

woeful pollen
#

i went to see the website but idk how i am meant to connect

slender thistle
#

Mind posting them?

delicate shore
#

@opal plank @restive furnace @misty sigil and @warm marsh thanks a ton i cannot be more grateful

heavy marsh
opal plank
#

@delicate shore np

heavy marsh
#

Wasn't as many as it looked. I had IDLE shrunk so it looked like a lot

opal plank
misty sigil
#

ping ping

woeful pollen
#

lol

warm marsh
#

👍

heavy marsh
#

Also, my code only has 74 lines so I don't know why it's saying line numbers in the hundreds.

slender thistle
#

That's internal errors caused by your code

heavy marsh
#

It's updated to the newest version...

slender thistle
#

1.3.3?

heavy marsh
#

I've literally only just updated it

slender thistle
#

1.3.4?

heavy marsh
#

1.3.3 but if I try to update, it says it's already on the newest version

slender thistle
#

How are you updating?

delicate shore
#
const Discord = require("discord.js")

module.exports = {
    name: 'tf',
    description: "true/false",
   async execute(msg, args){
   
   if (!args[1])
      return msg.channel.send(
        "***I need a question to answer between yes/no , Stoopid***"
      );
    let option = ["**Yes**", "**No**"];
    let Random = Math.floor(Math.random() * option.length);
    msg.channel.send(option[Random]);
     
   
   }}```
#

in my index file it was args 1 only

#

but since it is now a command handler

#

will it be args 0?

#

or same args

heavy marsh
#

pip3 install discord
This is how I was told to update it, just by doing the install command.

slender thistle
#

pip3 install -U discord.py

heavy marsh
#

Ah, thanks.

#

I thought it was different for Linux than Windows.

slender thistle
#

discord is just a fork of an official discord.py package and God knows why it's still there

heavy marsh
#

It works now, thanks!

slender thistle
versed ravine
#

guys can someone help me with play music command using eris?

#

somehow my bot didn't play the music even when everything is correct

delicate shore
#

error

#

just came

#

can we use two command handlers

#
client.memes = new Discord.Collection();

const commandFiles = fs
  .readdirSync("./memes/")
  .filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
  const memes = require(`./memes/${file}`);

  client.memes.set(memes.name, memes);
}

const commandFiles2 = fs
  .readdirSync("./fun/")
  .filter(file => file.endsWith(".js"));
for (const file of commandFiles2) {
  const fun = require(`./fun/${file}`);

  client.fun.set(fun.name, fun);
}
#

this is code

#

and first one is fine

#

in second it says cannot read property set

#

of undefined

#

oh wait

#

client.fun

#

i didnt declared it

#

that was the problem it worked nvm

midnight blaze
#
message.channel.messages.fetch({ limit: 10}).then(messages => message.channel.send(messages.map(msg => msg.author.map(msg => msg.User.username))))

why does this send 10 promises? 🤔 shouldnt the promise be resolved, after the first then?

sudden geyser
#

msg.author.map and msg.User don't look correct. What library are you using?

#

Why do you need two separate languages to make a bot?

restive furnace
#

is it possible to combined javascript and python ??????
@earnest phoenix yes but why

finite bough
#

u dont map messages

#

u map message content

#

a message is an object

sudden geyser
#

pick one language

restive furnace
#

just go with py, or js.

finite bough
#

i dont think its impossible but i also dont recommend it

midnight blaze
#

@sudden geyser it is correct tho, I was able to console log it

earnest phoenix
#
if (message.content === '!Sun rr') {
                        const exampleEmbed = new Discord.MessageEmbed()
                        .setTitle('Reaction Roles')
                        .setDescription('React to get your roles!');
                        message.channel.send(embed).then(msg => msg.react(':x:'))```

```js
RefrenceError: Embed is not defined```
versed ravine
#

@earnest phoenix why not just create an embed using json then send it

earnest phoenix
#

How do I do that?

tight heath
#
const a = ...;
function problem() {
  let out = "foo";
  if (a + 1 == 5 && a + 2 == 10) out += "bar";
  return out;
}
console.log(problem()); // "foobar"

solve for a

sudden geyser
#

confused

#

@midnight blaze log it how. Through sending messages? It doesn't look correct just looking at it, hence, what library are you using?

midnight blaze
#

discord js v12

summer torrent
#

msg.author.map ??

pale vessel
pure lion
midnight blaze
#

what is so confusing?

#

I am not quite sure why you guys are confused @summer torrent

pale vessel
#

author is not even an array or collection

sudden geyser
#

because message.author is a User instance.

#

It's not an array or collection like flaze said

summer torrent
#

^

midnight blaze
#

yes, but it still works

sudden geyser
#

that's wack

midnight blaze
#

🤷‍♂️

pure lion
#

msg.author = user object

#

You can map an object

pale vessel
pure lion
#

Imagine mapping a map

#

x)

pale vessel
#

You can map an object
@pure lion no

pure lion
#

e

#

I don't care any more I'm doing c it's cooler than js

#

x))))

#

That was a lie please help me I don't understand what the guy is saying

midnight blaze
#

so, how would you access username then?

pure lion
#

Ooh ooh I know

#

author: user { 3 }

#

💯% real

#

No scam try it and see

#

Not clickbait

#

Working 2020

pale vessel
pure lion
#

||/s||

#

Ok I'm done

pale vessel
#

just author.username?

turbid bluff
#

My Bot isn’t turning on , is it a problem from discord or from my bot ?, i have no errors , it says cannot connect to host discordapp.com

pure lion
#

Is your WiFi box plugged in

midnight blaze
#

yeah, I know falzepe and that works^^ I was just wondering

#

why I was able to use map

#

I thought there must be something I am missing

turbid bluff
#

Lol it wasn’t , but i reconnected and it still shows me an error.

stark abyss
#

Does discord bit verification cost Money

#

Bot

pure lion
#

Why don't you look at the docs

jaunty junco
#
client:on('memberJoin', function(member)
       local memberid = member.id
       local joinAt = member.guild:getMember(memberid).joinedAt
       member.guild:getChannel("735410662016155679"):send("some dude joined at "..joinAt.." !")
end)
#

how do i make the time more readable?

#

(discordia btw)

stark abyss
#

Why don't you look at the docs
@pure lion I wasn’t able to find information all it said was go to discord developer portal and it should be there but I wasn’t able to find it

summer torrent
#

@jaunty junco is this lua 🤔

jaunty junco
#

@jaunty junco is this lua 🤔
@summer torrent you guessed right

#

also

discordia btw
implies it

pure lion
#

Did you just ping me

#

Lmao

#

@jaunty junco there's probably a method to parse the joinedTimestamp to a LocaleTimeString

jaunty junco
#

@jaunty junco there's probably a method to parse the joinedTimestamp to a LocaleTimeString
@pure lion english please

#

im not a machine

pure lion
#

Uh

#

Function to make big millisecond to smol hooman second

#

:)

jaunty junco
#

oh

#

...

#

how do i find dat

#

;-;

pure lion
#

Idk look at the lua docs for time

jaunty junco
#

eh fair enough

spiral axle
#

I'm not a CSS expert, but how do I make those lovely small pages added in the bot page?

pure lion
#

Oh

#

You need to use CSS

spiral axle
#

I mean

finite bough
#

idk but

#

i think

spiral axle
#

Is there sorta template I can build on?

finite bough
#

lua has date manipulation as well

#

so if u get joinedTimestamp

#

i think u can do stuff with it

pure lion
#

@finite bough yeah there's probably a way to get the local time from the ms since Jan 1 1970

delicate shore
#
  if (command === "avatar"){client.fun.get("avatar").execute(msg, args);}
#

it says cannot read property execute of undefined

#

why

#

this is my avatr.js

#
const Discord = require("discord.js")

module.exports = {
    name: 'avatr',
    description: "displays avatr of person",
   async execute(msg, args){
  
     const member = msg.mentions.users.first() || msg.author;

    const Embed = new Discord.MessageEmbed()
      .setColor("RANDOM")
      .setTitle(`${member.username}`)
      .setImage(member.displayAvatarURL())
      .addField(`Link`, `[Click Me](${member.displayAvatarURL()})`);

    msg.channel.send(Embed);
   
   }}```
finite bough
delicate shore
#

o

#

shoot

finite bough
#

xd

delicate shore
#

thanks

finite bough
#

np

carmine echo
#

i have asked this in discord.js server but they are too busy with more pressing matters such as Help what does this error mean message is undefined
Let's say I have this directory structure.

app
├── dist
│   ├── index.js
│   ├── modules
│   │   └── module.js
│   └── shard.js
└── src
    ├── index.ts
    ├── modules
    │   └── module.ts
    └── shard.ts

I create a ShardingManager in index.ts that launches my shards from ./dist/shard.js when I run node dist/index while my working directory is app (it's actually done by yarn).
Now my shard's working dir is app instead of dist and it can't import ./modules/module. If I correct it to load files from ./dist/modules/module intellisense in vscode gets fucked up. How can I work around this?

paper phoenix
#

@carmine echo - Would adjusting cwd settings in VSC solve it?

carmine echo
#

Not really. My .ts files are in src, not dist.

quartz kindle
#

make use of __dirname and process.cwd()

carmine echo
#

perhaps i could use an absolute path

#

actually no, that just comlicates things

honest perch
#

whose type and why does he have a script

carmine echo
#

and doesn't fix anything

quartz kindle
#

__dirname gives you the absolute path of the current file
process.cwd() gives you the absolute path of the main file

#

so you can load everything from process.cwd()+"/shards.js" and process.cwd()+"/modules/module"

#

you might need to use the built-in path module on windows to correct it, because process.cwd() returns the escaped windows path format, with double backslashes

carmine echo
#

Thank you @quartz kindle, that solved my problem!

woven sundial
#

fn.bind is not a functionerror

code :

const Discord = require('discord.js');
const configf = require("./zpremium.json");
  const footer = configf.footer;
exports.run = async(client, message, args) => {

    if (!message.member.roles.cache.find("name", "@everyone")) { //Whatever role you want, I pick @everyone because everyone can use this command
        message.channel.send("![arminerror](https://cdn.discordapp.com/emojis/617366968554618943.webp?size=128 "arminerror") ERREUR : Vous n'avez pas la permission de faire ça");
        return;
    }
    
    // Check for input
    if (!args[0]) return message.channel.send('![arminerror](https://cdn.discordapp.com/emojis/617366968554618943.webp?size=128 "arminerror") ERREUR : Aucun sondage fourni');
    
    // Create Embed
    const embed = new Discord.MessageEmbed()
        .setColor("RANDOM") //To change color do .setcolor("#fffff")
        .setFooter(footer)
    .setDescription("Utilisez les réactions pour donner votre avis")
        .addField("Contenu","``"+args.join(' ')+"``")
    .addField("Créateur",message.author.username)
        .setTitle(`🗳️ **Sondage** 🗳️`);
        
    let msg = await message.channel.send(embed)
        .then(async function (msg) {
           await msg.react("713085772470681643");
           await msg.react("713085782574891110"); // You can only add two reacts
           await message.delete({timeout: 1000});
            }).catch(function(error) {
            console.log(error);
        });
};```
#

why do I get that error? :/

amber fractal
#

doesnt come from there

woven sundial
#

it is

carmine echo
#

yea, this code is not related

amber fractal
carmine echo
woven sundial
#
at Map.find (/home/container/node_modules/@discordjs/collection/dist/index.js:158:21)
at Object.exports.run (/home/container/commands/poll.js:6:34)```
amber fractal
#

it might be called from there

coarse vapor
#

fn is not anywhere in here

carmine echo
#

i think you somehow messed up discord.js collections

woven sundial
honest perch
#

@coarse vapor tokens have timestamps

#

old ones will work until you press reset

coarse vapor
#

I would like to see where you got that information

honest perch
#

Tokens are created by cryptographically signing a user ID and timestamp. Each time you refresh the page, the current time changes, and you get a new token. However, all the tokens you see are still valid until you click Generate a new token

coarse vapor
#

"cryptographically"

#

hey @honest perch do you have a bot?

honest perch
#

used to yeah

coarse vapor
#

oh wait i tried another bot

#

yeah that happens

#

but maybe its a flag on my account

honest perch
#

@quartz kindle please educate this human

coarse vapor
#

i will make a new account and try the same thing

#

ok i swear it didnt do that when i made prizm

#

but it doesnt matter because prizm wont go online anyway

#

something is fucked up on discord's end, it makes no sense to have your bot id encoded in base64, and have some time stamp

solemn latch
#

Snowflakes have timestamps, I dont think tokens do

coarse vapor
#

yeah

#

snowflakes are timestamps

honest perch
#

They do as they change on refresh

autumn aspen
#

Guys I want to do a command that awaits giving a role when someone types like "!verify me" and its gonna say "You have only been here for 10min! Please be patient and wait, try again later!" Can someone help me or send a YT link bc I dont know how to even start :/

sudden geyser
#

Check the date or timestamp at when the user joined the server and see if it's longer than the desired time needed before they can use the verify command

autumn aspen
#

@sudden geyser how can I do that?

#

I mean I have a command that tells what time and like that when they join

#

But idk what u say

sudden geyser
#

(Since you're using Discord.js), on the message object, you have the .member property to get the guild member instance (which may or may not be null). You then have the .joinedAt or .joinedTimestamp that gets you the timestamp at when the user joined. You can them minus that by the current timestamp (Date.now()) and see if that in milliseconds is above 10 minutes.

autumn aspen
#

Oh ok

#

ALso I want a command that my bot can reglate (slowmode)

sudden geyser
#

Why not just use Discord's built-in channel slow mode?

coarse vapor
#

They do as they change on refresh
@honest perch I agree, there is a time stamp. But there is also a password in there as well.
Bot_ID_in_base64 . time . Some_password

woven sundial
#
message.guild.channels.cache.find(`name`, "reports");
```doesn't work in DJS12. Anyone know the new function?
sudden geyser
#

It takes a function and works as a usual array find function. The first argument would be a guild channel instance.

woven sundial
prime glacier
#

UnhandledPromiseRejectionWarning: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number. error

sudden geyser
#

Show us where the error is coming from

prime glacier
#

command?

pure lion
#

Ever permissioned before

sudden geyser
#

Which command and what line

prime glacier
#

ok w8

pure lion
#

You're denying @everyone to view and then allowing?

sudden geyser
#

MANAGE_SERVER is not a permission.

prime glacier
#

then

sudden geyser
#

You're probably looking for MANAGE_GUILD

prime glacier
#

OK

sudden geyser
#

You're denying to view and then allowing?
@pure lion the first one denies everyone permission to view the channel. The next one allows only the message author to view it, then adds the bot permission to view it as well.

pure lion
#

Oh oops I didn't see the author

#

Sorry, there's a shit tonne of pollen today

regal edge
#

Have I a problem with implementing aliases, I get no error logs or anything, so I don't see what's the problem.

#

Example command

woven sundial
#
    message.mentions.roles.first() ||
    message.guild.roles.cache.get(args[0]) ||
    message.guild.roles.cache.find(role => role.name === args[0])

  // If we can't find any role, then just default to the author's highest role
  if (!role) role = message.member.highestRole;
  let posC = message.guild.roles.size - role.position;
  let pos = posC - 1;
```I tried to convert role.position in DJS v12 with ``role.rawPosition`` but it returns me that ``role.rawPosition`` is not defined...
How can I solve that?
regal edge
sudden geyser
#

@regal edge I think the issue here is with your message listener and using the && operator.

#

You're saying, "get the command by this name in the commands collection, and get this command in the commands collection by the alias name"

#

Try using || instead.

regal edge
#

kk

#

@sudden geyser Yeah, nope that doesnt help ._.

sudden geyser
#

hmm

#

Your second issue is I think here: js bot.aliases.forEach((alias) => { bot.aliases.set(alias, pull.config.name) });

#

You're iterating over the bot's global aliases collection rather than the command's aliases array.

regal edge
#

ohh

earnest phoenix
#

What is a snowflake ❄

nocturne grove
#

it's an id

sudden geyser
nocturne grove
#

lol I couldn't find that one using google, thanks :)

earnest phoenix
#

Hey so I am trying to make a Smash or pass discord bot and I'm trying to get the images from reddit. Most subreddits are NSFW tho and apis like random-puppy or imageapi don't work when the reddit is marked NSFW. Does anyone know how to bypass this? Here is my code if you need it

const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
    name: 'girl',
    run: async (client, message, args) => {
        let subreddits = [
            "RealGirls"
        ]
        let subreddit =
        subreddits[Math.floor(Math.random() * subreddits.length)];
        let img = await api(subreddit, true)
        message.channel.send("Here's a girl image...")
        message.channel.send(img)
    }
}
#

@earnest phoenix how do i make this work for me

#

if you can tell me that would be great

#

@earnest phoenix how do i make this work for me
@earnest phoenix I am trying to make NSFW work but if you're wondering on how you can make this work on normal subreddits just copy my code and change the subreddits in let subreddits and should work

#

uhhh is the module.exports required?

solemn latch
#

if you want to export it

earnest phoenix
#

but im literally pasting this in 1 code file

solemn latch
#

then your not exporting it

earnest phoenix
#

so then how do i make it work

#

dm

solemn latch
#

@slender thistle someones posting an invite link i think.

#

and insta deletion

#

just make a function @earnest phoenix without the exports

earnest phoenix
#

this dude dm advertised me

#

he was posting this here

#

but dmed me too

slender thistle
#

Screenshot in DMs

earnest phoenix
#

he delted it

#

he deleted it now

#

but wait

#

on my discord dekstop app

#

i have something to show deleted messages

#

let my discord desktop open

#

so then how do i make it work
@earnest phoenix just get rid of the ```js

const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {```

#

get rid of that

#

random-puppy functions on NSFW Sub-reddits?

pure saddle
#

idk

#

try

earnest phoenix
normal kraken
#

f

earnest phoenix
#

uhh get rid of just the module.exports thing?

#

and start from run: async?

#

@slender thistle

#

give me a moment on my main discord app ill track the deleted message

#

@dense bridge dmed me with the link

#

he surely will be dming it to others

#

oh wait fuck

#

my disccord updated

solemn latch
#

rip discord

earnest phoenix
#

i use better discord

#

it updated to normal discord

solemn latch
#

client mods, reported 🙊

pure saddle
#

better discord against tos

earnest phoenix
#

what do you need to beleive me that he dm advertised

#

wdym

#

i dont use bd

pure lion
#

can anyone help me with opengl C?

void drawRays3D()
{
    int r, mX, mY, mP, dof; float rayX, rayY, rayAngle, xOffset, yOffset;
    
    rayAngle = playerAngle;
    
    for(r = 0; r < 1; r++)
    {
        /*  Check horizontal lines  */
        
        dof = 0;
        
        float aTan = -1/tan(rayAngle);
        
        if (rayAngle > PI) { rayY = (((int) playerY >> 6) <<6) - 0.0001; rayX = (playerY - rayY) * aTan + playerX; yOffset =- 64; xOffset =- yOffset * aTan; } // if looking up
        if (rayAngle < PI) { rayY = (((int) playerY >> 6) <<6) + 64    ; rayX = (playerY - rayY) * aTan + playerX; yOffset =  64; xOffset =- yOffset * aTan; } // if looking down
        if (rayAngle == 0 || rayAngle == PI) { rayX = playerX; rayY = playerY; dof = 8; } // looking straight left/right
        while (dof < 8) 
        {
            mX = (int) (rayX) >> 6; mY = (int) (rayY) >> 6; mP = mY * mapX + mX;
            if (mP < mapX * mapY && map[mP] == 1) { dof = 8; } // colission
            else { rayX += xOffset; rayY += yOffset; dof += 1; }
        }
        glColor3f(0, 1, 0);
        glLineWidth(1);
        glBegin(GL_LINES);
        glVertex2i(playerX, playerY);
        glVertex2i(rayX, rayY);
        glEnd();
    }
}

:D

earnest phoenix
pure lion
#

*sad*

stray scaffold
#

uh

solemn latch
#

i totally cant help dice, but im excited to see what you end up doing

pure lion
#

:D

#

ray caster game engine

woeful tendon
#

can someone help me in private with my bot? don't want to spam the chat, because i dont know how to explain it.

pure lion
#

with no knowledge of C

#

:d

misty sigil
#

smart smart

pure lion
#

ikr

#

i made the dot move and have a spinny pp

#

but it wont shoot rays

#

:<

misty sigil
#

ok eyess

ornate flax
#

Does anyone know what is the reason for my 2 bot's token switching at the same time?

solemn latch
#

tokens only should change when you ask them to change

ornate flax
#

but it's not like that right now

fickle arch
#

Hey, can I ask how to disable skip,loop,stop if there more than 2-3 people ? because people could skip it and it's kinda annoying without DJ roles.

earnest phoenix
#

@shiva

#

you need any more proof?

#

@slender thistle

#

literally blocekd me

slender thistle
earnest phoenix
#

he was typing something before blocking me xD

#

prob when you banned him

#

can anyone covert this into a function for me?

#

const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
name: 'girl',
run: async (client, message, args) => {
let subreddits = [
"RealGirls"
]
let subreddit =
subreddits[Math.floor(Math.random() * subreddits.length)];
let img = await api(subreddit, true)
message.channel.send("Here's a girl image...")
message.channel.send(img)
}
}

#
const api = require("imageapi.js")
module.exports = {
    name: 'girl',
    run: async (client, message, args) => {
        let subreddits = [
            "RealGirls"
        ]
        let subreddit =
        subreddits[Math.floor(Math.random() * subreddits.length)];
        let img = await api(subreddit, true)
        message.channel.send("Here's a girl image...")
        message.channel.send(img)
    }
}```
#

do it by yourself

summer torrent
earnest phoenix
#

idk how to

slender thistle
#

You have a function there already

summer torrent
#

run: is a function

earnest phoenix
#

yes but i dont want to export it

solemn latch
#

then dont

earnest phoenix
#

how do i make this work without exporting

summer torrent
#

you have to export

earnest phoenix
#

let img = await api(subreddit, true)
^^^^^

SyntaxError: await is only valid in async function

summer torrent
#

make it async smh

misty sigil
#

isn't async

earnest phoenix
#

how do i do that

#

its async but wrapped in a module

#

fixed it nvmm

fickle arch
#

WaIt what should I replace for RichEmbed ?

solemn latch
#

for what?

fickle arch
#

MessageEmbed ?

solemn latch
#

oh djs 11 to 12 yes

fickle arch
#

oh, thanks.

#

I follow old tutorial to make embed message.

mortal dagger
#

anyone knows how to remove this everyone thing on the role? its on disc.py dm me if u can help plz ty

summer torrent
fickle arch
#

ah thanks.

mortal dagger
#

:/

earnest phoenix
#

its not giving any error nor anything else

fickle arch
#

is there a way to prevent people from trolling if there more than 3 people in VC ?

solemn latch
#

dj role is the normal one

#

or limit it to specific user permissions

lusty quest
#

either use a vote style system or roles

fickle arch
#

How I do that ? I guess I need to figured it out.

#

probably vote and roles could be used like rythm does.

lusty quest
#

some of the more popular Music bots handle it so that if there are 3 Users in VC that atleast 2 needs to skip for executing it

solemn latch
#

or you could limit it to the highest perm users in the room

fickle arch
#

yeah if there more than 3 poeple it can't be skipped without vote or dj roles.

#

I'm meaning about it.

sudden geyser
#

@mortal dagger I don't use Python often, but the first element in the list I assume you're using (Member.roles) is the everyone role. Could you not just remove the first element from the list?

fickle arch
#

I'm testing with help command how to make the bot dm you the list of command ?

lusty quest
#

message.author.send

fickle arch
#

ah thanks again.

slender thistle
#

There's two ways about removing the everyone role;

  1. A list comprehension or a for-loop checking r.name == "@everyone"
  2. Since Member.roles is sorted, Member.roles[1:] (ignoring the first element)
earnest phoenix
#

Botumu vdse kurdum fakat botumda hangi packagelerin olduğunu bilmiyorum package.json dosyasından hangileri modül?

solemn latch
#

hows 1: work?
everything after first?

lusty quest
#

you can filter out the role

fickle arch
#

so if you remove everyone role is that mean removing the owner roles to ?

lusty quest
#

only from the collection

#

not from the guild

slender thistle
#

A simple list comprehension as an example regarding the first option:
[r.name for r in ctx.author.roles if r.name != '@everyone']

#

But generally "removing the everyone role" means to ignore it, not to delete

mortal dagger
#

@mortal dagger I don't use Python often, but the first element in the list I assume you're using (Member.roles) is the everyone role. Could you not just remove the first element from the list?
@sudden geyser na dat aint work

sudden geyser
#

y

#

Shivaco's way explained how you'd do it

pure lion
#

anyone good at C and legacy OpenGL?

#

ping me like 3 times and ill explain my issue

fickle arch
#

I'm trying to put kick command at help list but it shown undefined

tame shuttle
#

@pure lion I know C & I've used fixed function OpenGL in the past (if that's what you mean) -- Can't guarantee I'll know how to solve your problem though (it's been a while).

sonic lodge
#

what is channelMessages

#

MessageManager?

pure lion
#

@tame shuttle sick ill send code here

tame shuttle
#

Or DM Idm

sonic lodge
#

.fetch() returns a promise with the collection of messages

#

you'll need to use .then() on channelMessages to have access to the collection

fickle arch
solemn latch
#

do you have execute function in command?

fickle arch
solemn latch
#

that doesnt answer the question 🤔

earnest phoenix
#

i tried createing a kick command it worked but i couldnt handle permissions and everyone could kick :/

#

help

#
const Guild = require("../../models/guilds");
const mongoose = require("mongoose");

module.exports = async (bot, message) => {
    Guild.findOne({
        guildId: message.guild.id
    }, async (err, guild) => {
        if (!guild) {
            const guild = new Guild({
                guildId: message.guild.id,
                autorole: "Not Specified",
                enable: false,
                prefix: "/",
                logs: true,
                whitelistchannel: []
            })
            await guild.save();
            return bot.guild.set(message.channel.id, {
                prefix: guild.prefix,
                logs: guild.logs
            });
        }
        if (!guild.logs) {
            guild.logs = true;
            await guild.save();
            return bot.guild.set(message.channel.id, {
                prefix: guild.prefix,
                logs: guild.logs
            });
        }
        return bot.guild.set(message.channel.id, {
            prefix: guild.prefix,
            logs: guild.logs
        });
    })
};
#

this file is not running

#

help

fickle arch
#

hmmm in the kick command or ?

earnest phoenix
#

idk why

#
const { readdirSync } = require("fs")

module.exports = (bot) => {
    const load = dirs => {
        const events = readdirSync(`./events/${dirs}/`).filter(d => d.endsWith('.js'));
        for (let file of events) {
            const evt = require(`../events/${dirs}/${file}`);
            let eName = file.split('.')[0];
            bot.on(eName, evt.bind(null, bot));
        };
    };
    ["client", "guild"].forEach(x => load(x));

};
#

this is the event command

#

help me

solemn latch
#

yeah @fickle arch if your command handler runs .execute
the command needs to have its function named execute

lusty quest
#

what did you expect it to do @earnest phoenix

earnest phoenix
#

well bot.guild has some value

#

that i expected

lusty quest
#

is guild defined?

#

i would get the guild object of the message instead of some funky import / require stuff

#

wait nvm

#

this is your model

#

add some console.log between the steps. so you can see if it executes but doesnt write data

#

also this line makes no sense for me ```
["client", "guild"].forEach(x => load(x));

fickle arch
#

@solemn latch you mean like this ?

      command.execute(message, args);
    } catch (error) {
      console.error(error);
      message.reply("There was an error executing that command.").catch(console.error);
    }```
solemn latch
#

yeah

fickle arch
#

I have it.

gray zealot
#

Hi again :)
Is there a way I could see how many of my bots commands have been used?

solemn latch
#

you have execute defined in your kick command?

fickle arch
#

yes

solemn latch
#

i use prometheus to track command usage

gray zealot
#

? ok 🙂

fickle arch
solemn latch
#

?

#

your code

fickle arch
#

before it was undefined.

restive furnace
#

i use variables to track my command usage :)

solemn latch
#

how do you graph command usage then?

lusty quest
#

you can use a Database and just run a +1 every time someone uses a command (a timed DB like prometheus, Influxdb are better for this than Mysql, Postgres, mongodb. etc)

restive furnace
#

idk lol

#

i just use vars

lusty quest
#

you can make graphs with canvas

mortal dagger
#
@commands.command()
    async def userinfo(self, ctx, member : discord.Member):

        roles = [role for role in member.roles]
        roles = [role for role in member.roles]

        embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)

        embed.add_field(name="**User's status:**", value=f'User status is {member.status}')
        embed.set_thumbnail(url=member.avatar_url)
        embed.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)

        embed.add_field(name="User's ID:", value=member.id)
        embed.add_field(name="User's name:", value=member.display_name)

        embed.add_field(name="Account Creation Date:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
        embed.add_field(name="Join Date:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))

        embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))
        embed.add_field(name="Top role:", value=member.top_role.mention)

        embed.add_field(name="Bot?", value=member.bot)

        await ctx.send(embed=embed)
``` how do i remove the @@everyone on the role section? (discord.py )https://cdn.discordapp.com/attachments/612548053034860595/735556549292064828/unknown.png
fickle arch
#

@solemn latch So my kick script is having some issues I guess ?

lusty quest
#

remove the role from the collection or what ever the d.py equivalent is

solemn latch
#

yeah, you did say you where getting an error 🤔

mortal dagger
#

wdym @lusty quest

slender thistle
#

@mortal dagger Show me the list expression you are using for fhe role list

mortal dagger
#

dm me @slender thistle

slender thistle
#

Eh, sure

mortal dagger
#

ty

earnest phoenix
#

so i made my own library to upload photos to instagram

#

since the already existing ones dont work anymore

#

and the developer of one of them is so toxic

#

like he literally trashtalked a person that reported him a bug

mortal dagger
#
@commands.command()
    async def userinfo(self, ctx, member : discord.Member):

        roles = [role for role in member.roles]
        roles = [role for role in member.roles]

        embed = discord.Embed(colour=member.color, timestamp=ctx.message.created_at)

        embed.add_field(name="**User's status:**", value=f'User status is {member.status}')
        embed.set_thumbnail(url=member.avatar_url)
        embed.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)

        embed.add_field(name="User's ID:", value=member.id)
        embed.add_field(name="User's name:", value=member.display_name)

        embed.add_field(name="Account Creation Date:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
        embed.add_field(name="Join Date:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))

        embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))
        embed.add_field(name="Top role:", value=member.top_role.mention)

        embed.add_field(name="Bot?", value=member.bot)

        await ctx.send(embed=embed)
``` how do i remove the @@everyone on the role section? (discord.py )https://cdn.discordapp.com/attachments/612548053034860595/735556549292064828/unknown.png
solemn latch
#

did shiv not help?

mortal dagger
#

not rlly lol

slate oyster
mortal dagger
#

my bot is 17ms

lusty quest
#

@slate oyster did you access a external API?

slender thistle
#

@solemn latch I'll say one thing in my defense

#

If someone was competent enough to learn python

lusty quest
slate oyster
#

No
I'm using a VPS with a horrible internet connection

lusty quest
#

rip

#

would look for a new host then

slate oyster
#

I'm not paying

lusty quest
#

rip

slate oyster
#

It's OVH, but somebody else is letting me share the same vps they put their bot on

lusty quest
#

ovh is ok but i dont like them

fickle arch
#

is klasa reliable ?

slate oyster
#

They (OVH) have terrible network connection

gray zealot
#

I'm back! :D
But is there a way I could log message content into a json file?

lusty quest
#

currently i use Digital Ocean but for proper servers i use Hetzner

restive furnace
#

is klasa reliable ?
@fickle arch yes

#

if u mean the library

slate oyster
#

Ah, ok

lusty quest
#

OVH has usually okish network but the issue is the firewall

fickle arch
#

@restive furnace Could use it with djs ?

restive furnace
#

yes, the stable one.

slate oyster
#

Ah, must be a poor firewall then

lusty quest
#

not poor its one of the best you can get. the issue is sometimes its slow

#

or filter stuff you want to use

fickle arch
solemn latch
#

gateways?

lusty quest
#

gateways?

slate oyster
#

Oh, ok
Ya, my bot goes into spurts of disconnecting and not working
The other persons bot, that is on the same VPS, has the same problems at the same times, so it's not me

lusty quest
#

its possible that both eat to much bandwith

#

did you use js?

fickle arch
#

I think I gonna delete klasa.

lusty quest
#

you can squeze a little bit more performance out of it

slate oyster
#

I use Java (Discord4J)

lusty quest
#

then idk

#

with d.js there are 3-4 packages that improve the websocket speeds

#

this can help with the timeouts

obtuse jolt
#
$quer = $conn->prepare("SELECT EXISTS(SELECT * FROM guildconfig WHERE guildID = ?)");
$quer->bind_param("s", $yes->id);
$quer->execute();
$guild = $quer->get_result();

echo "<script>console.log(" . print_r($guild) . ")</script>";```

I have this code that is supposed to output 0 (false) if the guild ID isnt in the database but it always output 1 and idk why
#

$yes->id is the guild id

#

before you ask

velvet void
#

``

lusty quest
#

i dont get the syntax. what lang is this?

obtuse jolt
#

php

lusty quest
#

i dont know php sry. also i think its a dead thing

solemn latch
#

i think we are a long way from php dying

obtuse jolt
#

^^

slate oyster
#

Ok, I have a stable connection now
But the connection goes out for 20 minutes at least once a day

lusty quest
#

is it a vps or a Root server? if it is a vps maybe try a different host

#

root servers should be good enought there

slate oyster
#

I mentioned I was sharing an OVH instance that somebody else is paying for

lusty quest
#

yea but if both have issues it makes sense to look for a new host

solemn latch
#

i heard ovh is known for some connection issues to discord

#

atleast a few years back it did

lusty quest
#

yea they filter out some stuff with the Firewall

pure lion
#
if (rayAngle > P2 && rayAngle < P3) { rayX = (((int) playerX >> 6) <<6) - 0.0001; rayY = (playerX - rayX) * nTan + playerY; xOffset =- 64; yOffset =- xOffset * nTan; } // if looking left
if (rayAngle < P2 || rayAngle > P3) { rayX = (((int) playerX >> 6) <<6) + 64    ; rayY = (playerX - rayX) * nTan + playerX; xOffset =  64; yOffset =- xOffset * nTan; } // if looking right

err:

[Error] expected expression before '=' token

no idea what to do here, i know what the error says but not sure how to fix

i cant c ||dont laugh too hard x))))))))))))))))))))||

slate oyster
#

I don't have a CC, and am too young for paypal, so I can't exactly get a new vps

pure lion
#

dont

#

use a proper db

lusty quest
#

json is easy to get corrupted. use sqlite instead

#

@pure lion also wtf is this

gray zealot
#

ok 😄

pure lion
#

raycaster engine

#

so i know if im looking left so it doesnt break

lusty quest
#

idk never used a game engine as a dev, only as a mapper for now

torpid edge
#

client.commands.get('trial').execute(message,args);

i wanna make a embed message come
i made the embed code but i cant make it send the embed
im kinda new to the discord bot thing so im not sure what to do
what should i add to that to make it come

slate oyster
#

@pure lion it's -=, not =-
oh wait
That's just negative, oof

restive furnace
#
#send/createMessage([id] /*eris only*/, { embed: { /*properties here*/ }});```
finite bough
#

const mentionHook = new Discord.WebhookClient(.., ..)
mentionHook.edit(name, URL)

#

is this correct?

#

i mean

#

it didnt work so i am asking

vague kite
#

Hey so I was trying to use message react with shards but keep running into problems and wanted to know if anyone could help me out a bit.

let m = await message.channel.send("hey")

return client.shard.broadcastEval('
let emote = this.emojis.cache.get("id");

if(emote){
   m.react(emote)
}
')
solemn latch
#

whats the error?

vague kite
#

m is not defined

#

But then I do ${m} I can't use react

earnest phoenix
#

حد بيتكلم عربي

solemn latch
#

m wouldn't be defined on the shard you are sending to, nor have acess to it

#

i wouldnt think

#

ive not sharded yet, but youd want to fetch that emoji right?

lusty quest
#

i think you need to run your send stuff inside the eval to share it between the shards

#

its possible that the eval got a different scope

solemn latch
#

or maybe just fetchClientValue

vague kite
#

or maybe just fetchClientValue
Not sure if that'll work but I'll have a look into it tonight

solid falcon
slender thistle
#

Surprisingly

#

Yes

solid falcon
slender thistle
#

HelpCommand class passed into Bot's constructor or make your own

obtuse jolt
#

[num_rows] => 1

#

how can i make pre selected server invites?

autumn aspen
#

GUys what vid do I need if I want my bot to give a role when someones join?

#

How to edit the default help command?
@solid falcon Lol just do the same "!help" command but the command page

#

Guys what vid do I need if I want my bot to give a role when someones join?

#

also what command is it if u wanna do so ur bot reacts to ur message?

earnest phoenix
#

You want to mega spoonfed

obtuse jolt
pure lion
#

okay it kinda works but sometimes the ray fractures

solemn latch
#

discordjs v11 ?

fickle arch
#

how you remove npm packages ?

amber fractal
#

npm uninstall package should do

fickle arch
#

I mean removing 1 package only.

knotty steeple
#

is it a good idea to gc every 10mins

fickle arch
#

nice.

knotty steeple
#

in node

#

dot jay ess

valid frigate
#

depends

#

your code needs to pause while the gc is cleaning up but usually it doesnt take long

#

on the other hand if your code has, say a memory leak it will exponentially take longer

#

if you have a real time app and this happens it will cause problems

knotty steeple
#

ok how about every minute

valid frigate
#

guess it's up to you

#

but https://stackoverflow.com/a/32826201/4926527

Running global.gc() manually (enabled with node --expose_gc) would reduce memory usage by 50MB every time and would pause the app for about 400ms.

knotty steeple
#

clappers

#

manual gc and disabled events 😳

amber fractal
#

wont manually running the garbage collector result in spikes in usage

knotty steeple
#

mem usage rises

#

manual gc

#

downnnnn

#

repeat

amber fractal
#

I know that cpu usage can spike with gc

knotty steeple
#

yea it will

earnest phoenix
#

just updated discord.js and all my code was instantly screwed

#

fixed a few commands

#

annoying but meh

solemn latch
#

intents and stuff make it worth it

misty sigil
#

what do intents even do lmao

amber fractal
#

free up your bandwidth

solid falcon
#

@solid falcon Lol just do the same "!help" command but the command page
@autumn aspen I mean, how to edit the return message, I want to edit to embed message

misty sigil
#

i have enough width in my band to not need that

solemn latch
#

intents are what you get from discord.
by only using certain intents you limit whats cached, and bandwidth usage

amber fractal
#

from what tim has done, he's used 5x less bandwidth

#

just with disabling presence updates

solemn latch
#

yeah

amber fractal
#

along with using a zlib compressed stream

#

you can basically use nothing

solemn latch
#

yeah. its a great update for bot devs and discord

hidden lynx
#

I think there is a function for that

#

array.reverse();

tulip ledge
#

So me and my friend we made an NPM package and we can't add myself to the Collaborators anyone knows how to do it?

#

It just shows my friend

earnest phoenix
#

Hey so I am trying to make a Smash or pass discord bot and I'm trying to get the images from reddit. Most subreddits are NSFW tho and apis like random-puppy or imageapi don't work when the reddit is marked NSFW. Does anyone know how to bypass this? Here is my code if you need it

const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
    name: 'girl',
    run: async (client, message, args) => {
        let subreddits = [
            "RealGirls"
        ]
        let subreddit =
        subreddits[Math.floor(Math.random() * subreddits.length)];
        let img = await api(subreddit, true)
        message.channel.send("Here's a girl image...")
        message.channel.send(img)
    }
}
hidden lynx
#

Where's the array?

solemn latch
#

arr.reverse();

hidden lynx
#

Sorry I'm on mobile everything's formatted terribly

#

Ah okay

#

If that returns an array and you did everything correctly there, channelMessages.reverse() should do the job