#development

1 messages Β· Page 581 of 1

rocky dagger
rotund sinew
#

I got my files in a VPS, (node.js) How can I run it? npm run dev isnt working now

#

I get this error ```> my-bot@1.0.0 dev /home/dakota/SeekerBot

nodemon index.js

/usr/bin/env: 'node': No such file or directory

npm ERR! Linux 2.6.32-042stab120.19
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! my-bot@1.0.0 dev: nodemon index.js
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-bot@1.0.0 dev script 'nodemon index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-bot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-bot
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-bot
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/dakota/SeekerBot/npm-debug.log```

inner jewel
#

"'node': no such file or directory"

rotund sinew
#

I made sure node was installed

marble needle
#

@rocky dagger you define coinUser in line 8, coinUser is not a valid property within discord's message object so it errors on line 11 since it can't access a property that doesn't exist

#

drop the message. part wherever you do message.coinUser and try again

frigid thistle
#

Does anyone here use discordia?
I'm just starting with it and I need some knowledge :p

grim aspen
#

discord.ia?

frigid thistle
#

no

#

The bot lib

#

discordia

#

by SinisterRectus

grim aspen
#

i use discord.js

frigid thistle
#

same

#

I wanted to expand my horizons :p

rocky dagger
#

@marble needle Thx

earnest phoenix
#

How can I play an mp3 file on command (please keep it simple) (the mp3 file is in the folder)

pallid jewel
#

You think the Amazon EC2 is good for hosting? Or should I do GCP?

dusky marsh
#

@earnest phoenix can't just ask that, we need additional information, such as, what library are you using?

earnest phoenix
#

@dusky marsh Windows / Destop/MyBot <--- JS

dusky marsh
#

Okay, that doesn't answer my question, tho I'll assume you're using Discord.js

#

Read that. And if you have future questions, it'd be easier for everyone involved if you asked clear and concise questions.

earnest phoenix
#

what i do for my bot answer a people by mention if her was with a nickname ?

dusky marsh
#

@earnest phoenix what library

earnest phoenix
#

discord.js

#

javascript

#

bot.js

#

@dusky marsh

dusky marsh
#
if(<message>.mentions.users.first().id == <client>.user.id) {/*handle if mentioned*/}
earnest phoenix
#

ty

earnest phoenix
#

For the box containing a long description for my bot, i cannot seem to get the correct css class to alter the background color for it, i'm quite new to css and html, the screenshot below is the classes/ids and such, i can't seem to select the proper one to apply the attributes to.

#

(this is for my bot's dbl homepage by the way, if anyone is unsure)

pale marsh
#

The classes you need are .longdescription.content

languid dragon
#

With a space

#

It would be .container .longdescription .content

#

If you can't get it in the first scope, just keep elevating the scope until you override the css

earnest phoenix
#
.container .longdescription .content {
    // stuff in here
}

so this would be the correct syntax?

languid dragon
#

Yh

earnest phoenix
#

i'll take that as a yeah

#

thank you for the help GWczeHowdy

languid dragon
#

Yeah

amber fractal
#

I dont use the .container

pale marsh
#

You should

languid dragon
#

Doesn't matter really

quartz kindle
#

for classes it doesnt matter as long as it has good enough specificity and finds it

#

but for IDs, you should use them if you can

#

css scans the whole document to find classes, but it gets the ID directly from memory. so if you use #id .class the css will only scan that specific ID for classes, not the whole document

#

IDs also give you a shortcut in javascript, so you dont need to use getElementById. example:

<element id="test">
    ok
</element>

<script>
    console.log(test.innerHTML) // ok
</script>```
mossy vine
#

holy shit tim i never knew about that that makes life so much simpler thank

grim aspen
#

what's a good vps to buy? friend's asking me

late hill
#

Can bots create categories

fiery quest
#

Can someone tell me what can i do to avoid this: Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found

#

This problem comes out after adding this:

#

@client.command(pass_context = True)
async def owping(ctx):

msg = await client.say("**Pinging...**")
ms = (msg.timestamp-ctx.message.timestamp).total_seconds() * 1000
embed = discord.Embed(title = "⏱ {}ms".format(int(ms)), color = 0x50D050)
await client.edit_message(msg, new_content = " ", embed = embed)
slim heart
#
// Get 10 values of DATA if x=...
            var values = []
            let parsed_data = new Expression(DATA).parse()
            for(var i=0;i<10;i++) {
                values[i] = eval(`var x = ${i};${parsed_data};`);
            }
        //End
        //Push to base chart
            var valueForChart = []
            for(var i=0;i<10;i++) {
                valueForChart[i] = {
                    "x": i,
                    "y": values[i],
                    "c": 0
                }
            }```
this gives me
```json
[ { x: 0, y: 2, c: 0 },
  { x: 1, y: 0, c: 0 },
  { x: 2, y: 6, c: 0 },
  { x: 3, y: 4, c: 0 },
  { x: 4, y: 10, c: 0 },
  { x: 5, y: 8, c: 0 },
  { x: 6, y: 14, c: 0 },
  { x: 7, y: 12, c: 0 },
  { x: 8, y: 18, c: 0 },
  { x: 9, y: 16, c: 0 } ]```
when i put `2x^2`
and in result gives me this;
https://img.jt3ch.net/99898e1e.png
which is clearly completely off
Anyone might be able to help?
inner jewel
#

it looks like it's using ^ for xor

slim heart
#

o shiiiiit

#

^ isnt actually exponent is it

cold pebble
#

How to do in a server we can do an command to set the welcome channel for my bot Someone can help me pls? (Language: JavaScript)

earnest phoenix
#

have a database
allow the user to define a channel, then store that channel's id in the database

cold pebble
#

no if I am in this server for example I do a command like *setwekcomechannel (channel) In any server and different for all serveur

ember shard
#

How do I code my bot

#

I have python

hushed berry
ember shard
#

Ok

#

I meant where do I go to get to the code

night imp
#

@ember shard

ember shard
#

HOW DO I OPEN THE BOTS CODE

night imp
#

Start at one of these

#

You have to code the bot yourself

ember shard
#

Ok

#

Ik

night imp
#

Do you know how to code in Python?

ember shard
#

Kinda

#

But I don’t know how to get to the place to code my bot

night imp
#

Do you know asynchronous code in Python?

ember shard
#

No

night imp
#

https://youtu.be/5yahh4tR0L0
πŸŽ₯ Discord.py: Making a Discord bot (Part 1: Setup)
https://youtu.be/xdg39s4HSJQ
πŸŽ₯ Discord.py Rewrite Tutorial #1 - How to Create a Discord Bot With Python

In this video, we go over the setup process for creating a discord bot in python. Command Prompt Commands: python -m pip install -U discord.py python -m pip ...

β–Ά Play video

This discord.py rewrite tutorial will show you how to create a discord bot with python. We will be using dicord.py rewrite, the newest version of discord.py....

β–Ά Play video
ember shard
#

Ok thanks

night imp
#

I would use rewrite (2nd link)

ember shard
#

Ok

grim aspen
#

and plus a tutor would help

night imp
#

Wdym tutor?

grim aspen
#

well i mean an instructor if you're wanting to learn more python

night imp
#

Ya can search the internet but I digress

bright spear
#

@late hill yes, a category is actually a type of channel

slim heart
#

what would the regex for if the string doesnt only have permitted characters

So like for example i only want 0-9 and the letter A
So:
"2a 912938" => false
"b" => true
"2a0912312 b" => true

hushed berry
#

wait

#

oh hm

#

one sec

#

[^0-9a]

#

if you just do that

#

and do like

#

matches any

#

it wont match the whole thing

slim heart
#

doesnt look like it

#

oh wait

#

the +

#

my b

hushed berry
#

lul

#

.*[^0-9a].*

#

this will match the whole thing

slim heart
#

what do the .*'s do

#

o cool

hushed berry
#

just match the rest of the string

#

.* just means

#

match any amount of anything

slim heart
#

instead of / /g?

hushed berry
#

?

slim heart
#

/regex/gi

#

wait

#

i feel lik i just derped

#

whatever, thank you ver much

hushed berry
#

lul

slim heart
#

@hushed berry wait is there a way to do it like conditional in the regex?

hushed berry
#

what are you trying to accomplish

slim heart
#

cuz i kinda wanna do the .exec so that i can get the specific part of the string that wasnt allowed

#

doing ! would just return false and whatnot or the things that it's supposed to be

hushed berry
#

wait

#

im confused

slim heart
#

wait i thyink i just went stupid mode again

#

im sorry lol

hushed berry
#

smh

celest saddle
#

For peeps that use source control, do yous use source control with a second bot and just update your main bot upon updates?
what's the go?

#

Like, how would I efficiently run certain versions only while being able to add stuff?

sick vine
#

I have a test bot to test fatures before adding them to my main bots

#

If someone isn't in the servers my bot is in, then they can't DM the bot right?

celest saddle
#

I can check if you want, what's your bot's name and tag?

bright spear
#

@sick vine yes, you need a mutual server

sick vine
#

Ok good.

#

I disbanded a server due to drama and I don't need them trying to use my bots

earnest phoenix
#

Anyone have idea how to reduce cpu usage of my bot? I have 2 cpu cores at my vps and my bot only in 700+ server but they're using 100% of cpu :(

late hill
#

Yes figured it out

languid dragon
#

then fix them wearies

#

using css

#

google it

#

no

#

CSS is literally the easiest thing to learn

#

you don't even have to learn it

#

just copy paste the code from the site

#

use F12 to open up chrome's dev tools and use the selector tool to pick what element you want to change the CSS of

#

figure out the class/ID's and element names and place that in the long description as CSS

#

for example

#

you have an element called

<div id="first">
    <div class="second">
        <third>
            Text
        </third>
    </div>
</div>
#first .second third{
    color:text-color-here;
    background:some-background-color;
}
#first .second{
    /* more styles for .second */
}
#first{
    /* styles for #first */
}
#

no

#

that is the website's CSS

#

that's my CSS lmao

#

whatever is in the element with the class ".longdescription"

#

it's not imported as a CSS sheet

#

it's injected directly into the HTML as a style tag

#

i explained that earlier

#

no you haven't

#

you found thenewstyle.css which is my CSS which is the sites CSS

#

yes

bright spear
#

CSS is easy to learn but hard to master

trail trout
#

this is when i change my region server to Singapore, Japan, and Hong-kong.

#

It returns this error. But, if i change it to the London for the example...

#

It will leave by itself and no error return.

#

I hosted on DigitalOcean.

#

Is it problem from my VPS or Discord?

late hill
#

What would be the best way to get the id of the @ everyone role using Eris πŸ‘€

#

guild.roles.find(role => role.position === 0) I guess

#

Thanks for the help bois

bitter sundial
#

the @ everyone role shares ID with the guild

late hill
#

oh wow

hushed berry
#

πŸ˜‚

earnest phoenix
#

How to use async ?

#

https://hastebin.com/utapifehaz.js
When i pay someone and check balance , balance becomes undefined.. its nothing wrong with the balance command but this command messing something up

dusky marsh
#

@earnest phoenix you use "await" in an async function to await data

earnest phoenix
#

hi

late hill
#

Use a database

#

Also doesn't make much sense that you're using an object for just 1 value

#

Another issue is that your code doesn't check for negative values

#

Which means user a could pay user b a negative amount to steal their money

#

fix those things πŸ˜‰

vital oracle
#

hi

rotund sinew
#

Node.js How can I add a music feature to my bot? Like it searches youtube and plays it if person is in a voice channel?

earnest phoenix
#

people nowadays use lavalink

earnest phoenix
#

@languid dragon wtf is this kind of bot

#

is it ur bot?

languid dragon
#

Duh

earnest phoenix
#

what a no neccesarsry bot

languid dragon
#

why do you care lmao

earnest phoenix
#

because that bot hacked my account

languid dragon
#

cool

rotund sinew
#

Doubt it

slender thistle
#

How can a bot hack your account though

earnest phoenix
#

your token

slender thistle
#

How does it get that?

earnest phoenix
#

In google chrome

slender thistle
#

Checked the invite link, redirects to nothing

#

Applications don't get access to user tokens

#

Even through the OAuth2 page

earnest phoenix
mossy vine
#

"that bot hacked my account"

#

a bot cant get your token holy fuck

earnest phoenix
#

Yes

#

but you can yourself

marble needle
#

that's called logging in

earnest phoenix
#

πŸ‘

mossy vine
#

question is about how a bot can get a token (it fucking cant)
posts video about how you can get your own user token

#

9000 iq

#

tl;dr there is no way for a bot using the discord api to get access to your account, therefore a bot cannot hack your account.

earnest phoenix
#

I spyk theu anglishe trer bi1

mossy vine
#

not even google translate can fix that sentence

marble needle
#

highly enjoy how you link to an outdated video aswell

#

discord stopped storing tokens in local storage for months

#

you can still find them in api request headers, either being the case you're not gonna grab anyone's token with a bot

mossy vine
#

mfw you answer my question before typing it out

rotund sinew
#

Okay, to clean up servers, how can I make my bot DM a help message?

mossy vine
#

<User>.send()

#

assuming youre using d.js because you didnt specify anything

rotund sinew
#

Oh right, yea

#

So lets say, client.on('message', msg => { if (msg.content === '$help') { msg.reply('help message'); } }); would become client.on('message', msg => { if (msg.content === '$help') { <user>.send('help message'); } });

mossy vine
#

no s my h

#

<> means placeholder

#

in that case it would msg.author.send

#

but dont make a new event listener for every command

rotund sinew
#

Ok, thank you man!

grim aspen
#

wait

rotund sinew
#

And I know it was an example

heady basalt
#

hi guys

grim aspen
#

which library again are you using?

rotund sinew
#

Me?

heady basalt
#

im new here

#

im begging for help

mossy vine
#

just post your question

heady basalt
#

About sequence diagram

grim aspen
#

yes @rotund sinew

rotund sinew
#

Discord.js

grim aspen
#

ah

rotund sinew
#

node.js

mossy vine
#

node.js isnt a lib

grim aspen
#

i thought msg.channel.send('message') would work for it to reply too?

mossy vine
#

he wants to dm a help message

grim aspen
#

oh

rotund sinew
#

BOOM worked, thanks man

mossy vine
#

yw

rotund sinew
#

Nah I got it to reply, I wanted it to send a DM

marble needle
#

know clapking the clapking difference clapking
Javascript is a language,
nodejs is a run-time environment,
eris and djs are libraries

rotund sinew
#

Ik

rotund sinew
#

Ok, I made a program for 8ball, pretty easy? Well, I need the people to ask the question and the bot repeats it before the answer.

    var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];

    return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', msg => {
 if (msg.content === '$8ball') {
 msg.reply('Your anwser is: ' + doMagic8BallVoodoo());
 }
 });```
#

Currently you just say $8ball and it works

nimble urchin
#

is dis javaq?

#

*java

rotund sinew
#

Javascript

nimble urchin
#

yes.. i dont know java i use python lol

rotund sinew
#

Or, I mean Discord.js

#

Oof

#

Ok, I made a program for 8ball, pretty easy? Well, I need the people to ask the question and the bot repeats it before the answer.

    var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];

    return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', msg => {
 if (msg.content === '$8ball') {
 msg.reply('Your anwser is: ' + doMagic8BallVoodoo());
 }
 });```
Currently you just say $8ball and it works
nimble urchin
#

why dis not work!?!?

if message.content.startswith('/8ball'):
        randomlist = ["The sky says most likely", "The moon says not", "INEEDIDEAS", "I would say its a maybe"
mossy vine
#

are you getting any errors?

nimble urchin
#

nope

mossy vine
#

are you sending anything back?

rotund sinew
#

Nope, just wont run if I add the question

nimble urchin
#

what u mean sending back?

#

i say

#

/8ball

#

and nothing happen

mossy vine
#

do you send anything to the channel after defining the randomlist

#

send the full /8ball code

#

@rotund sinew because you are checking exactly for $8ball so if my message is $8ball hi it wont work because it isnt exactly $8ball

#

you would need to use message.content.startsWith

rotund sinew
#
    var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];

    return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', msg => {
 if (message.content.startswith === '$8ball') {
 msg.reply('Your answer is: ' + doMagic8BallVoodoo());
 }
 });``` doesnt work
mossy vine
#

error?

#

oh i wonder why

marble needle
#

startsWith

rotund sinew
#

Yep

marble needle
#

not startswith

mossy vine
#

one second you define the incoming message as msg then check for message.content

marble needle
#

how did that even reply in the first place then

mossy vine
#

πŸ€”

#

no fucking clue lmao

rotund sinew
#
    var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];

    return rand[Math.floor(Math.random()*rand.length)];
}
client.on('message', message => {
 if (message.content.startsWith === '$8ball') {
 msg.reply('Your answer is: ' + doMagic8BallVoodoo());
 }
 });``` doesn't work either
mossy vine
#

because you still have msg.reply

#

yeah, he is amazing at css

ivory kelp
#

^^

rotund sinew
#

function doMagic8BallVoodoo() {
var rand = ['Yes', 'No', 'Why are you even trying?', 'What do you think? NO', 'Maybe', 'Never', 'Yep'];

return rand[Math.floor(Math.random()*rand.length)];

}
client.on('message', message => {
if (message.content.startsWith === '$8ball') {
message.reply('Your answer is: ' + doMagic8BallVoodoo());
}
});

#

Doesnt work either

marble needle
#

would you mind sharing the error for once

rotund sinew
#

I have no error, the only error was fixed

#

It just doesnt reply

mossy vine
#

oh god

#

this is cursed

#

please learn javascript properly

coral hedge
languid dragon
#

um thnx

dusky marsh
#

Why is it that making discord boots attracts people who know little to nothing

#

Bots* fuckin ac

crimson gull
#

Because they like to think it is the best first project to tackle, for some reason.

dusky marsh
#

For some reason indeed, a reason I have yet to find lmao

rotund sinew
#

Ok... I am sorry for asking so many questions

neon swift
#

How hard can it be to make a discord bot. It only like needs to listen and answer

crimson gull
#

If you're a bot, that's all you need your bot to do.

rotund sinew
#
    if (message.content.startsWith("$ban")) {
        if(!message.member.roles.find("name", "MODS"))
            return;
        // Easy way to get member object though mentions.
        var member= message.mentions.members.first();

        // No mentions catch
        if (member === undefined) return;
    // Sends them a message
    msg.member.send('You have been banned');
        // Kick
        member.ban().then((member) => {
            // Successmessage
            message.channel.send(":wave: " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou :point_right: ");
        }).catch(() => {
             // Failmessage
            message.channel.send("Access Denied");
        });
    }
});``` sends the DM to whoever did the ban, I am trying to make it message whoever was banned.
mossy vine
marble needle
crimson gull
#

Alright, to be fair, I have quite a few "unfinished" comments in my code.
The idea is to help you out in reading. It doesn't need to be perfect to be helpful.

rotund sinew
#

@mossy vine Thats because I just edited my kick command

grim aspen
rotund sinew
#

But yea, I don't get how to send it to them

coral hedge
#

You shouldn't have multiple message listeners.

marble needle
#

^^^^^^^

mossy vine
#

tHIS IS WHY

marble needle
#

great

coral hedge
#

Use a command handler instead.

grim aspen
#

ignore it @rotund sinew

rotund sinew
#

So I can't get it to DM them?

#

Without changing my whole script

crimson gull
#

You'll need some decent changes to your code, in general. Ignoring what you are trying to do, there are some things that should be changed just to make the bot run better as a whole.

neon swift
#

Sometimes I wish I knew more js just so I could see how stupid some people are with their discord bots

marble needle
#

dont need to know a lot of js to smell the bullshittery that's going on in here on a daily basis

rotund sinew
#

Well Bypass, Im just making the structure now then gonna make it run smoother after it works

marble needle
#

pushing those mem leaks as far as your toaster can pull heh

neon swift
#

Has anyone made a library comparison that doesn't just compare API coverage?
I mean something like saying what features the language/library provide

rotund sinew
#

No need for it to store anything

coral hedge
earnest phoenix
#

Correct me if I'm wrong, but seeing that slack and discord are nearly identical in user interface, are they the same on the back end as well? A discord bot would be easily slotted into slack?

mossy vine
#

hell no

#

slack has an entirely different api

#

and afaik bots arent that common there

ruby talon
#

(python)

#

Well prints 'None' is what I mean.

#

While running the subcommand 'list'.

earnest phoenix
#

@mossy vine We will be using bots to address equipment FAQ. Our company is based on sales/installation/maintenance of equipment. We have more maintenance personnel in the field than our office staff.

#

So having FAQ bots setup for specific pieces of equipment in specific channels would be great.

#

But other than the API, I would probably be able to repurpose it sounds like.

inner jewel
#

if you need to have it both in discord and slack you could write an abstraction layer over the actual platform

#

so you can reuse code between both

#

and only change what service is being used

earnest phoenix
#

I only need it in slack

#

but it would be nice to be able to copy and paste some functions from discord bots.

slender thistle
#

@ruby talon could you post that on hastebin?

ruby talon
#

Hastebin is a bit buggy for me.

#

I'll try tho.

#

Well

#

It doesn't seem to be working;

#

You can do it if you want to you have the code from pastebin.

loud salmon
#

Discord and slack have very different backends iirc

crimson gull
#

I can never get Hastebin to work.

rotund sinew
#

Me either

crimson gull
#

Wish I knew a bit more Python so I could help

ruby talon
#

Thanks tho. ^^

neon swift
#

gists are a thing

#

wtf are those try: except: blocks supposed to do @ruby talon ??

hushed berry
#

gists are kinda annoying tbh

ruby talon
#

I remove them when it works.

#

Uts just for fast error handling;

neon swift
#

..........

#

That's not how you are supposed to debug your bot, not at all

#

also if your function doesn't need to deal with async code, there's no need to async def it

#

Your command prints None because aa() isn't returning anything

#

also those try except blocks are useless because there's never anything that would raise some error in those blocks

#

it's like expecting

try:
    a = 1
except:

to throw an error.....

#

@ruby talon You still here?

#

explain me where did you learn how to python?

marble needle
#

its more of a programming at its core concept problem rather than the language he uses

neon swift
#

well yeah, but he is trying to use python, so I asked where did he learn it

ruby talon
#

Partly from myself, learning from other ppl there code and udemy (havn't finished that course yet tho).
And btw your statement: "Your command prints None because aa() isn't returning anything" isn't true since it just didn't meet the requirements to return something, because there is a difference in objects thats why it doesn't work.
And previously there was more code in those blocks so they stayed there for now.
and it doesnt work without async, believe me I tried.

#

But its fixed, I found it myself, it was a stupid mistake.

neon swift
#

didn't meet requirements to return == doesn't return anything

#

also your if statements will always be false. discord.Status is an enum, not a string

ruby talon
#

yep

#

That was my mistake.

#

Tought it was a string thats y it didn't work at all.

neon swift
#

and somehow having duplicate code and function definitions per for loop step is not a mistake ???

ruby talon
#

brooo chill, I prefer to first fix a problem and then optimize the code lol

#

works faster for me.

neon swift
#

"optimze" is used lightly in this context

ruby talon
#

since this isn't optimized

#

oml

marble needle
#

pasting the same block of code all over the place isn't what programming is about, your goal is to have it in one place and be able to use it wherever

ruby talon
#

well

#

seems like u don't read my messages lol

neon swift
#

I think I could have the same command be one-liner

ruby talon
#

well

#

do it then IDC, but hf.
I would be happier if my code would run in place of it 'looking clean'.
(and most 1 liners aren't clean lol)

But I'm going further, have a great day!
πŸ˜„

rotund sinew
#

I don't want mine clean

ruby talon
#

And a tip endu for the future, don't make your messages so insulting.
It might not be ment that way but it really pissed me off for a sec.

#

Maybe add your opinion ect as tips then it will get appriciated.
πŸ˜›

neon swift
#

I mean, if facts piss you off then

split hazel
#

Our server keeps getting chain mail sent that spams the chat with huge text art. Any ideas how i could create a filter for them?

ruby talon
#

I just mean you could say it on another way.

neon swift
#

Arthur, you should really learn how to program, just because your code works, doesn't mean you know how to program

ruby talon
#

Well not really.

rotund sinew
#

Wait

marble needle
#

all he did was make you aware of clear structural errors, that's what happens if you ask questions in a software development, people will tell you what else is wrong with your code

rotund sinew
#

Whats that code do?

neon swift
#

Counts the status of members in this server

rotund sinew
#

So this would ctx.send(", ".join([f"{s}: {sum(1 for m in guild.members if m.status == s)}" for s in discord.Status]))

ruby talon
#

@marble needle I appriciate the critique, I just wanna help him prevent pission off other members that have been in a "bad" mood for the day.
Its not like I'm angry at you Endu xD

#

Endu, I wanted to get the amount online membs of a role.
But thanks tho.

neon swift
#

Online members are litterally all - offline

ruby talon
#

Ye.

#

But I'm stupid

#

xD

#

But its a better solution indeed.

marble needle
#

@split hazel you could pick a few characters used in the art that are uncommon/don't usually occur in regular chat messages, filter message content based on those ascii art characters and delete them if the message contains whatever be it one, two or thirty of them

ruby talon
#

I should do that.
ty xp

neon swift
#

@split hazel Or you know, enable slowmode

split hazel
#

Yeah thats what i thought thanks

#

Well why slowmode?

ruby talon
#

@marble needle Maybe use it like if more than 70% of the message has those chars del those.

rotund sinew
#
 ctx.send(", ".join([f"{s}: {sum(1 for m in guild.members if m.status == s)}" for s in discord.Status]))
 }``` Doesn't work
ruby talon
#

ehm

rotund sinew
#

You said it counts members

ruby talon
#

Are you using python and js in one file?

#

The code he posted was for python.

rotund sinew
#

Js

marble needle
#

for the love of god, stop whatever you are doing and read through all the content including links that are pinned in this channel

earnest phoenix
#

what the fuck is that code

rotund sinew
#

LOL

marble needle
#

copied some py eval command someone posted above and threw it into js

earnest phoenix
#

pythonscript

rotund sinew
#

Y'all know I was messing with you

#

I may be dumb, but not THAT dumb

ruby talon
#

cry, hahaha you should invent that.

neon swift
#

People already did, but nobody wants to make it a reality

#

why would you want scripting language for html that looks kinda like python but is nothing like python

marble needle
ruby talon
#

Endu, can I ask you a question?

neon swift
#

πŸ‘‚

ruby talon
#

with a function in python when you return more than 1 item, how do you do that?
Like for example:

def foo():
    return False, 'bar'

How would you print the bar or get the False?

#

I'm probb stupid for not knowing this xD.

neon swift
#

pretty sure it just returns them in a tuple

#

so you can rv[1] to get 'bar'

ruby talon
#

And could you do this in your return func?

barcount = 0
def foo():
    return 'bar', barcount +=1
#

ok, ty

neon swift
#

no, you can't execute statements like that

ruby talon
#

thanks. ^^

rotund sinew
#

client.user.setGame("$help for Commands"); Can I make it like those others that say Playing <number of servers>

#

Oh right, djs

marble needle
#

${expression} in the syntax would be the server count

rotund sinew
#

Yes I know itll be ${something}

#

Would expression be the thing?

marble needle
#

are you aware of what expressions are in programming(or js)

rotund sinew
#

client.user.setGame( ${expression} + "|| $help");

#

Yes I know what they are, I don't know what expression I would use

marble needle
#

thats also not how template literals work

`${<expression>} and some other stuff`
#

you use backticks to wrap around the templated string

rotund sinew
#

But what expression would I use

#

Thats what I needed to know

marble needle
#

read the djs docs and figure out how to get the server count lol

#

also, .setGame is deprecated, use .setActivity

split hazel
#

When you attempt to code a bot but don't know the difference between javascript and python

ruby talon
#

Forbidden (status code: 403): {"error":"Forbidden"}

#

read

#

^^

split hazel
#

Few posibilities

ruby talon
#

I think that #topgg-api is more appropiate.
And ehm, are you using discord.py rewrite or the async version?
If you're using async its normal that it doesn't work with just copying it.

#

Are you using your secret dbl bot token thingie?

earnest phoenix
#

discord.py rewrite is a bad lib for programming bots in python?

marble needle
#

it’s a rewrite, hence supposed to be better than the original build lol

neon swift
#

it is better

#

and it's the only version getting updates

slim heart
#

how can i add a full string of a few characters to an already made /[0-9jkdnjewj]/ because if i add the specific string to it then itll count any of the letter into it instead of it all combined

earnest phoenix
ruby talon
#

Ehm

#

wuduheck, how duheck do you create a channel object in discord rewrite?

vernal rivet
#

Did you check the docs?

ruby talon
#

Couldn't find it.
(used control f)

#

I tought by doing discord.Object but seems like that only worked on async.
Exept if I'm trying to send the message wrong.

vernal rivet
#

You using discord.js?

ruby talon
#

My code representation:

channel = discord.Object(id='123456789')
await channel.send('foo-bar')
#

Rewrite.

vernal rivet
#

IDK py, sorry

ruby talon
#

np ^^

vernal rivet
#

Next time you might want to say what lib your using πŸ˜…, it's help you as much as it helps know what you trying to do, on what lib

ruby talon
#

Yes.
I'm sorry forgot it this time.

vernal rivet
#

It's all good

ruby talon
#

I said discord rewrite I'll say Python discord rewrite next time.

#

:p

slender thistle
#

@ruby talon client.get_channel

#

Or guild.get_channel

ruby talon
#

xD

#

Timing, ty tho lmao.

slender thistle
#

Just don't create the objects yourself

ruby talon
#

πŸ‘

glad creek
#

I'm using DiscordRB, and is there a way to check if a channel is NSFW? I looked at the documentation and it mentions channel#nsfw and channel#nsfw?, but I tried both of those and got an Undefined Method error

#

maybe it has to do with Discord changing how NSFW status was handled, since the library was made?

earnest phoenix
#

Anyone have giveaway command

sand crown
#

Yes.

earnest phoenix
split hazel
#

Firstly do you get any errors in console

#

And we don't spoonfeed code

earnest phoenix
#

process.exit() is normally a good solve-all solution to bugs

scarlet quest
#

if someone connected to steam on his discord, is there a way for me to get his steam link using JDA ?

#

tag me if u answer plz

mossy vine
#

afaik there is no way to get a users connected accounts with the api

amber fractal
#

Not without OAuth2 connections

earnest phoenix
#

if there was an error i wouldve posted it

amber fractal
#

ngl this is why I hate that db I could never understand how it actually worked so I settled with something simple mmLol

earnest phoenix
#

yea i tried that

#

still isnt taking money out or adding

rugged terrace
#

If any of y'all need an easy player storage for nodejs try out enmap

#

Super easy

earnest phoenix
#

i alrdy have everything done

#

id rather just fix it than to rewrite my whole bot

quartz kindle
#

have you tried debugging?

wanton walrus
#

Webstorm has a sexy debugger

earnest phoenix
#

no

quartz kindle
#

the simplest form of debugging is adding console.log in all relevant lines and log all relevant variables to see where it breaks

earnest phoenix
#

well

#

im pretty sure it breaks at

quartz kindle
#

then do this

earnest phoenix
#

this is what i get back

#

i literally got it working then it randomly broke again i didnt even touch anything

quartz kindle
#
console.log(global.db.get(relevantuser))
// update user code
console.log(global.db.get(relevantuser))
// update user code 2
console.log(global.db.get(relevantuser))```
#

or equivalent

earnest phoenix
#

ill try

#

global.db.get isnt a function

quartz kindle
#

i mean

#

do it the same way you do to get the user from the database

#

the idea is to read the user, then update the database, then read the user again, to see if the value was updated or not

#

and do this on each line that affects the database

#

if the database is not updated in a specific line, that means the sql query on that line is the problem

earnest phoenix
#

its just giving me a lot of info

#

not sure what im looking for

bright meadow
#

Any easy way to detect if message contains discord invite link πŸ€”

earnest phoenix
#

do you think that this part could be the problem?

coral hedge
#

What exactly are you typing as the command Sushi? Because from my understanding, amount is set to 0

earnest phoenix
#

well

#

thats why i took out amount

#

OH

#

I TOOK OUT AMOUNT

quartz kindle
#

Lol

earnest phoenix
#

LMAOOO

#

breh

coral hedge
#

Nice.

earnest phoenix
#

thanx

#

❀

#

brings me back to my original problem , the bot allows me to gift someone an amount of coins that i dont even have, and that breaks the whole database

coral hedge
#

Because you didn't return on line 24. ("Not enough Stripes")

earnest phoenix
#

T-T how do i reset it lol

#

i did

#

not in the link i gave you

#

wait maybe i didnt tho

#

is there a way for me to reset the database? cuz its broken

coral hedge
#

If you want to delete all the rows in a table DELETE FROM tableName

coral hedge
#

@long cipher to continue,
It's not defined because you didn't define it.

long cipher
#

how would i define it

amber fractal
#

That's basic to any programming lang

quartz kindle
#

npm -i undefined

#

:^)

amber fractal
#

Yes

#

very undefined module

earnest phoenix
#

πŸ˜‚

#

you are what?

earnest phoenix
fiery birch
#

I don't think this is bot development, you should ask in #general

earnest phoenix
#

I did

fiery birch
#

no you really didn't

earnest phoenix
#

I’m trying to get my bot on the discord server

#

And this keeps happening

fiery birch
#

you asked them to come help here

#

oh

earnest phoenix
#

Help

#

Plz

#

You have something wrong with your invite. Simple

#

Also, you can't add the bot to this server. Only people with perms can do that.

#

Ik

#

I’m trying to add it to my test server

#

Like I said, you have something wrong with your invite.

amber fractal
#

I like that jobs at discord tab tho

#

I wish you luck if you every apply

earnest phoenix
#

Is it the account i’d?

#

That didn’t work

earnest phoenix
#

is lavalink meant to use a lot of ram
only 1 stream of music uses like 90% of my ram
and i have 8gb ram

earnest phoenix
#

can anyone help me?

rustic axle
#

@earnest phoenix It uses a significant amount of compared to ffmpeg but not that much iirc...

#

are you sure a memory leak is not going on or you are not creating multiple instances?

sinful lotus
#

is it lavalink or your code?

earnest phoenix
#

that and lavalink is java, its going to eat your ram over a longer period of time

sinful lotus
#

yes but in my usage, mine is staying at 2gb

#

as well is it really in lavalink and not his code

humble plaza
#

I'm having trouble hosting my bot on deploys.io. Basically I bought the discord bot hostage package for a NodeJS bot and I keep running out of RAM apparently.

#

My bot simply responds with a link when tit see's the command in chat

#

I contacted support and they told me the server keeps running out of memory (its' only around 70MB, i know that's nothing in sense of modern day RAM but it's a simple bot with one functiom)

#

only costed 3 euros lol

earnest phoenix
#

that is a scam

#

you can get a decent vps on scaleway for 3 euros

humble plaza
#

they seem legit

knotty steeple
#

its a scam

humble plaza
#

it's just 3 euros for 3 months of hosting

#

is it?

#

damn ity

#

it

#

I feel stupid

knotty steeple
#

70 mb of ram

#

3 euros

humble plaza
#

I just wanted a simple service for a simple bot

earnest phoenix
#

yeah it is legit but its a huge ripoff

knotty steeple
#

yea but thats nothing

#

discord.js uses 100mb mostly

humble plaza
#

Any recommendations for hosting?

knotty steeple
#

galaxygate

humble plaza
#

Thing is the bot worked for a day r two

earnest phoenix
knotty steeple
#

digitalocean

humble plaza
#

ty

earnest phoenix
#

2 euros for 1 gb vps

knotty steeple
humble plaza
#

Cheers guys

#

I'm just gonna format my raspberry pi and put it on there

split hazel
#

In discord js, How would I get the first x amount of messages from a collection? I have a purge command that fetches messages in a channel then filters them by user id and I need to delete x amount of them

neat falcon
#

@knotty steeple no bad host

knotty steeple
#

no u

neat falcon
#

yes u

hushed berry
#

@earnest phoenix just specify a smaller max heap, it's as simple as that

earnest phoenix
#

putting a band aid on the problem is not solving it

amber fractal
#

Band aids are good for the process of solving it

hushed berry
#

@earnest phoenix wdym

#

was that in response to me πŸ€”

earnest phoenix
#

yeah

#

since the actual vps provides 100 mbs of ram

copper cradle
#

nice

spiral lava
#

Anyone hosting a bot on an RPI3?

#

If so, just have a question regarding it.

inner jewel
#

just ask the question, don't ask to ask

spiral lava
#

Eh, no reason in asking an entire question when someone may not answer.

#

Β―_(ツ)_/Β―

#

My bad.

earnest phoenix
#

just tell the question

spiral lava
#

Just curious if anyone has ran a bot on a RPI3, with a high server count, possibly using sharding.

knotty steeple
#

no

spiral lava
#

RPI3 farm? πŸ€”

knotty steeple
#

rpi is limited in many ways

spiral lava
#

In what ways

#

Obviously hardware wise.

knotty steeple
#

ram

#

cpu

spiral lava
#

Yeah, makes sense. What about network wise? Ever experience that?

#

Not on a RPI

knotty steeple
#

i dont use pi

spiral lava
#

Clearly.

#

In general, I'm curious about the network load on a heavily used bot.

inner jewel
#

if you don't need a lot of resources (aka no music) you can run a few thousand guilds on an rpi

spiral lava
#

Oh, alright, that's good to know. Won't be doing music, image rendering, etc.

ruby dust
#

in python, how would you get a datetime.datetime object representing 2 weeks ago from now?

#

nvm, got it working finally

slender thistle
#

@ruby dust How did you do it?

ruby dust
#

why did I have a feeling that someone will question me

#

there's a thing called datetime.timedelta

slender thistle
#

Noice

#

timedelta is πŸ‘Œ

ruby dust
#

I wanted to use it for purge(), but the only way to make use of it properly is with after, but then there's this

#

it basically forces it to be True if you specified after, idk why but that messes up the purge

bright meadow
#

Someone can work good with java Strings?

Please DM

inner jewel
#

just ask the question

bright meadow
#

(Need help with string.matches)

#

To check if message contains discord invite link

#

I tried some regex's but they dont work

mossy vine
#

make your own regex

bright meadow
#

@mossy vine I did, still not working

hushed berry
#

@bright meadow String#matches checks if a pattern matches the entire string

#

so its not the method you're really looking for

amber fractal
#

Well now it's working, but it wont center

#

Now it works

#

didnt change anything

languid dragon
#

Use css

amber fractal
#

No point it works now

languid dragon
#

Next time use css

earnest phoenix
#
  let platform = "";
  
  const filter = m => m.author.id === message.author.id;
  
  message.reply("Please chose a username. This will expire in 15 seconds...").then(q => q.delete(15000))
  message.channel.awaitMessages(filter, {
    max: 1,
    time: 15000
  }).then(collected => {
    collected.delete(15000);
    if (collected.first().content === 'cancel') {
      return message.reply("Canceled.");
    }
    username = collected.first().content;```
bot doesnt read names that are 3 args or more can someone tell me why?
amber fractal
#

I don't know tbh, but you use chose and not choose mmLol

glacial venture
#

i need help

#

I'm using node.js for my bot and the arguments in bot.on("Message") aren't the same as what I see other people using

#

I see people indexing the Message to get author, user, and other useful information, but mine is literally just a string and I get "undefined" when I try to index it

amber fractal
#

Yes

glacial venture
#

am I doing something wrong?

earnest phoenix
#

hiring someone to screenshare and help me with this sqlite3 problem im having , payment will be based off of how much has to be done to fix

amber fractal
#

@glacial venture you use discord.js?

glacial venture
#

I think that's what it is

amber fractal
#

Think?

#

did you npm i discord.js

glacial venture
#

hold on

#

i guess I'm using the wrong discord lol

glacial venture
#

alright I switched and now it works great thanks for the help

solemn walrus
#

I'm trying to make a starboard that only posts if 3 people (not including the person who posted the message) react to the message

rocky mesa
#

what lib?

solemn walrus
#

I'm using discord.js

amber fractal
#

I remember doing something like that a long time ago

#

Let me see if I still have it so I can remember what I did

#

Ah yes

#

48 lines of amazing code

#

It doesnt check for reactions on a starboard message though, just the original, suppose I could add it but meh

#

well 57 now I forgot to add stuff for removing stars mmLol

#

I mean I dont know how to explain it without giving you the code in a way that isnt obvious already

#

basically on reaction add if it is a star check it's count

#

if it's above what you want then add it to a starboard

#

and save the id, but it's obviously a little more complicated than this

#

I just cant really explain it better lol

solemn walrus
#

Thanks for answering

rocky mesa
#

we have made it go to the channel but the amount of stars on the message doesnt change

amber fractal
#

Well you only fetch a bunch of messages

#

well 100

rocky mesa
#

kek

amber fractal
rocky mesa
#

this is ours

#

I like urs

amber fractal
#

The difference is I store my message ids in a db so you can do one from any time

rocky mesa
#

nice

earnest phoenix
#

So I was at a book store today and was looking at Node.JS Training books and was wondering if buying a book is the same as https://discord.js.org/#/ ?
Discord.js. The books are just learning the language not discord bot development.

amber fractal
#

The book will teach you about the language not the libraries

#

it's like expecting to find slang in a translation book mmLol

earnest phoenix
#

So is the website the best option?

amber fractal
#

Well for the library

#

not the lang

earnest phoenix
#

Like I have someone helping me learn it, and most things I already understand.

#

If I were to get a book to learn, any good ones?

amber fractal
#

I never read any, so I wouldn't know, sorry

earnest phoenix
#

How did you learn?

amber fractal
#

A lot of self teaching and my high school

earnest phoenix
#

So Discord.JS be a good start for me or is there a better one?

#

I have a bot running now and is basic but I really want to expand it.

amber fractal
#

I'd say it's an easy lib to use

earnest phoenix
#

Yea it's laid out well.

grim aspen
amber fractal
#

You're sending a string

#

You probably have it set up to just do :emoji:

grim aspen
#

then what do i do to fix that

#

i'm using discord.js

ruby dust
#

You need to send the full emoji string

grim aspen
ruby dust
#

How exactly the full string looks like you can get by adding \ at the beginning of it

grim aspen
#

i will look

amber fractal
#

Well you could ust do <Emoji>.toString()

ruby dust
#

Yeah no shit, do it here

amber fractal
ruby dust
#

Steven no need to make this even more complicated

amber fractal
#

![mmLol](https://cdn.discordapp.com/emojis/356831697385422848.webp?size=128 "mmLol")

#

Thats the full string of mmLol

grim aspen
#

what does the number represent exactly? making sure

amber fractal
#

the id

grim aspen
#

of the emoji

ruby dust
#

@grim aspen I wasn't saying that bots have to add that symbol to work with emojis, I was saying that you need to use this method to get the full string for the bot to use then

inner jewel
#

also wrong slash

#

it's \

#

not /

grim aspen
#

i'm trying to get it to send this emoji when ever it gets pinged: AngerSock

ruby dust
#

Look

#

Do the same thing here with this emoji, but add \ in front of it

amber fractal
#

\:emoji:

grim aspen
#

i think it's an error by my system

ruby dust
#

What

amber fractal
#

it isnt

ruby dust
#

How can a string cause a system error?

grim aspen
#

i mean, instead of sending an emoji, it sends the text instead, your help is helping, but i think it's an error with my bot

ruby dust
#

Holy fuck

#

I'm just asking you to do \:emoji: right here in this channel

grim aspen
#

:emoji:

#

did it

amber fractal
#

the actual emoji

ruby dust
#

Not too literally

grim aspen
#

oh

#

well then

ruby dust
#

There, now copy and paste that into your code

amber fractal
#

there

ruby dust
#

That's the full emoji string

#

Have a nice day

grim aspen
#

thanks

#

it works

earnest phoenix
#

Checked online and theres almost no references regarding it

#

the only answer i can think of is my bot has evolved and tried to join the vc using google chrome

#

but i don't think thats very accurate

#

Also the error is not consistent as its only happened once and was fixed with a bot restart. Not happened since

#

also code snippet

fiery birch
#

idk, but cool ide

earnest phoenix
#

thanks bic boi its webstorm with material theme and custom background

bright spear
#

@earnest phoenix looks like you're using the browser version of discord.js

earnest phoenix
#

its normal discord.js

wide ruin
#

discord.js.

#
const token = 'NTI4NjU3MzE...........................OXP-uxP-c8'
const discord = require('discord.js')
const client = new discord.Client();

client.login(token)```
#

the bot is offline

mossy vine
#

try adding this in your code and see if it logs anything

client.on('ready', () => {
    console.log('Hello world!')
})```
wide ruin
#

nothing

mossy vine
#

can you screenshot your terminal after starting your bot

wide ruin
#
client.on('error', (err) => {
    console.log(err)
})```
#

this was added as well

mossy vine
#

start your bot and screenshot your terminal

wide ruin
mossy vine
#

so it is running. just not going onlien

wide ruin
#

yeah

mossy vine
#

you sure the token is correct and is corresponding to your bot?

wide ruin
#

yeah i copied it from discordapp

#

with the copy button

earnest phoenix
#

are you sure its the token and not the client secret

mossy vine
#

^

snow swallow
#

ğ

earnest phoenix
#

It should be Discord.Client

#

Not discord.Client

#

@wide ruin

wide ruin
#

it has to be capital?

earnest phoenix
#

Yes

#

I think so

wide ruin
#

i set const discord to lower case tho

mossy vine
#

its defined as lowercase

earnest phoenix
#

Oh

#

Nvm my bad

shadow dust
#

Im making a refactoring of my bot command handler and im wondering whats best when a user edit a command message (example: !ping)

  1. Delete previous command related bot messages and repost
  2. Edit previous command related bot messages
#

The second option seem more complicated because I have to abstract away the message posting and I essentially need to fetch existing reactions if any and delete them so

ruby dust
#

Does discord.py cache servers and users into memory or elsewhere?

sinful lotus
#

I think mostly caches are in memory

split hazel
#

how would i make a timed mute using sqlite? i could use setimeout but my bot doesnt run 24/7 without restarting

slender thistle
#

Save timestamp in db

#

On bot startup, check if user is in db, if they were supposed to be unmuted, unmute and delete record if needed

#

And run settimeout when command is used successfully and on bot startup

sinful lotus
#

Play around with Date.now()

#

and save the value

#

then run an cron job that checks the db at specified interval

hushed zodiac
#

Who knows the jda and can help me fix my mistake?

spare goblet
#

how do most people handle huge amounts of help embed info?? my bot's help is getting really spammy but i dont have a site to refer them to

earnest phoenix
#

@spare goblet uh

#

i dont understand

slender thistle
#

Pages

ruby dust
#

categorize your commands into more commands

earnest phoenix
#

either paginate the message or exclude descriptions from the commands list

#

@spare goblet maybe do a reaction system

sinful lotus
#

I dont know why you said hehe on that ^ but ok

crimson gull
#

Lol my bot was declined for having no actual features..I figured it had quite a few

sinful lotus
#

add more features perhaps

crimson gull
#

With 25 commands, I figured it was alright.

earnest phoenix
#

says actual functioning

crimson gull
#

They are. It handles quite a bit

#

Including account verification and linking, moderation, game information, etc

sinful lotus
#

then ask the mod

#

for more clarification

crimson gull
#

We'll see how it goes

mossy vine
#

i wonder why

sinful lotus
#

idk why are saying that like you are assuming that we will copy paste your code, but why dont you try it first before asking here if something errors

earnest phoenix
#

how do I make something like owner id but admin

#

with multiple admins

#

do i do it like this or

slender thistle
#

Correct

amber fractal
#

If you want to be given an error for not having a comma sure mmLol

slender thistle
#

Then you check if that array contains user ID

earnest phoenix
#

wait

#

its in a json

#

will i need to use commas in between the strings

slender thistle
#

Yes

amber fractal
#

yes, you still need a comma in arrays

earnest phoenix
#

thats in between the brackets

#

ok

slender thistle
#

That's still an array

earnest phoenix
#

oh

#

ok

slender thistle
#

The string itself is good

#

The syntax is not good

earnest phoenix
#

ok

#

so its correct now

slender thistle
#

Yep

earnest phoenix
#

ok

#

thanks

#

how do I make so that a command checks if the user is in that array

#

its wrong

slender thistle
#

Load that json if it's in file and as I stated earlier, check if that array contains user ID

earnest phoenix
#

but how do I check

slender thistle
#

Google "json use keys"

amber fractal
#

You can parse the json

#

just use it like a regular js object

earnest phoenix
#

im too retarded

#

can i have another hint

amber fractal
earnest phoenix
#

wait

#
if(message.author.id == JSON.parse(config.admins) {
code
}
amber fractal
#

no, if it's an array you need to check the full array, you're checking if an id equals an array. Also, I believe you can parse the JSON as you require it.

earnest phoenix
#

can i have an example

#

wait

#

no

#

i thought you sent the same link

amber fractal
#

Oh

earnest phoenix
#

if(config.admins.includes(message.author.id) {
code
}
#

is this correct

amber fractal
#

yes, if config.admins is the array.

earnest phoenix
#

ok

chrome olive
#
        let uUser = message.mentions.users.first();
        if(!uUser) uUser = message.author;

            Profiles.findOne({
                userID: uUser.id
            }, async (err, user) => {

                const profile = new Discord.RichEmbed()
                    .setAuthor(`${uUser.username}\'s profile:`, 'https://cdn.discordapp.com/emojis/396521773266632715.gif?v=1')
                    .setThumbnail(uUser.avatarURL)
                    .setDescription(`${user.bio}`)
                    .addField(` Rank` , `\`β‹– ${user.rank} β‹—\``, true)
                    .addField('Premium', `\`${user.premium}\``,true)
                    .addField(` Money` , `\`${user.money} Coins\``, true)
                    .addField(`Gold`, `\`${user.gold} Gold\``,true)
                    .addField('Badges' , `This user has no badges.`, true)
                    .setColor(config.color)
                message.channel.send(profile)
            })```
#

something wrong?

amber fractal
#

I am confused at why you're putting it in a template literal and not adding anything else

topaz fjord
#

I'm confused what the problem actually is

chrome olive
#

in the database the bio is redutzu e zew

#

and it shows me None

#

the default

#

value

#

in schema

fiery quest
#

im getting crazy, do you know how i can control if in a input string there's any special characters? because i tried all the methods i imaged but nothing works, please help

mossy vine
#

you can try regex

fiery quest
#

i would like to do a special characters control for a battletag, so "#" is an exception

mossy vine
#

instead of making a blacklist of all the illegal characters, make a whitelist of all the allowed characters with regex

fiery quest
#

i'll try

#

thanks

inner jewel
#

you don't need regex for that

mossy vine
#

how else would you do it then @inner jewel

inner jewel
#

an array of allowed characters

#

loop each character of the string

#

if not on the array, it's invalid

mossy vine
#

give me a minute

fiery quest
#

if message.content.startswith("!owrank"):
msg = message.content[1:]
await client.send_typing(message.channel)
s = 'asodgnasAIDID12313%*(@&(!$1231'
msg = re.sub('[^a-zA-Z\d. ]|( ){2,}','', s)
if msg == '' or os.path.splitext(msg)[0].isspace():
await client.send_message(message.channel, content = "Invalid Name!!!!!!")
else:
command = message.content.split(' ')
if (len(command) < 2):
embed = discord.Embed(title = "πŸ™ Make sure you have typed the message in the right form!", color = 0xFF0000)
await client.send_message(message.channel, embed = embed)
elif (len(command) > 2):
embed = discord.Embed(title = "πŸ™ Make sure you have typed the message in the right form!", color = 0xFF0000)
await client.send_message(message.channel, embed = embed)
else:
player = command[1]
for letter in player:
if letter == '#':
player = player.replace(letter, '-')
await client.send_typing(message.channel)
data = getInfo(player)
await client.send_message(message.channel, embed = printRank(data))

hasty dust
#

Hello. I'm new to all this bot stuff, i've never really touched code before. I was interested in learning how to code and program bots. Where could I start? Tutorials?

#

ive heard you use JavaScript

mossy vine
#

/[^A-Z1-9#]/gmi
that regex should be fine

slender thistle
#

You can use Python or JavaScript to start with

#

I strongly advice to learn the programming language itself and make some simple scripts first

hasty dust
#

my friend recommnded to use javascript, and not python

#

for bots

mossy vine
#

@hasty dust javascript and python are the most popular beginner-friendly choices. i personally reccommend sololearn.com and w3schools.com for learning those languages. you should be experienced with the language before trying to make something as complicated as a discord bot

#

you can use almost any programming language, it comes down to preference

slender thistle
#

Well, to each their own RenShrugGif

hasty dust
#

yea, I undertand not going straight to bots, but my friend says to never use python for bots

#

which im kind of confused about

fiery quest
#

im using python 3, and i love it @hasty dust

slender thistle
#

Well, I can't say Python is bad for DIscord bots

#

I use it myself and it's pretty good

mossy vine
#

i personally wouldnt use python because of the different python and discord.py versions that exist, it can cause confusions

slender thistle
#

Not to be rude, but your friend probably doesn't know what "preferences" are :^)

hasty dust
#

@wide ruin said that so you can ask him

fiery quest
#

@mossy vine yep, that's one defect

hasty dust
#

he's online right now

slender thistle
#

That name is awfully familiar

hasty dust
#

lol

wide ruin
#

eggs hasnt done a lot of python or javascript at this point, so thats why i said js

hasty dust
#

but isnt it preference?

mossy vine
#

it is

slender thistle
#

Exactly

hasty dust
#

confused

#

then why does pineapple say java

mossy vine
#

it doesnt matter what language you use, all libraries have 100% coverage of the discord api

slender thistle
#

JavaScript*

hasty dust
#

yea

slender thistle
#

Java and JavaScript are not the same

mossy vine
#

java and javascript are like ham and hamster, completely different things

hasty dust
#

im guessing they each have thier own pros and cons?

wide ruin
#

vegans only like one

slender thistle
#

Yeah

mossy vine
#

yep. but again, all comes down to preference

wide ruin
#

i mean if youve not done a lot of py, decorators and async can be a bit hard

hasty dust
#

so.. should I learn one and go to the other?

slender thistle
#

That's up to you, honestly

#

You could go with JS and later move to languages like C#

hasty dust
#

yea, I was planning originally with python, then going to C++ or something

slender thistle
#

The difference between them is significant

#

If you wanna go for C++ later, I suggest JS

hasty dust
#

ok

wide ruin
#

what are the c languages good for?

hasty dust
#

Later, way later down the road, I'd maybe be interested in.. AI?