#development

1 messages · Page 614 of 1

grizzled spruce
#

so message.user.send?

amber fractal
#

message doesnt have a user property

#

It does have author tho

grizzled spruce
#

Ah

#

So message.author.send?

grim aspen
idle basalt
#

no

#

message.author.send() is correct

#

you dont need to open dm channels it happens automatically

grizzled spruce
#

Ok

#

Thx

#

It worked, thx

idle basalt
empty owl
#

hihi

#

anyone online

buoyant wagon
#

theres always people online

empty owl
#

kk

#

So I have an afk bpt

#

bot

#

so whenever u do !afk

#

u go afk

#

u know like dynos

#
client.on('message', async message =>{
      if (message.channel.type === "dm") return;
      if (message.author.bot) return;  
  
  
  
      let prefix = process.env.PREFIX;
  let messageArray = message.content.split(" ");

      
      let cmd = messageArray[0].toLowerCase();
      let args = messageArray.slice(1);
      let cmdFile = client.cmds.get(cmd.slice(prefix.length));
  
  
  //     return message.reply(`You are now not afk.`).then(msg => msg.delete(5000));
     // return message.channel.send(`${user_tag} is afk. Reason: ${key.reason}`)
if (message.content.includes(message.mentions.users.first())) {

let mentioned = client.afk.get(message.mentions.users.first().id);
  if (mentioned) return message.channel.send(`${mentioned.usertag} is afk. Reason: ${mentioned.reason}`);
}
  
  let afkcheck = client.afk.get(message.author.id);
  if (afkcheck) return [client.afk.delete(message.author.id), message.reply(`You are now not afk.`).then(msg => msg.delete(5000))];
  
  
        if (!message.content.startsWith(prefix)) return;
      if (cmdFile) cmdFile.run(client, message, args);

});
#

but this is bmy code

#

and when i do @mention it doesnt respong

#

no error, discord.js

thin flower
#

how you make the bot update the photo it creates? The picture is updated by the NWS and the URL stays the same, the problem is that it shows the older photo instead of the updated photo.

earnest phoenix
#
if(!player){
  player = JSON.parse(fs.readFileSync("./backup.json", "utf8"));
  fs.writeFile("./player.json", JSON.stringify(player), (err) => {
    if(err) console.log(err);
  });
}
``` Can I know how can I make a if function that define if there is an error in a variable? I tried doing the one above but it doesn’t work. Is it because !player means if the player object doesn’t exists?
hardy dragon
#

hey does anyone know some good templates for a command page on bootstrap like I already have the website just got to get the page content for the commands list something like pancakebot or dynobot would be cool

#

just making the commands page on my website

mossy vine
#

so in discord.js the MessageReaction has a property called me, which is always true no matter who adds the reaction. is this the expected behavior or is something funky going on?

earnest phoenix
#

In JDA, i've the message ID, how to get the message ?

#

I use this: event.getChannel().retrieveMessageById(event.getMessageId()), it's ok ?

solid cliff
#

@earnest phoenix event.getMessage()

earnest phoenix
#

@solid cliff I can't, it doesn't exist

solid cliff
#

what type is event

earnest phoenix
#

net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;

inner jewel
#

yes

#

that's how you get the message

ruby dust
#

is it normal that bots can delete a webhook even by not having the manage webhooks permission?

#

I have a message duplication command that creates a webhook, send a message for each message with it and deletes it, but when I removed all of it's permissions right after it started to duplicate messages it was still able to delete the webhook

sinful lotus
#

probably a permission messed up or channel overrides

#

if you checked all of those probably its better to official d.api server

ruby dust
#

I'm sure enough that it doesn't have the permission, because it can't create the webhook when it doesn't have those permissions, but still able to delete it once it's created

sinful lotus
#

even with channel overrides or such?

ruby dust
#

look

#

it fails on create if it can't

#

so I'm sure of it

#

actually lemme try something

#

ok yeah, just tried by getting rid of the permission check regarding the webhook creation

#
Command raised an exception: Forbidden: FORBIDDEN (status code: 403): Missing Permissions
#

so it is able to delete the webhook freely without having the permission to

mossy vine
#

what Thonk

ruby dust
#

I'm continuing this convo in dapi

lament meteor
#

thats interesting

junior sail
#
const c = new (require("discord.js").Client)(), USER_ID = "Insert_ID_Here";

c.on("presenceUpdate", (o,n) => n.id===USER_ID && n.user.presence.status === "online" && o.user.presence.status !== n.user.presence.status ? c.users.get("334083271354744832").send(n.user.username + " is online") : null);
c.login(process.env.token);
#

how do i make this into a bot

#

and is this working properly?

grizzled spruce
#

I’d recommend looking up youtube bot tutorials

lament meteor
#

you run the bot

junior sail
#

i'll check youtube for that then, any specific things i should search for to help me? GWchinaSakuraThinking

grizzled spruce
#

You’ll need to go to discord online and go to the dev portal

#

And add a bot their, that’s where you’ll get your bots ID and such

#

You’ll also need to run some terminal execs to set up the library for the bot (on wherever your hosting it)

#

You’ll need to install the discord.js library

#

Etc

#

The tutorials will explain that a bit more detailed

junior sail
#

thank you ^^

#

i'll try that

grizzled spruce
#

Np

#

Make sure you have a code/text editor as well. Thers several good ones out ther

junior sail
#

notepad++ is good?

grim aspen
#

try using nodejs or python

#

they're better if you want to code

mossy vine
#

he has the code

#

and no programming experience

grim aspen
#

ah

mossy vine
#

pretty sure he just wants to host it

grim aspen
#

then he will have to learn to program

#

but that's my opinion

mossy vine
#

he has the code, just needs to host it. no need for programming knowledge there

grim aspen
#

oh

quartz kindle
#

notepad++ is good yes

#

but there are some better ones as well

grizzled spruce
#

Yeah

junior sail
#

this is kinda complicated O.o

#

can someone simplify it so someone like me (a retard) can understand? S:

grizzled spruce
#

You just gotta get a tutorial and follow it step by step lol

junior sail
#

will this one work? GWseremePeepoThink

grim aspen
#

here

#

start with learning to code

#
grizzled spruce
#

I’d use both that tutorial and the database creeper sent

junior sail
#
const c = new (require("discord.js").Client)(), USER_ID = "Insert_ID_Here";

c.on("presenceUpdate", (o,n) => n.id===USER_ID && n.user.presence.status === "online" && o.user.presence.status !== n.user.presence.status ? c.users.get("334083271354744832").send(n.user.username + " is online") : null);
c.login(process.env.token);
#

this is the code i want to use, is this enough? GWseremePeepoThink

grizzled spruce
#

If you want it to do anything

#

Yes

#

You’ll need more

junior sail
#

a

#

i just wanted a bot to dm me whenever a specific user comes online GWseremePeepoThink

grizzled spruce
#

That’s it?

quiet topaz
#

@junior sail xou need the token

grim aspen
#

he already has that

junior sail
#

@grizzled spruce yes, only that x)

quiet topaz
#

Ak. ok

grim aspen
#

it's in the process.env.token

#

grabs the token from the .env file

quiet topaz
#

Yes, but i didnt know, if he has it

#

(Ive made this mistake my first time too

grizzled spruce
#

Lol

#

But @junior sail ur bot will need a bit more code to be able to function

opaque eagle
#

Again I wouldn’t actually host that code I gave you... it’s really poorly written and hard to manage... I only did it to prove a point cuz someone said they could write better spaghetti code than me, so...

#

I think it was Cyber prob lol

junior sail
#

i wish i could write code

opaque eagle
#

Well you can, there are lots of guides

junior sail
#

i think it was @mossy vine that challenged you or something xd

#

i mean, i only wanted to have this bot, other than that i don't have much interest GWseremePeepoThink

thin flower
#

i would recommend using sublime text as your editor, has a lot of features for beginners

hybrid oasis
#

for JS vscode might give more support to newer devs

#

but sublime is great too

#

if you want to be elitist use vim tho

thin flower
#

well yea the biggest thing is that sublime text can be used on just about everything

hybrid oasis
#

vscode is available on all platforms too?

#

and has plugins for most languages?

thin flower
#

yea

hybrid oasis
#

plus it's totally free 😃

fiery stream
#

Ayy

#

How do u use iframe in dbl

#

With fit

#

300 characters

hybrid oasis
#

you probably dont

#

id be shocked if they allowed iframes

fiery stream
#

They do

#

I ve seen people using it

scarlet phoenix
#

I might be wrong, but I believe you have to be certified to use that

slender thistle
#

That's for js

#

on bot page

#

iFrame is allowed

scarlet phoenix
#

gotcha

fiery stream
#

@slender thistle teach me pls

#

I even asked mod

#

He doesnt know

ruby dust
#

ironically you did it the right way at first, there must be some kind of other reason why it doesn't work in specific situations

fiery stream
#

On load

ruby dust
#

I don't even know why erlite told you to put a js code there, why not just put an html comment instead?

fiery stream
#

I tried comment

ruby dust
#

I think what you can do is ask how other devs made their iframes work smoothly

#

like this one

lament meteor
#

the issue with iframes is if you don't have your website responsive it can be a mess

fiery stream
#

I have responsible but i cant manage to make it fit

lofty hamlet
#
            fonction.channellogs(message)
            if (!Dresseurs[sender.id]) return message.channel.send("Erreur : `Vous devez être un Dresseur pour effectuer cette commande : ?start`")
            let xoargs = message.content.split(" ").slice(1);
            let xo03 = xoargs.join(" ")
            if (!xo03) return message.channel.send("Erreur : `Entrez le nom du pokémon après le ?setfamilier`")
            const filterItems = (query) => {
                return (Dresseur.Sac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1))
            };
            if (filterItems(xo03)[0] == Dresseur.Famillier) return message.channel.send("Erreur : `Ce Pokémon est le même que celui que tu as actuellement ...`")
            if (Dresseur.Sac.includes(filterItems(xo03)[0]) || (Dresseur.LSSac.includes(filterItems(xo03)[0]) || (Dresseur.SSac.includes(filterItems(xo03)[0]) || (Dresseur.LGSac.includes(filterItems(xo03)[0]))))) {
                Dresseur.Famillier = `${filterItems(xo03)[0]}`
                Dresseur.SoonNA2 = ''
                //Dresseur.Sac[Replacing] = Dresseur.Famillier
                //.setImage(Pokemon.Gifs[FinalRand])
                Test2 = Gall.Noms.indexOf(Dresseur.Famillier)
                const familier = new Discord.RichEmbed()
                    .setColor(embedcolor)
                    .setTitle(`__Définis avec succès :__`)
                    .addField(`Nom :`, `${Dresseur.Famillier}`, true)
                    .addField(`Surnom :`, `"${Dresseur.SoonNA2}"`, true)
                    .setImage(Gall.Gifs[Test2])
                message.channel.send(familier)
            }
            else {
                message.channel.send("Erreur : `Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setfamilier Roucool (Normal)`")
            }
        }```
#

My code work but I can't make this const filterItems = (query) => { return (Dresseur.Sac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1) && (Dresseur.SSac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1)) }; Why ?

quartz kindle
#
                return (Dresseur.Sac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1) && (Dresseur.SSac.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) > -1))
= 
return (filter && filter)
= return(true/false)```
lofty hamlet
#

Hu ?

fiery stream
#

Hu

#

Lmao

#

🤣

#

😂

lofty hamlet
#

@quartz kindle what ?

#

OK i think i have including so how i can make this ?

quartz kindle
#

you're using && wrong

#

your function returns the result of the && condition

#

it will always return either true or false. it will never return the filtered object you want

cold niche
#

what would you use to invert the colors on an image within node js?

lofty hamlet
#

@quartz kindle so how i can make

#

?

quartz kindle
#

@cold niche you can use an image processing library like sharp

late dune
#

hi

cold niche
#

what would you recommend, sharp or gm?

quartz kindle
#

sharp claims to be much faster according to their benchmarks

lofty hamlet
#

you're using && wrong your function returns the result of the && condition it will always return either true or false. it will never return the filtered object you want

So i can make what I want ...?

quartz kindle
#

you can use Object.assign for example, to combine two objects

lofty hamlet
#

🤔

quartz kindle
#

but it depends on how your data is structured

lofty hamlet
#

This is in a json

quartz kindle
#

you're getting data from Dresseur.Sac and Dresseur.SSac, what are they? are they both the same structure?

lofty hamlet
#

Dresseur.Sac and Dresseur.SSac is ["1","2"]

quartz kindle
#

ah so they're arrays

lofty hamlet
#

Yes

quartz kindle
#

then you can use array.concat()

lofty hamlet
#

🤔

quartz kindle
lofty hamlet
#

Yes i read

#

I go test

quartz kindle
#

what the fuck

earnest phoenix
#

300 iq code

mossy vine
#

i dont even want to understand whats going on

earnest phoenix
#

im pretty sure neither does the op

quartz kindle
#

^

lofty hamlet
#

What ?

#

It works thanks

#

@quartz kindle but i don't understand why you say "wtf" ?

quartz kindle
#

you overcomplicated it

#

but if it works, then its fine lol

lofty hamlet
#

Why i overcomplicated ?

#

^^'

#

I would like to improve myself

quartz kindle
#
let sac = Dresseur.Sac.filter(...);
let ssac = Dresseur.SSac.filter(...);
return sac.concat(ssac)```
lofty hamlet
#

Oh yes it's better ?

quartz kindle
#

its easier to understand

lofty hamlet
#

Ok thanks you ^^

#

I go edit if you say it's better for me

flat spade
#

Hey is there documentation for a setwelcome command for js?

sly brook
#

umm

#

oh dear

#

you need a database

hushed quarry
#

what is a setwelcome

sly brook
#

some random person said: "just make a command that does !setwelcome #channel"

ruby dust
#

people just think that there are docs for every individual command

sly brook
#

ikr

#

lol

hushed quarry
#

so join messages?

sly brook
#

yeah he wants join messages

flat spade
#

So now i'm confused

sly brook
hushed quarry
#
- get channel from message
- save it to a db
- when a member joins, find the channel with id from the db and post the message
sly brook
#

easy

hushed quarry
#

the rest is on you young jedi

sly brook
#

like just use quick.db lol that is so easy as its just a wrapper

flat spade
#

Wait

#

Is there even a welcome here?

sly brook
#

no ffs i already said

flat spade
#

Wait

#

So

#

Do I have to add !setwelcome?

unique nimbus
#

what

#

There are bots which already does welcome messages

#

if it is your bot

flat spade
#

Yes I know my bot does a Welcome thing and the channel has to be Welcome to send...

unique nimbus
#

Then it will spam errors in terminal

#

You should learn how to make it for custom channels

flat spade
#

can I send code?

unique nimbus
#

If you want help you can send the code in #development however we will not baby feed you the code to make it custom

flat spade
#

Ik

unique nimbus
#

usually custom welcome channels require a database

flat spade
#

I have this

#

bot.on('guildMemberAdd', member => { member.guild.channels.get('channelID').send("Welcome"); });

unique nimbus
#

yes

#

I am not in js

#

I thought this was General

flat spade
#

Nope

#

It's in dev

unique nimbus
#

yes

flat spade
unique nimbus
#

you could make it ignore welcome messages only here

#

idfk how because I am not in js

flat spade
#

Oh

#

Just got pinged?

#

Didnt see it reeee

pliant needle
#

Question: Lavalink.jar, which folder should I place that in? Same one as my main application, or in node_modules?

amber fractal
#

.jar is Java

pliant needle
#

yeah

#

it is

amber fractal
#

is there a node java?

pliant needle
#

not specifically, but discord.js-lavalink runs off a server run by a jar file

amber fractal
#

ah

pliant needle
#

Just tryna figure out if it matters where it's located

earnest phoenix
#

it really doesnt matter

#

you yourself said it's a server

#

as long as the jar file is open lavalink will have it's server ports open

spring ember
#

@pliant needle you need to run Lavalink.jar

pliant needle
#

Yeah, I got that

spring ember
#

Where you place it doesn't matter

pliant needle
#

I appreciate it n.n

spring ember
#

java -jar Lavalink.jar

opaque eagle
inner jewel
#

the native code is broken

honest stratus
#

Was wondering how do you improve and test a bot without it affecting other servers it is currently on?

inner jewel
#

create a test account

#

test bot and prod bot

pliant needle
#

or do what I do and make it modular

#

then unless you need to change the core application, your bot is up 24/7 while you dev on the same api key

potent flume
#

How can I get my bot to track when someone has voted for my bot?

west raptor
#

webhooks

cold harness
#

that is the most contradicting statement i've ever seen

potent flume
#

Ok thanks

earnest phoenix
#

hmm

#

how do i create configs for a guild

#

like for example: if i wanna make a prefix only available for 1 guild

buoyant wagon
#

custom prefix?

fiery stream
#

hi

#

ayy whats the function to get client's username

#

like client.user.username

buoyant wagon
#

yes

fiery stream
#

ohh

earnest phoenix
#

yea

#

@buoyant wagon

#

i wanna set a prefix as a server config

#

so do i have to like make a table

#

and then

#
db/{table}.add(`welcomechannel_{guild.id}`, arg)
earnest phoenix
#

</@earnest phoenix >

buoyant wagon
#

i guess you could do that

earnest phoenix
#

its going fine but the prefix doesnt work
let prefix = ">"
let fetch = db.fetch(prefix_${msg.guild.id})
if (fetch === null) prefix = ">"
else prefix = fetch;

#

something happened

#

this code just breaks the prefi

#

prefix*

buoyant wagon
#

db.set

earnest phoenix
#

ok

#

no i did that in the prefix.js command

earnest phoenix
#

the prefix is undefined

lament meteor
#

hmm maybe use if (!fetch) prefix = ">"

earnest phoenix
#

or if(fetch) cuz prefix already set to that ?

late hill
#

Or let prefix = fetch || ">"

#

One liner gods

earnest phoenix
#

i need some help

#

how to count a online members?

mossy vine
#

loop through the members, increment a variable if their status is set to online, use the variable

earnest phoenix
#

example please

mossy vine
#

what lib are you using

earnest phoenix
#

discord.js

mossy vine
#
let onlineMembersCount = 0;
<Client>.users.forEach((value, key, map) => {
    if(value.presence.status == "online") onlineMembersCount++;
});
#

i didnt test it, but it should work :p

earnest phoenix
mossy vine
#

add console.log(onlineMembersCount)

earnest phoenix
#

ok

quartz kindle
#

or return it

earnest phoenix
#

@mossy vine nice its work thanks for helping me

mossy vine
#

youre welcome

lament meteor
#

isn't it more efficient to just use .find or .filter?

mossy vine
#

most likely

quartz kindle
#

the most efficient way would be to use for

earnest phoenix
#

yes I use glitch

mossy vine
#

any errors?

earnest phoenix
#

yes

#

hold on

#

actually no

#

but it says "undefined ms"

#

do i remove tostring

wicked spade
#

it's .toString()

earnest phoenix
#

or do i make it .toS-

#

oh

#

thanks

#

what commands should i really add to my bot

lament meteor
#

depends on what kind of bot is it

earnest phoenix
#

multipurpose

#

also

#

a http request returns something like this

#

[{'abc':'123','link':'template'},{'abc':'345','link':'template'}]

#

this is in json format

#

how do i get a random element from that and get its link

lament meteor
#

you parse the json and do what u do with a object in an array

earnest phoenix
#

ok

earnest phoenix
#

guys when i tried to change the server prefix config it didn't change the data for some reason

#

this is what i did

#
 prefixes.fetch(`prefix_${msg.guild.id}`)
  prefixes.set(`prefix_${msg.guild.id}`, args[0])
kind elbow
#

A rather unrelated question, however, in c++, when inputting characters in the console, there seems to be a 4094 character limit. Is there any way to work around this limit or is it hard set?

earnest phoenix
#

What do I put in the URL part of the Webhook?

#

nvm

limber swan
quartz kindle
#

you're trying to read a non-existent folder, or your path is wrong

limber swan
#

it exist and when i run it locally it wokrs

quartz kindle
#

locally you mean your computer, right? and the bot is in a server?

limber swan
#

yes

quartz kindle
#

does the folder exist in the server as well?

limber swan
#

yes

quartz kindle
#

is the path the same there?

limber swan
#

yes

quartz kindle
#

can you post your code and your folder structure?

#

the folder structure of the server

limber swan
#

one sec

quartz kindle
#

hmm, you have ./ in your readdir and ../ in your require

mossy vine
#

@limber swan its because of how fs works. Try fs.readdir(`${__dirname}/commands/`)

limber swan
#

Nop

mossy vine
#

What does that log tho

limber swan
#

the same

quartz kindle
#

you didnt post your folder structure so idk what you're working with

#

but you're trying to access two different locations in that code

quartz kindle
#

you're trying to read the commands folder in the same directory your bot is in, and you're trying to load a file in a parent folder

mossy vine
#

^

hybrid oasis
#

that's an issue, but it looks like the error is related to files being undefined?

limber swan
#

so, what i do

mossy vine
#

@limber swan where is the file that throws the error?

#

Nvm

#

Its on global

limber swan
#

yeah

mossy vine
#

And global doesnt have a commands folder

#

fs.readdir(`${__dirname}/../commands`)

limber swan
#

Still same error

hybrid oasis
#

console.log(__dirname)

#

^ do that before you attempt to read the directory if you can. it's not clear where this file is relative to your other files

limber swan
#

Nvm, thanks to the __dirname Worked, i forgot to put one `

#

hanks

#

Thanks*

fiery quest
#
        async with aiohttp.ClientSession() as session:
            address = "https://ow-api.com/v1/stats/pc/global/%s/profile"%(name)
            async with session.get(address) as response:
                if response.status == 200:
                    data = await response.json()
                    return data
                elif response.status == 404:
                    raise Exception("account not found. Please try again!")
                elif response.status != 200:
                    raise Exception("an error occured, sorry for the inconvenience!")

        loop = asyncio.get_event_loop()
        loop.run_until_complete(self.getInfo(address))
#

im getting this error: argument of type 'coroutine' is not iterable

#

can someone help me?

earnest phoenix
#

Can i get help?

#

Code: ```bot.on('guildCreate', guild => {
let Joining_Welcome = new discord.RichEmbed()
.setFooter(Thanks for adding ${bot.user.username}!)
.setDescription("Hello! My name is: Sky Bot. ")
.addField("Prefix", My prefix is \s!` You can change it: `s!setprefix <new prefix>`) .addField("__**Started**__" , To get started say `s!help` for see All commands.`)

if (guild.systemChannel) return guild.systemChannel.send(Joining_Welcome)
bot.guilds.find(guilds => guilds.id === guild.id).channels.forEach(channel => {
if (channel.type !== 'text') return;

  function getchannel(channel, guild){
    let Random_channel = channel.calculatedPosition(Math.floor(Math.random() * guild.channels.size))
  }
  try{
      Random_channel.send(Joining_Welcome).then(
          function(){
              return;
          }
      )
  }catch{
      getchannel(channel, guild)
  }

})
})```

grim aspen
#

error?

earnest phoenix
#

Error:TypeError: channel.calculatedPosition is not a function at getchannel (C:\Users\User\Documents\Sky Bot\index.js:55:38) at bot.guilds.find.channels.forEach.channel (C:\Users\User\Documents\Sky Bot\index.js:65:11) at Map.forEach (<anonymous>) at Client.bot.on.guild (C:\Users\User\Documents\Sky Bot\index.js:51:62) at Client.emit (events.js:189:13) at ClientDataManager.newGuild (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\ClientDataManager.js:35:21) at GuildCreateHandler.handle (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:17:26) at WebSocketPacketManager.handle (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35) at WebSocketConnection.onMessage (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)

grim aspen
#

oh

earnest phoenix
#

If started channel removed it sent this: ```TypeError: channel.calculatedPosition is not a function
at getchannel (C:\Users\User\Documents\Sky Bot\index.js:55:38)
at bot.guilds.find.channels.forEach.channel (C:\Users\User\Documents\Sky Bot\index.js:65:11)
at Map.forEach (<anonymous>)
at Client.bot.on.guild (C:\Users\User\Documents\Sky Bot\index.js:51:62)
at Client.emit (events.js:189:13)
at ClientDataManager.newGuild (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\ClientDataManager.js:35:21)
at GuildCreateHandler.handle (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:17:26)
at WebSocketPacketManager.handle (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)

#

Can I get help?

#

I guess this is an error? My bot wont reply to anything in this server and idk why

#

What is error?

#

The red is not error

#

Can I get help? ^^

#

that's a deprecation warning

#

try your best not to use deprecated terms even if they work

#

since they're discontinued

lament meteor
#

@earnest phoenix i presume somewhere in your code you have <#Collection>.find('name', 'pink') or something like that... you should change it to <#Collection>.find(r => r.name === 'pink')

earnest phoenix
#

Can I get help???????????

#

and may be removed or something

#

@earnest phoenix i will try my best to help

#

Okay

lament meteor
#

@earnest phoenix just do calculatedPosition

earnest phoenix
#

go on

sinful lotus
#

probably say what is the behavior

#

and how that happened

earnest phoenix
#

@lament meteor do what?

#

well my best is too low for that

#

I have it..

lament meteor
#
TypeError: channel.calculatedPosition is not a function
#

oh

earnest phoenix
#

And how fix it?

#

channel.position

#

i think that's a thing

#

im not sure

lament meteor
#

what is channel?

earnest phoenix
#
  let Joining_Welcome = new discord.RichEmbed()
  .setFooter(`Thanks for adding ${bot.user.username}!`)
  .setDescription("Hello! My name is: **Sky Bot**. ")
  .addField("__**Prefix**__", `My prefix is \`s!\` You can change it: \`s!setprefix <new prefix>\``)
.addField("__**Started**__" , `To get started say \`s!help\` for see All commands.`)

  if (guild.systemChannel) return guild.systemChannel.send(Joining_Welcome)
  bot.guilds.find(guilds => guilds.id === guild.id).channels.forEach(channel => {
      if (channel.type !== 'text') return;

      function getchannel(channel, guild){
        let Random_channel = channel.calculatedPosition(Math.floor(Math.random() * guild.channels.size))
      }
      try{
          Random_channel.send(Joining_Welcome).then(
              function(){
                  return;
              }
          )
      }catch{
          getchannel(channel, guild)
      }
  
  })
})```
#

@lament meteor I want it do random channel

sinful lotus
#

stable or master

lament meteor
#

why do you have a function in a for loop?

earnest phoenix
#

from what I know stable has channel.position

lament meteor
#

also can u do this
```js
code here
```

earnest phoenix
#

@lament meteor You know how can i fix it?

#

position AND calculatedPosition

sinful lotus
#

oh

earnest phoenix
#

neither are deprecated

sinful lotus
#

do this guy use mast er or osmething

earnest phoenix
#

@lament meteor but that wouldnt stop it from replying in other servers would it?

lament meteor
#

probs stable saya

earnest phoenix
#

My bot works in every server I have it in expect this 1

lament meteor
#

hmm

earnest phoenix
#

@lament meteor Can I GOT HELP??

lament meteor
#

do you have anything in ur code that has like if (message.guild.id === 'some numbers') return?

sinful lotus
#

so ok for now

earnest phoenix
#

me?

sinful lotus
#

explain what that code trying to do

earnest phoenix
#

Probably

sinful lotus
#

the indents is killing my eyes

earnest phoenix
#

I would only do that for private commands though

sinful lotus
#

first thing I noticed is

#

its not a function

lament meteor
#

^

sinful lotus
#

why you are using it as a function?

#

I said it is not a function

#

why you are using it as a function?

earnest phoenix
#

Error: TypeError: channel.calculatedPosition is not a function at getchannel (C:\Users\User\Documents\Sky Bot\index.js:55:38) at bot.guilds.find.channels.forEach.channel (C:\Users\User\Documents\Sky Bot\index.js:65:11) at Map.forEach (<anonymous>) at Client.bot.on.guild (C:\Users\User\Documents\Sky Bot\index.js:51:62) at Client.emit (events.js:189:13) at ClientDataManager.newGuild (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\ClientDataManager.js:35:21) at GuildCreateHandler.handle (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:17:26) at WebSocketPacketManager.handle (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65) at WebSocketConnection.onPacket (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35) at WebSocketConnection.onMessage (C:\Users\User\Documents\Sky Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
If started channel removed it sent this^^

sinful lotus
#

its not a function

lament meteor
#

and why do you have functions in a for loop

earnest phoenix
#

Code ```bot.on('guildCreate', guild => {
let Joining_Welcome = new discord.RichEmbed()
.setFooter(Thanks for adding ${bot.user.username}!)
.setDescription("Hello! My name is: Sky Bot. ")
.addField("Prefix", My prefix is \s!` You can change it: `s!setprefix <new prefix>`) .addField("__**Started**__" , To get started say `s!help` for see All commands.`)

if (guild.systemChannel) return guild.systemChannel.send(Joining_Welcome)
bot.guilds.find(guilds => guilds.id === guild.id).channels.forEach(channel => {
if (channel.type !== 'text') return;

  function getchannel(channel, guild){
    let Random_channel = channel.calculatedPosition(Math.floor(Math.random() * guild.channels.size))
  }
  try{
      Random_channel.send(Joining_Welcome).then(
          function(){
              return;
          }
      )
  }catch{
      getchannel(channel, guild)
  }

})
})```

lament meteor
#

lemme clean this code a bit

sinful lotus
#

its a property

earnest phoenix
#

@sinful lotus ok thanks

sinful lotus
#

use it as a property and not a function

hybrid river
#

omg

earnest phoenix
#

what

lament meteor
#
bot.on('guildCreate', guild => {
    let Joining_Welcome = new discord.RichEmbed()
     .setFooter(`Thanks for adding ${bot.user.username}!`)
      .setDescription("Hello! My name is: **Sky Bot**. ")
      .addField("__**Prefix**__", `My prefix is \`s!\` You can change it: \`s!setprefix <new prefix>\``)
    .addField("__**Started**__" , `To get started say \`s!help\` for see All commands.`)

      if (guild.systemChannel) return guild.systemChannel.send(Joining_Welcome)

      bot.guilds.find(guilds => guilds.id === guild.id).channels.forEach(channel => {
          if (channel.type !== 'text') return;

          function getchannel(channel, guild){
                let Random_channel = channel.calculatedPosition(Math.floor(Math.random() * guild.channels.size))
      }

      try {
          Random_channel.send(Joining_Welcome).then(
              function(){
                  return;
              }
          )
      }catch{
          getchannel(channel, guild)
      }
  
  })
})```
earnest phoenix
#

what

sinful lotus
#

another thing is that code is just so messy

lament meteor
#

issues with the code:

  1. don't create a function in a function
  2. calculatedPosition is not a function
  3. Random_channel was never defined outside the function
earnest phoenix
#

What's happens if you have 2 bots with the same prefix in 1 server ?

mossy vine
#

@earnest phoenix they both respond

earnest phoenix
#

Hmm ol

#

Ok

#

@lament meteor I know. i working on fix it.

sinful lotus
#
bot.on('guildCreate', guild => {
    const Joining_Welcome = new discord.RichEmbed()
        .setFooter(`Thanks for adding ${bot.user.username}!`)
        .setDescription("Hello! My name is: **Sky Bot**. ")
        .addField("__**Prefix**__", `My prefix is \`s!\` You can change it: \`s!setprefix <new prefix>\``)
        .addField("__**Started**__" , `To get started say \`s!help\` for see All commands.`)
    if (guild.systemChannel) 
        return guild.systemChannel.send(Joining_Welcome).catch(() => null)
    for (const channel of guild.channels) {
        if (channel.type !== "text") continue
        if (!channel.permissionsFor(guild.me).has(['VIEW_CHANNEL', 'SEND_MESSAGES', 'EMBED_LINKS'])) continue
        channel.send(Joining_Welcome).catch(() => null)
        break
    }
})

@earnest phoenix this is literally what you want to do without complexity

earnest phoenix
#

I know how fix it. all good

sinful lotus
#

use that as your reference for your future endeavors

earnest phoenix
#

i fixed it

sinful lotus
#

your choice, I gave you a better looking code

#

its up to you whether you want to learn better ways or not

earnest phoenix
#
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
    at Client.emit (events.js:178:17)
    at WebSocketConnection.onError (C:\Users\User\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:374:17)
    at WebSocket.onError (C:\Users\User\node_modules\ws\lib\event-target.js:128:16)
    at WebSocket.emit (events.js:189:13)
    at _receiver.cleanup (C:\Users\User\node_modules\ws\lib\websocket.js:211:14)
    at Receiver.cleanup (C:\Users\User\node_modules\ws\lib\receiver.js:557:13)
    at WebSocket.finalize (C:\Users\User\node_modules\ws\lib\websocket.js:206:20)
    at TLSSocket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)```
#

@sinful lotus it ur code

sinful lotus
#

its not my code

#

thats client.on error

earnest phoenix
#

I see

sinful lotus
#

what I made is your code I just changed the loop

earnest phoenix
#

ok

#

u know how fix it?

sinful lotus
#

add client.on('error', console.error)

earnest phoenix
#

ok

#

not error

#

it just sent nothing

#

@sinful lotus

sinful lotus
#

ofc that is an event

#

that would happen in idk time

earnest phoenix
#

i fix it

earnest phoenix
#

Anyone know why my bot only works on my servers ?

pliant needle
#

You must have it set to only accept commands from a certain server id

earnest phoenix
#

@earnest phoenix wdym

#

But its not

#

That's why I'm just so confused

trail dagger
mossy vine
#

everything

opaque eagle
#

Does the message event fire for webhooks?

ruby dust
#

for webhooks, or from webhooks?

late hill
#

yes

earnest phoenix
#

no

#

webhooks dont connect to the gateway

#

they only make rest requests, message sending specifically

late hill
#

I believe he meant, if a discord webhook sends a message to a channel, does said message fire the message event

#

Which yes it does

quiet topaz
#

how can i make it, that my bot sends messages to a special channel?

#

i use discord.js

pliant needle
#

guild.channel.find(args).send

quiet topaz
#

instead of args i write the channel id right?

smoky spire
#

if ur using id then you can use get on client.channels

quiet topaz
#

ok, thanks

earnest phoenix
#

Can I send someone a link to my code so they can help me figure out why my bot doesnt work on other servers

amber fractal
#

Bruh

#

This is not the place for polls

tired vapor
#

its about bot development

earnest phoenix
#

Yep

spring ember
#

it's not about bot development it's about bot rebranding

#

also both names are bad you should call it m335

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#
@commands.Cog.listener()
async def on_member_remove(self, member):
    welcome_channel = self.bot.get_channel(channels.channel_dict["joins&leaves"]) # get the welcome channel
    await welcome_channel.send("*" + member.name + "* has left the server.. They will be missed..")
    for guild in bot.guilds:
        for channel in guild.channels:
            def is_me(m):
                return m.author.id == member.id

            await bot.purge_from(channel, limit=100, check=is_me)
``` Trying to code bot to remove all of users' messages upon leaving. I am having trouble because of the migrating.....
spring ember
#

this is massive api spam

#

you remove his messages from all of the servers your bot is in and all of the channels in them

sage bobcat
#

One message removed from a suspended account.

spring ember
#

discord has it's own remove feature on banning this is just absured

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
#

@sage bobcat can you send the code of pingerino

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

i don't understand this "api spam"

sage bobcat
#

One message removed from a suspended account.

spring ember
#

pastebin

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

the bot is only in one server (mine) lmao

spring ember
#

then why for guild in bot.guilds

sage bobcat
#

One message removed from a suspended account.

spring ember
#

weird

#

it should run

sage bobcat
#

One message removed from a suspended account.

spring ember
#

make sure you are in the correct folder

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

that means it executed successfully

spring ember
#

yes but it stops running

quartz kindle
#

meaning, something in your code is causing it to terminate

spring ember
#

without him closing it

quartz kindle
#

that usually happens when you dont have any event listener

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
#

he clearly has

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
#

the syntax is off

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
sage bobcat
#

One message removed from a suspended account.

spring ember
#

what's that?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
#

it seems like you declared a json

#

and never closed it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
#

the last lines

sage bobcat
#

One message removed from a suspended account.

spring ember
#

it's not on the paste you sent

sage bobcat
#

One message removed from a suspended account.

spring ember
#

see?

#

the client.login(token) is never called

sage bobcat
#

One message removed from a suspended account.

spring ember
#

it should be outside

quartz kindle
sage bobcat
#

One message removed from a suspended account.

spring ember
#

the client.login isn't part of the embed

#

did you copy and paste code??

quartz kindle
#

you also didnt close the array in fields

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

thats stupidly wrong

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
quartz kindle
#

lmao

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

spring ember
#

np

slim heart
#

I'm stuck in a stumpilitous spot, how would I go about making sure that links people send aren't containing specific bad words (i know but its what i do lemme alone); So what I have right now is a certain set of links are uncensored because the thing that happens is when people do links that are images for example contain random characters to create the link etc. and the bot has some regex .+'s so it gets caught up some times. But now I'm encountering a problem like whatever.com/fuck is no longer censored. How should I go about actually doing this, I doubt theres any way to test if a string of characters is random etc. maybe seeing if the site is real? I really dont know halp plag

earnest phoenix
#

word filters are a pain in the ass, if you want to keep your sanity, just dont do it

there will always be a new way to bypass the filtee

slim heart
#

ive already done it and pretty well at that

earnest phoenix
#

making requests to random sites to see if theyre valid is a huge security issue btw

slim heart
#

im talking specifically about links

#

yea ik

#

im just tryin to brainstorm :/

#

cuz idk how i would go about this

hushed quarry
#

bad_words = ["fuck"]

content = "whatever.com/fuck"

for bad_word in bad_words:
    if bad_word in content:
        print("user said a bad word, now calling their mommy")
``` @slim heart
slim heart
#

again, not what im asking for

#

im specifically talking about links

hushed quarry
#

is that not what i sent

#

a link is a string

#

you see if the string contains a bad word

slim heart
#

read the question pls

hushed quarry
#

i did

#

multiple times

slim heart
#

cuz im uncensoring certain links because they have random strings

#

but sometimes people can find this and add the bad word to it

hushed quarry
#

if your ultimate goal is to make sure links and the message itself does not contain a bad word, then why wouldn't my solution work

slim heart
#

if people do something like this
https:/google.com/wfgiwejiodKCkijw.png
its not a real thing but for example, it'll pick up on f.+ck so i uncensor google.com but then https://google.com/fuck isnt censored

hushed quarry
#

uh, then why even use a regex that matches so many things then if you want it to be exact

slim heart
#

because i dont want it to be exact

#

the point is to include a lot

#

but then problem comes in when there's random strings involved

hushed quarry
#

why do you want it to include a lot...

slim heart
#

so that its not easy to bypass

#

I need an unconventional method of solving this, i dont want to have an argument over what already works well please

hushed quarry
#

then just use the levenshtein distance

amber fractal
#

"I need an unconventional method"

hushed quarry
#

i'm asking these questions because the way you want to approach this is very hard to do and unnecessary

slim heart
#

because i cant nor will just like make it less recognizing etc. i need something that isnt simple because im willing to be all those simple things would ruin what i already have

hushed quarry
#

500% not a weebToday at 6:14 PM
then just use the levenshtein distance

#

making it match everything will create so many false positives

tulip grove
#

Probably check the similarities of the strings in a link to censored words?

slim heart
#

ive worked to make sure it doesnt

#

i have a list of bypasses with each key, it just works im not talkin this :p

hushed quarry
#

friends up cats kite would be a false positive under your "algorithm"

slim heart
#

its argument by argument

#

split by spaces*

#

and actually half the time the curses are contained within said phrase

hushed quarry
#

can you give me some examples or something

slim heart
#

theres litterally like links such as whatever/weoij__FuC__saj.png etc.

hushed quarry
#

you need to realize nobody is able to help you because you're acting very arrogant and unable to provide examples or anything

slim heart
#

im kinda at a loss right now for anything specific cause my solution to those links are literally just adding them to uncensor lol

hushed quarry
#

correct?

slim heart
#

idk whatever nvrm theres nothing i can really do ugh

hushed quarry
#

🤷

#

then you need to rethink how you want the system

#

my proposed solution would probably be enough if you also make it ignore links (anything with https?:// or www.)

slim heart
#

i mean what ive done with the system is something unique and works very well;
and the links ignoring is then anyone can be like https://fuckyou

hushed quarry
#

then if they shouldn't be able to do that, but the "fuck" can be a part of the domain (such as google.com/aaafuck123), then you're kinda contradicting yourself with what you want

#

either you allow it in the link or not

#

maybe you could allow it in the domain path only and not the domain name part?

slim heart
#

but the domain path is usually the problem

#

it has random strings that can set off the filter

hushed quarry
#

i need a yes or no

slim heart
#

i just dont know

#

cuz like yes but no but ree

hushed quarry
#

i can't help you if you don't even know what it should do

slim heart
#

just nvrm

hushed quarry
#

k

glacial pecan
#

Someone help me for God's sake, I'm 12 days trying to make a bot command to block someone by the id of using the bot, please, if you're reading know, help me please!

unique nimbus
#

Use a database to store the id of the blacklisted person and every command is checked to see if they see in the database if they are it will not respond and if they aren't then the bot will respond

glacial pecan
#

I tried, however, for several annoying bugs that I can not solve

hushed quarry
#

1.) what code are you using?
2.) what are the bugs?

earnest phoenix
#

trying to run my bot through AWS can anyone lend me a hand? im stuck

sinful lotus
#

Steps on doing that.

  • Learn to use a database, probably use mongo if you dont want to deal with sql
  • Once you learned how on using it, make a command that takes a user id as a parameter
  • Fetch and see if you can access this user, if you can access it meaning theres no error in fetching the user save the ID to the database
  • on your command handler, when the bot knows the command exists, do a query to database if the msg.author.id is saved on your blacklist database, and if it do exists, return
    @glacial pecan
pliant needle
#

Mongo changed their license, didn't they?

earnest phoenix
#

but i cant download it

inner jewel
#

send the whole log

earnest phoenix
inner jewel
#

gyp ERR! stack Error: not found: make

#

install make

earnest phoenix
#

install make?

#

like npm i make?

#

oh wow o-o thanks

west spoke
#

@earnest phoenix I have tried through AWS, but hasn't worked. if you find a way to do it with python, please tell me!

glossy oxide
#

hello i am new to this can i get some help plz

west spoke
#

notwhatimeantbutk

glossy oxide
#

oh..sorry...

#

u said development..so..im sorry

west spoke
#

We cant help if you dont tell us your problem xD

glossy oxide
#

right...ok so is it possible to learn programing and coding by u or anyone..im good with tech but not that great at coding and programming

west spoke
#

ohmygod

#

Google

glossy oxide
#

ok...s-sorry to bother...

patent reef
#

o-oh g-god w-why d-do you s-stutter in t-text

glossy oxide
#

...

#

i-im sorry..

#

ill..l-leave...

west spoke
#

istilluseasync I dont know anything about rewrite foof

earnest phoenix
#

ha #oof

west spoke
#

xd

#

Reliable tbh

whole vigil
#

I still need help with making a bot

bright spear
#

Google it

#

You can ask specific questions here

earnest phoenix
#

should I submit a bot with this amount of commands. if no, what should I add? (it's multipurpose)

earnest phoenix
#

Seems fine

#

But if thats all the commands, add more

mossy vine
#

pretty general bot

#

nothing really unique tbh

earnest phoenix
#

needs a weeb avatar to be truly generic

hybrid oasis
#

my bot only has 1 command and got approved fwiw

#

sometimes less is more, you know?

quartz kindle
#

its more about purpose than individual commands these days. having commands that share a purpose or belong to a system with a purpose is better than having lots of unrelated commands

hybrid oasis
#

pick 1 thing and do it well

fiery stream
#

Ayy is go a good lang to learn??

west spoke
#

ree

earnest phoenix
#

@west spoke I couldnt get it working , can someone recommend me something other than glitch , AWS and heroku?

west spoke
#

Ah

#

Keeping it running on a computer you dont use

quiet topaz
#

@earnest phoenix you could buy a machine or a old computer like LazyNeko said or you could rent a server

glad briar
#

🔶 👌

inner jewel
#

renting a server is more reliable and will probably be cheaper

hybrid oasis
#

digital ocean, $5/mo

earnest phoenix
#

Niqqa said run it on a old computer LOL

#

I forgot about digital ocean

slim heart
#

Old computers are great for it wym

scarlet phoenix
#

Extra hardware laying around is the cheapest way lol. But then you rely on your home internet. Which no matter what you have is garbage compared to any host

quartz kindle
#

if you pay your own electricity bills, a vps is much cheaper

lost swallow
#

can i make css related questions here

quartz kindle
#

yes

scarlet phoenix
#

Calculating out the avg wattage my main box pulls from the wall, I am paying ~$4/mo for electricity (r7 1700 / 16gb / 512 nvme). I really doubt I could get that from a vps for that cheap. I do realize that not everyone just has that sitting around

amber fractal
#

But you can

quartz kindle
#

then you live somewhere with really cheap electricity

scarlet phoenix
#

60w avg * 24hrs/day * 30 days/ month = ~43.2 KWh, * $.1 KWh

#

~$4.32

quartz kindle
#

there are places you pay like 50usd a month for having a fridge

scarlet phoenix
#

If I lived in Hawaii (Highest cost per KWh, $.275) It would go up to $11.88, still not bad for the specs

#

But switch that out with like an old core 2 quad, shit mobo and large array of HDDs and then its not worth it

quartz kindle
#

yeah the bigger the machine you need, the cheaper it gets

#

hence why big servers use dedis

#

otherwise for small projects its overkill hardware and not worth it

#

another problem is that many places charge a minimum fee + taxes and yada yada for electricity

#

so you're paying 4usd/mo for the power consumption plus 10usd for base fees plus taxes + public lighting shares

#

or something stupid like that

earnest phoenix
#

whats the way to have the activity status say "playing etc.."

steel cloak
#

@earnest phoenix what language?

earnest phoenix
#

python sir, sorry!

mossy vine
#

what lib?

slender thistle
#

What version of lib

earnest phoenix
#

3.6

slender thistle
#

Library, not Python

earnest phoenix
#

v1.01 i believe

slender thistle
#
# Setting `Playing ` status
await bot.change_presence(activity=discord.Game(name="a game"))

# Setting `Streaming ` status
await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))

# Setting `Listening ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))

# Setting `Watching ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
earnest phoenix
#

thankyou, sorry for the misunderstanding

slender thistle
#

it's fine

earnest phoenix
#

banned pls

amber fractal
#

Wrong chat @hybrid oasis

hybrid oasis
#

obviously, that's why it was deleted

#

sometimes you just want to show how much of a city planner you are and get caught up in the excitement

amber fractal
#

It's still there for me but alright

hybrid oasis
#

I just reloaded and don't see it

#

cmd/ctrl+r?

amber fractal
#

It's a mobile thing

mossy vine
#

is it possible to somehow detect new lines in a discord message?

inner jewel
#

contains("\n")

mossy vine
#

and if i just want to go line by line i can just split at \n right?

hybrid oasis
#

yep

mossy vine
#

aight cool

errant ocean
#
module.exports.conf = {
    enabled: true,
    guildOnly: true,
    aliases: [ 'latency' ],
    permission: 0
}
client.commands = new Collection();

fs.readdir("./files/commands/", (err, files) => {
    if (err) return console.error(err);
    files.forEach(file => {
        if (!file.endsWith(".js")) return;
        const props = require(`./files/commands/${file}`);
        client.commands.set(file.split(".")[0], props);
    });
});
#

how would I make the command handler register the aliases

mossy vine
#

loop through the aliases and add an entry in client.commands for each of them

amber fractal
#

I just add them as I load the commands

opaque eagle
#

This is how I normally handle my commandsjs this.aliases = new Map(); for (const file of fs.readdirSync("./commands/")) { if (!file.endsWith(".js")) continue; // ... for (const alias of cmd.aliases) { this.aliases.set(alias, cmd); } }

amber fractal
#

I do mine like this

jsfiles.forEach((f, i) => {
      let props = require(`./cmds/${f}`)
      bot.commands.set(f, props)
      bot.aliases.set(f, props.aliases)
    });```
errant ocean
#

can someone give an example of adding the aliases in my current method

#
client.commands = new Collection();

fs.readdir("./files/commands/", (err, files) => {
    if (err) return console.error(err);
    files.forEach(file => {
        if (!file.endsWith(".js")) return;
        const props = require(`./files/commands/${file}`);
        client.commands.set(file.split(".")[0], props);
    });
});
autumn rain
#

general question regarding msuic players: How do you deal with youtube blocking 403-too many requests?

opaque eagle
#

We gave you two solutions... it's up to you to implement them... @errant ocean

errant ocean
#

Yeah, I'm trying

opaque eagle
#

While we could send the exact lines of code you'd have to copy/paste, that'd be considered spoonfeeding, and it won't benefit you at all.

errant ocean
#

Understood

#

I just can't seem to figure it out

opaque eagle
#

Well what r u having troubles with?

errant ocean
#

I tried adding aliases to the set but that just errors it

opaque eagle
#

What's the error? What's the code you ran?

errant ocean
#
client.commands = new Collection();

fs.readdir("./files/commands/", (err, files) => {
    if (err) return console.error(err);
    files.forEach(file => {
        if (!file.endsWith(".js")) return;
        const props = require(`./files/commands/${file}`);
        client.commands.set(file.split(".")[0], props);
        client.aliases.set(file.split(".")[0], props.aliases);
    });
});
opaque eagle
#

That doesn't say anything about aliases...

#

So no wonder that didn't work

mossy vine
#

Of course it errors, we dont give you code to copy and paste. We encourage you to learn, and will often only provide broad examples

opaque eagle
#

Lemme guess, you didn't define client.aliases...

errant ocean
#

I created another set

opaque eagle
#

You created a Set?

mossy vine
#

Set????

errant ocean
#

Collection*

opaque eagle
#

k

#

Your code doesn't show that at all...

#

@amber fractal if you do it that way, how would u search a command by its alias

errant ocean
#
client.commands = new Collection();
client.aliases = new Collection();

fs.readdir("./files/commands/", (err, files) => {
    if (err) return console.error(err);
    files.forEach(file => {
        if (!file.endsWith(".js")) return;
        const props = require(`./files/commands/${file}`);
        client.commands.set(file.split(".")[0], props);
        client.aliases.set(file.split(".")[0], props.aliases);
    });
});

Code right now ^

#

testing

#

what would I change in the file where I run the command

opaque eagle
#

What's the error?

amber fractal
#

By knowing js

#
try{
  var alias = bot.aliases.find(a => a ? a.aliases.includes(args[0].toLowerCase().slice(prefix.length).toLowerCase()) : "")
}catch(e){}
if(alias){
  let command = bot.commands.get(`${alias.command}.js`)
  if(command){
    command.run(bot, message, prefix)
  }
}``` is what I do
#

and I guess I did .toLowerCase() twice

#

Oh well

mystic shell
#

i need help with giving my bot a custom role like tatsumaki and some other bots have

bright spear
#

Wdym @mystic shell

#

Discord will make a role if it is invited with permissions

#

But generally people dislike those roles

mystic shell
#

on servers where my bot has a role given by the server owner the bot doesn't work and gives me a "missing permissions" error

earnest phoenix
#

on what action

mystic shell
#

i want to create a role for every server the bot is in that will give it the right perms

#

sending an image attachment

bright spear
#

Well you can do that by changing the invite link, but people may not like it

earnest phoenix
#

if you try to assign a role to the server owner or someone who has a role higher than the bot's highest role it will throw

#

you can't modify people higher than your bot in the hierarchy

bright spear
#

That's for kicking or banning, you should be able to give roles though @earnest phoenix

earnest phoenix
#

no

#

every action that's restricted by a permission has to respect the hierachy

bright spear
#

I can give roles to people higher than me

#

Just tried it

earnest phoenix
#

tried where

bright spear
#

In a server that I don't own

mystic shell
#

what about my bot giving a special role to itself when it joins a server

earnest phoenix
#

oh

#

nevermind just tried it too

#

they changed it i guess

#

my b

bright spear
#

@mystic shell I told you you need to set the permissions in the invite link

smoky spire
#

You can give roles to people above you as long as the role is below you

bright spear
#

Use the link generator in the discord dev portal

#

And choose the permissions

mystic shell
#

ok thanks

#

will it fix the perms for the servers im already in?

bright spear
#

No

#

That's not possible

#

You can't give yourself perms

earnest phoenix
#

you should catch exceptions regardless though, some people may invite your bot without the required permissions

bright spear
#

Yes

mystic shell
#

ok yeah, got the invite link fixed

#

so to get the perms fixed on the preexisting servers im gonna have to ask the server owners to fix them?

opaque eagle
#

Whenever that Missing Permissions error shows up, just make the bot send a reply message to the server, reminding them to give the specific permissions that the command needs.

mystic shell
#

oh ok i can add an event listener for that, right

opaque eagle
#

@mystic shell well that's an error, so I'd check if the bot has the proper permissions before doing the task it needs to do

mystic shell
#

ok

opaque eagle
#

Using d.js as an example: ```js
const perms_for_client = message.channel.permissionsFor(client.user);
if (!perms_for_client.has("MANAGE_MESSAGES")) throw "I'm lacking MANAGE_MESSAGES perms!!!";

message.channel.bulkDelete(10);```

mystic shell
#

wait how do i figure out which permissions my bot is missing

nocturne hazel
#

you can check what permissions your bot has

#

by doing

message.guild.me.hasPermission("PERMISSION_NAME");
#

it will return a boolean (false if the permission is missing and true if the bot has the permission)

#

@mystic shell

#

you can use the eval command to display it or you can log it to the console.

mystic shell
#

i got that already

nocturne hazel
#

ok

mystic shell
#

its ok now i figured out a fix

nocturne hazel
#

cool

#

@earnest phoenix what do you mean you don't know how to use it

#

have you added it

#

to the discord bot page

#

then add it

#

there is a guide on how to do so

#

np

robust acorn
#

hello

#
@commands.cooldown(1, 120, commands.BucketType.user)
async def email(ctx, *args):
   mesg = ' '.join(args)
   email = 'the gmail'
   password = 'the pass'
   send_to_email = 'the target email'
   server = smtplib.SMTP('smtp.gmail.com', 587)
   server.starttls()
   server.login(email, password)
   subject = 'Sent by {0} , {1}'.format(ctx.messsage.author.name, ctx.message.author.id)
   message = "Message:\n {0}".format(mesg)
   msg = MIMEMultipart()
   msg['From'] = email
   msg['To'] = send_to_email
   msg['Subject'] = subject
   msg.attach(MIMEText(message, 'plain'))
   text = msg.as_string()
   server.sendmail(email, send_to_email, text)
   await client.say("The message of ```{0}``` has been sent to the owner for review, thank you!".format(mesg))```
#

why would this not work?

#
  File "/home/runner/.local/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "/home/runner/.local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "/home/runner/.local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'messsage'```
#

this is the error

#

and yes im typing prefix email (message)

junior summit
#

i switched hosting services and when i installed everything like all the modedules I see this ```(node:5384) UnhandledPromiseRejectionWarning: Error: FFMPEG not found
at Function.selectFfmpegCommand (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\prism-media\src\transcoders\ffmpeg\Ffmpeg.js:46:13)
at new FfmpegTranscoder (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\prism-media\src\transcoders\ffmpeg\Ffmpeg.js:7:37)
at new MediaTranscoder (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\prism-media\src\transcoders\MediaTranscoder.js:10:19)
at new Prism (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\prism-media\src\Prism.js:5:23) at new VoiceConnection (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\discord.js\src\client\voice\VoiceConnection.js:46:18)
at Promise (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:63:22)
at new Promise (<anonymous>)
at ClientVoiceManager.joinChannel (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:45:12)
at VoiceChannel.join (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\node_modules\discord.js\src\structures\VoiceChannel.js:130:30)
at Client.<anonymous> (C:\Users\chillkey123123123213\Desktop\ChillBot\discord-bot\bot.js:969:36)
at Client.emit (events.js:189:13)

sinful lotus
#

install ffmpeg

junior summit
#

i did

#

i did npm i fmpeg

#

i tried it several times

sinful lotus
#

its not an ffmpeg package

#

I mean an npm package

#

thats ffmpeg

junior summit
sinful lotus
#

yeah just follow instructions there

junior summit
#

wait when i download

sinful lotus
#

what when

junior summit
#

but last time i didnt do anything like this

sinful lotus
#

not because you didnt do anything like that means you dont need to do anything like that

#

every provider is different

junior summit
#

oh okay

#

still getting the same error

sinful lotus
#

did you install it correctly?

#

what is your host even

junior summit
#

google cloud

sinful lotus
#

I feel like thats a windows pc

junior summit
#

yea

sinful lotus
#

go ask on d.js support server on how to put ffmpeg on path

#

for I never hosted my bot on windows

junior summit
#

k

ashen jay
#

I would like to use rateLimitPerUser, but I do not know how to install discord.js dev, can you help me?

opaque eagle
#
yarn add discordjs/discord.js#11.4-dev``````sh
npm install --save discordjs/discord.js#11.4-dev```
earnest phoenix
#

@coral trellis

coral trellis
#

Did you install the dbl package?

earnest phoenix
#

yes

opaque eagle
#

How'd u define dbl?

earnest phoenix
#

const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('my key', client);

opaque eagle
#

It needs to have options between your key and your client

#

Me is dumb nvm

mossy vine
#

that is weird, as the source code does include an isWeekend function

earnest phoenix
#

yeah but it doesnt work

mossy vine
#

can you show your code?

earnest phoenix
#

dms

mossy vine
#

i have no idea

dreamy heath
#

I use JavaScript for dev have another language for dev with Atom ? Thx

mossy vine
#

what

#

@dreamy heath elaborate

idle basalt
#

atom supports multiple languages if thats the question

trail dagger
#

can someone come with a suggestion of commands?

idle basalt
#

what

opaque eagle
#

@trail dagger A great bot is one with original features...

trail dagger
#

yea

#

thats why iam asking for suggestions

idle basalt
#

if we had ideas for original features why wouldnt we make it ourselves

opaque eagle
#

^

#

Plus how would the ideas be original if you'd be taking them from us...

#

Whenever I open my fresh install of zsh, it shows MacBook-Pro% instead of ~

mossy vine
#

@opaque eagle yes, thats what a fresh install of zsh does

opaque eagle
#

How do I change it to the ~ that many have?

mossy vine
#

custom themes

#

oh-my-zsh is very good for themes, and comes with a ton preinstalled

#

~ is your home directory on linux btw

opaque eagle
#

Oh

#

I like gruvbox but I'll check out omz

#

What does the color of the arrow mean in omz

mossy vine
#

?

opaque eagle
covert roost
#

Every time I turn on my bot, it goes online, but when I turn off my computer, the bot automatically turns off and goes offline. How do I keep my bot online until I turn off my bot?

zealous veldt
#

Use a VPS to host your bot

#

]]vps

covert turtleBOT
#

A VPS or virtual private server is a virtualized server instance run in the cloud. It acts like a normal server, allowing you to remotely login and manage it just like a physical server or computer. If you're looking for a way to keep your bot online 24/7 a VPS is a great option. Having trouble choosing a VPS provider or don't know where to start? Click here for a list of common and affordable VPS providers.

slate kayak
#

hello all anybody that could maby help me with this seeing that this code works on my other bot but on this 1 i keep getting it like this 😢 http://prntscr.com/nn9exd

Lightshot

Captured with Lightshot

opaque eagle
#

You didn't ignore your bot?

#

Show code...

dreamy heath
#

JavaScript is ok for visual code ? Help please

#

Or visual studio

slate kayak
#

what code you want @opaque eagle ?? message.js or level.js ??

opaque eagle
#

Visual Studio Code @dreamy heath

dreamy heath
#

Yes

opaque eagle
#

Just make sure that the bot ignores messages from itself. @slate kayak

dreamy heath
#

Thx for help

#

You use what ?

opaque eagle
#

I typically use WebStorm and vim (depending on how large the project is)

dreamy heath
#

Ok

#

Atom is good ?

opaque eagle
#

Idk, I tried it once and instantly got rid of it

#

Didn't like how primitive it was

dreamy heath
#

Ok

zealous veldt
#

Popular VPS Providers
Being on this list does not in any way shape or form represent a partnership or endorsement from me or DBL, all prices shown in USD unless otherwise noted

If you have suggestions to add to this list please let me know and I'll look into adding them

opaque eagle
#

Wasn't there a similar pin before?

modern sable
#

yeah

#

but it was made by someone who isn't even in the server anymore

zealous veldt
#

Yeah

opaque eagle
#

oh

#

Oh yeah York left the server I think

zealous veldt
#

ye

#

he did

#

owo

#

sinistre

#

do you use vim bindings with webstorm

spring ember
#

@zealous veldt isn't it in the pins already?

zealous veldt
#

unpinned old one

spring ember
#

Oh ok

opaque eagle
#

Yea

zealous veldt
#

hahayes

#

Webstorm + Vim Binding = loveheart

mossy vine
zealous veldt
#

ye

#

added @mossy vine

mossy vine
#

Thanku