#development

1 messages · Page 803 of 1

earnest phoenix
#

i get this

quartz kindle
#

recent windows versions have that enabled by default

#

no

#

no

#

no

#

dont

#

you are following a very old outdated tutorial

#

pls

#

has been dead for 2 years

earnest phoenix
#

where do i find new one

sudden geyser
#

no where

quartz kindle
summer torrent
quartz kindle
#

yes

earnest phoenix
#

do i remove all my stuff in my folder for discord

#

i have this

quartz kindle
#

you need node.js installed in your system

#

yes you can remove those

earnest phoenix
#

i got one already

#

is this correct one

#

cuz i dont think this one is

summer torrent
#

npm install discord.js

earnest phoenix
#

so i type that

#

is that correct

true ravine
#

You do that from powershell

#

Or command prompt

#

Whichever tickles your fancy

earnest phoenix
#

i type npm install discord.js in power shell???

true ravine
#

Yeah

#

If stuff is installed right that should work

earnest phoenix
#

this one

quartz kindle
#

you need to run npm init

#

to create a package.json file

earnest phoenix
#

npm init in powershell????

quartz kindle
#

yes

true ravine
#

Indeed

#

Powershell is cool

earnest phoenix
#

is that correct

true ravine
#

Lovely

earnest phoenix
#

ok then

true ravine
#

Press enter

earnest phoenix
#

again????

true ravine
#

Just keep doing it for a bit

earnest phoenix
#

spam enter right

true ravine
#

Basically

#

Should make a file for you

earnest phoenix
#

i spammed enter

#

and get this

#

do i keep doing it

true ravine
#

You can stop now

earnest phoenix
#

ok what else

true ravine
#

Check the folder was made

#

File I mean

#

Should be called package

earnest phoenix
#

is that correct

true ravine
#

Looks like it

earnest phoenix
#

ok

#

what else

true ravine
#

You need an index.js file where everything starts from

earnest phoenix
#

wat

true ravine
#

You should be able to find a YouTube tutorial on it

#

Just search how to make a discord bot

#

You also need some prior programming experience

earnest phoenix
#

where can i find that

true ravine
#

Programming experience?

earnest phoenix
#

yes

true ravine
#

But there are alternatives

#

You basically just need to understand how to code because otherwise your brain will explode

earnest phoenix
#

i never code

#

this is my first time

true ravine
#

That's a slight obstacle then

#

I recommend you learn first

#

Ideally learn JavaScript if you're looking anywhere

earnest phoenix
#

there this codecademy pro

#

what does it do

true ravine
#

It gives more activities

#

I haven't used it I just used the free stuff

earnest phoenix
#

do i learn "Give me a custom recommendation" or "I want to explore on my own"

true ravine
#

Probably the second one

#

And then choose JavaScript related things

earnest phoenix
#

the i want to explore thing

true ravine
#

Yeah

earnest phoenix
#

i will learn javascript right

true ravine
#

Yeah

#

Don't expect to be good at it very quickly

#

I've been programming for 7 years and I still think that making a bot is hard

#

But you gotta start somewhere

earnest phoenix
#

does codecademy work on games

true ravine
#

What do you mean?

earnest phoenix
#

like people make their own servers and they code

quartz kindle
#

programming is an entire world, there is endless things to learn

#

you can do literally anything with programming

earnest phoenix
#

aight

quartz kindle
#

but at the same time, there is always "the right tool for the job"

#

so you need to learn a LOT

#

before you can start doing more complex things

true ravine
#

Certain languages are more suited to a particular thing so it's all about learning the right language for what you want

earnest phoenix
#

aight

quartz kindle
#

language, architecture, environment, target platform, etc...

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

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.login(TOKEN);```
summer torrent
#

Has anyone worked with Instagram Real Time API?

topaz fjord
#

@quartz kindle you can create a girlfriend with coding

sudden geyser
#

get a waifu for christmas

quartz kindle
#

well, robot "girlfriends" are improving everyday

amber fractal
#

Sadly. Time for more antisocial people, let's go.

unique nimbus
#

I mean

#

all that needs is AI training

#

however proper robotics needs a lot more training it is nowhere near

pine bear
#

i'm confused, they said this will work but it did send a welcome message.

client.on('client.guilds.channels.get', member => {
    member.guild.channels.get('660593478807322634').send("Hey there" + `${member.user.tag}` + "Welcome to She ra https://tenor.com/view/fighting-combat-duel-battle-sword-fight-gif-13471573");
});

this is strange

#

I think it's the link.

#

No.

summer torrent
#

there is no event called "client.guilds.channels.get"

#

i think you want use guildMemberAdd

pine bear
#

MMM

summer torrent
#

client.on("guildMemberAdd"

pine bear
#

Seems like a similar event.

#

That happened earlier

#

So what about this?

member.guild.channels.get
^^^^^^^^^^^^^^^^^^^^^^^^^
copper cradle
#

you gotta read the docs

#

like

#

seriously wtf are you doing

copper cradle
#

also the object you're calling member isn't a member object it's a guild object, the name doesn't matter but the properties you're trying to access don't exist the guild object has the channels property

#

so in your case it should be. member.channels.get(you know what to do here)

quartz kindle
#

guildMemberAdd returns a member, not a guild

copper cradle
#

ah shit

#

I read guildCreate

#

for some reason

#

¯\_(ツ)_/¯

#

but still

quartz kindle
#

@pine bear whats your current code?

copper cradle
#

yeah

#

show ur code

#

I'm literally blind

#

i need glasses

#

and I don't have 'em

quartz kindle
#

i need glasses as well, but no money to buy them =X

copper cradle
#

oof

pine bear
#
client.on('guildMemberAdd', member => {
    member.channels.get('660593478807322634').send("Hey there" + `${member.user.tag}` + "Welcome to She ra https://tenor.com/view/fighting-combat-duel-battle-sword-fight-gif-13471573");
});
grizzled raven
#

@pine bear what version of djs?

copper cradle
#

don't listen to what I said @pine bear

#

I was being fucking blind

grizzled raven
#

yall out here mixing events and didnt bother to ask for more context smh

pine bear
#

Lemme run the command to see

copper cradle
#

and read guildCreate

grizzled raven
copper cradle
#

see

quartz kindle
#

hes on v11

pine bear
#

6.13.4

quartz kindle
#

should be member.guild.channels.get

pine bear
#

That was the old code

grizzled raven
#

leave it as member.guild.channels.get, or use member.client.channels.get

copper cradle
#

@pine bear yeah and it was right, I read guildCreate, so the code I sent only works in the guildCreate event

pine bear
#

Yea huh

#

so typing

client.on('member.client.channels.get', member => {
    member.channels.get('660593478807322634').send("Hey there" + `${member.user.tag}` + "Welcome to She ra https://tenor.com/view/fighting-combat-duel-battle-sword-fight-gif-13471573");
});

should work?

quartz kindle
#

no

#

you changed the wrong thing

#

guildMemberAdd is correct

#

member.channels is not

pine bear
#

Oh I see by what you mean.

quartz kindle
#

if you go to the docs website

#

you can see all possible values you can put there

#

client.on("channelCreate")
client.on("guildMemberAdd")
etc...

#

all possible values are listed there

pine bear
#

I forgot about that, must add it to my vocabulary.

#

It also appears that https is also in my browser.

grizzled raven
#

tim ur still on light mode turn off the lights

pine bear
#

lol

#

next step, creating a module. I'll work on it in a sec.

quartz kindle
#

wait d.js has dark mode?

#

why didnt i know about that

#

lmao

copper cradle
#

@quartz kindle bruh

grizzled raven
#

i literally just found out that topgg has dark mode, or i already knew and just forgot about it

pine bear
#

For dark mode

#

Dang, You click the "SUN" icon on the top left of the screen

sudden geyser
#

or suffer and scroll to the bottom of the page for the button

quartz kindle
#

^thats what i did

pine bear
#

Ahh! I can't really tell what's going on with command handlers, I'll try to understand it later, then make a module. because I don't want to start something if I don't know how to set it up.

earnest phoenix
#

can i get help

pine bear
#

You might need to clarify what do you need help with, also. I might not be of any help anyway! 😔

earnest phoenix
#

error

ionic anchor
#

Hey someone can help me i cant install diskusage package..

formal agate
#

ok, so in python i have a global var set at line 23 using row_counter = 0 and on line 121 inside of a function im adding 1 to it using row_counter += 1. Im getting the error local variable 'row_counter' referenced before assignment. With global vars it just has to be defined before it is even used in a function as far as i am aware. So im wonder what on earth is causing this issue because i must be missing something.

halcyon ember
#

whats the discord.js kick function

sudden geyser
#

you mean the GuildMember kick method?

halcyon ember
#

whats that lol

hoary elm
halcyon ember
#

Oh that thing i tried it once and it gave me this error

#

(node:27358) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:27358) [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.

hoary elm
#

Oh 🤔

earnest phoenix
#

I don't know why i can't get the guild iconurl??

rain sail
#

hey guys im new is this were u get the code

earnest phoenix
#

No sorry this is my error i don't have put any icon for the guild....

amber fractal
#

that's not how programming works

pine bear
#

@rain sail You learn programming language and get the necessary coding environment set up type the code yourself.

pine bear
#

I'm working on modules and do I put the entire event block in the module js file? Because I want to put the entire roll command in that module file instead of my main js file.

#

Like then create a const value and set it to ('./modulename.js') etc in the main.js file

astral yoke
#

Hello. I'm attempting to make a seperate bot that's duty is to stare at my main bots status, when it goes offline, it detects it, then tells me.

#

Heres the error code.

#
    if (dogbot.presence.status != "online") owner.send("DogBot has crashed or is offline."); // If DogBot is not online, send the owner this message
               ^

TypeError: Cannot read property 'presence' of undefined
    at Timeout._onTimeout (C:\Users\Cools\Downloads\StatusBot\index.js:26:16)
    at listOnTimeout (internal/timers.js:536:17)
    at processTimers (internal/timers.js:480:7)

C:\Users\Cools\Downloads\StatusBot>```
#

Here is my code.

#

Index.js^

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

const client = new Discord.Client();

const config = require("./config.json");


client.on("ready", () => {
  console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`); 

  client.user.setActivity(`DogBots status!`);
});

const owner = client.users.get("279116778246766593"); 
const dogbot = client.users.get("679211740202008596"); 

setInterval(function(){
    if (dogbot.presence.status != "online") owner.send("DogBot has crashed or is offline."); // If DogBot is not online, send the owner this message
}, 60000); 


client.login(config.token);

slate oyster
#

dogbot is never defined

#

wait

#

oh

#

client.users.get is returning undefined

#

Probably an invalid id being passed

astral yoke
#

What would I be able to replace it with?

#

Hm.

#

Likes the owner id/dogbot id?

#

Let me recheck that.

#

Yeah, I believe you're right.

#

I'm going to check.

red hollow
#

@earnest phoenix try iconURL()

earnest phoenix
#

@red hollow i'm not in v12(dev) i'm in stable(11.6.1) and this is iconURL but the server doesn't have icon sorry

red hollow
#

oh

earnest phoenix
#

I have add an icon and this work

red hollow
#

its null then

earnest phoenix
#

Yeah sorry

astral yoke
#

I retried it and it's still undefined.

#

@slate oyster

slate oyster
#

Weird

astral yoke
#

Do you think it would have to have to deal with adding " run: async (bot, message, args) => {}"?

#

Or would that be unrelated?

slate oyster
#

I don't see that line in the code
Anyways though, if that lambda has an empty body, it should do n
Wait that's not a lambda
Must be some code thing I don't know about

astral yoke
#

Oh hm, anyone else know?

slate oyster
#

Wait
oh that is a lambda

#

just different syntax then I thought

#

¯_(ツ)_/¯

astral yoke
#

Hm okay.

#

Thanks.

slate oyster
#

Anyways though
If it has an empty body
the lambda should do nothing

#

Perhaps try moving all your code into the ready event handler?

slate oyster
slate oyster
#

But I'm too lazy to do all of that

#

So I instead just send "Localize this message"

#

Ok, I'ma test my new feature
I'm quite sure I forgot some code somewhere
But maybe I didn't

pine bear
#

I'll ask again in a few hours

slate oyster
#

@pine bear You put the event in your main file, and then call your roll command that is in another file
At least, that's what I would do

pine bear
#

Oh ok

slate oyster
#

Oof
I meant to save some data in a chatlink document
but I instead saved it in a channel document
so my command gave me a "no such chatlink" error
Will fix tomorrow
Goodnight

pine bear
#

Gn

#

nope, it's obvious I did something wrong.

#

I probably just missed something

pine aspen
#

Hey!

#

So.

#
const { gblacklist } = await con.prepare('SELECT blacklist FROM config WHERE guildid = ?').get(args[1]);
                    if (gblacklist == 0) {
#

The command is suposed to run like this

pm!bl g <guildid>

earnest phoenix
#

how good are u

copper cradle
#

@pine aspen yeah and?

#

do u think we're fucking magicians

pine aspen
#

Sorry.

#

I'm pretty sure the value is 1 or undefines

#

I'm doing a test for it.

earnest phoenix
#

how good are you

pine aspen
#

?

copper cradle
#

@earnest phoenix where r u from

pine bear
#

Yep, hit a road block.

earnest phoenix
#

how good are you at coding @pine aspen

forest mirage
#

client.fetchUser("547115752574943311").then(user => { const { createdAt } = user client.user.createdAt })

I’m just trying to eval and this isn’t working... (I’m trying to get my created date) I know I did something wrong but I can’t figure it out

pine aspen
#

@earnest phoenix I'm decent.

earnest phoenix
#

How do I set up this bot in my server

pine bear
#

@earnest phoenix Did you make the bot account?

earnest phoenix
#

I invited it to my server

forest mirage
#

This isn’t a bot support server.

earnest phoenix
#

I know that

pine bear
#

is he talking about his bot or a made bot?

earnest phoenix
#

If it’s not a rule I could care less

#

It’s called server list bot

forest mirage
#

Well no one’s gonna answer you. mmulu

pine bear
#

Lmao

copper cradle
#

@earnest phoenix no, it's called discord bot list not server list bot

earnest phoenix
#

Okay thank you

#

@forest mirage ask me how much fucks I give

copper cradle
#

this isn't any bot's support server

#

what are you looking for?

earnest phoenix
#

Well I’m trying to find a bot that tells me what servers people are in

hoary elm
#

You won't

#

That would be a breach of privacy

pine bear
#

I never heard of a bot that does that

forest mirage
#

const bradley = require("rage") bloblul

earnest phoenix
#

XD

pine bear
#

And yes

#

XD

earnest phoenix
#

Import Bradley as rage

forest mirage
#

Haha.

earnest phoenix
#

i need help

#

We all do

#

i dont knw you person

#

Oke

copper cradle
#

there's no such thing as a bot that "tells the servers ppl are in"

pine bear
#

maybe common servers?

earnest phoenix
#

That’s odd I got a bot in my server That is names “discord server list”.

hoary elm
#

I don't even think you would be able to list said servers if there was unless the bot was in them

pine bear
#

^

hoary elm
#

@earnest phoenix discord server list is a place to post and advertise your server

#

Same thing as the bot list but for servers

earnest phoenix
#

👍

forest mirage
#

I’ll just repeat what I said earlier lol.

client.fetchUser("547115752574943311").then(user => { const { createdAt } = user client.user.createdAt })

I’m just trying to eval and this isn’t working... (I’m trying to get my created date) I know I did something wrong but I can’t figure it out

hoary elm
#

The only reason you have that bot is that's how it gets your server info.

#

Well some of it

pine bear
#

I need a little help with something, I need to add a module.export but I don't know where in here.

if (command === 'roll'); {
    const value = parseInt(args.join(" "));

    if (isNaN(value)) return message.channel.send('Not a valid number to roll!');

    if (!isFinite(value)) return message.channel.send('Can\'t roll infinite!');

    isFinite

    const roll = Math.floor(Math.random() * value) +1;

    const embed = new Discord.RichEmbed()

.addField("You rolled", roll)

.setColor(0x00A2E8)

message.channel.send({embed})
 };
hoary elm
#

@forest mirage try const user = client.users.get('yourID') then use user.createdAt

forest mirage
#

Will do

#

Maybe it’s different since I’m on mobile haha.

#

Different as in visually different so I wrote it wrong.

hoary elm
#

For the eval to test it try something like

#
user.send("Hi")```
#

If that doesn't work then I honestly have no clue why it's blocking it 🤔

forest mirage
#

It does work

#

It’s just that once I have this I don’t even know where to go lol

pale vessel
#

it's a promise

forest mirage
#

Wait

#

Wrong ss

pine bear
#

ok, so I need to find out where to put the module.export variable in the js code in the module file.

pale vessel
#

i don't think you need client

#

(second last line)

hoary elm
#

Yeah he should be able to just do user.createdAt

pale vessel
#

client is the bot

pine bear
#

Oh hey toxic

hoary elm
#

Hey

forest mirage
pale vessel
#

and i think you can omit const { createdAt } = user too

forest mirage
#

Oh, really. Gimme a sec.

hoary elm
#

@pale vessel the only thing I couldn't remember helping him is if createdAt takes brackets after it

#

Like createdAt()

pale vessel
#

no

hoary elm
#

Yeah I didn't think so

#

But wasn't sure off the top of my head

pale vessel
#

createdAt and createdTimestamp like that

#

Timestamp is easier to format

#

like using moment

hoary elm
#

Ahh okay

forest mirage
pale vessel
#

await client.fetchUser

#

no im stupid

#

wait

#

yeah

forest mirage
#

bloblul dw me too

pale vessel
#

try await

forest mirage
#

instead of then?

pale vessel
#

still need then

hoary elm
#

I think he means await user.createdAt

pale vessel
#

sorry

#

await client.fetchUser

hoary elm
#

Oh

forest mirage
#

Ohh

pale vessel
#

oh yeah

#

because the promise is pending

forest mirage
#

Wait whats async...

pale vessel
#

yep

hoary elm
#

Yeah I was gonna say I don't think await will run out of async

pale vessel
#

})();``` ~~no?~~ nope
#

what's this for btw

hoary elm
#

He wants to get the date his acct was created

pale vessel
#

userinfo?

#

his?

hoary elm
#

Kinda but for him only

pale vessel
#

oh

forest mirage
#

I mean... yeah but I can do it with anyone after I figure it out lol

pale vessel
#

try

then(async (user) => {
  await user.createdAt;
});```
hoary elm
#

Also wouldn't it show the date if he added a message.channel.send(user.createdAt) ?

pale vessel
#

sure

forest mirage
#

Doesn’t work. It’s 1 AM and my brain is fried. Probably why I can’t figure it out bloblul thanks for all your help

pale vessel
#

i'll try it on my bot for you

forest mirage
#

Thanks!!

pine aspen
#
const { gblacklist } = await con.prepare('SELECT blacklist FROM config WHERE guildid = ?').get(args[1]);
                    if (gblacklist == 0) {

The command is supposed to run like this pm!bl g id

The resault of ID is gblacklist is undefined.

pale vessel
#

@forest mirage you there

forest mirage
#

Yeah

pale vessel
#

it's because user.createdAt does not exist

forest mirage
#

...

pale vessel
#

only user.createdTimestamp

forest mirage
#

So you can only get the bots creation date?

pale vessel
#

You can get user's too

#

createdTimestamp

#

createdAt is just formatted createdTimestamp

#

you can format it yourself

forest mirage
#
let s = bot.users.get('266432078222983169');
s.createdTimestamp;```
pale vessel
#
client.fetchUser(id).then(user => { console.log(user); });```
forest mirage
#

ok i tried to do that on mobile

#

it works anyhow

pale vessel
#

that id is just my id

forest mirage
#

Yep, thanks again

#

Really appreciate it!!

pale vessel
#

no problem

forest mirage
#

You as well Toxic

hoary elm
#

Np :)

earnest phoenix
#

Hi I have an error in my dashboard

#

This

#

If anyone can help me please dm me

#

Pretty sure that's a discord invite

#

@flat pelican ?

flat pelican
#

Hmh

earnest phoenix
#

I mean. Also. The subdomain

flat pelican
#

Bruh

pale vessel
#

i saw that

flat pelican
#

You created a loop

#

It redirects to the same domain once you pass the Oauth check

earnest phoenix
#

So I'm just a dumbass then and it wasn't an inv?

#

It was not

#

Invite

#

Btw what is that

#

Assuming you're missing a )

#

You’re missing a parantheses

#

*parentheses

#

} brace

#

] bracket

#

ik

#

O

#

at Function.render (/rbd/pnpm-volume/5fa57373-af26-4845-a77c-ff17ff4ff69a/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:580:17)12:41 PM

at ServerResponse.render (/rbd/pnpm-volume/5fa57373-af26-4845-a77c-ff17ff4ff69a/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/response.js:1012:7)12:41 PM

Jump To


#

What about this

#

idk

#

read the error

#

jump to the code

honest perch
#

Would hosting on a pi4 2gb ram be better than on glitch

pale vessel
#

sure

surreal sage
#

Is it possible to make a roblox connection to a game and be able to execute a command in game from discord

finite bough
#

@surreal sage yes

restive furnace
#

everything is possible.

tight plinth
#

everything is possible.
True

surreal sage
#

So i have to make a roblox client user

#

xd

earnest phoenix
pale vessel
#

add the module

earnest phoenix
#

Im new to coding

pale vessel
#

discord.js right?

earnest phoenix
#

yeah

pale vessel
#

open cmd

#

and navigate to bot folder

earnest phoenix
#

ok

#

so cd StreamNotifier

pale vessel
#

do npm i discord.js

#

sure

#

wait

earnest phoenix
#

wdym

pale vessel
#

okay go ahead

#

i was making sure if the missing module was discord.js

earnest phoenix
#

it says the system cannot find the path specified

pale vessel
#

just open the folder in explorer

#

click on the path box and type cmd and enter

earnest phoenix
torn nebula
#

cntrl+`
then
npm i discord.js

#

enter

#

you sure ur're missing discord.js module

earnest phoenix
#

idk

pale vessel
#

it's the only module used in the code

restive furnace
#

show ur package.json @earnest phoenix and the file whats it says its missing module.

pale vessel
#

oh. just type npm i then

torn nebula
#

or show error above
throw error in terminal

tight plinth
#

index.json

#

Hmm

#

It's index.js

pale vessel
#

it is index.js

earnest phoenix
pale vessel
#

you're right, outside the folder

tight plinth
pale vessel
#

it says index.js in the screenshot

tight plinth
#

What is that

earnest phoenix
pale vessel
#

open package.json and scroll further down

tight plinth
#

Put index.js file outside of ur node_modules folder

pale vessel
#

the whole bot is in the node_modules folder

torn nebula
earnest phoenix
pale vessel
#

config = discord waitWhat

tight plinth
#

What have you done...

earnest phoenix
#

idk you tell me

tight plinth
#

Normally u don't need to put anything inside node_modules folder

pale vessel
#

i can tell you got the code from github

earnest phoenix
#

no

#

I didnt

pale vessel
#

are you sure

earnest phoenix
#

I got it from yt lol

pale vessel
#

ah

#

even worse

tight plinth
#

Ah

#

Worse

#

Never follow a yt tutorial for djs

#

NEVER

tight plinth
#

This guide is better

pale vessel
#

wayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy better

#

don't follow some dude with a notepad on youtube

earnest phoenix
#

so do I restart the whole script?

tight plinth
#

Yes

pale vessel
#

delete everything and follow the guide

tight plinth
#

Delete everything and follow this guide

earnest phoenix
#

so delete my bot folder?

pale vessel
#

trust me it's important

tight plinth
#

Yes

#

Start from nothing

pale vessel
#

i feel old

earnest phoenix
#

how do I clear out VSC?

torn nebula
#

u can create new folder instead deleting

pale vessel
#

no, d e l e t e

tight plinth
#

Delete folder manually

torn nebula
#

..

tight plinth
#

And close vsc

pale vessel
#

the old folder won't help

#

might as well delete

earnest phoenix
#

So do I create a new folder through VSC?

pale vessel
#

and am i the only one who use classic notepad++ to code my whole bot?

tight plinth
#

@pale vessel yes

pale vessel
#

k

tight plinth
#

@earnest phoenix u delete ur workspace and everything on vsc

#

And start from nothing

earnest phoenix
#

yeah did that

tight plinth
#

Just follow the guide

pale vessel
#

"you are now on the right path!"

earnest phoenix
pale vessel
#

let it be

earnest phoenix
#

where do I put my code in?

pale vessel
#

index.js

#

what's inside the package.json?

earnest phoenix
pale vessel
#

yes. create a new file called index.js

earnest phoenix
#

where?

pale vessel
#

in the root folder (streamnotifier)

earnest phoenix
pale vessel
#

add the bot code in there

earnest phoenix
#

ight thx for the help

pale vessel
#

no problem good luck with the journey

pine bear
#

lol

pale vessel
#

bruh

earnest phoenix
#

uhgg

#

it keeps giving me a broken line

pale vessel
#

can we see the error

finite bough
#

@earnest phoenix

pale vessel
#

nice ping

earnest phoenix
finite bough
#

show ur package.json

pale vessel
#

that's normal

finite bough
#

.

pale vessel
#

you're not finished with the code yet

finite bough
#

^

earnest phoenix
#

sorry new to coding

pale vessel
#

it's ok

finite bough
#

its ok

pale vessel
#

don't say sorry

#

say "cool, i'm learning"

#

now that's pog

torn nebula
#

cool, i'm learning 🎉

finite bough
#

try referring to a guide

#

it helps

earnest phoenix
#

how do I add a prefix like for example sn!

pale vessel
#
if (!msg.content.startsWith("sn!")) return;```
earnest phoenix
#

thx

finite bough
#

const prefix = "sn!"

#

@pale vessel error => msg not identified

pale vessel
#

oops

#

change it to what you use

earnest phoenix
#

he uses nothing atm okeh

finite bough
#

}

pale vessel
#

yes

earnest phoenix
#

you need to close the brackets, do })

pale vessel
#

continue

#

not yet

finite bough
#

});

earnest phoenix
#

alr

pale vessel
#

that bot would be useless

#

add !

earnest phoenix
pale vessel
#

he did

#

maybe he's not following it anymore

finite bough
#

or u just do

#

commit break computer

#

like I did

earnest phoenix
#

I am following it

#

but I dont see the written code

finite bough
#

click see full code

#

at the bottom

pale vessel
#
const Discord = require("discord.js");
const client = new Discord.Client();
 
client.on("ready", () => {
  console.log("I am ready!");
});
 
client.on("message", (message) => {
  if (message.content.startsWith("ping")) {
    message.channel.send("pong!");
  }
});
 
client.login("SuperSecretBotTokenHere");```
#

delete everything and paste that and try to understand the code

earnest phoenix
finite bough
#

I remember

pale vessel
#

it's from the guide

finite bough
#

raging at an error

#

when I was new

pale vessel
#

same

finite bough
#

I was literally scared

#

RED TEXT

#

RUNN

pale vessel
#

ok, not that serious

earnest phoenix
#

When i started java, the entire screen was like a mix of red and yellow

#

i understood nothing lul

finite bough
#

type

pale vessel
#

});

finite bough
#

});

#

at the bottom

#

where the big Zag lineis

pale vessel
#

also delete that code (if (message.con...) it's useless

earnest phoenix
#

@earnest phoenix ya need to close the open brackets so node.js knows when you want the function to end

#

means })

pale vessel
#

more like javascript in general

finite bough
#

add ;

#

it makes a sad winky face

earnest phoenix
pale vessel
#

i use it even if it's optional

earnest phoenix
#

yes

#

perfect

pale vessel
#

remove that line of code

finite bough
#

before we go forward

#

where is the login token

#

.,.

pale vessel
#

add const prefix = "sn!";

earnest phoenix
#

Not existant

finite bough
#

XD

pale vessel
#

client.login(token)

#

store your token somewhere safe

earnest phoenix
pale vessel
#
if (msg.content == prefix + "kick") {
  code
}```
#

if it's too basic add args don't do it yet

earnest phoenix
#

i think we are just confusing him atm

pale vessel
#

hmm

earnest phoenix
pale vessel
#

nice copy paste

earnest phoenix
#

yeah

pale vessel
#

LMAO

earnest phoenix
#

you like it?

pale vessel
#

.then

#

no

finite bough
#

ok what

pale vessel
#

delete it

finite bough
#

how did u even learn that .then

earnest phoenix
#

deleted

pale vessel
#

add message.channel.send("Kick command here") to test it out

finite bough
#

@pale vessel he

#

has

#

no

#

token

pale vessel
#

i was going there

finite bough
#

throw the test in the dustbin

pale vessel
#

let him do one thing first

earnest phoenix
pale vessel
#

after you're done, you need to log in to the bot. you can do that by adding client.login("TOKEN") on the bottom

#

Token is the bot's token

earnest phoenix
#

I know that

pale vessel
#

nice

#

i was trying not to spoonfeed by explaining what it does lol

ocean frigate
#

I do the following in my code to get when the bot is voted, do I need to set the webhook url also in the bot's page on DBL?

bot.dbl_client = dbl.DBLClient(bot, bot.dbl_token, webhook_port=5000)

@bot.event
async def on_dbl_vote(data):
    uid = data["user"]
    print("Vote received")
    await increment_ticket(bot, uid)
pale vessel
earnest phoenix
pale vessel
#

yes

#

save and start the bot

#

open cmd in current folder and type node .

torn nebula
#

will get error from Package.json file GWloopyBlobShrug

pale vessel
#

yeet did you install the modules yet?

finite bough
#

or

earnest phoenix
finite bough
#

node index.js

pale vessel
#

nope

#

install the module first

#

npm i

earnest phoenix
#

ok done

pale vessel
#

now type node index.js

earnest phoenix
#

ok worked

pale vessel
#

type the command

earnest phoenix
#

the kick one?

pale vessel
#

yeah

earnest phoenix
#

msg

#

and message

pale vessel
#

change msg to message

earnest phoenix
#

you need to change msg.content to message.content

#

@earnest phoenix

#

kk

finite bough
#

or

#

do (msg)

#

instead of (message)

pale vessel
#

that's what i do to save space

earnest phoenix
#

message is more nice

pale vessel
#

arguable

finite bough
#

everyone had their own preference

pale vessel
#

yep

earnest phoenix
#

and i cant speak english yeet

finite bough
#

I used to do

#

m

#

m.content

earnest phoenix
#

bc the bot is off

finite bough
#

@earnest phoenix click f5

#

on ur keyboard

earnest phoenix
#

ok

#

oh wait...

#

I just realized I gave out the bot code...

finite bough
#

too blurry to see

earnest phoenix
#

regenerated anyway

#

thats why you usually store the token in annother file

#

it worked

#

ok

#

How do I create a custom status for my bot like "Watching _"

finite bough
#
client.user.setPresence({
    game: {
      name: `[text]`,
      type: "Watching"
}
});
earnest phoenix
#

use logic

#

that code doesn't make sense

#

if the message content equals exactly to "sn!kick"
then kick the first member mentioned

#

but there aren't any members mentioned because the content matches exactly to "sn!kick"

#

so how do I made it make sense?

#

lol

#

yikes

finite bough
#

:/

earnest phoenix
#

im new to coding...

finite bough
#

@earnest phoenix its ok continue learning

quartz kindle
#

Use .startsWith() instead of ==

#

You want to check if the message starts with the prefix and the ban command, not if the message is exactly that

#

Google js startswith to see how to use it

devout wraith
#

?i

#

-bots

gilded plankBOT
devout wraith
#

@stuck star i

#

Okayy ❤️

earnest phoenix
devout wraith
#

no right

#

red {

earnest phoenix
#

how do I fix?

devout wraith
#

save and test ?

quartz kindle
#

That will make the command run with any prefix

#

It only checks for prefix length, not what the actual prefix is

#

Also you have one else blocks too many

earnest phoenix
#

I cant even start the bot...

finite bough
#

from where did u get that

#

its messed up

earnest phoenix
#

yt :/

quartz kindle
#

You only have one IF, and yoi have two ELSE

finite bough
#

use guide or websites

quartz kindle
#

Remove the second ELSE part

earnest phoenix
#

I did

finite bough
#

wait

#

there r 2 ifs

quartz kindle
#

The first if is self-enclosing

#

It doesnt have an else

finite bough
#

oh nvm

earnest phoenix
#

client.on("message", (message) => {
let args = message.content.substring(PREFIX.length).split(" ");

switch (args[0]) {
    case 'kick':
        if(!args[1]) message.channel.send('You need to specify a person!')

        const user = message.mentions.users.first();
        
        if(member){
            member.kick('You were kicked from Stokeleys Streaming Den')() =>{
                message.reply('Successfully kicked ${user.tag}');
            }).catch(err =>{
                message.reply('I was unable to kick the member');
                console.log(err);
            });
        }else{
            message.reply("That user isn\' in the server")
        }
#

thats the code

#

rn

quartz kindle
#

Code blocks please

finite bough
#

ima fix it 2 min

quartz kindle
#

``` code here ```

#

Also, its member.kick().then().catch() and not member.kick()().catch()

finite bough
#

wait

#

that cmd has so many errors

#

@earnest phoenix

#
client.on("message", (message) => {
  const PREFIX = "sn!"
    let args = message.content.substring(PREFIX.length).split(" ");

    switch (args[0]) {
        case 'kick':
            if(!args[1]) message.channel.send('You need to specify a person!')

            const user = message.mentions.users.first();
            
            let member =message.guild.member(user);
   
            
            if(member){
                member.kick('You were kicked from Stokeleys Streaming Den').then(() =>{
                    message.reply(` Successfully kicked ${user.tag}`);
                }).catch(err =>{
                    message.reply('I was unable to kick the member');
                    console.log(err);
                });
            }else{
                message.reply("That user isn' in the server")
            }
            
    }
});
mossy vine
#

spoonfeeding arent we

finite bough
#

welp

pale vessel
#

delicious

quartz kindle
#

thats still not checking for prefix lmao

blissful scaffold
#

It will accept the command with any 3 character prefix

pale vessel
#

make it so that it ignores commands that don't start with the prefix

earnest phoenix
#

Can you set a bot status to idle?

pale vessel
#

sure

restive furnace
#

clientPresence#setStatus

#

@earnest phoenix

earnest phoenix
#

Nothing happened

quartz kindle
#

then you did it wrong

pale vessel
#

put it on onready

earnest phoenix
pale vessel
#

no

#

try setPresence()

earnest phoenix
#

Ok

finite bough
#

using idle is a bad idea

#

on glitch

pale vessel
#

on glitch

finite bough
#

yea

#

coz

#

if u dont set up a watch.json

#

everytime it resets

#

the status goes online

pale vessel
#

why

finite bough
#

it wouldnt look ligit

#

that's how life is

pale vessel
#

sad

finite bough
#

precisely

earnest phoenix
#

I remember it worked before on my old bot

#

And it stop working on day

pale vessel
#

then you messed something up

earnest phoenix
#

I didn’t edit the bot but the bot is on glitch so

pale vessel
#

why do you want your bot to be idle anyway

earnest phoenix
#

Idk

pale vessel
#

ok

#

did you do whatever this is?

earnest phoenix
#

Whatever I will not set the status to idle

pale vessel
#

great idea

#

make your life easier when you can

finite bough
#

I use idle mode

pale vessel
#

okay, go on....

finite bough
#

yes

#

forever idle

pale vessel
#

yes

#

ok

finite bough
#

#lazygang

pale vessel
#

good talk

finite bough
#

mhm

earnest phoenix
#

Anyone know cheap vps for discord bot

cursive dagger
#

Contabo

summer torrent
#

check pinned messages

finite bough
#
client.once('ready', ready => {
  console.log('Ready');
  
  client.user.setPresence({
            game: {
                name: `prefix is ${config.prefix}`,
                type: "Watching",
              url: 'https://youtu.be/kt-j6Gwzx84',
               
            },
            status: "idle",
        });
  
  
});
cursive dagger
#

Yeah

finite bough
#

Jacob u can use that as reference

summer torrent
#

setActivity()

earnest phoenix
#

Do I need to add watch.json or something

finite bough
#

well

#

nah

#

I didnt add it

#

coz it's too unepic

earnest phoenix
#

lol

finite bough
#

is it working

#

@earnest phoenix

earnest phoenix
#

Just show me error

#

Whatever

finite bough
#

wut

#

yes

#

error coz

#

"config.prefi,

earnest phoenix
#

Just wondering do I put the help command on my bot website or respond with the help command ?

warm marsh
#

Do both.

pine aspen
#

Hey, this is kind of related to Development. How could I do if my node index.js is running if my program is running. If it stops it sends a webhook saying the bot stopped.

finite bough
#

@pine aspen to where

pine aspen
#

A discord webhook.

slender thistle
#

An external process manager

pine aspen
#

@slender thistle got a name?

#

Like a good one you know of?

sick cloud
#

@pine aspen what lib you using

slender thistle
#

Ehh just a simple script that tracks your processes, not familiar with node.js stuff

earnest phoenix
#

How to send output of a code as a command in discord.py?

pine aspen
#

Discord.JS

sick cloud
#

discord.js has a disconnect event

#

that should help you along with the ready event

slender thistle
#

@earnest phoenix Do you mean send a response to a command in Discord channel or

pine aspen
#

So like bot.on(disconnect) => {
}

sick cloud
#

discord.js also has a webhook interface

earnest phoenix
#

Yes

sick cloud
#
<client>.on('disconnect', () => {
  ...
});```
pine aspen
#

Yes

#

Ok

sick cloud
#

then you can use that to send the message

pine aspen
#

Ok.

#

Cool!

sick cloud
#

since when the bot disconnects the code in the event fires

pine aspen
#

Thanks.

earnest phoenix
#

@slender thistle Yes i meant this, so how?

sick cloud
#

i'd help you with webhooks too but it's 10pm here so gl with the rest

late hill
#

But that won't work if the process just exits

sick cloud
#

but the process won't exit when the bot disconnects

#

and if there's a fatal code error other monitoring wouldn't help

late hill
#

The question was

process stops

pine aspen
#

I’ll figure out the Webhook part.

sick cloud
#

well then ignore what i said if that's what your goal is, to rubbish any help i try to give

late hill
#

Wasn't

slender thistle
#

@earnest phoenix Are you using the commands extension or on_message event for commands?

late hill
#

Just making the person aware that your suggestion is likely not what they were looking for

earnest phoenix
#

I am using commands extension

slender thistle
#

So you should have Context object that you can use .send coroutine on

earnest phoenix
#

It says None

slender thistle
#

What does

earnest phoenix
#
@bot.command()
async def eval(ctx, *, code):
    func = f"async def func():\n{textwrap.indent(code, '   ')}"
    await ctx.send(f"{exec(func)}")```
slender thistle
#

Well duh

#

exec doesn't return anything

#

eval does

#

Also you are overwriting reserved keywords

#

Rename your command function to _eval and use name='eval' in the decorator

earnest phoenix
#

Ok

#

eval does
What do you mean?

slender thistle
#

Do you know the difference between eval and exec?

earnest phoenix
#

exec runs the code and prints it to the output, it doesn’t eval it

#

But i don’t know eval

#

eval(func)?

slender thistle
#

First search result for exec vs eval python

#
eval and exec have these two differences: ... eval returns the value of the given expression, whereas exec ignores the return value from its code, and always returns None (in Python 2 it is a statement and cannot be used as an expression, so it really does not return anything).
earnest phoenix
#

Ok

#

And?

slender thistle
#

So what returned value are you trying to use with exec when it doesn't return ANYTHING

earnest phoenix
#

No value

#

Ok

#

I mean

slender thistle
#

where as eval does return what is returned

earnest phoenix
#

eval(func)?

slender thistle
#

same arg as exec accepts

earnest phoenix
#

Ok

slender thistle
#

expressions inside a string

earnest phoenix
#
@bot.command(name="eval")
async def _eval(ctx, *, code):
	func = f"async def func():\n{textwrap.indent(code, '    ')}"
	await ctx.send(f"{eval(func)}")
#

It raised SyntaxError in async def func():

slender thistle
#

What's the full traceback

earnest phoenix
#
Ignoring exception in command eval:
Traceback (most recent call last):
  File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/core.py", line 83, in wrapped
    ret = await coro(*args, **kwargs)
  File "<string>", line 192, in _eval
  File "<string>", line 1
    async def func():
        ^
SyntaxError: invalid syntax

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

Traceback (most recent call last):
  File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 892, in invoke
    await ctx.command.invoke(ctx)
  File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/core.py", line 797, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/core.py", line 92, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: SyntaxError: invalid syntax (<string>, line 1)```
#

So?

modest maple
#

can eval even support asyncio

#

noramally you use exec() to eval asyncio based funcs

slender thistle
#

I remember being able to async stuff

#

Uhh it's more complciated

modest maple
#

yh

#

eval uses locals normally which fucks async a bit

late hill
#

what's undefined

#

might also be helpful to know what promptMessage is

#

and using meaningful variable names would make your code read better

pale vessel
#

please do this:
```js
code
```

earnest phoenix
#

Why?

#

is it in the server?

#

Yes

nocturne grove
#

Does anyone know what this error means?
I can't find anything on the internet, I thought it was something with slowdown mode, but I heard that channel doesn't have a slowdown mode.

name: 'DiscordAPIError',
message: 'Missing Access',
path: '/api/v7/channels/'a channel id'/messages?limit=1',
code: 50001,
method: 'GET' }```
earnest phoenix
#

doesnt look like it is hmm

summer torrent
#

are u using d.js? @nocturne grove

nocturne grove
#

yes

earnest phoenix
#

message: 'Missing Access', make sure your bot has access to the channel maybe?

nocturne grove
#

sry, forgot to mention

earnest phoenix
#

ive never seen this before tbh

summer torrent
#

read this

nocturne grove
#

my bot is checking on 'send message' perm

#

and catching an error

quartz kindle
#

did you hide that before posting, or does the original error show like that?

nocturne grove
#

no that's my edit

quartz kindle
#

ah ok lol

nocturne grove
#

I hid it

#

xd

quartz kindle
#

and yeah, missing access means the channel is not accessible

nocturne grove
#

but that 'messages?limit=1' is a weird thing, I tried to google it

quartz kindle
#

no, thats normal, you're trying to get/fetch a message right?

earnest phoenix
#

it's just an endpoint to get messages out of a channel

nocturne grove
#

ohhh

#

hmm thank you, but still not sure what it is lol

quartz kindle
#

channel s not acccessible

earnest phoenix
#

check for perms before trying to interact with it; discord sends you all of the channels regardless if you're able to access them or not

quartz kindle
#

either it was deleted, or its from a guild where your bot is not part of, or the bot cant see the channel because it has no view channel permissions

nocturne grove
#

oh wait I now see that error came 1 sec after the bot joined the guild, and my bot is grabbing last message of each channel when it joins

quartz kindle
#

why are you doing that?

nocturne grove
#

my bot is sending a welcome message in the first channel it encounters where the last message was sent less than a minute ago

#

and these channels are apparently not filtered well

quartz kindle
#

what if it doesnt find one lol

nocturne grove
#

will test that in a moment, good question 😉

#
const channels = guild.channels.filter(c => c.type == 'text' && c.permissionsFor(guild.me).has('SEND_MESSAGES')).array();```
that's what it does
#

but it couldn't read, so maybe it doesn't have read perms but does have send perms

quartz kindle
#

maybe yeah

nocturne grove
#

a guild without text channels wasn't the problem, it was the 'read messages' permission

#

thank you all for your help

pine aspen
#

Hey.

#

SO

visual sandal
#
client.on(`messageReactionAdd`, reaction => {
    console.log(reaction);
    if (reaction.author.id === `${config.client_id}`) {
        return;
    }
    if (reaction.channel.name === `server-roles`) {
        if (reaction === `💻`) {
            reaction.author.addRole(`Programmer`);
        } else {
            return;
        }
    }
});

It doesn't even console.log any information

sudden geyser
#

did you add a reaction? is the message cached (not sure if this is required)?

visual sandal
#

yea.. i tried adding a reaction

nocturne grove
#

once I was doing some things with reactions, with some reaction events (idk which) you had to react to a message that was sent after the bot was turned on for the event to be triggered

visual sandal
#

pretty sure it is

nocturne grove
#

pretty sure it is
@visual sandal was that a reaction to my message?

visual sandal
#

yea

#

and i couldn't figure out how to use the raw way

nocturne grove
#

hm

#

I tested it, the event only triggers with messages that are sent after the bot was turned on (it's an assumption though, that that is the reason)

visual sandal
#

so.. i guess i'll have to go back to the raw event

nocturne grove
#

what do you mean?

visual sandal
nocturne grove
#

think you have to use the reaction collector, but I don't know everything about reactions

#

oh wow never seen that

earnest phoenix
#

How to make custom prefix for a guild?

mossy vine
#

save prefix in database

#

fetch from database on message

earnest phoenix
#

ok

honest perch
#

how do i fix this

mossy vine
#

provide a correct token

honest perch
#

i have

summer torrent
#

check again

honest perch
earnest phoenix
#

the first step to checking if your token is right is printing it from your app

#

to see if your app gets the correct token in the first place

honest perch
#

i copy pasted it

#

the token is right