#development

1 messages · Page 1678 of 1

fallow steppe
#

Where can I find some api to use for my bot? Because I want to create some fun commands like blush slap etc

#

Well I mean a list of apis I can find

vivid fulcrum
#

there isn't a list

#

you do research on your topic

#

and find some information on it

sterile lantern
#

essentially all i want this to do is split the cases by 5

#

so if a user has 10 cases,send 2 embeds

#

well 6 ,but same thing

#

but now its sending like 9 cases on one embed x3

#

and one singular case

#

its weird

deft jackal
#

God, that isn't working

#

I can't send what permissions my bot need

#

In any server

#

When it join in any server

#

He doesn't create his own role

smoky herald
#

any leads to where this could originate from? my whole bot crashes on the same error almost on regular basis like every 30 hours

earnest phoenix
#

So weird

smoky herald
boreal iron
#

Looks like a common disconnect to the gateway.
I would guess your app is crashing because you didn’t handle the error as this was still allowed in older node versions.

#

Lemme guess you’re using node 15+?

split cipher
#

Hello, does anyone here know how I could break a new line (\n) in the description of my embed in broadcast without errors?

message.client.shard.broadcastEval(`
(async () => {
const Discord = require('discord.js')
            
const a = new Discord.MessageEmbed()
.setColor('#e5b3b5')
.setDescription("Apple \n Bread") 
})()`)
vivid fulcrum
#

huh?

split cipher
#

I'm trying to find a way to make a new line, because the code above caused an error coming from \n

boreal iron
#

Escape the \

#

\\

vivid fulcrum
#

oh right, that's a string

#

the syntax highlighting threw me off

boreal iron
#

Ya in eval

split cipher
#

Did not work :(

boreal iron
#

Was wondering too and took a second view on it

#

Why are you actually creating an async function?
You’re going to await the message?

#

What kind of error do you get anyway?

split cipher
#

Nevermind, I forgot a quotation mark. Your solution works, thanks :))

ruby orchid
#

My bot won't stay online after I run my code. How do I fix this?

boreal iron
#

Debug your code and/or provide any error codes since nobody in here owns magical glass balls okeh

ruby orchid
#

ok thanks 🙂

smoky herald
slender wagon
#

hmm is http://127.0.0.1:4000 wrong?

rustic nova
#

have you added it to your redirect_uri's on the dev portal?

slender wagon
#

fixed

#

it was just wrong url

#

lol

lyric mountain
#

obviouly you can't point to localhost KEKW

vivid fulcrum
#

i love how all of these services restrict how your redirect uri can look like

#

patreon only allows https etc

#

discord literally doesn't care KEKW

#

as long as discord sees two slashes in the redirect uri they'll just say "yup, that seems okay to me"

lyric mountain
#

ftp://111.222.33.444

#

someone could try lol

opal plank
#

ssh://111.222.33.444 possibly valid either

rustic nova
#

topgg://queue

cinder lodge
#

anyone knows how to fix this problem?

odd stratus
#

Make it lowercase

cinder lodge
#

thank you

odd stratus
#

Np

cinder lodge
#

Is anyone knows, what's wrong with my code? The bot doesn't reply when I type -kick 😦

earnest phoenix
#

so if you typed -kick @cinder lodge reason1 reason2 reason3
@cinder lodge is args[0], reason1 is args[1], reason2 is args[2] and so on.

cinder lodge
earnest phoenix
#

let me explain better

cinder lodge
#

okay

earnest phoenix
#

so

#

how do you want to use the command?

#

-kick @short wraith <reason>

#

right?

cinder lodge
#

like this

earnest phoenix
#

well, then you need to change args.slice(1) on line 12 to args.slice(0)

earnest phoenix
#

try it now

cinder lodge
#

still doesn't work

earnest phoenix
#

check your console

#

put all of the code in one big try and catch

#

then check for an error

cinder lodge
earnest phoenix
#

try and catch

#
try{
all the code here
}catch(error){
console.log(error)
message.channel.send('Sorry, there was an error.')
}
cinder lodge
#

😦

quartz saddle
cinder lodge
#

ahh got it

#

Okay I'll try

quartz saddle
#

good luck

cinder lodge
quartz saddle
#

no

#

i said below line 9

#

everything below line 9

#

move that try block

cinder lodge
quartz saddle
#

better, but you seem to have some errors with the catching part.

catch (error){
  console.log(error)
}

^^ move this part down one line

quartz saddle
#

here

#

ill give a better example

#
  try{
    await mentionedMember.send(kickEmbed)
  } catch (err) {
    console.log("I was unable to message the member")
  }
} catch (error) {
  console.log(error)
}

hopefully this helps a little

lament rock
#

That is how they meant, but doing that isn't necessary as your code doesn't have any logical errors that would require that large of a try catch block.

Doing that will log an error if your client tries to send a message to a channel they don't have access to which may not be intentional considering that's just unnecessary and there's nothing you can do about it reasonably.

if args is defined as the message content split by a space after the command, then what you have to change is reason = args.slice(1).join(" ") as slice returns an array between two indexes. If only 1 index is provided, then it goes from the index to the end of the Array. Providing a 0 would just be duplicating the Array as index 0 is the first index. What's expected to be at index 0 is a user mention. Not the start of the reason string.

#

to answer why your bot isn't responding to your message, try putting a console log at the start of the inside of the run function, restart, then try the command. If there is a log, then your command is being called and something is preventing the rest of the function from being run. (this is unlikely since I read the code and everything makes sense logically)

If there is no log, then this might either be that your logic to get a command object might be flawed or your client doesn't have permissions to read messages in the channel you're sending the command in, or it doesn't have permissions to send messages in the channel you're sending the command in.

#

Or the bot isn't online. Or the bot needs to be restarted depending on how commands are loaded into memory

earnest phoenix
#

we cant see the error

cinder lodge
lament rock
#

message.mentions.member is undefined

cinder lodge
lament rock
#

make it message.mentions.members

cinder lodge
#

on line 11 right?

lament rock
#

yeah

boreal iron
#

Also make sure to await the embed sending before kicking the user if not done already

cinder lodge
#

It WORKS! Thank you very much for helping me! I am so happy. @earnest phoenix @quartz saddle @lament rock

boreal iron
#

If he gets kicked right after the embed is sent he won’t be able to read it anyways

cinder lodge
boreal iron
#

Dunno can’t see your kickembed being sent on your screenshots

#

Just the line you declare it

lament rock
#

You should kick first then send the embed, because if the kick fails, then the bot would look like a clown for sending the message in the member's DMs. Notifying the user shouldn't be a top priority. If the user still shares guilds after being kicked and doesn't have their privacy settings blocking messages from other servers, then the message would probably still send

boreal iron
#

But your method wouldn’t work anyways if the client and the bot don’t share the same server anymore the client won’t receive a message anyway

#

So overall all permission checks etc. in the first place, then awaiting message, then kick

#

If a DM is necessary needed

lament rock
#

Shouldn't matter. Notifying the user directly shouldn't be prioritized because of volatility with permissions to DM someone

boreal iron
#

And the message needs a catch due the fact lots of people don’t even allow DMs from non friends

boreal iron
#

water on the screen is horrible

lament rock
#

mentionedMember.send

#

They do attempt to notify the kicked member.

earnest phoenix
#

what does coro mean

pale vessel
#

Coroutine iirc

#

Can you show your code?

earnest phoenix
#

here

#

what am i missing?

sudden geyser
#

The error means you're missing some argument in some function.

#

what is line 614?

#

wait I'm blind

#

Remove the parentheses

earnest phoenix
#

where? on @open nestar_error?

sudden geyser
earnest phoenix
#

OOP i just pinged someone 😬

sudden geyser
#

eh don't worry

#

wasn't intentional

earnest phoenix
simple zodiac
#

Does anyone know how to do slash commands in discord js? I'm not using any command handler or anything like that (I think thats what its called?)

drifting wedge
#

someone help? socket.io ```js
SERVER.JS

const io = require("socket.io")(3285);
console.log("hi");
io.on("connect", socket => {
console.log("user");
socket.emit("chat-message", "Hello World");
})```

SCRIPT.JS



const socket = io("http://localhost:3285");
console.log("on");
socket.on("chat-message", data => {
    console.log(data, "hi");
})```

```html
HTML

<html>
    <head>
        <title>Chat App</title>
        <script src="http://localhost:3285/socket.io/socket.io.js"></script>
        <script src="script.js"></script>
    </head>

    <body></body>
</html>```
#

giving connection refused errors

#

and Access to XMLHttpRequest at 'http://localhost:3285/socket.io/random stuff' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

thick nexus
#

how make bot reply to message

simple zodiac
#

What language are you using?

thick nexus
simple zodiac
#

Yes you

thick nexus
simple zodiac
#

Oh, ok sorry I'm afraid I cannot help Cry

#

I can try though, I see you have the bot dev role. You've made A command right? Where it would respond do something like "!help" (example)
If you have it's basically just that, but you change out that for your word

ripe shadow
# thick nexus how make bot reply to message

If you want bot send Message in the channel of the Command executed you can use this.

@client.command()
async def command_name(ctx):
	
	await ctx.send("Your reply Message")```

Else I can't help you sorry ¯\_(ツ)_/¯
earnest phoenix
#

wait how do i get the bot developer role?

long crow
#

after your bot got approved

earnest phoenix
#

oh

#

i really hope it does ive been working on it for like 6 months now

cinder lodge
#

What code should I add if I want to make slowmode 0 / slowmode off?

feral arch
#

Hi (: how could I get the guildId inside a commandRun event?
I just have the executed command and does not have reference to the current guild

earnest phoenix
old cliff
cinder lodge
old cliff
#

Check out the docs

#
let newValue = 10
Channel.edit({rateLimitPerUser: newValue})
earnest phoenix
#
db.subtract(`gbank_${message.author.id}`, 1000000

Error: Target is not a number...

old cliff
earnest phoenix
#

There already is a number.

old cliff
#

Ther error says it isn't

earnest phoenix
#

I have 2.5 Million In my balance.

#

It alr has a number...

#

It just wont let anything be removed-

#

I can use my remove, setbal, and add commands fine.

old cliff
#

Maybe its a string...

earnest phoenix
#

This is the first time I've ever encountered this error over years

old cliff
#

Idk then

earnest phoenix
#

😩

earnest phoenix
earnest phoenix
#

Oh

#
const amount = 1000;//Example```
#

Like this^^

#

Well, it's a target error

#

I've alr tried that

#

Target should be a item name right

#

Along with everything else my years of experience has taught me 😩

#

Oh

earnest phoenix
earnest phoenix
#

Whatevers specified in the DB Isnt a number.

#

Oh

#

😩 I'll just economy reset, seems as it's my only option at this point.

#

But every users acc will be deleted 😭

#

Only their balances.

#

ohok

earnest phoenix
delicate shore
#

no

earnest phoenix
#

Hmm Ok Sorry

old cliff
#

I guess google rejected the translate request

cinder patio
#

WOAH

#

Did y'all see the new code blocks

summer torrent
#

no what is it

cinder patio
#

wait what

summer torrent
#

yes

#

did you delete it

cinder patio
#

I guess it only works with actual code

summer torrent
#

oh i saw this

cinder patio
#

oh it's a file

#

not an embed

bleak crown
#

why is javascript so hard

summer torrent
#

it is not?

cinder patio
#

So sending files is now better than sending embeds or screenshots 😩

bleak crown
#

its really complicated for me to understand :l

summer torrent
#

@cinder patio screenshot

bleak crown
#

wait what you can send files in discord

cinder patio
#

Wait that's a screenshot?

summer torrent
#

no

#

i mean send screenshot

summer torrent
bleak crown
#

omg i just found out

summer torrent
bleak crown
#

niceee

slender thistle
#

Interesting update 👀

tame kestrel
#

Hi for anyone that knows Typescript,

I want to pass in a parameter that is basically one of the property names of a given type, is there a way I could select a Type's given properties as a string literal type?

cinder patio
#

You could do keyof typeof Interface|Class

tame kestrel
#

oh I like that let me poke around and see if that would work

#

keyof works great

#

thank you @cinder patio

solemn quartz
#

how did you do that

summer torrent
#

what

slender thistle
#

This is neat

summer torrent
#

i don't see anything

slender thistle
summer torrent
#

yes

#

i just did Ctrl + R and now i can see

median iris
#

Hello i need help

cinder patio
#

Oh u wanted me to screenshot it

median iris
#

Bro

#

can you tell me something

cinder patio
#

yes

median iris
#
const sendError = require("../util/error");

module.exports = {
    info: {
        name: "join",
        aliases: ["come", "connect", "hey"],
        description: "Join The Voice Channel!",
        usage: "Join",
    },

    run: async function (client, message, args) {
        let channel = message.member.voice.channel;
        if (!channel) return sendError("I'm sorry but you need to be in a voice channel!", message.channel);

        try {
            const connection = await channel.join();
            queueConstruct.connection = connection;
            play(queueConstruct.songs[0]);
        } catch (error) {
            console.error(`I could not join the voice channel: ${error}`);
        }

        message.client.queue.delete(message.guild.id);
    serverQueue.songs = [];
    message.react("👌")
  },
};
slender thistle
#

Well this is a bearable mistake

median iris
#

I made this

#

but bot isn't reacting to that message

#

when joined

#

:/

#

pls help

#

@cinder patio

cinder patio
#

is everything else working?

median iris
#

yes

#

but

#

bot not reacting

cinder patio
#

So like, the bot joins the channel, it's just not reacting

#

and you're not getting any errors?

median iris
#

yes

#

yes

cinder patio
#

weird, I see no reason for it to not react

#

everything looks fine

median iris
#

But it not reacting

#

:(

#

why

cinder patio
#

Btw, where do you define the play function

median iris
#

in play.js

#

Ur bot dev

#

pls tell

#

why it is not reacting

cinder patio
#

but you don't import it anywhere in the join command

#

import it

median iris
#

ok

#

no reaction = need to add embed

#

message

cinder patio
#

the code never gets executed in the first place

median iris
#

you code ir

#

and give it to me

#

coz im in beginner stage

cinder patio
#

I'm not going to give you anything except advice on how to fix your code

median iris
#

so pls tell it once again

#

why bot not reacting to the message

#

:(

#

ok

#

i fixed

#

@cinder patio

cinder patio
#

nice

quaint fjord
#

Is it possible to put a variable in an embed footer? (python)

slender thistle
#

Yes

quaint fjord
#

(text="Servers:", len(client.guilds)

slender thistle
#

set_footer(text=your_variable)

#

Use f-strings or .format

quaint fjord
#

oh

#

okay, thanks!

slender thistle
quaint fjord
#

f-strings worked, thanks!

slender thistle
#

Aye, np

lyric solstice
#

Hey, are we allowed to advertise top.gg using our bots

summer torrent
lyric solstice
#

Yeah

summer torrent
#

yes why not

lyric solstice
#

Ok thanks

#

Just wanted to make sure my bot doesn't get rejected because of that

summer torrent
#

@ripe prairie

#

stearmcommuniity lmao

simple zodiac
#

does someone know how to get someones nickname in a server with discord js? I've looked through the docs and through many different posts across different platforms, and all have just given me "undefined"

summer torrent
#

GuildMember#nickname

simple zodiac
#

I've tried like ```js
${message.author.username}
${message.author.displayName}

summer torrent
#

message.member

simple zodiac
#

How exactly do I say that? I'm not using a command handler or anything like that just normal discord js

#

wait would you mind like putting it together? i'm kinda confused sorry

summer torrent
#

message.member.nickname

#

message.author is User which don't have a nickname

simple zodiac
#

Thank you!

dusky lagoon
simple zodiac
#

Would anyone know how I could get like a mentioned users info? I'm making a userinfo command (why i needed the nickname) and I tried something that had worked before, but the functions like "member.typingDurationIn" isnt working (Before it was message.author.typingDurationIn).

vivid fulcrum
#

you don't return out of the method @dusky lagoon

dusky lagoon
#

i know

#

im figuring out how tho

vivid fulcrum
#

very much copypasted vibes

#

you already do it in your code how tf are you still figuring out how

dusky lagoon
summer torrent
simple zodiac
summer torrent
#

no

dusky lagoon
#

@vivid fulcrum

simple zodiac
summer torrent
#

message.mentions.users is collection of mentioned users

simple zodiac
#

oh

summer torrent
#

if you want to get first user just do message.mentions.users.first()

simple zodiac
#

yeah thats what i have var member = message.mentions.members.first();

summer torrent
simple zodiac
#

oh ok

#

sorry

vivid fulcrum
#

found that snippet of code on google

#

lol

#

embarrassing

simple zodiac
summer torrent
#

it is property then

simple zodiac
#

how would I write it though? Cause i keep getting the same few errors editing that one

summer torrent
#

remove ()

simple zodiac
#

now it says that it cannot read property ID of undefined (i tried to say member.id somewhere else)

dusky lagoon
#

😂

vivid fulcrum
#

good for you, i didnt ask though

slender thistle
#

cry probably knows better than you, having been active here for a while 😛

#

Also, why are you bringing nonsense roles into this

dusky lagoon
#

ugh nvrmind

summer torrent
#

"white name" lmfao

vivid fulcrum
#

i really dont get what is up with people trying to claim code from guides is theirs

slender thistle
#

And you don't learn by copying. You learn by researching, evaluating found snippets, thinking about how they work, and then using them

cinder patio
#

🤭

simple zodiac
dusky lagoon
#

dumbass

summer torrent
#

rule 1 bro

cinder patio
#

No but it looks like you're getting offended by someone pointing out that your code is copied

simple zodiac
cinder patio
#

when it is

dusky lagoon
#

only the cooldown part

#

the rest is all me

vivid fulcrum
dusky lagoon
#

bruh go @vivid fulcrum in a corner

vivid fulcrum
#

ok

dusky lagoon
#

😂

vivid fulcrum
#

are you like 11

summer torrent
vivid fulcrum
#

my man can't even throw proper insults 💀

#

but ok

summer torrent
dusky lagoon
#

you can better stop now cry

summer torrent
#

mentions.users

slender thistle
#

Can we move on

simple zodiac
#

oh ok

dusky lagoon
#

thanks

simple zodiac
#

ill tell you how that works

summer torrent
#

@dusky lagoon you can better stop being dick

slender thistle
#

This is starting to look like a kindergarten

cinder patio
#

That's not a bad thing

slender thistle
#

a?

earnest phoenix
#

Stack overflow 🏃‍♂️

slender thistle
#

Not many people there who are proficient in Discord bots imo

simple zodiac
# summer torrent also in code yes

Okay so it works when I ping someone, but now when I just do "userinfo" it says cannot read property ___ of undefined. (it says that for all the properties like .nickname and stuff) I tried having it like if users === "" but that didnt work, so it only works rn if you ping someone

vivid fulcrum
#

it's just like any other library, unless you're writing a library, god bless if you are

#

theres a learning curve because people don't want to take their time to learn and understand what they're doing

#

programming is not for everyone

regal creek
simple zodiac
regal creek
#

I were paid to say that

solemn quartz
#

Guys is there a way to make a bot online 24/7 for free

simple zodiac
#

Okay so I figured out how to make it work if no one is mentioned (if (!message.content.includes(users))), but, when I mention someone, the username says "undefined" (even tho they have a username) The code for that one is "Username: ${users.username}". Users is stated before like with the mentions.users thingy

solemn quartz
#

is it 24/7 or 7/24? i dont even remember

simple zodiac
slender thistle
#

24 hours 7 days

#

7/24 means 7 hours 24 days

simple zodiac
#

I use repl and uptime robot together and its basically 24/7 atleast (really good uptime i dont think ive seen my bot go down)

slender thistle
#

Usually

#

Probably

#

Don't know how some languages have it

simple zodiac
solemn quartz
#

thank you!

simple zodiac
#

Here is the link, and here is the code you'd need to put at the top of your file.

const express = require('express');
const app = express();
const port = 3000;
app.get('/', (req, res) => res.send('Hello World!'));
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`));
``` (also in the guide). https://dev.to/fizal619/so-you-want-to-make-a-discord-bot-4f0n. The rest is here but yea
#

I should've said , this is for JS

#

I'm not sure about other languages exactly

#

you could probably find something though

solemn quartz
#

i use djs

simple zodiac
#

and since repls are public (at least free ones) you will prolly wanna follow a little more of the guide as it shows how to hide ur token

#

ok good

solemn quartz
#

i have a config file

simple zodiac
solemn quartz
#

oh fuck

#

this is a hard decision

simple zodiac
#

If you pay for the premium one of repl you can get free ones

#

I mean you could make a new profile with an obscure name

solemn quartz
#

hm

#

sounds good

simple zodiac
#

but dont worry the TOKEN is hidden if you follow the guide

solemn quartz
#

do i need to do that proces.env.token thing?

simple zodiac
#

yeah

#

its really easy

solemn quartz
#

i never did that

#

i have it in my config file

simple zodiac
#

if you're doing it on repl, you definitely want it in a .env

#

cause people can see your config file

#

so whatever is not in a .env is public

#

i believe you can have your config code in the .env

#

or just in your index.js

#

im not completely sure how that works

#

my bot is pretty simple so i only have like 3 files lol

solemn quartz
#

oh lol

simple zodiac
#

prefixes.db, .env, and index.js

solemn quartz
#

actually i stopped making bots for 2 years and now im a beginner again

simple zodiac
#

ah

#

i only started not too long ago

solemn quartz
#

i just dont know what process.env is

simple zodiac
#

oh

#

I dont really understand that part but

#

it just takes whats in the .env and then uses that to log in

#

think of the process env as just the bot logging in maybe

#

if that helps?

#

and yea as it says its just logging in

solemn quartz
#

omfg

simple zodiac
#

yes?

solemn quartz
#

i just tried to search for my friend's account

simple zodiac
#

mhm?

solemn quartz
#

i can literally see his token

#

wtf is this

simple zodiac
#

oh god

#

lmao

#

tell them to change it

solemn quartz
#

lol

simple zodiac
#

& do the env thing

solemn quartz
#

im gonna troll him first, then tell him

#

really useful thing to know

#

he has something like 20 repls

simple zodiac
#

probably not the best idea but i cant stop you

solemn quartz
#

i will not change anything

simple zodiac
#

i got quite a few repls too

solemn quartz
#

just be like "i aM a HaCkEr"

#

smth like that lol

simple zodiac
#

aight lol

solemn quartz
#

oh shit he knew

#

he knew

#

all his other bots had that

#

@simple zodiac lol

simple zodiac
solemn quartz
#

process.env.token

simple zodiac
#

oh okay

solemn quartz
#

ok so im gonna watch that thing like now

simple zodiac
#

aight

#

its just an article thing

#

idk what there is to watch exactly

#

but i would like to see you try

solemn quartz
#

oh i think it was a video

#

lol

#

ill read it then

#

wait

solemn quartz
#

server.js

median iris
#

can anyone help me

#

I uploaded bot logo on github

#

and i take the link

#

and applied in the code

#

but

#

image not showing in embed

simple zodiac
solemn quartz
#

ok ty

tardy hornet
#

how can i like, make that it will show 251,064

#

like add a , where needed

vivid fulcrum
#

in which language

simple zodiac
#

could someone help me with something? I made a userinfo command using discord js, and, when I ping someone to get their info like "userinfo @simple zodiac " (it'd be someone else but you get the point) it says "nickname: undefined". The code for nickname is Nickname: ${users.nickname}. Also, var users = message.mentions.users.first(); is before that. Anyone know how to make it not be undefined?

solemn quartz
#

@simple zodiac wait so i just create a file at the left called .env?

simple zodiac
#

yeah

tardy hornet
solemn quartz
#

oh lol

solemn quartz
simple zodiac
#

this is what my sidebar looks like (obv you might not have my other one(s))

vivid fulcrum
simple zodiac
#

Just post whatever's in your thing at discord.com/developers/applications.||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||https://pays.host/SA3wEEwb

Uploaded at 3/31/2021, 9:14:56 AM by cantchoosethis

#

just changed token if it was visible behind my epic censoring 😎

solemn quartz
#

wait so just like this?

simple zodiac
#

remove the ""

solemn quartz
#

and i put the things

solemn quartz
simple zodiac
#

idk thats just how they work

simple zodiac
solemn quartz
#

k

simple zodiac
#

like for my token its just

cinder patio
#

Fine

#

<User>.username

simple zodiac
#

DISCORD_TOKEN=bruhbruh

#

no ""

cinder patio
#

you got the gist

simple zodiac
#

exact screenshot of my code

cinder patio
#

send all your code

simple zodiac
#

uh ok

#

its a bit long

solemn quartz
#

just to know

simple zodiac
#

you need to change whats in process env in that case

earnest phoenix
simple zodiac
#

I'll just put whats in the else part (where im having issues)

else {
      var users = message.mentions.users.first();
      const uEmbed = new Discord.MessageEmbed()
      .setColor(`RANDOM`)
      .setAuthor(`Userinfo for ${users.tag}!`,"https://cdn.discordapp.com/avatars/"+users.id+"/"+users.avatar+".gif")
      .setDescription(`\`\`\`yml
      Username: ${users.username} \\\\ Tag: #${users.discriminator}
      Bot: ${users.bot} \\\\ Creation Date: ${users.createdAt}
      Nickname: ${users.nickname} \\\\ Typing Duration in this channel: ${users.typingDurationIn(message.channel)}s \\\\ Flags: ${users.flags.toArray()} 
      Avatar URL: cdn.discordapp.com/avatars/${users.id}/${users.avatar}.gif\`\`\` `)
      message.channel.send(uEmbed)
  }
solemn quartz
#

so like this?

simple zodiac
#

the if before the else is if no one is mentioned

simple zodiac
solemn quartz
#

oh

#

cool

earnest phoenix
simple zodiac
#

change token with whatever the name of the var is (exact caps)

tardy hornet
cinder patio
#

in that file

solemn quartz
#

and this at the start?

simple zodiac
solemn quartz
#

sorry if im being annoying i just want to be sure btw

simple zodiac
#

all good lol

cinder patio
#

console log it

simple zodiac
#

okay

cinder patio
#

also avoid var

#

use let or const

simple zodiac
#

ight

simple zodiac
#

uh it just doesnt log anything lmao

#

i put it right after the message.channel.send

earnest phoenix
#

Put it after the variable declaration

simple zodiac
#

ok

cinder patio
#

Then that code block doesn't run

pale vessel
simple zodiac
#

Still nothing?

#

i have no idea what i'm doign wrong

#

the other code runs

#

am i stupid

earnest phoenix
#

Show the entirety of the code I guess?

simple zodiac
#
else {
      var users = message.mentions.users.first();
      console.log(users)
      const uEmbed = new Discord.MessageEmbed()
      .setColor(`RANDOM`)
      .setAuthor(`Userinfo for ${users.tag}!`,"https://cdn.discordapp.com/avatars/"+users.id+"/"+users.avatar+".gif")
      .setDescription(`\`\`\`yml
      Username: ${users.username} \\\\ Tag: #${users.discriminator}
      Bot: ${users.bot} \\\\ Creation Date: ${users.createdAt}
      Nickname: ${users.nickname} \\\\ Typing Duration in this channel: ${users.typingDurationIn(message.channel)}s \\\\ Flags: ${users.flags.toArray()} 
      Avatar URL: cdn.discordapp.com/avatars/${users.id}/${users.avatar}.gif\`\`\` `)
      message.channel.send(uEmbed)
  }
earnest phoenix
#

That block of code doesn't run

simple zodiac
#

why not

#

if you know

cinder patio
#

We can't tell you much without giving us all the code

earnest phoenix
#

Because if it did, it would log users

old cliff
#

Codeblocks updated?

earnest phoenix
#

wut

cinder patio
#

send the entire file

old cliff
#

whats this?

simple zodiac
cinder patio
#

a file

simple zodiac
#

thats the whole code for the thing

old cliff
#

ok... so they added txt preview?

#

nice

cinder patio
#

yes

#

not only txt

cinder patio
simple zodiac
# old cliff

how're you doing that? is that a canary feature?

cinder patio
#

because a string cannot include an object

old cliff
simple zodiac
simple zodiac
cinder patio
#

What's the point of checking that

solemn quartz
#

so now if i click stop the bot continues to work?

earnest phoenix
#

@simple zodiac Just change it to !users at this point

simple zodiac
simple zodiac
#

will that work..?

solemn quartz
cinder patio
#

yes

#

why wouldn't it

simple zodiac
#

idk

#

the way it was said seemed sarcastic

simple zodiac
#

if you just leave it or close the tab whatever it WILL stay up

solemn quartz
#

k

simple zodiac
#

so now it says if (!users) {
<code with message.author>
} else {
<code with users.stuff>
}

#

Still says undefined for username sadpee but it does log user

earnest phoenix
#

Also why would you use if statements for that

cinder patio
#

You can just do const users = message.mentions.users.first() || message.author

simple zodiac
#

oh ok

earnest phoenix
#

You could use the logical OR operator to fallback to author

simple zodiac
#

and get rid of the else?

cinder patio
#

no

simple zodiac
#

oh

cinder patio
#

get rid of the code inside the first condition

simple zodiac
#

ok

willow mirage
#

help

simple zodiac
willow mirage
#

it says location.lat is undefiened

solemn quartz
#

referenceError: env is not definied

simple zodiac
#

oh

#

wait im sorry

#

i had the ; at the mentions first

cinder patio
#

you're not doing something right then

simple zodiac
#

that part fixed yeah sorry

willow mirage
earnest phoenix
simple zodiac
solemn quartz
#

do i need to do const env = smth

#

?

simple zodiac
#

it has to process the name of the var for your token

earnest phoenix
simple zodiac
#

or

#

oh sorry it was

#

ig i delteed it

tired panther
#
let state = guild.votes.some(g => g.userid === userid);
    console.log(state);
    if(state){
        let position = guild.votes.indexOf(g => g.userid === userid);
``` having some problems lol
I want to get the position of the user object in the array guild.votes
state gives true
but the position -1 ?
but it exits
simple zodiac
#

this is what it said in console

simple zodiac
#

nickname is still undefined

#

in the embed

earnest phoenix
#

Users don't have nicknames

solemn quartz
simple zodiac
#

they do in my server

cinder patio
#

it's .username

earnest phoenix
#

Only guild members have nicknames

simple zodiac
cinder patio
#

if you want the nickname then it's GuildMember#nickname

earnest phoenix
#

User !== Guild Member

tired panther
simple zodiac
solemn quartz
simple zodiac
solemn quartz
#

wait no actually

#

wait

cinder patio
earnest phoenix
simple zodiac
#

thats what users is..

#

const users = message.mentions.users.first() || message.author

earnest phoenix
#

And <Message>.member to get the guild member object of the author

#

no

solemn quartz
#

add const mem = message.guild.member(users),
then for it's nickname do mem.nickname

earnest phoenix
#

users !== members

solemn quartz
#

it should be something like that

simple zodiac
#

not the author

earnest phoenix
#

Author is just the fallback

earnest phoenix
#

Don't

simple zodiac
#

uh ok

earnest phoenix
#

<Guild>.member() will be removed

simple zodiac
#

im not sure at all what i do with this since idk where to put it + how to write it

#

i just want to be able to get someone that i mentions NICKNAME

earnest phoenix
#
const member = message.mentions.members.first() || message.member;```
solemn quartz
#

try

earnest phoenix
#

Get the guild member object

solemn quartz
#

try

simple zodiac
#

oh cool thank u volt

#

that one worked

#

i used member.nickname in there

#

thxxxxxx

solemn quartz
#

:|

earnest phoenix
#

Member properties -> member

User properties -> member.user

simple zodiac
#

sorry bg sadpee

#

whoever talks the loudest ill usually go with

solemn quartz
#

wait so do i need to do const env = smth ???

#

the console says that env module is not definied

solemn quartz
earnest phoenix
#

All of your .env variables are stored in process.env automatically as you're using repl.it

#

So you can just access them easily

simple zodiac
#

In .env

#

do

#

token= <put token here>

#

then at the bottom

#

like very last line do

#
client.login(process.env.token); 
#

whatever the var name is in .env, goes in process.env.___

solemn quartz
#

thats exactly what i did

simple zodiac
#

hmm

#

try making it all caps?

#

like TOKEN=

earnest phoenix
#

And the problem?

solemn quartz
#

wait imma send in pastebin all the things i edited today

simple zodiac
#

it could be an issue being lowercase? idk

#

So in the .env it should look like this (obv ur token)

#

then this at the very last line

#

that should work

pseudo helm
#

Should be correct

solemn quartz
#

i wrote .env and index.js at the start of the files

#

to make you guys know where i wrote that

earnest phoenix
simple zodiac
#

token actually has a value right

pseudo helm
#

To me, all looks fine. Might be good if you provide us a errorcode.

simple zodiac
#

and yeah what IS the issue?

simple zodiac
solemn quartz
#

(node:780) UnhandledPromiseRejectionWarning: ReferenceError: env is not defined

simple zodiac
#

oh

#

hm

old cliff
#

define it

solemn quartz
#

this is the first line

simple zodiac
#

uh

solemn quartz
simple zodiac
#

i dont think defining would help lol

#

that isnt what i did

old cliff
#

show code bro

solemn quartz
#

do i need to do something like const env = bruh

simple zodiac
#

he did

#

bg

#

try and make

#

it

#

TOKEN=<token>

#

and process TOKEN

solemn quartz
#

ok

simple zodiac
#

not lowercase token

pale vessel
#

stop
typing
like
this

simple zodiac
#

try that

earnest phoenix
simple zodiac
pseudo helm
#

Is your file really named ".env" only?

simple zodiac
#

yes

#

So is mine in my project

#

works fine

earnest phoenix
#

The error is not related at all

#

They're using a variable they never defined

#

@solemn quartz Can you show us the stacktrace of the error

solemn quartz
simple zodiac
solemn quartz
#

wait a second

earnest phoenix
#

no

simple zodiac
#

this is because repls are public, and the token needs to be private

earnest phoenix
#

That's not the issue

simple zodiac
#

what is

earnest phoenix
#

The error says that they're using a variable they didn't define

#

Not the variables from the .env file

pseudo helm
#

@solemn quartz make sure your .env is in the same folder your index.js is in.

solemn quartz
#

obv it is

earnest phoenix
small tangle
#

ur using the dotenv module with require('dotenv').config() to load the env variables?

simple zodiac
#

or atleast i dont think so

#

we're using the same thing

#

i dont have that

earnest phoenix
#

They don't need to use dotenv since repl.it automatically uses it

small tangle
#

oh i see

simple zodiac
#

so then ig in a way

willow mirage
#

why node-fetch return me this thing?

#
const fetch = require('node-fetch');

module.exports = async (long, lat) => {
    const url = `http://dev.virtualearth.net/REST/v1/Locations/${lat},${long}?includeEntityTypes=Postcode1&includeNeighborhood=1&include=ciso2&key=${process.env.bingmap}`
    console.log(url);
    const data = await fetch(url);
    console.log(data)
    return data;
}
solemn quartz
#
(node:964) UnhandledPromiseRejectionWarning: ReferenceError: env is not defined
(node:964) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:964) [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.```
earnest phoenix
solemn quartz
#

this is my whole code

#

and do i need to change the port?

pseudo anchor
#

Yo, how would I go about making a top.gg vote command for my bot using discord.js-commando?

#

I've seen methods for python but not discord.js

simple zodiac
earnest phoenix
solemn quartz
#

ok

simple zodiac
#

for the prefix, you might want a module called discord-prefix. I'll try and find the npm page for it

earnest phoenix
#

no

simple zodiac
simple zodiac
#

I use it & mine works just fine?

#

is there a problem with it?

small tangle
#

why using an extra module when its one codeline?

earnest phoenix
#

No need to use bloated npm packages for everything

simple zodiac
#

alright

#

not entirely sure what that means

solemn quartz
#

oh my fucking god it finally works

willow mirage
#

:))))))))

simple zodiac
#

but my prefix works fine lol

earnest phoenix
#

Bruh

cinder lodge
#

I set if (!value || value > 21600) return message.channel.send('You need to state a number between 0 and 21600, which represents the second the slowmode will be.');
But when I type -slowmode 0 it still says You need to state a number between 0 and 21600, which represents the second the slowmode will be.

Why?

small tangle
#

really? theres an extra module for that? xD

simple zodiac
willow mirage
earnest phoenix
earnest phoenix
cinder lodge
simple zodiac
#

Bg did you write all those commands?

earnest phoenix
#

if (value <= 0 || value > 21600) { ... } @cinder lodge

simple zodiac
#

i dont understand any of them really (i dont have a commadn thing like that) but they look cool & complex

solemn quartz
earnest phoenix
#

MegaThonk Why do people here suggest to use npm packages for everything

#

KEKW wtf

cinder lodge
simple zodiac
earnest phoenix
#

It's not cool

simple zodiac
#

It's also easier than however else you do it from what i know

earnest phoenix
#

Using bloated shit was never cool

willow mirage
#

what?! you says my npm package is shit?!

earnest phoenix
willow mirage
#

.l.

simple zodiac
#

lmao

earnest phoenix
#

KEKW Fuck my life

simple zodiac
#

isnt that already a function?

#

like toLowerCase()?

#

is that why the funny

#

😔

earnest phoenix
#

That's literally what I'm trying to explain, npm registry is ruined with bloated useless npm packages

simple zodiac
#

oh

cinder patio
#

Lmao

simple zodiac
#

ok

#

i understand

willow mirage
cinder patio
#

to-lower uses to-str

lament rock
#

oh my fucking god

earnest phoenix
#

Npm registry is just fucked

simple zodiac
#

but i will continue using discord prefix npm yawn

tired panther
simple zodiac
tired panther
#

use your own system

simple zodiac
willow mirage
#

I think people should do something like "wait for package approval" ?

slender thistle
#

Why does that even exist

#

Are JS devs that inept

earnest phoenix
#

Imagine "Use this npm package today to get a life"

tired panther
willow mirage
#

Imagine "Use this npm package or ur mama . . . "

cinder patio
willow mirage
#

LMAO

tired panther
#

I did not recommanded someone here

lament rock
#

if (![prefix, <@${client.user.id}>, <@!${client.user.id}>].find(p => msg.content.startsWith(p))) return

willow mirage
tired panther
#

but its better than the discord-prefix lol

solemn quartz
#

@simple zodiac im stupid

simple zodiac
#

i recommended the thing, sorry if im too stupid for all you lol

solemn quartz
#

i just realised i didnt do the step 3

earnest phoenix
#

I seriously get mad over people publishing stupid npm packages

simple zodiac
#

im really new to bot dev

simple zodiac
willow mirage
earnest phoenix
#

I remember this npm package called isThirteen which literally checked if the input was the number 13

earnest phoenix
#

Wtf has this registry become

willow mirage
#

lmaooo

median iris
#

Hey help

willow mirage
#

or isTrue ig?

median iris
#

I coded embed

lament rock
median iris
#

and i need to add more description

#

how can i add

earnest phoenix
median iris
#

pls tell

solemn quartz
#

wait sorry wrong reply

willow mirage
earnest phoenix
#

Omegalul

median iris
#
      .setAuthor("Invictus", "https://scontent-del1-2.cdninstagram.com/v/t51.2885-15/sh0.08/e35/s640x640/167222470_497654101239265_1837190606735502418_n.jpg?tp=1&_nc_ht=scontent-del1-2.cdninstagram.com&_nc_cat=101&_nc_ohc=fGs15qi-FV0AX-fKd88&ccb=7-4&oh=3160dd412529b5d0930e196b3187ef18&oe=608A3EE7&_nc_sid=fa978c&ig_cache_key=MjU0MTQyMDEwNTMwMTA3MDM1MQ%3D%3D.2-ccb7-4")
      .setTitle("")
      .setColor("BLUE")
      .setDescription("Invictus is best bot for playing music in your servers . it supports youtube , soundcloud more coming soon !")
      .setFooter("My Prefix Is -")```
#

code

simple zodiac
#

i assume you responded to the wrong person lol but yeah you gotta do that

median iris
#

tell pls

solemn quartz
simple zodiac
earnest phoenix
#

...

median iris
#

pls

lament rock
#

true

solemn quartz
#

to make the bot online

simple zodiac
#

?

median iris
#

hello

#

pls tell

#
      .setAuthor("Invictus", "https://scontent-del1-2.cdninstagram.com/v/t51.2885-15/sh0.08/e35/s640x640/167222470_497654101239265_1837190606735502418_n.jpg?tp=1&_nc_ht=scontent-del1-2.cdninstagram.com&_nc_cat=101&_nc_ohc=fGs15qi-FV0AX-fKd88&ccb=7-4&oh=3160dd412529b5d0930e196b3187ef18&oe=608A3EE7&_nc_sid=fa978c&ig_cache_key=MjU0MTQyMDEwNTMwMTA3MDM1MQ%3D%3D.2-ccb7-4")
      .setTitle("")
      .setColor("BLUE")
      .setDescription("Invictus is best bot for playing music in your servers . it supports youtube , soundcloud more coming soon !")
      .setFooter("My Prefix Is -")```
#

code

earnest phoenix
lament rock
#

@earnest phoenix I hate it when people don't think logically or don't accept help from senior devs

median iris
#

i neeed to add more description'

#

with gap

willow mirage
#

then just add it?

earnest phoenix
median iris
#

like this

simple zodiac
#

yeah i dont understand

median iris
#

​To get started, join a voice channel and `!play`` a song. You can use song names, video links.```
willow mirage
#

use \xa0 for spaces

simple zodiac
#

add \n for new line?

earnest phoenix
#

what

willow mirage
#

and \n to break lines

median iris
#

ok

#

tysm

earnest phoenix
#

KEKW wtf is going on

median iris
#

where

willow mirage
#

?

median iris
#

"after this or

willow mirage
#

where wha

#

no

median iris
#

inside this

#

inside ?

willow mirage
#
Line 1\n Line2\nLine3
#

Line 1
Line 2
Line 3

earnest phoenix
#

I am getting error on track while writing this.

const { thumbnail } = track;
slender thistle
#

I just opened this channel and I'm as confused as I can be

median iris
#

.setDescription("Invictus is best bot for playing music in your servers . it supports youtube , soundcloud more coming soon !")

#

tell with this

#

ls

#

pls

willow mirage
#

wdym

median iris
#

to give gap

earnest phoenix
willow mirage
#

how you wanna make it look like?

median iris
#

of 2 lies

#

lines

willow mirage
#
Invictus is best bot for playing music in your servers . 
It supports youtube , soundcloud more coming soon !

like this?

earnest phoenix
#

Just use new lines???

median iris
#

yes

willow mirage
#

then just simple add \n after servers.

median iris
#

​To get started, join a voice channel and `!play`` a song. You can use song names, video links.1```
earnest phoenix
#

KEKW wtf is happening

slender thistle
#

What the genuine fuck

median iris
#

like this

willow mirage
#
Invictus is best bot for playing music in your servers . it supports youtube , soundcloud more coming soon !\nTo get started, join a voice channel and `!play`` a song. You can use song names, video links.1
#

simple

median iris
#

tysm

willow mirage
#

no problem

#

I do take cash

#

😎

simple zodiac
#

I mean people are just new to discord bots? I understand its confusing for people that are experts with it

#

lmao

earnest phoenix
#

Wow, we're now teaching people how to use new lines?

willow mirage
#

ig?

slender thistle
#

Newlines aren't exclusive to Discord

#

I'm surprised we have to teach Discord bot devs such simple shit

simple zodiac
#

yeah ik

lament rock
#

Born in the wrong generation of devs PensiveYeehaw

simple zodiac
#

lmao

earnest phoenix
#

I now understand why Tim would want to retire

willow mirage
#

LMAOO

willow mirage
simple zodiac
#

lmao

lament rock
#

global.makeNewLine = () => "\n";

median iris
#

Tysm cat

#

i did it

earnest phoenix
median iris
#

tysm

#

car

#

cat

willow mirage
#

no problem

#

I do take cash

median iris
willow mirage
#

or credits cards

simple zodiac
#

i also take cash

median iris
#

O

simple zodiac
#

idk waht for

#

but ill take cash

earnest phoenix
#

Development has basically become shitpost at this point

lament rock
#

The problem is being able to tell who's shitposting and who is genuinely bad

simple zodiac
median iris
#

how to set footer description /

willow mirage
simple zodiac
median iris
#

mm

#

that was like title

simple zodiac
#

yeah

willow mirage
median iris
#

i need description