#development

1 messages ยท Page 364 of 1

quiet bobcat
#

How do I limit it to only one per search

#

Like so only one of me

#

instead of 5

#

idk what I'm saying rn

#

Please mention me if you know a solution.

earnest phoenix
glossy sand
#

@quiet bobcat use a for loop instead of forEach

#

and break upon finding one match

quiet bobcat
#

wym

#

oh

glossy sand
#

right now you're going

guild.members.forEach(function(member) {
  // do stuff
});
#

you should instead go

for (const member of guild.members) {
  // do stuff
}
#

then you can break; in the middle

quiet bobcat
#

ok

#

But can I use user objects with that setup?

earnest phoenix
#
const cookies = require('quick.db'); // database
const moment = require('moment');

    let today = moment().format('1')
      if(message.guild.id === '383790085901910016') return;
  cookies.fetchObject(`lastBump_${message.guild.id}`).then(i => {

                if (i.text === today) return message.channel.send('**FAILED!** Your server already bumped today');
      cookies.updateText(`lastBump_${message.guild.id}`, today).then(() => {

is pissing me off because it just returns the failed message .-.

quiet bobcat
#

like js member.user.discriminator

glossy sand
#

I mean presumably yes

#

since for..of loops are functionally equivalent to forEach in all the cases I can think of

quiet bobcat
#

Weird

#

because I can't do it

#
TypeError: Cannot read property 'discriminator' of undefined```
glossy sand
#

hold up are you using d.js?

quiet bobcat
#

Yes?

glossy sand
#

oh I assumed eris

quiet bobcat
#

oh lol

glossy sand
#

then you'll need to do

#
for (const [id, member] of guild.members) {
  // do stuff
}
#

where id is the member's snowflake and member is the member object

#

since d.js stores members as a map and eris stores them as a weird unkeyed collection

quiet bobcat
#

ok

#

hm

#

Still got this sipurak#4275 jonasjac#4275 jonasjac#4275 jonasjac#4275 jonasjac#4275 jonasjac#4275

#

even though I had a break

glossy sand
#

let's see your code

earnest phoenix
#

try a different discrim?

quiet bobcat
#
for (const [id, member] of guild.members) {
                if(member.user.discriminator == args[1]) {
                    output += member.user.username + '#' + member.user.discriminator + '\n'
                    found = true
                    break;
                    }
            }})```
earnest phoenix
#

maybe thats all the users with that discriminator?

#

or

glossy sand
#

well you're running this for each guild

quiet bobcat
#

You can't have multiple people with the same name in one discrim

#

yes?

glossy sand
#

so probably your bot shares 5 servers with you

quiet bobcat
#

Yes...

earnest phoenix
#

Actually, alot of people after the nitro update have the #0001 discriminator

quiet bobcat
#

yup

trim plinth
#

lol

#

I've seen like 5 people with 0001 already

earnest phoenix
#

yeah

glossy sand
#

so make the outer forEach a for..of loop as well

#

and break the outer loop when you find a match

#

although I don't really know how useful that command would be lol

quiet bobcat
#

me neither

#

just for fun I guess

earnest phoenix
#
const cookies = require('quick.db'); // database
const moment = require('moment');

    let today = moment().format('1')
      if(message.guild.id === '383790085901910016') return;
  cookies.fetchObject(`lastBump_${message.guild.id}`).then(i => {

                if (i.text === today) return message.channel.send('**FAILED!** Your server already bumped today');
      cookies.updateText(`lastBump_${message.guild.id}`, today).then(() => {

why do I keep getting failed? -.- I haven't bumped in like 2 days LMAO.. If you figure it out, mention me ๐Ÿ˜ƒ

pale light
#

thats very unspecific

quiet bobcat
#

You code it.

pale light
#

consider learning a coding language first

#

well thats not helpful

earnest phoenix
#

learn an application language

#

Wait, slow loris? Don't you own that bump server GWaizenFeelsbetaman

pale light
#

hm

earnest phoenix
#

...

#

Ban?

#

Kick?

glossy sand
#

muted

earnest phoenix
#

๐Ÿ˜„

#

yey

pale light
#

gr

#

get beaned

torpid vale
#
const Discord = require('discord.js');
const fs = require('fs');
const config = require(`./../../config.json`);
const search = require('youtube-search');
const yt = require('ytdl-core');

var opts = {
  maxResults: 1,
  key: ''
};
let dispatcher;
function play(message){
    if(queue[message.guild.id][0]){
        message.channel.send(`Playing song **${queue[message.guild.id][0][0].title}**`);
        let stream = yt(queue[message.guild.id][0][0].link, { filter : 'audioonly' });
        dispatcher = message.guild.voiceConnection.playStream(stream, { seek: 0, volume: 1 });
        dispatcher.on('end', function(){
            queue[message.guild.id] =  queue[message.guild.id].slice(0);
            play(message);
        });
    }
}
let queue = [];
module.exports.run = function(bot, command, args, message, updateJSON, addFooter){
  if(args[0]=='queue'){
    if(queue[message.guild.id]==undefined){
      queue[message.guild.id] = [];
      search(args.slice(1).join(' '), opts, function(err, results) {
      if(err) return console.log(err);
        queue[message.guild.id][0] = results;
      });
    }else{
    search(args.slice(1).join(' '), opts, function(err, results) {
      if(err) return console.log(err);
        queue[message.guild.id][0] = results;
        message.channel.send(`Queued song **${results[0].title}**`);
    });
    }
    message.guild.members.get(message.author.id).voiceChannel.join();
  }
  
  if(args[0]=='play'){
      play(message);
  }
}

module.exports.help = {
    names: ['music'],
    usage: 'e-command <args>',
    description: 'what?'
}```
#

I still need help understanding why it doesn't play the second time

earnest phoenix
bright spear
#

change setGame to setActivity

earnest phoenix
#

Ik that.

bright spear
#

setGame doesn't work anymore

vital lark
#

it's eperated

bright spear
#

eperated

vital lark
#

don't use .setGame(), use setActivity()

earnest phoenix
#

Mk.

bright spear
#
change setGame to setActivity```
#

i said that

earnest phoenix
#

Anyone know why when I set bot.user.setStatus('invisible') then start the bot up and run a command it replys twice.

bright spear
#

probably because you have 2 instances running

earnest phoenix
#

But when it is bot.user.setStatus('dnd') it dosent.

cerulean zinc
#

Anyone know how to generate graphs/charts in NodeJS?

rich kiln
#

use canvas or chart js

earnest phoenix
#

Any help with this?

#

(node:11496) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Request to use token, but token was unavailable to the client.
(node:11496) [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.
events.js:183
throw er; // Unhandled 'error' event
^

Error: socket hang up
at createHangUpError (_http_client.js:331:15)
at TLSSocket.socketOnEnd (_http_client.js:423:23)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

#

@bitter sundial This is your Discord.js Server count code. I got this in console.

#

Only got that error when I added your code.

uncut slate
#

that's unrelated to the stat post

#

you've done something very weird to your client[.token]

earnest phoenix
#

oh ya

#

oof

#

I removed it

#

OOOFF

cerulean zinc
#

Anyone know why when using Lavalink the client always reports 0 connected VC?

earnest phoenix
#

Im not sure if it is updating,

#

@uncut slate Do you know why?

uncut slate
#

no, not unless you have an error code to give me

earnest phoenix
#

Nope.

uncut slate
#

that will only post stats on an interval

earnest phoenix
#

So I screwed something up?

uncut slate
#

no

earnest phoenix
#

I need to change the time>

#

?

uncut slate
#

not really

earnest phoenix
#

Thats why it didnt update correct?

uncut slate
#

kinda, sorta

#

it'll post every X ms

#

in this case X is a fair bit so you just need to wait for the first cycle ๐Ÿคท

#

or use other code

earnest phoenix
#

post on guild join leave and startup

cerulean zinc
#

Anyone know why when using Lavalink the client always reports 0 connected VC?

earnest phoenix
#

It shouldn'tโ„ข

#

snekfetch.post(https://discordbots.org/api/bots/stats)
^

ReferenceError: snekfetch is not defined
at Timeout.setInterval [as _onTimeout] (C:\Users\owner\Desktop\Weather Bot\app.js:159:5)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
Any Help?

cerulean zinc
#

Define snekfetch

earnest phoenix
#

how.

cerulean zinc
#

-_-

#

How did you define discord.js

earnest phoenix
#

Like this?

#

const Discord = require('discord.js');

cerulean zinc
#

Yes

earnest phoenix
#

So what do I put>

cerulean zinc
#

Now you would do the same for snekfetch

earnest phoenix
#

?*

#

Could you just write it out?

cerulean zinc
#

No. you need to figure it out

earnest phoenix
#

:/

#

@cerulean zinc Please?

cerulean zinc
#

It says it even in the snekfetch docs

austere meadow
#

discord.js is the name of the package
if requiring discord.js is require('discord.js'), what would requiring snekfetch be?

#

keeping in mind snekfetch is the name of the package

uncut slate
#

lul

earnest phoenix
#

@cerulean zinc

#

.send({ server_count: client.guilds.size })
^

ReferenceError: client is not defined
at Timeout.setInterval [as _onTimeout] (C:\Users\owner\Desktop\Weather Bot\app.js:161:29)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)

cerulean zinc
#

Maybe you dont use client

earnest phoenix
#

What do I do to update it then?

cerulean zinc
#

Please ask someone else

austere meadow
#

do you use bot instead of client?

#

like bot.login

earnest phoenix
#

Yes

#

@austere meadow

#

@austere meadow Any solutions?

pale light
#

bot.guilds.size

#

if you use bot, you should replace client with bot

earnest phoenix
#

oof

#

Mk.

#

It worked.

pale light
#

๐ŸŽ‰

earnest phoenix
#

I'm even suprised how many servers it is in.

pale light
#

nice good luck with ur bot

earnest phoenix
#

10 Servers in a day. xD

pale light
#

pretty good

earnest phoenix
#

@pale light Have any code for when the bot joins a server that it says the server name in console?

pale light
#

yeah

#

do you know the guild join event?

earnest phoenix
#

No.

#

My friend does most of the coding.

pale light
#

use this

earnest phoenix
#

I am trying to push members with a function

#

(NodeJS - Discord.js)

pale light
#

link to function?

earnest phoenix
#

UGH

#
private Dictionary<ulong, Queue<Tuple<string, string, int, ulong>>> audioqueues = new Dictionary<ulong, Queue<Tuple<string, string, int, ulong>>>();```
#

this line hurts my head

inner jewel
#

what the fuck

strange escarp
#

Makes sense to me

topaz fjord
#

@earnest phoenix wdym push members

earnest phoenix
#

yea

#

it's just spastic line

#

makes sense

#

just hurts

#

@late saffron play middle kids ep playlist

fleet epoch
#

I'm bored, Imma build a Android app

tulip bronze
#

hey, uh since this was here.. i was gonna ask for some help

#

i'm making a bot

wicked tartan
#

what part are you hung up on?

#

oh still typing rip

tulip bronze
#

but once i typed node bot.js

#

it gave me a sytax error

#

need a screenshot?

wicked tartan
#

yeah

tulip bronze
#

that's all i really got

#

and from the tutorial

#

i only really varied on the commands

#

so my test command is an objection

austere meadow
#

can you run npm ls discord.js?

tulip bronze
#

lemme do that

austere meadow
#

oh wait

#

what lib are you using

wicked tartan
#

ye

tulip bronze
#

thanks for the help people

fleet epoch
#

Use my tutorial :)

tulip bronze
#

that means restarting making this.. oh well

#

uh you got a link or something?

fleet epoch
heady zinc
#

Turtorial

#

nice

fleet epoch
#

What

heady zinc
languid dragon
#

Bot-Turtorial

austere meadow
#

also

#

thats discord.js

fleet epoch
#

Oh rip

heady zinc
austere meadow
#

i mean

fleet epoch
#

Yea

austere meadow
#

im not sure

languid dragon
heady zinc
#

discord.js too zoomeyes

austere meadow
fleet epoch
#

Lol

austere meadow
#

what discord.js deprecated @heady zinc

fleet epoch
#

Use discord.js

austere meadow
heady zinc
#

no anidiotsguide i meant

austere meadow
#

oh

tulip bronze
#

thanks lemme use this tutorial

fleet epoch
#

What one

heady zinc
austere meadow
#

lmao you said isn't discord.io deprecated entirely Thonk
and then you said "and discord.js too" right after so i was like "what"

heady zinc
#

both died

fleet epoch
#

Cause they are both for discord.js and your using discord.io

austere meadow
#

people still seem to use them

#

im not sure how

#

but

heady zinc
#

atm i think they just don't have categories support

#

and progressively starts breaking

tulip bronze
#

i'm just gonna continue working on my edgybot

fleet epoch
#

If you need help just dm me

tulip bronze
#

k

#

ty

fleet epoch
#

Np

tulip bronze
#

edgybot's for a server i have with some friends

#

we play ao together

#

and i added a wrightbot today

#

and there's no edgebot

#

but the world needs edge

#

so there

languid dragon
#

/\.+/g this regex will work ye?

earnest phoenix
#
if (command === "leaveserver") {
        if(message.author.id !== botowner) {
            message.reply('this command is only for bot owner!!!');
            return;
        }
        let guild = bot.guilds.get(args3);
        var args3 = message.content.substring(12);
        message.channel.send(args3);
        message.channel.send(`guild ${guild}`);
        //guild.leave();
        message.channel.send('Left guild.');
    }

when im giving command leaveserver 268324543217532929
parameter 1 sending message on channel 268324543217532929
and parameter 2 sending message on channel guild undefined

#

@austere meadow

austere meadow
languid dragon
#

ty i console logged it ๐Ÿ˜‚

austere meadow
#

oh lmao

#

its really nice

earnest phoenix
#

which message for me ?

languid dragon
#

but i was lazy

austere meadow
#

oh okay

#

same

#

uhh PK

#

im not sure

#

is args3 a string?

earnest phoenix
#

args3 is a message what im type after command

austere meadow
#

yeah but what is it
if you do typeof(args3) what do you get

earnest phoenix
#
if (command === "leaveserver") {
        if(message.author.id !== botowner) {
            message.reply('this command is only for bot owner!!!');
            return;
        }
        let guild = bot.guilds.get(args3);
        var args3 = message.content.substring(12);
        message.channel.send(args3);
        message.channel.send(`guild ${guild}`);
        //guild.leave();
        message.channel.send('Left guild.');
    }

when im giving command leaveserver 268324543217532929
parameter 1 sending message on channel 268324543217532929
and parameter 2 sending message on channel guild undefined

#

read again plz

austere meadow
#

what

#

nah i read it

#

im asking what the type of args3 is because .get only works with a string

#

actually

#

what are you doing

#

args3 isn't defined when you are defining guild

#

you need to put args3 above let guild

earnest phoenix
#

args3 is a string

austere meadow
#

put var args3 above let guild

earnest phoenix
#

ok

#

@austere meadow dude same position after do that

austere meadow
#

what

earnest phoenix
#

guild undefined

austere meadow
#

show code

earnest phoenix
#
    if (command === "leaveserver") {
        if(message.author.id !== botowner) {
            message.reply('this command is only for bot owner!!!');
            return;
        }
        var args3 = message.content.substring(12);
        let guild = bot.guilds.get(args3);
        message.channel.send(args3);
        message.channel.send(`guild ${guild}`);
        //guild.leave();
        message.channel.send('Left guild.');
    }
austere meadow
#

are you sure you aren't chopping off one of the characters in args3 or you have a space in there maybe?

#

thats the only other thing i can think of

earnest phoenix
#

parameter1 giving me correct message

#

there are no space or aqnything

austere meadow
#

im not sure then sorry
its possible the guild isnt in bot.guilds but other than that im not sure

earnest phoenix
#

and if im try to open guild.leave();
console error TypeError: Cannot read property 'leave' of undefined

#

thet guild is available and my bot is on in it

#

@austere meadow

potent anchor
#
will i make the bot have 2 prefix```
fleet mason
#

guys best program to code on. Im currently using notepad XD

languid dragon
#

atom

tawny lava
#

vsc

earnest phoenix
#

Jetbrains products

frail kestrel
#

vscode

earnest phoenix
#

is there any way through which my bot can be online 24/7?

tawny lava
#

get a server

#

vps

heady bough
#

Is anyone else getting random "Unhandled 'error' event"s?

#

with Discord.JS i mean

#

To be precise, I am getting websocket errors

restive silo
#

well read the WS error code up

#

could be an Connection/network related issue

fleet mason
#

guys where do i put if(message.author.id !== config.ownerID) return; into this ``` if(message.content.startsWith(config.prefix + "prefix")) {
// Gets the prefix from the command (eg. "!prefix +" it will take the "+" from it)
let newPrefix = message.content.split(" ").slice(1, 2)[0];
// change the configuration in memory
config.prefix = newPrefix;

// Now we have to save the file.
fs.writeFile("./config.json", JSON.stringify(config), (err) => console.error);
}```

earnest phoenix
#

probs after the first line

#

idk what you're trying to acheive

fleet mason
#

when i type !prefix "something" it will change my prefix to that thing but i want it to only be me that can do it with the if(message... but it will not work when i try XD

earnest phoenix
#

after first line then

fleet mason
#

do i have to use } else after?

earnest phoenix
#

where?

#

Do you know how to actually write basic js?

fleet mason
#

im trying to learn XD

earnest phoenix
#

I'd suggest looking up a standard tutorial on how to write in js first

#

and go through that

#

because clearly your understanding of logic and syntax is rather lacking

#

and a tutorial will help you out

fleet mason
#

this is a easy tutorial but i cant get it to work XD

#

the command works without the first line but when i try to put it in it wont work

earnest phoenix
#

Writing a bot without any experience in a language is never going to be easy

fleet mason
#

"ownerID":"XkijuX#6667"

earnest phoenix
#

That's not an id

fleet mason
#

whats the id then XD

earnest phoenix
#

dsicord -> settings -> appearance -> developer mode -> on

restive silo
#

thats an combination of Username + discrim

earnest phoenix
#

then right click on yourself

#

and click copy id

fleet mason
#

XkijuX#6667

#

thats what i get

earnest phoenix
#

Nope

#

Follow what i said

fleet mason
#

i did and i only get that

earnest phoenix
#

You're lying

#

If the copy id button is on the right click menu it wont give that

#

otherwise you havent followed what i said

fleet mason
#

when i right click i get these options. Profile, mention , change nickname

potent lily
#

Follow better than

earnest phoenix
#

^

#

Read my first step

fleet mason
#

ohh

#

i didnt see the other parts

#

i thought it only was righclick and copy

#

btw thank you

slate comet
#

@fleet mason 202159988666400769

#

that's your ID

languid dragon
#

someone

#

tell me

#

how this fucking works

restive silo
#

wait what

languid dragon
#

ive installed node 9.x multiple times

#

and removed it so many times

restive silo
#

what kind of magic is that

languid dragon
#

and i still have 6.12

#

im fucking triggered as heck

uncut slate
#

which distro are you on

restive silo
#

i think that is fedora

uncut slate
#

disgustin

#

also try just node

languid dragon
#

1 sec

#

"rhel fedora"

restive silo
#

ayy

languid dragon
#

it actually hates me

#

nope, i cant do anything to change it

#

niceโ„ข

uncut slate
#

did you try node

languid dragon
#

yes

#

it just gives me the node thing

#

it wont uninstall

uncut slate
#

sudo rm /bin/node :^)

tawny lava
#

tried reinstalling and restarting vps

earnest phoenix
#

U are using the wrong port number I asume.

earnest phoenix
#

what does it mean*

and... google?

potent lily
#

Port migration Thonk

#

You can do it but its weird

earnest phoenix
#

Press OK? ๐Ÿ˜‚๐Ÿค“

earnest phoenix
pale light
earnest phoenix
#

Okay thanks, just need to try and work our how to send my data to it?

pale light
#

you send data

#

using the post method

#

what language are you using

earnest phoenix
#

discord.js

pale light
earnest phoenix
#

Okay thank you

pale light
#

np

earnest phoenix
#

Sorry i cant seem to find the post there? Are you able to tell me who made it so i can search it? Thanks

#

Dont worry found it ๐Ÿ˜ƒ

pale light
#

kk

earnest phoenix
#

Im still have problems with status code that i want to add

#

-TypeError: Cannot read property 'setPresence' of null
at Object.<anonymous> (/Users/rowinsalomons/Desktop/Lil dumb/bot.js:30:13)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

pale light
#

code?

earnest phoenix
#

client.user.setPresence({
status: "online",
activity: {
name: "Eshketit",
type: 0,
url: "none"
}
});

#

Where it asks for "API KEY" wheres this?

pale light
#

the api key is

#

wait

#

I'll take sc

earnest phoenix
#

Found it sorry ๐Ÿ˜ƒ

pale light
#

ok

earnest phoenix
#

Still cant seem to figure it out.

pale light
#

are you using bot or client

earnest phoenix
#

Client i think

pale light
#

well its saying that client.user is null so

#

do you have: const bot = new Discord.Client();?

earnest phoenix
#

Above the piece of code? Or in the code at all?

#

I have it like at the top of the code,

fathom pebble
#

at the top

earnest phoenix
pale light
#

hm client

#

oh

#

you should put the setpresence in the ready event

#

so

#

client.on('ready', () => {

#

in there

#
client.on('ready', () => {
client.user.setPresence...
})
earnest phoenix
#

Mkay, ill try that thanks

pale light
#

np

earnest phoenix
#

oof rip

#

how many req/s are you sending?

pale light
#

ouch

earnest phoenix
#

Idk xD i think ive fixed it

#

It worked,

pale light
#

k great

earnest phoenix
#

Well, sorta tho

pale light
#

waht

earnest phoenix
#

It doesnt show the "online" part

fathom pebble
#

whats the amount of time till you automatically get unblocked from the api?

earnest phoenix
#

The code doesnst prevent it from not turning on.

#

But it doesnt show.

pale light
#

hm waht

earnest phoenix
#

How long will i be banned for? xD

pale light
#

what version of discord.js are you using @earnest phoenix

earnest phoenix
#

"discord.js": "^11.3.0"

#

As fas as I know, latest version.

pale light
#

well then setPresence is depreciated

earnest phoenix
#

What do I replace it with then?

whole mural
#

@low rivet Jesus christ, my heroku stuff is actually staying online

pale light
earnest phoenix
#

Gotcha

#

Hmmmmm

#

The bot still works,

#

Ho brb gtg eat

pale light
#

k

chrome field
#

@earnest phoenix really?

earnest phoenix
#

Still havent figured it out ripppp

#

Wait

#

I might have it

#

Noop I havent fml

#

Anyone help?

#

๐Ÿ˜ฆ

#

.

quiet bobcat
#

@earnest phoenix try js client.on('ready', () => { client.user.setGame("Game here") client.user.setStatus('online (can also be away or dnd) }

#

or js client.user.setPresence({ activity: { name: `game here` } )}

earnest phoenix
#

Its showing a red (

#

in the last )}

quiet bobcat
#

It's }) not )}

#

my bad

#

@earnest phoenix

earnest phoenix
#

Does it matter were I put it tho?

#

Cuz im still getting the red )

quiet bobcat
#

hm

earnest phoenix
quiet bobcat
#

You have too many } and )

#

You're closing off the on ready event even before you console log it

#
client.on('ready', () => {
    client.user.setPresence({
    activity: {
        name: `Game Here`
    }
    }) 
console.log("I'm ready to listen to commands")
});```
earnest phoenix
#

Omfg

#

im stupid

#

found it

quiet bobcat
#

lol

#

ok

#

Try it

#

Does it work?

earnest phoenix
#

Im new into Js

quiet bobcat
#

That's ok

#

Everyone has to start somewhere

earnest phoenix
#

Bot started up

#

lemme check

#

I should edit it tho

quiet bobcat
#

Yeah

earnest phoenix
#

I need it to play a game

#

lol

#

thats 0

quiet bobcat
#

Does it not play a game?

earnest phoenix
#

It doesnt show anything yet

#

still blank

quiet bobcat
#

You might have to replace your current activity with this:js activity: { name: `Game name here`, type: 0 //Might be one if it doesn't start playing with 0. }

tulip wave
#
 if (command == "mute") { // creates the command mute
        if (!message.member.roles.some(r=>["bot-admin"].includes(r.name)) ) return message.reply("Sorry, you do not have the permission to do this!"); // if author has no perms
        var mutedmember = message.mentions.members.first(); // sets the mentioned user to the var kickedmember
        if (!mutedmember) return message.reply("Please mention a valid member of this server!") // if there is no kickedmmeber var
        if (mutedmember.hasPermission("ADMINISTRATOR")) return message.reply("I cannot mute this member!") // if memebr is an admin
        var mutereasondelete = 10 + mutedmember.user.id.length //sets the length of the kickreasondelete
        var mutereason = message.content.substring(mutereasondelete).split(" "); // deletes the first letters until it reaches the reason
        var mutereason = mutereason.join(" "); // joins the list kickreason into one line
        if (!mutereason) return message.reply("Please indicate a reason for the mute!") // if no reason
        mutedmember.addRole(mutedrole) //if reason, kick
            .catch(error => message.reply(`Sorry ${message.author} I couldn't mute because of : ${error}`)); //if error, display error
        message.reply(`${mutedmember.user} has been muted by ${message.author} because: ${mutereason}`); // sends a message saying he was kicked
    }```
#

I'm getting a discord api error while running the mute command

#

can anyone see what might be wrong

#

coded in JavaScript

heady zinc
#
  1. what is the error
quiet bobcat
#

^

earnest phoenix
#

Still nothing, weird. Lemme try 1 instead of 0

quiet bobcat
#

Yeah try that

earnest phoenix
#

the bot does start so its just ignoring the code

quiet bobcat
#

hm

earnest phoenix
#

Yet again, nothing

quiet bobcat
#

Weird

earnest phoenix
#

Smh

#

Hmh

#

Ugh,

tulip wave
#

TypeError: Supplied parameter was neither a Role nor a Snowflake.

#

@heady zinc

quiet bobcat
#

Try this then js activity: { game.name: `Gamename here` game.type: "PLAYING" }

heady zinc
#

right kirito

quiet bobcat
#

If that doesn't work idk what will work @earnest phoenix

heady zinc
#

you didn't even defined mutedrole if i read that well

tulip wave
#

it also said something about a discordAPI error

heady zinc
#

so you give undefined to the method

#

and discord doesn't like this zoomeyes

tulip wave
#

ohhhh

earnest phoenix
#

Nothing ๐Ÿ˜ฆ

#

Well gues it wont work then

gloomy parrot
quiet bobcat
#

Try to check out the discord.js server @earnest phoenix

#

I can dm you an invite link

earnest phoenix
#

Got it already

glossy sand
#

@gloomy parrot you mean the space inside the cards or between the cards?

quiet bobcat
#

ok

gloomy parrot
#

inside the cards

glossy sand
#

that's padding

#

just set it to zero if you want it gone

gloomy parrot
#

uh

#

it's not padding

#

the actual card is just like that

glossy sand
#

i can't actually tell without inspecting it myself really

gloomy parrot
#

oops

#

it's likely because they want to match the height

#

with eachother

earnest phoenix
#

Hey I maked a code for showing discriminator but now a probalm
If bot found so many discriminator he can't send message cause letter is up to 2000 it's a discord message sending limit & showing this error
content: Must be 2000 or fewer in length.
How to handle it?

gloomy parrot
#

a discriminator is 4 letters..

severe socket
#

limit it to a specific number of discrim to show

quiet bobcat
#

Yes...

#

But you search for every user with that discrim @gloomy parrot

severe socket
#

or split the message if you really want but it might be really spammy

earnest phoenix
#

Read message carefully

gloomy parrot
#

your message isnt formulated carefully

#

Hey I maked a code for showing discriminator but now a probalm
a discriminator is 4 letters, showing whose discriminator are we talking about, in which context??

earnest phoenix
#

I mean if my bot want to sent upto 2000 letter how can do this?

gloomy parrot
#

split it up into different messages?

quiet bobcat
#

going to be too spammy

gloomy parrot
#

@quiet bobcat you just assumed that

#

we dont know shit of what the context is

quiet bobcat
#

If you do 0001 you're going to get the bot ratelimited

#

So yes, it will be too spammy

earnest phoenix
#

Yes @quiet bobcat

quiet bobcat
#

I'd say if the output is more than 1999 chars return it with a message saying there are too many users with that discriminator or something

earnest phoenix
#

Yes it is my problem

gloomy parrot
#

why would you make a function like this

quiet bobcat
#

What do you mean?

#

Searching users with a discrim or limiting the amount of characters??

gloomy parrot
#

just casually send 200 usernames with the same discrim

quiet bobcat
#

It's just a fun command

earnest phoenix
#

Amount of characters

gloomy parrot
#

lmao what

quiet bobcat
#

and you can also change your discrim if you change name to someone who has your discrim

gloomy parrot
#

then you change it once, and your discrim is changed

#

you only need 1 person with the same discrim

quiet bobcat
#

Yes?

#

And that's the command to find a person with that discrim

#

You know you can't change into some names because they are too popular right?

#

Lets say 9999 users have the same name eg Mike

#

Then you can't change your name into Mike

#

because all discrims are already taken

gloomy parrot
#

you still don't need 200 users for that shit

quiet bobcat
#

You'd have to do Mike1

#

But there is 200 users with the new update which lets you CHANGE discrim with NITRO

#

Why are we even having this argument?

#

The problem he had is already solved

#

So can we just move on?

#

Thanks

earnest phoenix
#

How would I repeat a whole queue? BizarreThinking

heady zinc
#

go back to the first song once the last ended?

earnest phoenix
#

I've tried ๐Ÿค” I guess I did it wrong, I'll try again after work

cerulean zinc
#

Should I add locales to my bot using a translator

#

Or is it not worth it

earnest phoenix
#

nah

#

english is gud

cerulean zinc
#

But if you get at least Spanish, that's like a ton of the population there. Idk

earnest phoenix
#

most know enlgish

#

english is the language of the world

cerulean zinc
#

Basically

heady zinc
#

do it if you have enough motivation and time

#

otherwise no

cerulean zinc
#

Maybe when I get bored

quiet bobcat
#

Hello, yes. I've created a config command which currently only lets you change one thing but when I change that thing from off to on it adds an extra bracket. Leveling from on to off works fine but for some reason off to on adds an extra bracket. The code is: js if(args[1].toLowerCase() == "off") { configs[message.guild.id].leveling = 'off'; message.channel.send(`Level up messages are now **${args[1].toLowerCase()}**`); fs.writeFile("commands/Storage/configs.json", JSON.stringify(configs, null, 4), (err) => { if (err) console.error(err); }) return; } else if(args[1].toLowerCase() == "on") { configs[message.guild.id].leveling = 'on'; message.channel.send(`Level up messages are now **${args[1].toLowerCase()}**`); fs.writeFile("commands/Storage/configs.json", JSON.stringify(configs, null, 4), (err) => { if (err) console.error(err); }) return; }

#

If you know a fix please @ me. Probs going to sleep soon so sorry if I'm not that fast at responding

earnest phoenix
#

using json as a database :megalul:

inner jewel
pale light
#

tf

wanton nova
#

@quiet bobcat Try changing
(configs, null, 4)
to
(configs)

trim plinth
#

help

#

.setField doesn't want to work ;-;

jagged plume
#

addField

#

not setField

trim plinth
#

oh

#

;-;

daring mulch
#

What username

#

Nice username

#

Im gonna see

#

What username

#

Nice username

#

Im gonna see

pale light
#

stop u baguette

south finch
#

smh

trim plinth
#

how to fix this? and the lines of code used for this is var fortunes = [ 'Hell to the nah, to the nah nah nah!', 'fuck no', '***REEEEEEE***', 'Fuck yeah.', 'No.', 'Yes.', 'Tragic :(', 'fucc', 'Your fate is quite depressing.', 'Aaaannddd it is false โ™ช', 'Aaaannddd it is true โ™ช' ] const eightball_embed = new Discord.RichEmbed() .setAuthor('๐ŸŽฑ Omobot says: ๐ŸŽฑ') .setColor('#9f87ff') .setDescription(message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)])); if (!message.content.startsWith(settings.prefix)) return; message.channel.sendEmbed(eightball_embed);

#

it says it outside the embed for some reason

elder rapids
#

.setDescription(message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)]));

#

message.channel.sendMessage(

#

????

earnest phoenix
#

The desciption has (sendMessage) in it

trim plinth
#

oof

#

that is what you call me not noticing random typos in my code zoomeyes

topaz fjord
#

thats not a typo

#

thats a fuck up

pale light
#

Ono

trim plinth
#

@topaz fjord agreed

topaz fjord
#

@pale light dont ban

pale light
#

zoomeyes convince me

topaz fjord
#

erm

#

ill let u post my nudes?!?!?!

pale light
#

k good enough

south finch
#

LOL

trim plinth
#

oh my

#

this is uh

south finch
trim plinth
#

slowly walks away

pale light
#

yea

topaz fjord
#

@south finch no u

pale light
#

lets get out

topaz fjord
#

leaves

earnest phoenix
#

I need some help. In discord.js, how would I get the bot to send a welcome message when it joins a guild? (client.on, what??)

pale light
#

client.on guildCreate

earnest phoenix
#

Thanks

pale light
earnest phoenix
#

@earnest phoenix If your talking about when it joins a guild I got a script that shows it in audit log.

#

console*

#

But in the mean time. Does anyone know how to make a mention work. For like @pseudo root help

#

I use discord.js

#

@austere meadow Yo, Any help?

austere meadow
#

whats up

#

oh

#

message.mentions.first()

earnest phoenix
#

Like?

#

if (msg.mentions.first('HELP')
message.channel.send('Blah blah')

#

Like that?

austere meadow
#

or you can just do if (message.content.startsWith("<@" + client.user.id + ">"))

earnest phoenix
#

.

#

@austere meadow Wouldnt this work?
if (msg.mentions.first('HELP') message.channel.send('Blah blah')

austere meadow
#

nah

#

thats not how it works

earnest phoenix
#

Could you write one?

austere meadow
#

im not gonna write one for you but you can use

if (message.content.startsWith("<@" + client.user.id + ">") + " help") {
//stuff
}
#

thats a basic way to do it

earnest phoenix
#

if (message.content.startsWith("<@" + client.user.id + ">") + " help") {
message.channel.send('Blah Blah?')
}

austere meadow
#

yeah

earnest phoenix
#

Mk

#

And

#

I can change client to bot?

austere meadow
#

yeah

earnest phoenix
#

I use bot.on

austere meadow
#

keep in mind that wont work

#

if the bot is nicknamed

earnest phoenix
#

OOF

austere meadow
#

since discord uses <@! for nicknames

earnest phoenix
#

Well its someones fault if they nicknamed my nice bot.

austere meadow
#

ok GWchadThonkery

earnest phoenix
#

xD

#

@austere meadow (node:8528) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Missing Permissions
(node:8528) [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.

austere meadow
#

read what it says

earnest phoenix
#

(node:8528) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): DiscordAPIError: Missing Permissions

austere meadow
#

missing permissions

earnest phoenix
#

oof

#

@austere meadow MUTE MY BOT

#

I messed up

#

Its spamming

austere meadow
#

what

earnest phoenix
#

in my other test discord

austere meadow
#

end the process

#

muting it here wont do anything

earnest phoenix
#

Mk

#

Just incase someone tagged it.

#

@austere meadow What permissions are the bot missing?

austere meadow
#

im not sure

#

thats for you to figure out

earnest phoenix
#

@austere meadow Anything wrong with this?
if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') { message.channel.send('List of Commands: -weather (City), -ping, -donate, -invite, -discord, -help, -aboutme, -updates') console.log('Help+Mention Command Ran') return; }
Bot is spamming the command.

zealous veldt
#

use a code block please

#

```js
<code>
```

earnest phoenix
#

Mk

zealous veldt
#

thanks, it just makes it much easier to read the code ๐Ÿ˜ƒ

earnest phoenix
#
  if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') {
  message.channel.send('``List of Commands:`` -weather (City), -ping, -donate, -invite, -discord, -help, -aboutme, -updates')
  console.log('Help+Mention Command Ran')
  return;
  }```
austere meadow
#

change if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') {
to if (message.content.startsWith("<@" + bot.user.id + ">" + ' HELP')) {

zealous veldt
#

well, the bot will only register the command if you type help in caps

earnest phoenix
#

No.

#
  let msg = message.content.toUpperCase();
zealous veldt
#

you're not using msg

#

you're using the message object

#

so change js if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') {
to

if (msg.startsWith("<@" + bot.user.id + ">") + 'HELP') {
#

also, you probably don't need that js return;

earnest phoenix
#

But.

#

Help+Mention Command Ran
(node:7856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Missing Permissions
(node:7856) [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.
Help+Mention Command Ran
(node:7856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): DiscordAPIError: Missing Permissions
Help+Mention Command Ran
(node:7856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): DiscordAPIError: Missing Permissions

zealous veldt
#

one sec

strange escarp
#

Can you create embeds in discord.js?

zealous veldt
#

add this line: js if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
so you're code looks like this, then try it

if (msg.startsWith("<@" + bot.user.id + ">" + ' HELP') {
if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
  message.channel.send('``List of Commands:`` -weather (City), -ping, -donate, -invite, -discord, -help, -aboutme, -updates')
  console.log('Help+Mention Command Ran')
  return;
  }
#

@strange escarp yes

strange escarp
#

I'm not seeing any kind of embed object in the reference

zealous veldt
#

it's called RichEmbed

#

you can also use JSON to make them

strange escarp
#

Thanks

zealous veldt
#

no problem

earnest phoenix
#

@zealous veldt How did you get fired?

#

And

#
if (msg.startsWith("<@" + bot.user.id + ">" + ' HELP') {
                                                       ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:607:28)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
austere meadow
#

you're missing a )

strange escarp
#

^

austere meadow
#

before {

earnest phoenix
#

Mm

#

Sigh

#
if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
                 ^

TypeError: Cannot read property 'permissionsFor' of undefined
    at Client.bot.on.message (C:\Users\owner\Desktop\Weather Bot\app.js:30:18)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:330:35)
    at WebSocketConnection.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:293:17)
    at WebSocket.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)```
strange escarp
#

Where do I put the client ID for discordjs?

earnest phoenix
#

You dont need to?

strange escarp
#

Wot

earnest phoenix
#

You need the token.

strange escarp
#

The last library I used needed both the ID and token

earnest phoenix
#

@strange escarp Are you using bot.on(''?

zealous veldt
#
<client>.login(<token>);
earnest phoenix
#

Or

#

bot.on

#

@zealous veldt

#
if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
                 ^

TypeError: Cannot read property 'permissionsFor' of undefined
    at Client.bot.on.message (C:\Users\owner\Desktop\Weather Bot\app.js:30:18)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:330:35)
    at WebSocketConnection.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:293:17)
    at WebSocket.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)```
zealous veldt
#

change msg to message sorry

earnest phoenix
#

But I got

#
let msg = message.content.toUpperCase();```
zealous veldt
#

only change it in that if statement i sent you

#
if (!message.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}```
#

there

#

dont change anything else

earnest phoenix
#

@zealous veldt

zealous veldt
#

yes?

earnest phoenix
#
if (!message.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
                                              ^

TypeError: Cannot read property 'me' of undefined
    at Client.bot.on.message (C:\Users\owner\Desktop\Weather Bot\app.js:30:47)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:330:35)
    at WebSocketConnection.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:293:17)
    at WebSocket.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)```
zealous veldt
#

oh

fathom pebble
#

that says msg

zealous veldt
#
if (!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}```
#

yeah

#

whoops, try that

fathom pebble
#

but im not sure if you're using msg or message in your bot

zealous veldt
#

he's using message

#

he has a var named msg, but thats just a .toUpperCase string of message.content

earnest phoenix
#

Ayy.

#

It worked.

zealous veldt
#

what does your console say?

earnest phoenix
#

Help+Mention Command Ran

zealous veldt
#

cool

earnest phoenix
#

Ps.

#

Nvm

zealous veldt
#

you might want to change it to this though

if (!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES')) return console.log('bot does not have send message permission');
earnest phoenix
#

No.

#

return should be after console.log

#

@zealous veldt Right?

#

Otherwise it cancels console.log

zealous veldt
#

what i sent will prevent the bot trying to send a message when it cant

#

and no, return wont block the console.log

#

when you do something like js return console.log('hello world');

#

it will returns the instruction to run the console.log

#

and then stops

earnest phoenix
#

Ay, I finshed my requirements for certify. I only need 100 Servers now. 90 Servers to go.

zealous veldt
#

lol

earnest phoenix
#

@zealous veldt One more thing.

#
bot.user.setActivity('Prefix: - | Say -help')``` How can I add the server count to this?
zealous veldt
#

hold on

#

server count is bot.guilds.size @earnest phoenix

earnest phoenix
#

Ik that.

zealous veldt
#

so js bot.user.setActivity(`Prefix: - | Say -help | Servers: ${bot.guilds.size}`)

earnest phoenix
#

Mm

#

Mk.

#

Ayy.

#

Worked

zealous veldt
#

awesome!

strange escarp
#

Still isn't sure what my bot will do yet

earnest phoenix
#

@strange escarp Are you doing discord.jsร‰

strange escarp
#

Yes

earnest phoenix
#

Mk

#

Let me give you something to start off with

strange escarp
#

Just started using it for the first time

#

I already have a base

#

I just need it to have a purpose

earnest phoenix
#
const Discord = require('discord.js');
const bot = new Discord.Client();

const prefix = '-';

let msg = message.content.toUpperCase();
let sender = message.author;
let cont = message.content.slice(prefix.length).split(" ");
let args = cont.slice(1);

  // Commands

  // Ping
  if (msg === prefix + 'PING') {

    message.channel.send('Ping!');
console.log('Ping Command Ran')
  }
bot.on('ready', () => {



  bot.user.setStatus('dnd') // Can be 'Online', 'idle', 'dnd', 'invisible'.

  bot.user.setActivity(`gamestat`) // Can be whatever


});

bot.login('token');```
#

@strange escarp Then run the node.

#

and try doing -ping with your bot.

strange escarp
#

I know how to do it

#

I just need ideas of what it would do

earnest phoenix
#

Moderation.

strange escarp
#

Something unique

earnest phoenix
strange escarp
#

I have

#

I want it to be different

#

Not these classic moderation bots or whatever

earnest phoenix
#

how do i get the bot developer rank??

#

and how long does it take to approve a bot?

glossy sand
#

@earnest phoenix you get bot developer automatically once you have at least one verified bot

earnest phoenix
#

oh okay

glossy sand
#

bot verification takes anywhere from a minute to a week

#

you'll just have to wait

earnest phoenix
#

thanks due

#

dude

austere meadow
#

does anyone here have any experience with lavalink (more specifically, lavalink.js)? ive been trying to get it working for a while now, but im having this issue where it fails to connect to the voice channel
it consistently times out and i don't know what the issue is https://please.zbot.me/DByN1PLK.png
here's a screenshot of the lavalink server console as well, notice at the bottom it says "Unexpected operation: connect" https://please.zbot.me/7M2T6Tre.png

inner jewel
#

what server version are you using?

austere meadow
inner jewel
#

if you downloaded it recently you're probably with a 2.0 server

#

rn only the java wrapper supports 2.0

austere meadow
#

oh

austere meadow
#

alright, thanks for the help agooglehearts

#

cheers natan that worked blobthumbsup

strange escarp
#

Quick question: Does Javascript have a function like Lua's pcall?

languid dragon
#

what does pcall do

strange escarp
#

Basically it wraps the function inside it with a kind of protective shell

#

So like

languid dragon
#

a protective shell? what would be the practical use for that

strange escarp
#

Let's say I gave everyone access to eval

copper plank
strange escarp
#

Stupid example I know

#

But I wrapped it in pcall

#

They wouldn't be able to access client.token

languid dragon
#

so kinda like a virtual machine

strange escarp
#

Yeah

languid dragon
#

i think there is a way you could do that

strange escarp
#

Almost like it initializes it's own env

languid dragon
#

an empty js environment

#

almost like a child process

strange escarp
#

So it prevents them from messing with my bot

inner jewel
#

js has try catch

strange escarp
#

Yes but it isn't the same

inner jewel
#

it's the equivalent of pcall

strange escarp
#

Yes and no

inner jewel
#

pcall just returns true, <function returns>

strange escarp
#

pcall does act a bit like try/catch

inner jewel
#

or false, error

strange escarp
#

But it doesn't do exactly what I'm looking for

inner jewel
#

pcall is literally try catch

#

having a custom env in lua is the 4th arg to load()

strange escarp
#

Isn't pcall "Protected Call"?

inner jewel
#

a = 123
print(load("return a", nil, nil, {})())

#

protected as in catch errors

strange escarp
#

Ah

#

Well RIP my past code

languid dragon
#

although your idea isn't lost

strange escarp
#

True

languid dragon
#

i think it could be possible to create a protected enviroment in which u can run javascript

strange escarp
#

Can you use WebAssembly in Node?

languid dragon
#

1 sec

strange escarp
#

I'm new to using node

languid dragon
#

ok so like

#

u could make a child_process, run node inside that, and send data through the child channel into that process

#

and that should be protected

strange escarp
#

Fair enough

languid dragon
#

the only thing i'd suggest would be removing the ability to exit the process

strange escarp
#

That answers my previous question

languid dragon
#

otherwise you could just create a new process every time

#

and since you're running an eval, it would be easy to send a string through the channel

#

its a really smart idea and if you dont mind im gonna try implement it into my bot as well :]

strange escarp
#

Also just a thought

#

People who add an eval command to their bot....

#

It's not a good idea

languid dragon
#

yeah

strange escarp
#

Have it run code from the console or something

languid dragon
#

that's why it should only be restricted to owner only

strange escarp
#

Only you have access to that

#

In fact, yesterday

#

And accidentally got someone's bot token

#

Because they didn't secure eval

languid dragon
#

smh, silly bot devs

heady zinc
#

sandboxing with a child process ? zoomeyes

languid dragon
#

yeet EYES

heady zinc
#

sounds sexy

languid dragon
#

it honestly does

#

i wanna try it lul

heady zinc
#

imma steal that

languid dragon
#

same LOL

strange escarp
#

Has someone already made a Reddit command?

languid dragon
#

likely

#

if theres reddit API

#

there's probably a reddit command

strange escarp
#

There is

#

RIP my ideas

languid dragon
#

nah make a better one ;]

inner jewel
#

sandboxing and child processes

#

what could go wrong

languid dragon
#

everything

strange escarp
#

Also in Javascript with switch/case can you have it trigger if it matches one of many strings?

inner jewel
#

inb4 forgets to remove fs

languid dragon
#

^

#

LOL

strange escarp
#

RIP @inner jewel

inner jewel
#

inb4 js let a = [] while(true) a = [a]

strange escarp
#

Aaaaaaaaaaaaaaaaaaaaaaa

inner jewel
#

lots of GCs can't handle that

strange escarp
#

Well let's see

#

You're basically placing an array inside of an array inside of an array inside of an array inside of an array inside of an array inside of an array inside of an array ....

inner jewel
#

and some GC algorithms stack overflow on that

#

if you were more evil

#

you could make it use a lot of memory

#

using string concatenations

#

while(true) string = string + ' '

strange escarp
#

If you were more evil, you'd place bytecode in the memory and find a way to execute it.

inner jewel
#

after a few thousand iterations you'd be creating kbs of garbage each iteration

strange escarp
#

The APIs they have here don't do much

earnest phoenix
#

well, i wanna make a simple bot fr my server, i was hopin somebody could direct me towards resources, (python btw)

#

i'm super noob

pale light
earnest phoenix
#

hmmm thanks

earnest phoenix
#

@earnest phoenix When you use the multiple scopes, such as bot and identify (and set require code grant), the user will be redirected to the redirect uri, additionally in the query string is the guildid for the selected guild.

strange escarp
#

Is there something like deborphan for npm projects?

spare spruce
#

yo how i make next line on discord js

inner jewel
#

\n

spare spruce
#

kk

#

"\n 1. Do not BEG for SUB Rank, We Take ROLE as Payed Monthly for supporting WORK!" +

#

like that

quiet bobcat
#

Yup like that

maiden trout
#

can anyone help me out with my bot?

pale light
#

what language

#

whats the problem

#

need specifics

maiden trout
#

the person i was getting help from earlier made me install python

#

didnt know multiple languages could be used

#

well i need to put scripts into my bot, not sure how

#

ive been asking around

#

im not really sure

#

i dont know anything about bots

#

i just recently have been trying to create one

#

i have it set up and its in a couple servers already

#

but its offline and has no use yet

earnest phoenix
#

Take apart a bot

#

Oh

maiden trout
#

what doi you mean by that

pale light
earnest phoenix
#

Are u using discord.js?

maiden trout
#

not sure

earnest phoenix
#

I know the code for activity

maiden trout
#

o

pale light
maiden trout
#

could you send me it?

earnest phoenix
#

Surr

pale light
#

Bu - Today at 4:02 PM
the person i was getting help from earlier made me install python

mighty barn
#

๐Ÿคฆ

earnest phoenix
#

Out of all of them, this is the only one that worked for me:

#

client.user.setActivity('YouTube', { type: 'WATCHING' });

maiden trout
#

aight could you explain how i put that into my bot

#

or

#

apply it

#

whatever you do

earnest phoenix
#

Well, make sure u ended ur last code correctly

maiden trout
#

never added an6y

earnest phoenix
#

And then its as simple as copy that code

pale light
#

@maiden trout I highly suggest you learn an application language such as python or javascript first

maiden trout
#

thats what the last person said

earnest phoenix
#

He was right

maiden trout
#

i dont want to spend a month trying to learn a lanaguage im only using once

#

and will probably never use again

pale light
#

if you're not willing to put in the effort then why are you making a bot

maiden trout
#

i thought it would be more simple than this

mighty barn
#

Just clone a red bot or smth

earnest phoenix
#

Hmh

restive silo
#

its programming, what did you expect to be simple about it

#

...

maiden trout
#

a lot

#

my friends does this all the time, makes it sound easy

mighty barn
#

It's like a language you learn

earnest phoenix
#

makes

mighty barn
#

english, French, etc.

#

And you just have to understand it to make up a sentence

maiden trout
#

theres another problem

#

i cant

#

find any where

#

on the internet

pale light
#

Wait if your friend does it all the time, why don't you ask them to help

mighty barn
#

^

maiden trout
#

because hes retarded and keeps asking me something about lua