#development

1 messages · Page 1272 of 1

earnest phoenix
#

lemme try evaluating without deleting

astral yoke
#

weird

#

what should i make it too then?

patent geyser
#

okay uhh

#

i've disabled firewall completely

#

2020-09-26T07:59:44.223157+00:00 heroku[Worker.1]: State changed from starting to up
2020-09-26T07:59:44.232223+00:00 heroku[Worker.1]: Idling
2020-09-26T07:59:44.233776+00:00 heroku[Worker.1]: State changed from up to down
2020-09-26T07:59:44.241646+00:00 heroku[Worker.1]: Idling because quota is exhausted
2020-09-26T07:59:50.347134+00:00 app[Worker.1]: Error waiting for network: Resource temporarily unavailable

tight plinth
#

quota exhausted

#

you consumed your free hours

earnest phoenix
#

Hello ! anyone know how to get the id of the user who invited the bot to the GuildCreate Event?

next flax
#

How can i remove this ?

let channel = client.channels.cache.find((x) => (x.id === "753232862375051384"))    
channel.join();
bot.user.setPresence({ activity: { name: 'Đ I Ξ 丶 H O M Ξ T O W N:tm: ', type: "PLAYING" }, status: 'dnd' })
console.log(`${bot.user.tag} music is setup `)
)```
earnest phoenix
#

By learning js syntax

next flax
#

but i think its ok

#

whats the matter

earnest phoenix
#

Learn JS syntax will solve your problem.

next flax
#

pls help

misty sigil
#

also that’s glitch

eternal osprey
#

hey

#

how can i automate a discord.js command?

earnest phoenix
#

@astral yoke idk maybe ask in discord.js server for help this is the first time i am seeing an error like this

peak anchor
#

hey if someone votes for my server on top.gg how can i make it so they automatically get a voter role?

earnest phoenix
#

hey if someone votes for my server on top.gg how can i make it so they automatically get a voter role?
@peak anchor goto the server edit page and scroll down

misty sigil
#

You can use @pliant gorge

#

it can be configured on the site

earnest phoenix
#

there should be smth to select the role which DSL will give to people

peak anchor
#

@earnest phoenix ok ty

eternal osprey
#
client.on('message', message=> {
  
  const args = ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
  queueMessageText= ('**A new tweet has been posted by you: **')
  queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^tweet/, '').trim()
 
  if (message.content.startsWith(prefix + 'tweet')){
  if (message.channel.id == '734123034243367002'){
   T.post('statuses/update', { status: args }, function(err, data, response) {
      console.log(data)
      message.channel.send(queueMessageText)
    }
  
    ``` how i automate this command to send every 5 minutes.
earnest phoenix
#

@eternal osprey setInterval

#

setInterval(callback, time_in_milliseconds);

peak anchor
#

it worked ty

charred geyser
#

anyone recommend the best way to be able to toggle features/commands of a bot per server

#

like for example disabling the help command in a server

digital ibex
#

a database

charred geyser
#

bruh

#

i have a database

#

just

#

would you just store like one schema per server

#

and have each command on there

digital ibex
#

then set the command availability or whatever u wanna call it to a bool, and in ur code before running the command, check if the command is disabled or not

charred geyser
#

and then like a boolean

#

yeah alright i guess that works

#

thanks :3

digital ibex
#

np

eternal osprey
#

thanks @earnest phoenix !!

#

hmm i have encountered some problems tho:

#

return this.request('POST', path, params, callback)
^

TypeError: this.request is not a function

#
const args1 = ' ' + message.content.slice(prefix.length).replace(/^autopost/, '').trim()
  queueMessageText= ('**The twitter autopost has been set to: **')
  queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^autopost/, '').trim()
  
  if (message.content.startsWith(prefix + 'autopost')){
  if (message.channel.id == '734123034243367002'){
    setInterval(T.post, 20000)
   T.post('statuses/update', { status: args1 }, function(err, data, response) {
      console.log(data)
      message.channel.send(queueMessageText)
    }
  
    
        
      )```
narrow cloak
#

hey how i keep my bot 24/7 in online please anyone help

eternal osprey
#

my code

misty sigil
#

hey how i keep my bot 24/7 in online please anyone help
@narrow cloak with a server

eternal osprey
#

hey how i keep my bot 24/7 in online please anyone help
@narrow cloak you can run it on a vps using pm2 or on heroku for free.

misty sigil
#

no heroku

#

(See pins)

eternal osprey
#

what

#

okay, anyways how do i fix this problem i've sent above?

narrow cloak
#

@narrow cloak with a server
@misty sigil yes i want to keep my own bot online i have coded also

eternal osprey
#

well look at a youtube tutorial

digital ibex
#

what is this.requst @eternal osprey

narrow cloak
#

but when i run it seems online after it again go to offline

digital ibex
#

show ur constructor

eternal osprey
#

it's in the twit package

#

wait

#
Twitter.prototype.post = function (path, params, callback) {
  return this.request('POST', path, params, callback)
}
#

it's a npm package for javascript

narrow cloak
#

but when i run it seems online after it again go to offline
@narrow cloak any help please

next flax
#
let channel = bot.channels.cache.find((x) => (x.id === "753232862375051384"))    
channel.join();
bot.user.setPresence({ activity: { name: 'Đ I Ξ 丶 H O M Ξ T O W N:tm: ', type: "PLAYING" }, status: 'dnd' })
console.log(`${bot.user.tag} is setup `)
)```
eternal osprey
#

owh wait

#

is it because twitter doesn't like doubles to be posted

next flax
#
^^^
SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
    at internal/main/run_main_module.js:17:11```
digital ibex
#

idk

eternal osprey
#

o it would intervene

next flax
#

why

eternal osprey
#

you can't tweet the same message 2x on twitter

narrow cloak
#

@digital ibex please help me

eternal osprey
#

it would simply not post

#

@narrow cloak find a tutorial on yt.

digital ibex
#

idk what ur issue is jeffin

eternal osprey
#

he wants to host his bot 24/7

#

i already said

#

find a free cloud server or a vps.

misty sigil
#

no free hosting

next flax
#

help me please

narrow cloak
#

i coded in visual studio code

digital ibex
#

buy a vps or use glitch or heroku (i've given up with telling people not to use them)

misty sigil
#

free hosting is bad

digital ibex
#

no its not

eternal osprey
#

stan

next flax
#

there is no free vps boi @narrow cloak

misty sigil
#

it barely has any power

eternal osprey
#

if it is a small project for a small server

misty sigil
#

it’s probably leaking data around

eternal osprey
#

what's the matter with that?

next flax
#
^^^
SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
    at internal/main/run_main_module.js:17:11```
digital ibex
#

you've not used every free hosting service have you?

next flax
#

i do

eternal osprey
#

heroku doessn't spill any info around tho?

misty sigil
#

uGh

#

yea but they’ll start charging you if you use too much resources

#

that’s why they want your card

eternal osprey
#

i have never needed to put in my card lmao

digital ibex
#

same

zenith terrace
#

let channel = bot.channels.cache.find(x => x.id === "753232862375051384")

You dont need all of them () lol @next flax

eternal osprey
#

also

digital ibex
#

idk where ur getting this info from, oh yeah. heroku and glitch

misty sigil
#

you need to put it in for 1000 hours?

eternal osprey
#

does that guy look like he made a super powerful bot?

zenith terrace
#

let channel = bot.channels.cache.find((x) => (x.id === "753232862375051384"))
You didnt need all of these

eternal osprey
#

that needs lots of resources?

digital ibex
#

who?

eternal osprey
#

Jefiin josva

#

or whatever his name was.

digital ibex
#

prob not

misty sigil
#

fuck it I give up

pale vessel
#

bot.channels.cache.get("753232862375051384") 😎

eternal osprey
#

yeah, so free hosting is just okay in this case. Why would you pay for a vps/server for a simple bot you made lmao.

digital ibex
#

:shrug:

zenith terrace
#

@pale vessel fair enough as well lol

narrow cloak
#

hey the hosting website asking url what do i

earnest phoenix
#

c# is cool because you can extend reference types

#

so you can do something like "753232862375051384".Channel()

#

granted, ids are ulongs, not strings

eternal osprey
#

@narrow cloak you really have to watch a tutorial on youtube.

narrow cloak
#

@narrow cloak you really have to watch a tutorial on youtube.
@eternal osprey I am using visual studio man

eternal osprey
#

i know

pale vessel
#

you don't learn by using vs

eternal osprey
#

nvm,

pale vessel
misty sigil
eternal osprey
#

i know that you are using vc

#

vsc*

digital ibex
#

most people who talk in this channel dont really have their own opinions, they just coincidentally have the same opinion as someone with the nitro booster role or certified dev role its just annoying at this point

eternal osprey
#

you have to put those folders (of your bot) on to heroku.

#

look at their fucking tutorial on yt.

misty sigil
#

You don’t put folders onto heroku iirc

narrow cloak
#

You don’t put folders onto heroku iirc
@misty sigil why

eternal osprey
#

idk what you do

misty sigil
#

it’s a git repo

eternal osprey
#

you use the heroku scli

misty sigil
#

you need a github repo

#

ok

eternal osprey
#

i have always been using git and their cli*

#

hey boys and girls

#

how do i randomly choose 4 letters ranging from a-z?

#

and it changes every time

hazy sparrow
#

Put them in a array

#

And Math.random() the array

pale vessel
#

and a loop

fickle sapphire
eternal osprey
#
function makeid(length){
      var result           = '';
      var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
      var charactersLength = characters.length;
      for ( var i = 0; i < length; i++ ) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
     }

    }


    setInterval(T.post, 20000)
    
    T.post('statuses/update', { status: args1 + result }, function(err, data, response) {
      console.log(data)
    })
     ```
#

result is not defined/

autumn aspen
#

Hey I wanna make a random command for a channel I mean that u can choose what welcome channel u want with this command.

    const channel = member.guild.channels.cache.find(channel => channel.name === `traffic`);

Or do I need a different code?

earnest phoenix
#

have you ever, trying to read what the error said

#

and think to your self, I should probably define that @eternal osprey

eternal osprey
#

yeah

#

but

#

isn't it alraedy defined

earnest phoenix
#

it's outside function scope

eternal osprey
#

var result = ''; and result += characters.charAt(Math.floor(Math.random() * charactersLength));

#

oowh okay

autumn aspen
#

Hey I wanna make a random command for a channel I mean that u can choose what welcome channel u want with this command.

    const channel = member.guild.channels.cache.find(channel => channel.name === `traffic`);

Or do I need a different code?

Anyone help?

eternal osprey
#

owh yeah ofc

earnest phoenix
#

Please read your code before posting

eternal osprey
#

sorry i just didn't notice.

earnest phoenix
#

@autumn aspen could just turn it into array

#

and get a random element

autumn aspen
#

and get a random element
@earnest phoenix messageArray or Math.floor?

#

or how do u mean?

earnest phoenix
#

Math floor

#

Since you want a random channel

#

you can just turn it into an array and pick a random one.

#

also remove the .find to make it complete random

undone carbon
#

Hey anyone familiar with canvas constructor? (DJs) how do I change the font, add bold text?

autumn aspen
#

Math floor
@earnest phoenix yes but I want it to like /set welcome channel channel

earnest phoenix
#

@undone carbon Have you tired google or reading their docs?

#

@autumn aspen could check if it mention a channel

#

or use that code for channel name and id

autumn aspen
#

@autumn aspen could check if it mention a channel
@earnest phoenix can I send u my command?

undone carbon
#

@earnest phoenix Google did not help.

#

: )

earnest phoenix
#

I see.

#

well

#

i will find the answer

#

brb

undone carbon
#

I saw registerFont but it's still in alpha and buggy.

earnest phoenix
#

actually

#

i am too lazy to help you so

#

eh

#

Lmao

undone carbon
#

Lol

earnest phoenix
#

@autumn aspen nah m8

#

you can try searching djs docs

#

.mentions check for role, user and channel

silent cloud
#

Yo

#

How i can connect scripts in command folder with bot.js

earnest phoenix
#

@silent cloud ya require them

#

and exports the run function

#

Omg how the hell do u people even get your bots running

#

^

silent cloud
#

Ez

earnest phoenix
#

Lemme guess.. annoying everyone?

silent cloud
#

All code in bot.js

#

Lol

autumn aspen
#

Omg how the hell do u people even get your bots running
@earnest phoenix clent.login('token')

#

oh lmao

earnest phoenix
undone carbon
#

Seems legit

autumn aspen
#

All code in bot.js
@silent cloud wdym the token and prefix and all

#

?

silent cloud
#

In config.json

#

I have private hosting

earnest phoenix
#

@earnest phoenix the only thing that people care for is spoonfeeding

autumn aspen
#

In config.json
@silent cloud my index.js is the big brain can I show u my command handler?

earnest phoenix
#

Dont you dare

#

spoonfeed

#

We need a rule where we ban spoonfeeders and idiots who dont wanna learn a language before asking for help

autumn aspen
#

nevermind

#

Dont you dare
@earnest phoenix no not like that lmao

#

nvm

#

We need a rule where we ban spoonfeeders and idiots who dont wanna learn a language before asking for help
@earnest phoenix agree

still merlin
#

A rule like that would be cool, But maybe not a instant ban

earnest phoenix
#

Instant ban pls

autumn aspen
#

lmao

#

guys my friend from china spoonfeeded me how to do kick owners command

digital ibex
#

you cant kick the owner

earnest phoenix
autumn aspen
#

you cant kick the owner
@digital ibex it was a joke

silver lintel
#

changing for (var i in items) to for (var i = 0; i < items.length; i++) doesnt work, i just wanna make it so when i reaches a certain value, the whole for loop stops

earnest phoenix
#

🤡

#

@silver lintel wdym “doesnt work”

eternal osprey
#
return this.request('POST', path, params, callback)
              ^

TypeError: this.request is not a function```
earnest phoenix
#

just use break to get out of the loop

#

var i of x for element inside it
var i in x for number

digital ibex
#

did the thing not work, awesome?

#

the x2 messages

earnest phoenix
#

Or if(i >= 5) return

eternal osprey
#

    setInterval(T.post, 20000)

    function makeid(length) {
      var result           = '';
      var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
      var charactersLength = characters.length;
      for ( var i = 0; i < length; i++ ) {
         result += characters.charAt(Math.floor(Math.random() * charactersLength));
      }
      
   
    
    T.post('statuses/update', { status: args1 + result }, function(err, data, response) {
      console.log(data)
    
    })
  }``` this is my code
earnest phoenix
#

@eternal osprey context?

#

Whats T

eternal osprey
#

from the twit npm package

#

it post the put-in messages to twitter

#
Twitter.prototype.post = function (path, params, callback) {
  return this.request('POST', path, params, callback)
}
``` this is where the problem comes from
earnest phoenix
#

Have u tried googling

eternal osprey
#

i have

digital ibex
#

you would use classes to extend the twitter prototype not like that

severe frost
#

hallo

digital ibex
#

it just makes it a lil bit easier

eternal osprey
#

owh okay

digital ibex
#

oh and

#

wait nvm i stupid

silver lintel
#

@silver lintel wdym “doesnt work”
@earnest phoenix when i console console.log(items[i]), nothing comes up

earnest phoenix
#

have you try to turn it into array

#

@silver lintel

silver lintel
#

how do that

#

do i use push to array?

earnest phoenix
#

no

#

what was you looping throught?

silver lintel
#

{
"thing1": {
"stuff": 69
},
"thing2": {
"random": 'poop
}
}

silent cloud
#

``
fs.readdir("./commands/", (err, files) => {

if (err) return console.error(err);

files.forEach(file => {

    if (!file.endsWith(".js")) return;

    let props = require(`./commands/${file}`);

    let commandName = file.split(".")[0];

    bot.commands.set(commandName, props);

});

});``

#

Whats wrong, why ...

earnest phoenix
#

have you tried reading the error

silent cloud
#

Yep

earnest phoenix
#

and what does it say

silent cloud
#

Or no

misty sigil
#

bot.commands should be a discord collection from what i can see

violet mesa
#
@bot.command()
async def dep(ctx, arg: int):
    await open_account(ctx.author)



    
    users = await get_bank_data()
    
    user = ctx.message.author
    
    if users[str(user.id)]["wallet"] >= arg:
        
       users[str(user.id)]["wallet"] -= arg
       users[str(user.id)]["bank"] += arg
       await ctx.send("succesfully transfered the cash")
    elif users[str(user.id)]["wallet"] < arg:
        await ctx.send("you dont have enough for that")
```why does this not work?
#

no errors

#

nothing

#

can anyone help?

silent cloud
#

Oh

#

Pyton

#

``const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {

const command = require(`./commands/${file}`);



bot.commands.set(command.name, command);

}

``

#

Why...

digital ibex
#

bot.commands isnt a thing maybe

earnest phoenix
#

how do i make an html embed?

#

like

digital ibex
#

wut

silent cloud
#

bot.commands isnt a thing maybe
@digital ibex sec

earnest phoenix
silent cloud
#

bot.commands = new Discord.Collection();

earnest phoenix
#

how do i make an embed^

digital ibex
#

use the meta tag

#

one sec lemme find

#

@silent cloud show ur code

silent cloud
#

...

digital ibex
silent cloud
#

``bot.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {

const command = require(`./commands/${file}`);



bot.commands.set(command.name, command);

}

``

#

Thats all ...

digital ibex
#

thats not all the code there is

#

oh i didnt see the top

silent cloud
#

Nah

digital ibex
#

console.log(bot.commands)

silent cloud
#

``const Discord = require('discord.js');
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);

const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");``

digital ibex
#

pls ```js
code here ```

silent cloud
#
const Discord = require('discord.js');
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);

const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");

bot.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {

	const command = require(`./commands/${file}`);



    bot.commands.set(command.name, command);
}

#

Sooooo

digital ibex
#

?

#

what does it log?

silent cloud
#
const Discord = require('discord.js');
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);

const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");

bot.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {

	const command = require(`./commands/${file}`);



    bot.commands.set(command.name, command);
}

@silent cloud .

digital ibex
#

you've sent the same thing 3 times

silent cloud
#
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);

const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");

bot.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {

	const command = require(`./commands/${file}`);



    bot.commands.set(command.name, command);
}```
#

Wtf

#

It cant do ```

digital ibex
#

i give up

silent cloud
#

I sit on this 16 hours

#

My friend too doesnt know

digital ibex
#

send the code again, it might help

silent cloud
#

Maybe pastebin?

digital ibex
#

nah

silent cloud
#

Bcs discord can't do it normal

#

Rip

earnest phoenix
#

@digital ibex embed doesn't work

#

I want it to embed like this

digital ibex
#

show ur code

earnest phoenix
#
<head>
  <meta charset="UTF-8">
  <meta name="description" content="Free Web tutorials">
  <meta name="keywords" content="HTML, CSS, JavaScript">
  <meta name="author" content="John Doe">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>```
digital ibex
#

show the code around it

earnest phoenix
#

It's my whole website then

#

So

#

I just want to learn how to embed

digital ibex
#

r u using local host or have you got a domain?

earnest phoenix
#

I have a domain

digital ibex
#

send ur website link here

earnest phoenix
digital ibex
earnest phoenix
#

I got rid of it now

misty sigil
#

here to save the day

silent cloud
#

Stan

#

Can you help me

#
const bot = new Discord.Client();
const backup = require("discord-backup");
const { MessageEmbed, MessageAttachment, Collection } = require("discord.js");
const chalk = require("chalk");
const ytdl = require("ytdl-core");
const ffmpeg = require("ffmpeg");
const { TOKEN, PREFIX } = require("./config.json");
prefix = PREFIX;
backup.setStorageFolder(__dirname+"/data/");
bot.login(TOKEN);

const { readdirSync } = require("fs");
const { join } = require("path");
var queue = require("./commands/play.js");
const fs = require("fs");

bot.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {

	const command = require(`./commands/${file}`);



    bot.commands.set(command.name, command);
}```
digital ibex
#

send it again, it helps trust me

silent cloud
misty sigil
#

send it more why dontcha

violet mesa
#
@bot.command()
async def dep(ctx, arg: int):
    await open_account(ctx.author)


    
    
    users = await get_bank_data()
    
    user = ctx.message.author


    ba = users[str(user.id)]["bank"]
    wa = users[str(user.id)]["wallet"]

    
    if users[str(user.id)]["wallet"] >= arg:
       wa = wa - arg
       ba = ba + arg
       await ctx.send("succesfully transfered the cash")
    elif users[str(user.id)]["wallet"] < arg:
        await ctx.send("you dont have enough for that")
```why does this no work?
#

and can anyone help fix it?

misty sigil
#

wHy DoEs tHiS nOt wOrK

#

give us an error

#

pls

violet mesa
#

there is no error

#

it just doesnt work

slender thistle
#

put prints under each line

#

see what's executed and what's not

violet mesa
#

ok

steel shell
#

huh

violet mesa
#

1 sec

earnest phoenix
#

Hello someone can help me?
How to do: send message 5 times.

#

/seconds

violet mesa
#

it prints all of it

#

must be a prob with the bank

#

1 sec

#

i dont see the problom

honest perch
#

@misty sigil you alive

misty sigil
#

no

honest perch
#

have you seen the site

misty sigil
#

which site

honest perch
#

mb

misty sigil
#

where

honest perch
#

dms

slow crag
#

Hi everyone

silent cloud
thin turret
#

Pug said

#

🕺🎶

autumn aspen
#

Guys I want to make a edit message thingy but dont know how to do, my code

module.exports.run = async (client, message, args) => {
    message.reply(message.author.displayAvatarURL());

}

I have createdTimestamp on my ping command but I want it to have it on this command too

#

Anyone help? bc I want it to look so smooth asp when its gonna show ur pfp

thin turret
#

Do you want to edit the message, add a timestamp, or have it run faster

misty sigil
#

discord.js?

#

try <client>.on('debug', d => console.log(d))

#

it provides useful info

knotty sigil
#

I get this error for some reason
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
Can someone help me?

misty sigil
#

have you updated code recently?

#

weird

#

anything below that screenshot?

knotty sigil
#

stan can you also help me

misty sigil
#

after loading commands?

#

@knotty sigil sup

knotty sigil
#

how you dion

#

doin

misty sigil
#

am good

knotty sigil
#

I get this error for some reason
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
Can you help me?

misty sigil
#

seems like a code problem but im no expert

knotty sigil
#

:(

misty sigil
#

i doubt its a problem there

#

cuz there is a func

quartz kindle
#

Are you sure the error is from there?

misty sigil
#

^ thinking that

sudden geyser
#

show us the stack trace pls

earnest phoenix
#

@knotty sigil screenshot or copy of stacktrace pls

#

so we can help you identify the actual issue

knotty sigil
#
events.js:111
    throw new ERR_INVALID_ARG_TYPE('listener', 'Function', listener);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
    at checkListener (events.js:111:11)
    at _addListener (events.js:348:3)
    at Client.addListener (events.js:406:10)
    at Object.<anonymous> (C:\Users\j\Documents\GitHub\FakeBot-discord\index.js:283:8)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}
#

nvm i fixed it

#

i forgot to close a part of the code

cosmic robin
#
    const args = message.content.slice(PREFIX.length).trim().split(/ +/g);
    const command = args.shift().toLocaleLowerCase();
    if(command === 'warn') {
        console.log('1');
        if(message.member.hasPermission('KICK_MEMBERS')) {
            console.log('2');
            const Embed = new Discord.MessageEmbed()
            .setColor(0xFF009E)
            .setTitle('User war warned')
            .setDescription(args[1])
            .setAuthor(message.author.username)
            .setFooter('Discord Bot Created by Phil#0005')
            message.channel.send(Embed);
            const warned = message.mentions.users.first();
            warned.roles.add('758787460468572171');
            console.log('3');
        }
    }
})```
its not outputting an error its just not doing the actions set and won't log the numbers to console
#

any help would be appreciated

sudden geyser
#

Your source code looks correct. What is PREFIX and how are you writing the command out? Is the event being added at the top scope (aka are you sure the event has been added to the client)

cosmic robin
#

prefix is just '-' so the code takes the first input after '-'

unique patio
#

looks wrong

cosmic robin
#

and yes to the second aswell

autumn aspen
#

Do you want to edit the message, add a timestamp, or have it run faster
@thin turret 1st u said

unique patio
#
    if (receivedMessage.author == client.user || receivedMessage.author.bot || !receivedMessage.content.startsWith(Config.COMMAND_PREFIX)) return;

sudden geyser
#

looks wrong
@unique patio can you point out what looks wrong?

unique patio
#

Yeah your prefix don't do it like that

#

on received message; run this to cancel if it doesn't match your prefix and talks to another bot.

#

Then!!!

#

You run command check if it continues

#

var splitCommand = receivedMessage.content.substr(1).split(/\s+/);

#

Then you can!

sudden geyser
#

The way they're getting the command and args is not incorrect though.

#

That's just another way of doing it.

unique patio
#
        if (typeof PublicCommands[splitCommand[0]] == "function") {
            PublicCommands[splitCommand[0]](splitCommand.slice(1), receivedMessage);
        }
cosmic robin
#

its the same code as the other commands i use

#
    const args = message.content.slice(PREFIX.length).trim().split(/ +/g);
    const command = args.shift().toLocaleLowerCase();
    if(command === 'embed') {
        if(message.member.hasPermission('ADMINISTRATOR')) {
            var inputsstr = args.join(' ');
            var inputsarray = inputsstr.split('*');
            const Embed = new Discord.MessageEmbed()
            .setColor(0xFF009E)
            .setTitle(inputsarray[0])
            .setDescription(inputsarray[1])
            .setAuthor(message.author.username)
            .setThumbnail('https://cdn.discordapp.com/attachments/739943623348453386/753265807726739676/57.gif')
            .setFooter('Discord Bot Created by Phil#0005')
            message.channel.send(Embed);
        }
        else {
            message.channel.send('You do not have permission to use this command')
        }
    }
    if(message.content.startsWith('-embed')) {
        message.delete();
    }
    if(message.content.startsWith('You do not have permission to use this command')) {
        setTimeout(() => {  message.delete() }, 3000);
    }
})```
#

this is another command in the bot using the same code to seperate it

unique patio
#

hmmm

#

messy

#

On message run this as a check.

    if (receivedMessage.author == client.user || receivedMessage.author.bot || !receivedMessage.content.startsWith(Config.COMMAND_PREFIX)) return;

tired gate
unique patio
#

change config.command_prefix to "!" or w/e you use, then legit just substr(1) and split the co ntent

#

into array

#

@tired gate That's not completed code.

#

Missing lots.

tired gate
#

i know, the bottom part is irrelevant

#

thats why i left that out

#

no problems in vs code

#

and it stops working from there on

unique patio
#

oh at testkey1?

sudden geyser
#

Does it log the first message at the top (react with <> emoji)?

tired gate
#

yessir

oh at testkey1?

#

log the message? wdym lite

sudden geyser
#

I think the issue is maxMatches

#

In v12 the name is max

tired gate
#

ooo

unique patio
#

nice find

tired gate
#

dang thanks man

unique patio
#

Was just getting to that

tired panther
#

Can i make a command , in which it pulls file from a private github repo?

unique patio
#

Yes

#

Not necessarily private unless you have links

tired gate
#

is awaitmessages v11 too?

#

it says it only knows awaitReactions

tired panther
#

Not necessarily private unless you have links
@unique patio wdum?

unique patio
#

You can XHR/Fetch Github repo's easily

#

as long as you have a link to them, they are not private to the webs.

#

🙂

tired panther
#

but when it is a private one?

unique patio
#

So if you made a repo hid it to yourself only

#

and used it, sure.

#

It depends on how private, as in no link can access it must be owner perms, nah. API won't fetch it.

#

If you can see the private git by link, you can fetch it for your requests.

tired panther
#

no its full private

unique patio
#

no issues!

#

You'd need some permissions to fetch it so yeah if it's locked down unlikely without the permissions.

tired panther
#

with ssh?

unique patio
#

Nah not that sophisticated lol

#

simple calls like that, wait on response

#

That's to some dummy-event JSON file.

#

So yeah just try using the API to fetch the repo's.

pallid igloo
#
const axios = require('axios');

async function GetReq() {
    const text = await axios.get(process.env.url);
    return text.data;    
};

console.log(GetReq())

Why doesn't it work? process.env.url is correct.

sudden geyser
#

log process.env and see if it exists in the object

pallid igloo
#

It does

sudden geyser
#

try it and see

#

for example you could have a .env file but it's not being loaded, which often a package called dotenv is used to load it.

pallid igloo
#

It works.

#

My process.env.url exists

#

Because I'm on my host

#

even if I replace it with a plain string, it doesnt work.

#

Just logs nothing, and emits process.exit(1)

#

plain string as in a string with the URL.

tired gate
#
message.channel.send('Please enter you activation key!')
                const filterkey = m => m.author.id === message.author.id;
                message.channel.awaitMessages(filterkey, { max: 1, time: 180000, errors: ['time'] })
                if (collected === 'testkey1') {
                    if (db.get(`testkey1_redeemed` == undefined || true)) {
                        message.channel.send('🪄 Success! This server is now **premium**!')
                        db.set(`testkey1_redeemed`, true)
                        db.set(`${message.guild}_premium`, true)
                    } else message.channel.send('That key has already been used. Keys can only be used once.')
                }``` what about that isn't working?
sudden geyser
#

So when you logged process.env and looked inside the object you found the key url. Then what is not working about it right now. What is failing with the .get() now

pallid igloo
#

@sudden geyser there's some problem with the return thingy, because if I call the function and do my shits inside the function, it works properly

#
const axios = require('axios');

async function GetReq() {
    const text = await axios.get(process.env.url);
    console.log(text.data);
};

GetReq();
#

This works

#

But this isn't the way I want to do it

#

as my "url" is a webhook link which needs fetching.

tired gate
#
message.channel.send('Please enter you activation key!')
                const filterkey = m => m.author.id === message.author.id;
                message.channel.awaitMessages(filterkey, { max: 1, time: 180000, errors: ['time'] })
                if (collected === 'testkey1') {
                    if (db.get(`testkey1_redeemed` == undefined || true)) {
                        message.channel.send('🪄 Success! This server is now **premium**!')
                        db.set(`testkey1_redeemed`, true)
                        db.set(`${message.guild}_premium`, true)
                    } else message.channel.send('That key has already been used. Keys can only be used once.')
                }``` no error, no response
pallid igloo
#

djs, I suppose?

tired gate
#

yessir

pallid igloo
#

you might want to use a collector

#

instead of awaitmessages

#

Collectors are more efficient

#

and More easier to handle

tired gate
#

ill try that, thanks

pallid igloo
#

wait

#

@tired gate you arent reffering to the promise in any way.

#

do the rest of the code in your promise

#

or a .then statement tbh

#

TextChannel#awaitMessages uses a promise to check the collected thingies.

sudden geyser
#

@pallid igloo so the work inside the function is working, but outside the function it doesn't work properly? Is it because GetReq returns a promise so you need to either use .then / await?

pallid igloo
#

Lemme check if It is returning a promise.

#

I'm going to feel very dumb if I find it out

sudden geyser
#

An async function will always return a promise

pallid igloo
#

Ah okay.

sly dawn
#

how do i get my bot not to reply to other bots

umbral zealot
#

if author is bot stop

#

the actual syntax depends on your language

#

but Users have a bot property that defines whether they're a bot, so in JS, you can do if(message.author.bot) return; and boom, the bot ignores other bots

sly dawn
#

like if(message.bot) return; message.channel.send(" ");?

#

oh ok

umbral zealot
#

so discord.js. See my message above, that code is what oyu need.

autumn aspen
#

!h

#

-h

#

Is there a reason this isn't working? It's not reading any of the events in that folder.


fs.readdir('./events/', (err, files) => {
  files = files.filter(f => f.endsWith('.js'));
  files.forEach(f => {
      const event = require(`./events/${f}`);
      client.on(f.split('.')[0], event.bind(null, client));
      delete require.cache[require.resolve(`./events/${f}`)];
  });
});```

@fleet hornet thats a weird command handler

#

ngl

#

lol

sudden geyser
#

@fleet hornet are you sure the .forEach is not being executed (executing at least one file)?

#

Okay, but can you try adding a console log inside your forEach to see if any of the files from the directory are being read

sly dawn
#

how can i make my bot not to reply to other bots

open rune
#

!<message>.author.bot

slender thistle
#

why client

#

and not message

open rune
#

my bad

sly dawn
#

@slender thistle i tried it with message and it still doesnt work

#

my bot still replies to other bots

#

my code is if(message.author.bot) return;

#

and it don't work,.

sudden geyser
#

can you share more of your source code

sly dawn
#

Okay

sudden geyser
#

preferably from the start of the event listener

sly dawn
sudden geyser
#

but you aren't doing anything after

slender thistle
#

Uhhhh

sonic lodge
#

did you make an entirely separate listener

sudden geyser
#

do you have more than one event listener

gentle oxide
#
In embed.image.url: Not a well formed URL.)```
quartz kindle
#

well, you need to put that in the same place where you have your command

#

not in a new message event lol

ancient nova
sly dawn
#

I have more than 11 message listeners..

earnest phoenix
#

no

quartz kindle
#

then dont

sonic lodge
#

you shouldn't

earnest phoenix
#

delete that code now

sudden geyser
#

You only need one

earnest phoenix
#

btw im talking about the bf code in the image

sudden geyser
#

wdym brainfuck is legendary

slender thistle
#

@ancient nova care to elaborate what that's supposed to do?

sudden geyser
#

and there's moo as well

slender thistle
#

Brainfuck is fun

#

As is lolcode, imo

sly dawn
#

how am i supposed to not make my bot not reply to other bots lol

slender thistle
#

Put that code wherever you do your commands

sudden geyser
#

you do this thing

well, you need to put that in the same place where you have your command

slender thistle
#

You created a separate event that doesn't affect any of the other by any chance

sonic lodge
#

since you have 11 listeners you need to do that 11 times

sly dawn
#

okay

umbral zealot
#

Or, don't have 11 message handlers

sly dawn
#

ill put the command in 11 message listenenrs lol

ancient nova
#

how do I increase limit of listeners? for a snipe command

gentle oxide
#

@sly dawn message.bot.author

open rune
#

message.author.bot*

sly dawn
#

@gentle oxide ?

sudden geyser
#

You don't need 11.

umbral zealot
#

Like, 100%, you should only have one single message event, that's it.

quartz kindle
#

why 11 listeners tho... just use 1 listener

sly dawn
#

idk i have been coding since 2 months i was so dumb when i started coding

ancient nova
#

how do I make it use only one then?

quartz kindle
#

not too late to change

sly dawn
#

and here i am lol

umbral zealot
quartz kindle
#

and shouldnt be hard to do

umbral zealot
#

go from there

sly dawn
#

brb

#

@umbral zealot na i have alr built my bot to next level

ancient nova
#

how do I make an onDeleteMessage event use only one listener?? or increase the listeners

umbral zealot
#

"next level"?

quartz kindle
#

lmao

sudden geyser
#

yes

umbral zealot
#

if you're still using 11 handlers you're not next level.

sly dawn
#

@umbral zealot it is a old code

#

if ya know

ancient nova
#

how do I make an onDeleteMessage event use only one listener?

umbral zealot
quartz kindle
#

thats no excuse, code refactoring exists

slender thistle
#

That reminds me, I need to rewrite my clusterfuck of moderation module

quartz kindle
#

none of my code is older than 6 months, even though my bot is like 4 years old

#

because im always upgrading, changing and improving it

sudden geyser
#

@fleet hornet the file should be called guildMemberAdd.js.

Where are you defining member? I see you defined message, but not member

quartz kindle
#

@ancient nova ```js
client.on("messageDelete", message => {
// do something
// do something else
})

gentle oxide
#

@sly dawn

if(message.bot.author) return;```
umbral zealot
#

yeah we've already answered that part, Noel

#

did you forget to scroll down?

sonic lodge
#

also flip bot and author

open rune
#

yes

umbral zealot
#

yeah that too 😂

#

those shit quotes, too.

open rune
#

message.author.bot

sudden geyser
#

dylan where are you defining member though

fleet hornet
#

I added it to the module exports

gentle oxide
#
In embed.image.url: Not a well formed URL.)``` please
eternal sandal
#

This is why discord.py has the blessed on_command handler

#

That shit autoignores bots IIRC

slender thistle
#

uhh

#

on_message

umbral zealot
#

@gentle oxide clearly the URL you're sending isn't valid.

slender thistle
#

on_command is an event when a command is executed

sudden geyser
#

You have async (client, message) => { up there, but I don't see the definition of member.

#

oh now I see

#

message would be the GuildMember instance.

gentle oxide
#

but it won't let me put a .json file as url> @gentle oxide clearly the URL you're sending isn't valid.
@umbral zealot

umbral zealot
#

What? a json file as a URL???

#

a JSON file is not a URL.

#

And it's not an image

gentle oxide
#

but it can be put as a link to another file which is .json don store a list of urls

#

I do not know if you understand me

quartz kindle
#

i certainly dont

sonic lodge
#

so your json file has a set of urls to choose from?

gentle oxide
#

yes and that images come out randomly

quartz kindle
#

if you have a json file with URLs, then you need to write code to read this file, chose one url and add the url to the embed

#

you cannot add the json to the embed directly

earnest phoenix
#

@quartz kindle when did u get certified

quartz kindle
#

like a year ago?

earnest phoenix
#

Why am i just noticing

sly dawn
#

I have a question, how can i get my bot reply on @mention him?

earnest phoenix
#

Use .includes on message.content

quartz kindle
#

or check if it starts with the mention pattern

sly dawn
#

message.content.includes(??

earnest phoenix
#

@fleet hornet whats get

sly dawn
#

Like if(message.content.startsWith(@bot name)

quartz kindle
#

startsWith("<@BOTID>")

sly dawn
#

okay

#

thx

gentle oxide
#

can't create a file with multiple urls and inside the embed.set_image (filename.json)

earnest phoenix
#

Can you not

gentle oxide
#

can't create a file with multiple urls and inside the embed.set_image (filename.json)

#

?

quartz kindle
#

no

#

as i said, you need to write code that reads the file and choses one url, then give the url to set_image

#

you cannot give a json to set_image

#

it doesnt know what to do with it

#

it cant guess what you want it to do

autumn aspen
#

Who wanna try a gay test command

#

lmao

#

In my server real quick

#

support server

knotty sigil
#

why when i reset my nickname it's shows that my new nickname is null?

autumn aspen
#

why when i reset my nickname it's shows that my new nickname is null?
@knotty sigil hhahahah u copied it

knotty sigil
#

copied it?

gentle oxide
#

I am creating a command called memes I need to put out of the bot.py file a file called listmemes.json and here I will put all the urls of the memes that I want it to reproduce embed style

earnest phoenix
#

a) why
b) pick a random entry from the json file

#

but why

#

you need to manually update all urls

#

lol

gentle oxide
#

Look

earnest phoenix
#

you have to read the contents of the file and parse the json

#

it doesn't work like that

#

it isn't magic

gentle oxide
#

json

cinder patio
#

That doesn't look like valid JSON

earnest phoenix
#

it isn't

#

and it doesn't correlate to what i said

gentle oxide
#

in what fails?

earnest phoenix
#

can you speak comprehensive english

thin turret
#

Json doesnt have comments with #

quartz kindle
#

@knotty sigil if a nickname doesnt exist, its null

#

null means an empty value, a value that doesnt have anything

gentle oxide
#

tell me to express myself haha

knotty sigil
#

How can i define null = newMember.username @quartz kindle?

#

but only for this function

quartz kindle
#

what

faint prism
#

lol

opal plank
#

👀

gentle oxide
#

Tim take you can say what is my mistake please

quartz kindle
#

if newMember.nickname is null, it means the user doesnt have a nickname

#

so you either need an if to check if its null or not, or you can use .displayName that basically does it for you

opal plank
#

also null is defined

faint prism
#

null is an empty value

opal plank
#

just means its empty

faint prism
#

undefined * another JS thing

opal plank
#

nah, null IS defined

#

undeinfed =/= null

gentle oxide
#

Tim look

opal plank
#

lmao

gentle oxide
opal plank
#

null is a declared var, just means its value is empty

quartz kindle
#

@gentle oxide your json is wrong, you're using object syntax, but what you want is an array not an object

#

also, thats not how you open a json file

pale vessel
#

looks like a set

opal plank
#

or array

pale vessel
#

a python set

opal plank
#

its def py

pale vessel
#

but it says listmemes.json

#

well, assuming that's the file

opal plank
#

'La lista con los gifs'

#

the list with the gifs

slender thistle
#

Man

#

Pain

#

Hotse

pale vessel
#

i don't think those two images correlates

slender thistle
#

What the fuck is going on

#

They aren't

opal plank
#

wdym?

slender thistle
#

Sets aren't supported in json

pale vessel
#

well yeah but

earnest phoenix
#

objects are sets

pale vessel
#

those don't look like memes

slender thistle
#

@gentle oxide where is the list of the links declared?

opal plank
#

i though sets are just array but with unique entries

gentle oxide
#

What page do you recommend me to know how to use json is that I have no idea what I want to achieve is to make a memes command but instead of the urls lidta being followed by the command that they are in a separate folder and being able to add more urls together

opal plank
#

{[//sets]} shuold be valid

#

though i think sets in py are different

slender thistle
#

Yes

quartz kindle
earnest phoenix
#

returning to my original question, why are you storing the urls in a json file in the first place

#

you have to manually update that

opal plank
#

arent sets in py like tuples?

slender thistle
#

set is a mutable unordered list with unique immutable values

opal plank
#

or am i gravely mistaking things here?

slender thistle
#

Well tuples are immutable

opal plank
#

hmmm i see

gentle oxide
#

para tenerlo bien ordenado

#

to have it well ordered

tired gate
#
else if (collected.find(r => r.emoji.name === '🦖')) {
                const embed = new Discord.MessageEmbed

                .setColor(0x00ff00)
                .setTitle('Premium features')
                .setField('Warning types', 'premium lets you change the bot\'s warnings from meme-y, to professional warnings.')
                .setField('Warning methods', 'On top of changing the warning type, you can make the warnings be deleted after 3 seconds to sstop chat clutter, or DM the user upon infractions!')
                .setField('Logging', 'Whenever someone infracts by sending an inappropriate emoji, this will be logged in any channel with the name `#elogs`.')
                .setFooter('buying premium will keep me thriving! run the command again to get the link.')
                try {
                    message.channel.send(embed)
                } catch {
                    console.log(err)
                }
            }```
#

that isnt sedning the embed

faint prism
#

Send more code in hastebin

gentle oxide
#

returning to my original question, why are you storing the urls in a json file in the first place
@earnest phoenix

to have it well ordered

earnest phoenix
#

what

faint prism
#

Json is just the representation of an object lol

earnest phoenix
#

why does the order matter if you're going to randomly select it

#

???

rocky hearth
#

Erwin its been 48 hours, and I can't still figure out why ts-node is not working for me. I also tried create a whole new project, but no luck @opal plank

tired gate
#

the redacted part are premium codes

#

that workes fine

#

just not the embed

pale vessel
tired gate
#

OOOOO

opal plank
#

@rocky hearth show me the new project

tired gate
#

wait @pale vessel that still isnt working

rocky hearth
#

Can I share the screenshots privately?

opal plank
#

sure

pale vessel
tired gate
#

OOOO

#

smh

gentle oxide
#

@faint prism
I say stored all memes and not scattered by bot.py

tired gate
#

ty flazepe

ancient nova
#

I did messageDeleted event but I get event limter exeeded 11 listeners error very often, how do I fix it?

thin turret
#

Dont stack events

ancient nova
#

wdym

thin turret
#

Each event should be in a seperate block, no events inside others

ancient nova
#

ah I see

#

thanks

opal plank
#

why the fuck so many voice state updates?

tired gate
#

gateway intents?

opal plank
#

Hmmm...

#

no i mean, i AM using them[

#

jsut wondering why so spammy

tired gate
#

¯_(ツ)_/¯

autumn aspen
#

@opal plank

earnest phoenix
#

i mean if 500 and 6000 is the min and max i would assume so

autumn aspen
#

i mean if 500 and 6000 is the min and max i would assume so
@earnest phoenix also I got 0 of 1 of 4

#

I can show u my code

earnest phoenix
#

what language is it?

autumn aspen
#

what language is it?
@earnest phoenix what?

earnest phoenix
#

like coded in

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

module.exports.config = {
    name: "random", 
    aliases: ["ra"]
}
    
module.exports.run = async (client, message, args) => {
    if(!args[0]) return message.reply("You didn't specify args 1!")
        if(!args[2]) return message.reply("You didn't specify args 2!")
        message.channel.send("Your random number is: " + Math.floor(Math.random() * args[2] + args[0]));
    }
#

my code

earnest phoenix
#

oh ok js

autumn aspen
#

english

#

yup

misty sigil
#

Wouldn’t it be args[0]

#

and args[1]

#

or args[1] and args[2]

autumn aspen
#

wdym I tryed but it said NaN

earnest phoenix
#
Math.random() * (max - min + 1) + min```
#

i use that

#

for my rand function

#

and the args should be min = 0

#

of = 1

#

max = 2

shy turret
#

does anyone know how to javascript -> typescript

umbral zealot
#

I wouldn't do it automatically, so you just... start doing it manually.

shy turret
#

@umbral zealot i meant like start a web with a typescript editor and make the typescript work

umbral zealot
#

mmkay well there are many, many tutorials about that

shy turret
#

frick it im making my own scripting lang

#

bad idea me

umbral zealot
#

yes yes that's much easier than just following typescript tutorials. sarcasm

rocky hearth
#

Anyone here who knows ts-node better than me.

umbral zealot
#

how would we know ¯_(ツ)_/¯

rocky hearth
#

Well, I'm stuck in a situation. So...

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

module.exports.config = {
    name: "kick", 
    aliases: []
}
    
module.exports.run = async (client, message, args) => {
    if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send('You can\'t use that!')
        if(!message.guild.me.hasPermission("KICK_MEMBERS")) return message.channel.send('I don\'t have the right permissions.')

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

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

        if(!member) return message.channel.send('Can\'t seem to find this user. Sorry about that.');
        if(!member.kickable) return message.channel.send('This user can\'t be kicked. It is either because they are a mod/admin, or their highest role is higher than mine.');

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

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

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

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

        const kickembed = new Discord.MessageEmbed()
        .setTitle('Member Kicked')
        .setThumbnail(member.user.displayAvatarURL())
        .addField('User Kicked', member)
        .addField('Kicked by', message.author)
        .addField('Reason', reason)
        .setFooter('Time kicked', client.user.displayAvatarURL())
        .setTimestamp()

        message.channel.send(kickembed);
                

    }

I got an error when I dont specify a reason?

umbral zealot
#

what error

autumn aspen
#

wait

opal plank
#

@shy turret the easiest way to convert js to ts is to throw :any everywhere

autumn aspen
#
(node:8552) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:432:23)
    at C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:452:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:451:8)
    at MessageEmbed.addFields (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:266:42)
    at MessageEmbed.addField (C:\Users\admin\apemodicus\node_modules\discord.js\src\structures\MessageEmbed.js:257:17)
    at Object.module.exports.run (C:\Users\admin\apemodicus\commands\kick.js:35:10)
    at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
(node:8552) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, 
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8552) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@umbral zealot

shy turret
#

k

#

@autumn aspen empty field

opal plank
#

of course you need to fix it later

shy turret
#

like you cant .addField("", "")

opal plank
#

but just as a basic port

autumn aspen
#

yes but when I dont specify a reason to kick a member I got an err

opal plank
#

make sure you use the right types, setting :any's everywhere completely defeats the prupose of TS

umbral zealot
#

args.slice(1).join(" "); would return "" if there are no more args, and "" is not the same as undefined. @autumn aspen you need to learn to use console.log() in order to know what your values are instead of guessing what they are

autumn aspen
#

ok

#

args.slice(1).join(" "); would return "" if there are no more args, and "" is not the same as undefined. @autumn aspen you need to learn to use console.log() in order to know what your values are instead of guessing what they are
@umbral zealot but how do I stop that from happening

#

?

#

Bc if I kick with a reason its works normal

#

and when Im not adding a reason it kicks but gives me a error

umbral zealot
#

... I...

#

I understood the problem

#

and I gave you the answer.

misty sigil
#

reason is defined

#

but its ""

umbral zealot
misty sigil
#

ttps

pale vessel
#

h

autumn aspen
#

so how do I fix it ? Schrimpingit to ""

#

?

pale vessel
#

ttpsh

umbral zealot
#

Let's try again, ELI5 level:

Your reason variable is not undefined, it's ""

autumn aspen
#

Oh yes

umbral zealot
#

httpsspspspsps

autumn aspen
#

Ok

#

And after

#

oh okkkkkkk

umbral zealot
#

After what

autumn aspen
#

I think I understand now

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

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

So do I write in some of them @umbral zealot

umbral zealot
#

?

autumn aspen
#

Wich of them

misty sigil
#

if(reason == "")

umbral zealot
#

God, please go learn javascript

misty sigil
#

please

#

go learn some basics

stable nimbus
#

Is there a way for a bot to calculate a message authors ping to discord?

umbral zealot
#

nope

misty sigil
#

no

stable nimbus
#

Okay. I was wondering, thanks.

autumn aspen
#

if(reason == "")
@misty sigil LMAO Im blind

stable nimbus
#

As these gentlemen have said, please go learn the basics.

autumn aspen
#

As these gentlemen have said, please go learn the basics.
@stable nimbus no Im just silly

umbral zealot
#

we've been saying this for days. is he ever gonna listen? Of course not, he's a tyler.

stable nimbus
#

Hahahaha

pale vessel
#

or const reason = args.slice(1).join(" ") || 'Unspecified';

#

"" is an empty string, which is falsy

umbral zealot
#

well, no, "" is not undefined, it's an empty string. But it is falsey.

pale vessel
#

ye

#

fixed

opal plank
#

0, null, undefined, empty string, NaN

#

i think im missing something

#

false

#

there we go

#

all those are falsey

vernal depot
#

How can I download emojis, to use them in canvas ?

#

Because node-canvas-emoji... doesn't work inside a module.exports function

opal plank
#

Buffer from URL

vernal depot
#

Heuuu what

opal plank
#

Buffer

#

from

#

URL

vernal depot
#

hmm

opal plank
#

request the pic

#

then make it into a buffer or save it locally

pale vessel
#

can't you just loadImage(<emoji url>)

opal plank
#

not sure if canvas can use url's

#

havent dicked with canvas at all

misty sigil
#

it can

#

if it returns raw image iirc

opal plank
#

then there you have it

#

cdn definetly returns raw image

misty sigil
#

it does, yes.

opal plank
#

cuz im shamelessly downloading every single emote

pale vessel
#

flashback to writing every permissions

opal plank
#

you mean me?

vernal depot
#

Hmm

#

But it will take some extra time no ?

pale vessel
#

a little

vernal depot
#

Hmm

pale vessel
#

not much

vernal depot
#

1 second ?

pale vessel
#

but it's always better to have it locally

#

less than 1 second

opal plank
#

cuz i may have done this, so when you say writing every perm flashbackl i remember this endeavor that i pulled when i forgot d.js has its own permission resolver

pale vessel
#

it's just a small emoji

#

yea that's what i meant

opal plank
misty sigil
#

lMAO

opal plank
#

300IQ

#

that shit so old i used any on it

#

and still havent fixed

#

i should make an interface for that

pale vessel
stable nimbus
#

a

opal plank
#

nothing to see there

#

👀

#

definetly not doing some advanced checks

merry sun
#

i have some error when my bots are playing music i have 6 (all the same code) but for example 1 bot doesnt play music ant another exactly the same bot does play songs

lofty seal
#

Is anyone still on even though it's been a night?

worldly nebula
#

¯_(ツ)_/¯

#

It's 7:39PM

merry sun
#

what could be causing the error?

pale vessel
#

have you tried debugging

lofty seal
#

In Indonesian its 11:40 pm

pale vessel
merry sun
#

yes i tried but idk what it means

pale vessel
#

you could be rate limited

#

log your results

merry sun
#

and its wierd 1 bot works and another wont

earnest phoenix
#

what's the error you get and what are the email contents

#

you'd usually get an email that your token got reset

#

there must be an error

#

that doesn't mean jackshit

#

lol

#

your console output doesn't matter if you aren't logging the error

#

anyways

#

it's quite possible that you exceeded the 1000 IDENTIFY per day limit

#

ergo you logged in too many times

pale vessel
#

debug, use the debug event for example

#

it's fine?

merry sun
#

my logging is
2020-09-26T16:46:07.951909+00:00 app[worker.1]: Error: input stream: Status code: 429

2020-09-26T16:46:07.951924+00:00 app[worker.1]: at ClientRequest.<anonymous> (/app/node_modules/miniget/dist/index.js:150:31)

2020-09-26T16:46:07.951924+00:00 app[worker.1]: at Object.onceWrapper (events.js:422:26)

2020-09-26T16:46:07.951925+00:00 app[worker.1]: at ClientRequest.emit (events.js:315:20)

2020-09-26T16:46:07.951925+00:00 app[worker.1]: at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)

2020-09-26T16:46:07.951926+00:00 app[worker.1]: at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)

2020-09-26T16:46:07.951926+00:00 app[worker.1]: at TLSSocket.socketOnData (_http_client.js:469:22)

2020-09-26T16:46:07.951927+00:00 app[worker.1]: at TLSSocket.emit (events.js:315:20)

2020-09-26T16:46:07.951927+00:00 app[worker.1]: at addChunk (_stream_readable.js:295:12)

2020-09-26T16:46:07.951928+00:00 app[worker.1]: at readableAddChunk (_stream_readable.js:271:9)

2020-09-26T16:46:07.951928+00:00 app[worker.1]: at TLSSocket.Readable.push (_stream_readable.js:212:10)

earnest phoenix
#

bin that

merry sun
#

what it means?

earnest phoenix
#

holy shit

pale vessel
#

you got rate limited

earnest phoenix
#

@low orbit you might've leaked your token too

#

try regenerating and using the new one regardless

pale vessel
#

doesn't hurt to try tbh

#

well never mind

#

you did that two hours ago

#

i need to read ffs

merry sun
#

everything works in the bot exept music

#

plugin issue?

#

by youtube?

#

wierd each bot got its own api

earnest phoenix
#

which still does access to youtube

#

lol

#

youtube does ip bans for scraping and has daily quota on their official api

merry sun
#

im hosting from heroku with every bot another account how in hell ip is the same?

stark abyss
#

how to connect to mongodb

pale vessel
#

what wrapper are you using?

#

read their documentation

stark abyss
#

mongodb atlas

misty sigil
#

that

#

thats not a wrapper

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

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

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

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

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

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

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

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

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

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

    message.channel.send(banembed);


}
#

Anyone help?

umbral zealot
#

log err and see

misty sigil
#

just return err

#

?

umbral zealot
#

again, learn to use console.log

#

debugging 101.

autumn aspen
#

yes but what wrong now?

#

with the log

stark abyss
#

~~it's okay ill just use a json file Smileweird ~~

autumn aspen
#

~~it's okay ill just use a json file :Smileweird: ~~
@stark abyss lol

hasty mulch
#
  File "/usr/lib/python3.7/importlib/util.py", line 96, in find_spec
    parent_path = parent.__path__
AttributeError: module 'cogs.room-sealer-ship-stuff' has no attribute '__path__'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/Documents/Room_Sealer/room-sealer-core.py", line 105, in <module>
    bot.load_extension(extension)
  File "/home/pi/.local/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 649, in load_extension
    spec = importlib.util.find_spec(name)
  File "/usr/lib/python3.7/importlib/util.py", line 100, in find_spec
    f"while trying to find {fullname!r}", name=fullname) from e
ModuleNotFoundError: __path__ attribute not found on 'cogs.room-sealer-ship-stuff' while trying to find 'cogs.room-sealer-ship-stuff.py'```
#
import discord
from discord.ext import commands


class SimpleCog(commands.Cog):

    def __init__(self, bot):
        self.bot = bot

    @commands.command(name='test')
    @commands.is_owner()
    async def only_me(selx, ctx):
        await ctx.send(f'{ctx.author.mention} the cog is working as expected')


def setup(bot):
    bot.add_cog(SimpleCog(bot))```
#

Anyone know how I can get the path attribute done?

#

For Python

umbral zealot
#

@autumn aspen we have no idea why the ban didn't work, and we cannot tell. console.log(err) and you can find out

rocky hearth
#

Can somebody tell me what this regex is doing??
/^([^\.].*)\.js(on)?$/

slender thistle
#

Probably searches for .js/.json files

pale vessel
#

gosh why do you need regex for that

rocky hearth
#

for advance programming

#

haha, lol

pale vessel
#

that's-

sudden geyser
#

Regex is useful, but you don't need it a lot.

pale vessel
#

regex != advanced but i guess you're being sarcastic

slender thistle
#

@hasty mulch how are you loading the extension?

sudden geyser
#

For example, a .startsWith method is probably better.

slender thistle
#

and more performant

hasty mulch
#

One sec @slender thistle

pale vessel
#

yeah

rocky hearth
#

regex is fast, I guess?? Isn't it?

sudden geyser
#

not really

slender thistle
#

In most cases the difference is insignificant enough to be unnoticed

hasty mulch
#

@slender thistle Disregard. Found the issue

cogs.room-sealer-ship-stuff**.py**

#

Needed to delete the bold part

earnest phoenix
#

alright so i need me some react experts, i've got this as of right now. the state of these components defaults to their config value and has a metadata container to contain their data while they're being changed (that gets cleared on parent component unmount)

autumn aspen
#

@autumn aspen we have no idea why the ban didn't work, and we cannot tell. console.log(err) and you can find out
@umbral zealot it didnt pop any errors

umbral zealot
#

It has to

#

err cannot be undefined
if it was, it wouldn't trigger your error in the embed

stable nimbus
#

I'm trying to create a restart command so my bot will restart upon command but I am having issues getting my bot to do this with a .then function.

await message.channel.send(`Hey <@${message.author.id}>!`, embed01, console.log(`${message.author.tag} has reset me!`)).then(message => {
                client.destroy().then(
                    client.login(config.token)
                )
                message.channel.send(embed02);
            });```

And this is my error: 
```js
(node:5340) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'then' of undefined
    at C:\Users\dargc\Desktop\Coding\betarpbot\commands\Administration\restart.js:34:33
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.execute (C:\Users\dargc\Desktop\Coding\betarpbot\commands\Administration\restart.js:33:13)
(Use `node --trace-warnings ...` to show where the warning was created)```
earnest phoenix
#

the issue is that the state for the last one doesn't seem to fall back to the original config value and react thinks it's still modified

#

i do have a backing value that stores the path however that gets reset too

umbral zealot
#

@stable nimbus process.exit() and have a process manager like pm2 to restart it. that's best way to do it.

sudden geyser
#

.destroy() returns nothing

#

It doesn't return a promise.

stable nimbus
#

Okay.

sudden geyser
#

Do what Evie said as well

opal plank
#

Coding challenge, attach process.exit() on every .catch() block you got in your code. Lets play Hardcode Coding yay

umbral zealot
#

@earnest phoenix you'll probably have a much better chance with react questions on the /reactiflux discord.

earnest phoenix
#

it's unavailable for me