#development

1 messages · Page 380 of 1

idle grail
#

ERROR GONE

#

😄

quiet bobcat
#

@earnest phoenix it can't find that emoji

idle grail
#

Thanks everyone

languid dragon
#

change :thingy: to the ID of the emote

quiet bobcat
#

Or use the unicode symbol for it

languid dragon
#

\👌

quiet bobcat
#

\😄

#

np

bitter sundial
#

\💩

quiet bobcat
#

You're \💩

bitter sundial
#

dont tell me its a sa response

quiet bobcat
#

I think it is

earnest phoenix
#

\☯

#

lul

austere meadow
#

if anyone here uses postgres ive got a question
right now the way i have my database laid out is i've got a single structure that starts/handles the database so that my models can use it
this is what one of my models looks like

const Sequelize = require('sequelize');
const Database = require('./../../structures/PostgreSQL.js');
const SettingsModel = Database.db.define('settings', {
    guildID: Sequelize.STRING,
//blah blah more stuff after this and then i'd export this file

and i access this model by requiring it in a command/structure, however i've seen people use import (like this https://please.zbot.me/QCyEYgiQ.png ) and i was wondering if it would make any difference to switch over from requiring a bunch of models to just importing them all?

restive silo
#

it doesn't actually its just another way of doing it what looks a bit cleaner afraik

fluid basin
#

@earnest phoenix You must put the emoji itself

#

And then save the file as unicode, if it is not in unicode

uncut slate
#

message.content.includes or message.content.indexOf, whichever you like

#

what's swears defined as

#

what's in the file, what kind of structure is it

#

then you're not doing it right

#

..? 🤔

#

you didn't use it at all

old glade
#

how do i make a command usable only for 1 user ?

#

if user = "username"
command()

uncut slate
#

compare msg.author.id

#

don't do it by username

old glade
#

okay

earnest phoenix
#

@earnest phoenix

#

ID's are strings

inner jewel
#

IDs are uint64

uncut slate
#

not in js

inner jewel
#

but bad langs need them as strings because they use doubles only

uncut slate
solemn obsidian
#

npm i bigint64 :^)

inner jewel
#

using a library to emulate 64bit ints because no native support in the lang

restive silo
#

Natan pls

quasi marsh
#

discord py switched to ints in rewrite version

elder rapids
#

That's why I use C#

#

#Native64Bit

inner jewel
#

That's why I use JVM

#

#Native64Bit

restive silo
#

#IfYouComplainAboutSupportingFeaturesThenBlameJavaForNotBeAbleToOverLoadStuff

inner jewel
#

but you can?

restive silo
#

Since when can you overload operators?

inner jewel
#

you can overload methods

#

it's still overloading

#

technically the java bytecode allows overloading with return types

#

int a(int b)
long a(int b)

restive silo
#

But not operators for some reason

inner jewel
#

are different methods

#

because they learned from the abuse that became c++

#

<< for writing to streams

#

for reasing

restive silo
#

Hey you could only take the good parts like C#

inner jewel
#

reading*

#

when used correctly it's a nice feature

#

but people often misuse it

#

and shit becomes hell

#

for eg, math related stuff operator overloading is useful

restive silo
#

Same you dont need .addTo() .subtractFrom() etc.

inner jewel
#

because a + b is more readable than a.add(b)

restive silo
#

yea

inner jewel
#

but when you have << writing instead of bit shifting

#

it makes sense why someone might not include it

earnest phoenix
#

[help

#

@earnest phoenix O

#

not used

#

aaaaaaaaaaaaa

#

who pinged

#

no u

#

me

ruby dust
#

I'm afraid my monitor is too small to see the whole token 🤔

severe socket
#

same for me

#

inspect element

languid dragon
#

just double click

#

itll select all

topaz fjord
#

Can you make custom events in node.js

uncut slate
#

"custom events"?

topaz fjord
#

Yes

toxic oracle
#

i hope you're joking

#

EventEmitter.emit('event', arg1, arg2, arg3);

karmic parcel
#

yeah

#

you can even just throw an object at that point with those args

#

What are you trying to call inside a function inside a function?

#

@earnest phoenix

earnest phoenix
#

okay

#

so what I'm doing is this:

#
function Lib() {
function getAccInfo(accid) {
// some code here
}
}
sand roost
#

Js Objects?

earnest phoenix
#

wait a sec

karmic parcel
earnest phoenix
#

@sand roost thank

sand roost
earnest phoenix
#

ik

sand roost
#

ok

earnest phoenix
#
let lib = {
    getAccInfo: function(accid) {
// some code here
         }
}
karmic parcel
#

I'm not sure why you were declaring the function in there tho

#

o

earnest phoenix
#

ok im going

sand roost
#

@earnest phoenix that seems fine

karmic parcel
#

I mean yeah you could do that

#

You could maybe look into classes too

#

depending on your level of understanding

topaz fjord
#

Who?

karmic parcel
#

Fire

languid dragon
#

let yes = () => {
return {
yes:()=>{
return false
}
}
}

karmic parcel
#

but your case, uh with custom events look into EventEmitter

uncut slate
#
let yes(){
#

?

languid dragon
#

mobile shhhhh

#

yes().yes()

uncut slate
sand roost
#

:banne:

topaz fjord
#

Rip

#

Wait this is Development

sand roost
#

yes

karmic parcel
#

yes

uncut slate
#

🤦

restive silo
#

@inner jewel BigInts are coming in newest V8 build MeguLewd

inner jewel
#

@restive silo

#

mfw they link to j7 javadocs

restive silo
#

oh yea

#

i think so

karmic parcel
#

JS snowflake lib when

uncut slate
#

👀

karmic parcel
#

brb taking the repo name on npm

#

jk

granite grotto
#

guys how to play my spotify music into bot

topaz fjord
#

idfk

#

what is the best way to store access tokens
i was thinking storing in db

bitter sundial
#

not storing them GWchadMEGATHINK

inner jewel
#

@granite grotto spotify doesn't allow playing directly from them

#

your best bet is using their API to get track names and searching those on soundcloud/youtube

granite grotto
#

@inner jewel thanks dude ❤

topaz fjord
#

does the dbots weebhook send whenever someone upvotes?

#

or could that be a feature

inner jewel
#

it sends every time someone upvotes/removes vote

topaz fjord
#

oke

outer void
#

umm

#

im really new but ok

#

getting ready for disapproval

#

lol

finite tendon
#

Were do I put the code in for the bot to work

trim plinth
#

do you know how to code

finite tendon
#

yes

trim plinth
#

which language

#

actually wait nvm

#

ok so you put your code in your main file

finite tendon
#

were

trim plinth
#

like lets say, main.[your language extension]

ruby dust
#

beginner level classes

finite tendon
#

yes

#

no

trim plinth
ruby dust
#

which language do you know?

finite tendon
#

python

trim plinth
#

ok so you would put your code in main.py, or any other name

ruby dust
#

you generally would just create a python file and put your code there

#

as easy as that

finite tendon
#

ok

#

than

#

after I do that, will it start up buy it self

trim plinth
#

no

#

you have to run the file

finite tendon
#

ok

ruby dust
#

I don't think you even know the basic computer knowledge before getting into python...

finite tendon
#

i do

trim plinth
#

then why are you saying you know python yet you don't know where to put code or how to start a bot

finite tendon
#

i am new

inner jewel
#

how to turn pseudocode into python: rename file from pseudocode.txt to pseudocode.py

trim plinth
#

ok then

ruby dust
#

no, not even that, you would know that files don't open by themselves just by putting code in there, like you have to open it like any other file

finite tendon
#

but I am a programger

ruby dust
#

sigh

trim plinth
#

programger?

finite tendon
#

yes

trim plinth
ruby dust
#

he is a legit programger, not gonna lie

#

🤔

topaz fjord
#

lies

trim plinth
#

yes, he most likely isn't a "programger"

ruby dust
#

don't you see? he knows new level words that we don't know, of course he is the best programger!

trim plinth
finite tendon
#

I am

trim plinth
#

show me some python code then

#

type some in chat

inner jewel
#

wtf is going on here

ruby dust
#

our fellow "programger" knows python, but doesn't know where to put the code to run a bot

#

¯_(ツ)_/¯

finite tendon
#

there you go

ruby dust
#

idk why, but to me this looks like a stolen image from the internet 🤔

topaz fjord
#

wtf are u editing on

#

a potato

#

fake

#

google image search confirms

#

@ruby dust

ruby dust
#

holy

#

I was right

finite tendon
#

Well I do not have any right now

topaz fjord
#

why are you trying to pass android backup service as your own Thonk

finite tendon
#

I am not

topaz fjord
#

then why send image say its yours

finite tendon
#

Never said it was mine

ruby dust
#

this isn't to the channel's topic anymore

finite tendon
#

I no

topaz fjord
#

wow he deleted picture

trim plinth
#

@finite tendon check the second pin of #general

grizzled isle
#

Using the messagesDeleteBulk event, how could I get a channel using that event?

#

discord.js that is

earnest phoenix
#

cant, I can do D.js

pine burrow
#

@brittle oyster I can't, sorry

glossy gust
#

Does this have any support for ruby?

young wind
#

Question: Can bots have gif avatars?

elder rapids
#

Answer: No

#

Bot's don't have Nitro

young wind
#

Reply: Thank you. But can't bots use animated emojis and use custom emojis as well? Those are Nitro perks, aren't they?

elder rapids
#

That's the only thing they get

#

They don't actually have Nitro

round solstice
#

What?

#

U wrong

#

Bots have access to anything if programmed properly

earnest phoenix
#

not gif avatars

solemn obsidian
#

ok access linked accounts

earnest phoenix
#

lmao

round solstice
#

Yeah except that 😂

earnest phoenix
#

and discrim changing

idle grail
#

CAN YOU GUYS HELP ME PLEASE

#

I CANNOT USE client.fetchUser!

#

@earnest phoenix May you be of any assisstence?

#

The problem is that the bot isn't here

#

so i can't show you o.O

quiet bobcat
#

Screenshots?

idle grail
#

I guess

quiet bobcat
#

Also isn't client.fetchUser only for user accounts 🤔

ruby dust
#

even if it would be here, how would you show us? just a lot of bots will respond like always lol

idle grail
#

Or you could join the testing server

#

...

#

Mine...

#

Lets just say its UNIQUE...

#

I am pretty sure no other bot runs like mine lol

quiet bobcat
#

wym?

#

if you're using discord.js then you can't

#

because

#

or maybe you can

#

idk

#

¯_(ツ)_/¯

idle grail
#

I could show you in my server but i cannot invite ;-;

#

No

#

fetchUser

#

not profile

#

fetchUser can only be used in bot accounts

quiet bobcat
#

what are you trying to get?

idle grail
#

A user

quiet bobcat
#

But what do you want from it?

idle grail
#

To get the user tag and the avatarURL(RIGHT NOW.. Will need it for more stuff later)

#

Wait

quiet bobcat
#
idle grail
#

No lol

quiet bobcat
#

What do you mean no lol?

idle grail
#

I need to get the id'd user's avatar and tag

quiet bobcat
#

use that one aswell then

idle grail
#

...

#

🤦 You don't get me

quiet bobcat
#

Appearantly not

#

But that's how you do it

idle grail
#

I need fetchUser to get users from outside the guild

quiet bobcat
#

What

idle grail
#

and get their discrim and avatarURL

#

...

#

What

ruby dust
#

you reminded me to imlplement a hackban for my bot

#

thanks

#

it's actually possible to get a user from outside of the guild in python, idk if it's possible in js tho

idle grail
#

It is

#

🤦

#

FETCHUSER

#

THATS THE ONLY WAY

ruby dust
#

OK, NO NEED TO SHOUT, IM NOT INTO JS OK

idle grail
#

client.fetchUser(id)

ruby dust
#

xd

idle grail
#

WHY DOES IT NOT WORK

tawny lava
#

fetchUser returns a promise

idle grail
#

Yes

#

and...

tawny lava
#

you need to add a .then or use await

idle grail
#

OH

#

Ok gotcha

#

Will try that

gusty topaz
#

Promises: Catching beginners in a crossfire of frustration since 2010

quiet bobcat
#

I want to check for \ but it just cancels out my quotes

#

Any way to fix that in js?

bitter sundial
#

@quiet bobcat escape the escape

quiet bobcat
#

so two \ after eachother?

bitter sundial
tiny turtle
#

Possible to make a XP system, embeded with pic on a single page of .js?

#

was on a server that had this bot and was like wth lol

#

would dig to add something like it on mine

#

I made one but its lame just says level up and you can check your level

frail kestrel
#

yes it is possible

tiny turtle
#

I see that, but how?

#

Ive been looking everywhere for examples after seeing this, but an avatar inside a pic?

#

I can get a random pic and probably get that to work, but this blows my mind lol

uncut slate
#

jimp or sharp

#

or canvas

tiny turtle
#

This could add a pic on a pic with text?

uncut slate
#

yes

#

actually not sure if sharp does text, think the rest do

tiny turtle
#

awesome ty, i havent heard of this before so it never crossed my mind to look

sudden willow
#

Hi

earnest phoenix
#

i would like some info-advice-help on something
I want to request something from sites and get the output
https://lingojam.com/PirateSpeak
what should i begin to see to make it

ruby dust
#

I don't trust that domain

uncut slate
#

@earnest phoenix if they don't have an API, your best bet is GET'ing the output and then parsing it with something like cheerio

earnest phoenix
#

i asked in other channel too and they gave me this link

#

but how do i install

#

what is this $ npm install --save pirate-speak

solemn obsidian
#

Is your bot in nodejs

earnest phoenix
#

no

#

only py

quiet bobcat
#

Anyone know any good twitch libs for js?

frail kestrel
#

oh sorry

#

@earnest phoenix, npm i[nstall] --save pirate-speak installs the pirate-speak module from npm.

solemn obsidian
#

his bot is in python

earnest phoenix
#

i have another question

#

nvm

#

i will search a bit more

#

I want to make it so

#

guys gives a specific name

#

then the bot search all the users

#

and mention him

#

but it could give like "Dredd"

#

not full name

frail kestrel
#

@solemn obsidian he trying to install node packages w/ py?

solemn obsidian
#

somebody told him to get npm package, but whoever told him to never knew his bot was in python

#

so now he thinks he wants the module from npm

frail kestrel
frail kestrel
#

ig you could use that module to write an english -> pirate converter in node and utilise it in your py bot

solemn obsidian
#

easier to just rewrite the 20 lines of actual code in python

frail kestrel
#

ye

earnest phoenix
#

hmm

#

i took the dictionary

#

and made it work

#

but it took me so long 😄

#

can you help me with the other question?

#

there is a get info something

keen wedge
#

just a quick question, how long does it usually take to get the discord bot approved?

quiet bobcat
#

Depends on the queue length

inner jewel
#

from a few hours to a few days

old glade
#

and for a certification ?

ruby dust
#

I submitted on the other site first before this one, still waiting for the approval there, apparently bot's uptime is very important to them

#

(╯°□°)╯︵ ┻━┻

south finch
#

It’s not. They’re just lazy.

ruby dust
#

it really says that in the information channel

#

it has to have a decent uptime

heady zinc
#

because it says it doesn't mean its true

#

dbots queue is just messed up

south finch
#

They’re literally just lazy

ruby dust
#

like I've been waiting for 9 days as of now

heady zinc
#

it takes month

quiet bobcat
#

I waited like 2 or 3 weeks for it

#

They are very lazy

old glade
#

any idea of the time needed to confirm or not a bot certification application ?

quiet bobcat
#

Depends. Oly does certifications

old glade
#

oh ok

ruby dust
#

what does certification even do?

quiet bobcat
#

Usually a week or so

old glade
#

I thought mods can also give a certification

quiet bobcat
#

Nope :/

uncut slate
#

this is more appropriate for #general, guys

old glade
#

yeah

#

Sorry for that

earnest phoenix
#

I want to make it so
guys gives a specific name
then the bot search all the users
and mention him
but it could give like "Dredd"
not full name

uncut slate
#

which lib are you using

earnest phoenix
#

wut :D?

old glade
#

discord.js ?

earnest phoenix
#

python

ruby dust
#

doesn't discord.utils.find do the trick?

#

it's in the api docs

#

I forgot what is discord.utils.get for, it may be either one

earnest phoenix
#

member = find(lambda m: m.name == name , channel.server.members)

#

and then ctx.member.mention ?

ruby dust
#

I'm assuming this is for async version?

earnest phoenix
#
@bot.command(pass_context=True)
async def command(ctx, name:str = ctx.message.author.mention):
        member = find(lambda m: m.name == name , channel.server.members)
        await bot.say(ctx.member.mention+ random.choice(list))
#

list is defined

#

will that work?

ruby dust
#

I would test that, but I'm on rewrite version

earnest phoenix
#

it says ctx is not defined

earnest phoenix
#

@ruby dust

ruby dust
#

I've been summoned

#

lol what

lavish mango
#

Lol

ruby dust
#

yeah... I'm not on async, so idk how that is possibe

quiet bobcat
#

Does anybody know how to overwrite permissions on all channels in a guild? I've tried doing it like this js message.channel.overwritePermissions({ overwrites: [ { id: created.id, denied: ['SEND_MESSAGES'] }, ] }) but it says that it cannot read id of undefined (created) created is just an empty let that I filled with this js created = await message.guild.createRole({ data: { name: "Muted", } });

#

That's discord.js btw

obtuse crown
#

anyone know how to limit eval() to just math

earnest phoenix
#

How do I make it play a specifc mp3 file in my channel?
where is the info in API

quiet bobcat
#

What lib?

earnest phoenix
#

python

quiet bobcat
#

idk then

#

sorry

earnest phoenix
#

😦

#

:'

old glade
#

Guys

quiet bobcat
#

?

old glade
#

Isn't Python supposed to be faster as a language because it can handle multithreading

#

compared to JS

quiet bobcat
#

¯_(ツ)_/¯

old glade
#

Is there some significant speed improvement with python ?

#

or not at all ?

quiet bobcat
#

idk

#

google it?

old glade
#

lmao

ruby dust
#

I know C languages are faster than light, but that's about it

#

¯_(ツ)_/¯

old glade
#

well

#

it's hard to be faster than C

restive silo
#

Assembler does it

old glade
#

because of it's very precise memory usage

#

yeah

#

ofc assembler

#

but binary can also be faster you know what I mean

#

I was speaking in terms of "moderns' and widely used languages

ruby dust
#

I'm actually planning on moving to C# or something, I'm tired of python as a language

#

idk why

#

is it worth it?

old glade
#

mmmm

#

I'd say yes

weak parrot
#

I would say it is

old glade
#

because you can build and automatize a shitlaod of things

#

azure deployment

ruby dust
#

python is like for beginners lol

old glade
#

python is more of a scientist language

restive silo
#

python is one of the fastest langs for recusrive stuff

#

with Crystal lewd

old glade
#

I don't know crystal

#

never heard of it

ruby dust
#

I've been playing with C# a lot before even knowing how to code

restive silo
inner jewel
#

@old glade python isn't that faster because it has GIL (global interpreter lock)

old glade
#

what is this ?

inner jewel
#

so you can only have a single thread running python code at once

restive silo
#

Natan with the knowledge again

#

OwO

ruby dust
#

+1 reason to ditch python lol

old glade
#

lmao

#

that escalated quickly

inner jewel
#

node has a single thread too

restive silo
#

^

#

C# doesnt

inner jewel
#

also for recursive algorithms a lang with tail recusion might be better

#

and python/node do have multiple threads

#

but only one running code

#

others may be doing I/O

ruby dust
#

there's never a need for the best of the best language, just enough for everyone to be happy 😄

old glade
#

what are the others doing ?

#

oh ok

inner jewel
#

so it's still a benefit

old glade
#

I see what you mean

inner jewel
#

CRuby also has GIL

#

that's why in some (most?) benchmarks JRuby wins

ruby dust
#

the problem is that I have no motivation to start over to learning the basic of a programming language

restive silo
#

thats quite sad

#

experiment with other langs is pretty fun

inner jewel
#

^

restive silo
#

try other langs out and you will see when you feel confident while writing in one

ruby dust
#

well I also don't like the fact that python is case sensetive EVERYWHERE

restive silo
#

thats how i got from C++ to C# actuall

#

isn't any lang case sensetive Thonk

#

or what do you mean

ruby dust
#

I mean you can type a command in any case

#

like a bot command

restive silo
#

yes?

ruby dust
#

with python it's case sensetive, a user must type just the way it was defined

old glade
#

well

#

no

restive silo
#

wait thats not a python thing

ruby dust
#

it's how it works for me Thonk

restive silo
#

thats from your lib

old glade
#

if str.lower() or str.upper')

restive silo
#

or framework

old glade
#

just if/elif/else

ruby dust
#

well I'm not doing that nonsense for sure lol

restive silo
#

okay im not sure which lib/framework you use (i guess d.py with build in framework?) but thats not a language thing its because of your library/framework

#

normally it should lowercase all input and compare to lowercase commands so its case insensetive

toxic oracle
#

prism

earnest phoenix
#
@bot.command(pass_context = True)
async def laugh(ctx):
        'Performs his evil laugh.'
        await bot.say("MWAH-HAH-HAH-HAAA!!!")
        await bot.join_voice_channel(ctx.message.author.voice_channel)
        voice.play(discord.FFmpegPCMAudio("\murray bot\cool.mp3"))
#

i need help wit hlast command

#

so it can play

#

the mp3 file

frail kestrel
#

pass_context=True

#

iirc no spaces between is known as a more pythonic way of doing things

earnest phoenix
inner jewel
#

two processes running

earnest phoenix
#

my bot keeps on going offline about every 30 minutes, but nothing shows in the console and there is no error? thinkingeyes

#

I think it started happening after I added the Discord Bot List API into it, but I don't know

topaz fjord
#

Lmao

#

Dbots causes outages

inner jewel
#

my first bot tripled mem usage after getting added to botlists

#

the other guild eats 10MB alone

#

probably more by now

trim plinth
#

Oof

earnest phoenix
#

So how can I still connect it the Discord Bot List API without it causing outages?

#

Any suggestions?

topaz fjord
#

Make sure you coded it right

earnest phoenix
#

I just followed the example code on the API info section on the website

#

I set it to post the guild count to dbl every 30 minutes, that's all I did with it.

uncut slate
#

so what's going wrong

trim plinth
#

How do you use emojis through bots again? I forgot

fluid basin
#

Default emojis or user added ones

elder rapids
#

<:emote:EMOTEID>

#

and if it's default use the unicode char

fluid basin
trim plinth
topaz fjord
#

can anyone help me with mongoose

idle grail
#

Can anyone help me(again)?

trim plinth
#

what do ya need help with

idle grail
#

How to use .has()

trim plinth
#

In JS I'm guessing?

idle grail
#

.hasPermission() is deprecated

#

Yeah

trim plinth
#

I'm guessing you're using discord.js so try searching in the docs

idle grail
#

I want to check if someone has a permission

#

Yeah i already did

#

Its useless lol

#

i have no idea what a "bitfield" is so...

trim plinth
#

not useless, thats where I found out how to check perms so try checking again

idle grail
#

...

inner jewel
#

A bit field is a data structure used in computer programming. It consists of a number of adjacent computer memory locations which have been allocated to hold a sequence of bits, stored so that any single bit or group of bits within the set can be...

idle grail
#

so

#

Ok just show me how to check a member's perm using .has() i don't need that crap

#

I need to check it every message

trim plinth
idle grail
#

I KNOW

#

I ALREADY TOLD YOU

inner jewel
#

we won't spoon feed you

idle grail
#

WHY

#

ME A BABY gagagoo

inner jewel
#

i'd suggest you stop

trim plinth
#

Spoonfeeding is not good for the soul

inner jewel
#

and read the rules too

idle grail
#

Ok

#

So

#

can you atleast show me what it actually works on

#

apparently not message.member

#

i ran it like a 100 times

trim plinth
inner jewel
idle grail
#

Yeah ik

idle grail
#

🤦 I AM ON THOSE PAGES

inner jewel
#

member.has("ADMINISTRATOR")

idle grail
#

BEFORE YOU POSTED

#

No

#

That doesn't work

#

🤦

trim plinth
idle grail
#

I tried it

trim plinth
#

do you know how to use it though it a way that would check the permissions of a member

inner jewel
#

member.permissions.has

idle grail
#

Oh

#

lemme see

idle grail
#

WHOA

#

IT WORKED

#

😮

#

THANKS

idle grail
#

Hi

#

i need help again lol

pale light
#

what endpoint are you trying to access

idle grail
pale light
#

d.js right

idle grail
#

(f.sti filters the mess for the ID)

#

Yup

pale light
#

I don't have much experience with fetchApplication, but isn't it exactly as the error says, a bot cannot access that endpoint Thonk

idle grail
#

Whats an endpoint?

trim plinth
#

google

idle grail
#

;-;

earnest phoenix
#

Using d.js, how can I set uptime to show as DD:HH:MM:SS

inner jewel
#

using basic math

#

SS = time % 60
MM = (time % 3600 - SS)/60
HH = (...)
DD = (...)

topaz fjord
#

just use moment-duration-format

#

lmao natan

inner jewel
#

considering time is in seconds

#

using a lib just for that is overkill tbh

topaz fjord
#

but its not just for that

#

i use for other things

#

also natan

#

do u know some stuff about the html script tag

inner jewel
#

<script src="..."></script>

#

<script>/* js code */</script>

topaz fjord
#

cus i need to use javascript and jquery...

#

in the same tag

inner jewel
#

two script tags

#

<script src="jquery"></script>
<script>yourcode</script>

earnest phoenix
#

can someone help me with embed stuff, stuff that does this basically, I have it for the broken eval command I have but idk how to code it, any help will be appresiated

#

only with different stuff, not just a copy of that

earnest phoenix
#

rethinkDB or mongoDB

which 1 is better

#

@earnest phoenix What lib?

#

discord.js / node.js
@earnest phoenix

#

Okay! Same library! Let me get the code!

#

Do you have a prefix?

#

do you use Atom? if so this would get a lot easier

#

Yes

#

Ny.help

#

K

#

and it died wtf

#

Ny.ping

#

can bots not work here? ok

#

No

#

oh ok

#

K here's the code

#

The code for discord.js is:

#
  if (command === 'botinfo') {
    message.channel.send(message.channel.send({embed: {
    color: blue,
    author: {
      name: client.user.username,
      icon_url: client.user.avatarURL,
    },
    title: "Owner Status",
    description: "Status for the bot's owner.",
    fields: [{
        name: `Server Count`,
        value: `${client.guilds.size}`
      },
      {
        name: `User Count`,
        value: `${client.users.size}`
      },
      {
        name: "PING",
        value: `${message.createdTimestamp} ms`
      }
    ],
    timestamp: new Date(),
    footer: {
      icon_url: client.user.avatarURL,
      text: "© Hekapoo#4756"
    }
   }
 }))
  } else
#

You can edit text, name, value, title, description, and color

#

ok thank you so much

#

To your customs and your welcome

vagrant imp
#

can anyone help me make one

earnest phoenix
#

Of what?

vagrant imp
#

i am looking for someone to tach me how to make a bot

earnest phoenix
#

Sure, what lib?

vagrant imp
#

can u pm me?

earnest phoenix
#

Yes

vagrant imp
#

ok

earnest phoenix
#

hhhh my bot wont come online >^<

#

HAHA I DID IT!!!

#

1 SIMPLE FUCKING } SCREWED BY BOT WITH CREATING THOUSANDS OF ERRORS

gilded blaze
#

^ coding in a nutshell

earnest phoenix
#

yes

dapper comet
#

@earnest phoenix 🎉

frail kestrel
#

@earnest phoenix don't spoonfeed people

uncut slate
#

a mistake

#

I hope

frail kestrel
#

yes

old glade
#

how do I code a configurable bot prefix ?

earnest phoenix
#

Discord.js?

#

@old glade

old glade
#

.py

earnest phoenix
#

@old glade

prime geyser
#

!avatar @old glade

uncut slate
arctic nova
#

t!avatar @prime geyser

uncut slate
fathom pebble
#

!avatar @fathom pebble

heady zinc
#

and there i intended to do the same zoomeyes

uncut slate
#

In case anyone else wants to do the same thing Ulti did, take a look at #mod-logs

languid dragon
#

except it'll be 2 hours*

west quartz
#

Anyone Here Can Help Me With Checking Over My Discord.py Code
Need An Experienced Discord.py User To Check It Over tickYes

karmic parcel
earnest phoenix
#

You should be able to check over it BizarreThinking

west quartz
#

I've never used it @earnest phoenix so I wanted somebody to check

inland goblet
#

lmfao

earnest phoenix
#

Does anyone have a reference where I can find out when a command is issued, it will show in the console? I use Discord.jd

#

js

inner jewel
#

change your command handler to do that

earnest phoenix
#

okay, don't r/facepalm me, but still new to the bot business, what is that?

heady zinc
#

i mean

#

console.log()

#

literally not sure what you need more

topaz fjord
#

para

#

u dont stop lying

old bridge
#

Any c++ devs here

#

😮

earnest phoenix
#

What am I doing wrong here?

function findType(type) {
        switch(type){
            case 0:
                return "Basic";
                break;
            case 1:
                return "Medium";
                break;
            case 2:
                return "Advanced";
                break;
            case 3:
                return "Very Experienced";
                break;
            default:
                return "Basic";
                break;
        }
    }
}
trim plinth
#

hmmm

topaz fjord
#

@earnest phoenix why do u have an extra }

trim plinth
#

yes roight there m8

topaz fjord
#

other than that looks fine

#

why what does it do

trim plinth
#

finding type "type", but what is it's purpose?

#

finding a type of type is ehh

storm leaf
#

!avatar @storm leaf

trim plinth
topaz fjord
storm leaf
#

Or sorry

earnest phoenix
#

@trim plinth its for a level thing

#

@topaz fjord oh, thats why

#

thanks

trim plinth
#

ok

topaz fjord
#

lmao

#

that extra bracket

abstract mango
#

oof

gilded blaze
#

Does forever npm package account for fatal errors in nodejs apps?

earnest phoenix
#

so I got embed working today, I am proud! just need to get color to work

pale light
#

this is for questions not for comments on your progress GWjustinThonkEyes

earnest phoenix
#

sorry

#

;-;

#

my mistake

pale light
#

nvm, my bad

#

@earnest phoenix what lib do you use

earnest phoenix
#

discord.js and a little bit of node.js sprinkled in there

pale light
#

richembed or messageembed

earnest phoenix
#

idk, I am very new to this

pale light
#

Hm

earnest phoenix
#

probably rich

#

ig

pale light
#

does it look like

#

let embed = new Discord.RichEmbed()

inner jewel
#

bot embeds are always rich

pale light
#

👀

#

o ok

#

I might've misunderstood something then

earnest phoenix
#

yea but I have it as a constant variable

#

prob bad idea but oh well, it works

inner jewel
#

if you never modify it it's actually a good idea

#

no point in always creating a new one if it'll always have the same data

earnest phoenix
#

ok

#

how do I get my embed to show color in its message, as of the image below it has no color. how do I give it color?

#

pm me, mention me, whatever

#

I need help

jagged birch
#

.setColor(0x<hex colour code>)
for example, .setColor(0x4d94ff)

earnest phoenix
#

oh ok

#

tysm

jagged birch
#

np

earnest phoenix
#

where do I implement it?

#

nvm I got it

jagged birch
#

in your embed variable

earnest phoenix
#

yea I know, just clicked in my head

jagged birch
#

you're using a rich embed right?

earnest phoenix
#

yes

jagged birch
#

ok

earnest phoenix
#

well I tried,

fresh shuttle
#
        message.delete();
        message.author.send("Please do not say that!")
    }``` Is this correct, its not working for me?
#

Please tag me if you know.

jagged birch
#

instead of if(message.content.indexOf("tester") >= 0), use if(message.content.includes("tester") @fresh shuttle

fresh shuttle
#

@jagged birch Now the message on the second row is underlined.

jagged birch
#

does your code look like this?

if(message.content.includes("tester") {
    message.delete();
    message.author.send("Please do not say that!")
}```
#

cause it should work..?

fresh shuttle
#

No, the I got rid of the top { by accident.

jagged birch
#

oh, well that's why it's not working.

fresh shuttle
#

Lol, yeah.

#

Welp if(message.content.includes("tester") **{** message.delete(); message.author.send("Please do not say that!") } The bolded curly brackets are underlined and everything in between them are whited out.

grizzled isle
#

lol you didnt close off your if statement

#

@fresh shuttle

fresh shuttle
#

I just did and it still doesn't work. Do you know what could be wrong?

languid dragon
#

show error lmao

jagged birch
#

oh yeah lol

#

forgot to add another ) my bad

fresh shuttle
#

That still does not seem to work?

earnest phoenix
fresh shuttle
#

Please ping me if you know.

#

Now im confused af, its sending me the help command when i type the blocked word...

idle grail
#

YES I HAVE COMPLETED MUSIC COMMANDS YAYAYAYAY

jagged birch
#

dafuq, send me the code @fresh shuttle

wintry dune
#

Hello how to shard my bot?

terse quarry
#

What language?

jagged birch
#

Why can't I change the h2 color on my bot page? Because on the dark theme, you can't see the h2's as they are white. I tried changing it to red: <h2 style="color:red;">Fun:</h2> and it doesn't work, tested on my own html page and it worked on there.

uncut slate
#

Mm, try !important

jagged birch
#

isn't that only for css?

#

doesn't work anyway.

uncut slate
#

How'd you use it

jagged birch
#

<h2 style="color:red;" !important>Fun:</h2> @uncut slate

#

never really used !important in html before

uncut slate
#

yeah that's wrong

#

try looking it up

jagged birch
#

I did, it just comes up with css shit

uncut slate
#

it's seriously not that hard to google

jagged birch
#

yeah i know

#

"The !important rule is used for overriding the previously assigned CSS declarations. But it is also possible to override itself"

uncut slate
#

look at how you use it syntax wise

frail kestrel
#

how do you edit your bot page to incorporate custom CSS?
do you use a <style></style> and select parts of the bot page to edit?

uncut slate
#

yeah

frail kestrel
#

o ok

#

time to put my shit css skills to use

lethal sun
muted oxide
#

How do I add a permission to my discord.py bot? Also, I am using async not that rewrite one.

frail kestrel
#

@lethal sun /branding*

earnest phoenix
lethal sun
#

@frail kestrel ty for the notice

toxic hearth
#

How to use payload_json on create messages endpoint?

inner jewel
#

use an actual wrapper

topaz fjord
#

@wintry dune why do you want to shard

wintry dune
#

@topaz fjord I want to know how to do it. Maybe I might need one day.

wintry dune
#
const dbl = new DBL('token', client);```
#

is it enough?

topaz fjord
#

For wut

tiny turtle
#

Ive never made a search for a wb page on my bot, how would I do this?

https://us.tamrieltradecentre.com/pc/Trade/SearchResult?ItemID=&ItemNamePattern=
adding the search name to the end of this

//*[@id="body"]/table/tbody/tr[3]/td[2]/section/div/table/tbody/tr[1]```
`Item 1 ^`
```#body > table > tbody > tr.align-top > td.max-width > section > div > table > tbody > tr:nth-child(3)
//*[@id="body"]/table/tbody/tr[3]/td[2]/section/div/table/tbody/tr[3]```
`item 2 ^`
```#body > table > tbody > tr.align-top > td.max-width > section > div > table > tbody > tr:nth-child(5)
//*[@id="body"]/table/tbody/tr[3]/td[2]/section/div/table/tbody/tr[5]```
`item 3^`
```#body > table > tbody > tr.align-top > td.max-width > section > div > table > tbody > tr:nth-child(7)
//*[@id="body"]/table/tbody/tr[3]/td[2]/section/div/table/tbody/tr[7]```
`item 4 ^`
```#body > table > tbody > tr.align-top > td.max-width > section > div > table > tbody > tr:nth-child(7)
//*[@id="body"]/table/tbody/tr[3]/td[2]/section/div/table/tbody/tr[7]```
`item 5 ^`
How do I add this to a search for an item with this

https://us.tamrieltradecentre.com/pc/Trade/SearchResult?ItemID=&ItemNamePattern=
do I use the selector or the xpath?

Any help would be most awesome if someone has exp with this plz pm me!
elder rapids
#

... holy fak

tiny turtle
#

those are the values im just not sure how to put it together

#

im guessing after the lack of responses this would be uber hard? lol

inner jewel
#

google "web page scrapping <YOUR LANG>"

tiny turtle
#

discord.js

#

k

elder rapids
#

so web page scrapping js

glossy sand
#

i hope you're using an xml parser for this

elder rapids
#

discord.js is a library

inner jewel
#

discord.js isn't a lang

languid dragon
#

what

inner jewel
#

@glossy sand parse it with regex

glossy sand
inner jewel
#

someone pls get that stackoverflow answer

#

yes

#

that one

glossy sand
#

way ahead of you

tiny turtle
#

thanks

inner jewel
#

@glossy sand best comment was "Is it possible to use RegEx to parse this answer?"

tiny turtle
#

im not seeing anything usefull yet

#

to search and bring up the values anyways

#

as the items continually change

glossy sand
#

what you really should do is parse the page with an xml parser then traverse the tree the parser builds to get to whatever tag you're looking for

inner jewel
#

tl;dr find an xml parser and learn how to use it + basic xml knowledge

tiny turtle
#

so an xml parser and learn how to use it, check and check. Example would be cool though if you have the knowledge.

#

that's all I was aiming for. just a basic example of a search that can bring up a changing value.

glossy sand
#

what exactly do you mean by "changing value"

languid dragon
#

what exactly are you doing lmao (im lost)

tiny turtle
#

the items wont remain the same, they change as people buy or sell them ingame

#

if it was a set webpage i would ask for adive

glossy sand
#

ok well here's the issue

inner jewel
#

did you check if they have an actual api first?

glossy sand
#

I assume you mean the page updates in real-time?

tiny turtle
#

yea as I said above he doesnt have api's

#

yea

glossy sand
#

well that won't do for your application

inner jewel
#

front end changes will break your code fyi

languid dragon
#

regex parsing html is a nightmare is a waste of time, if you can work a way around it, do it

glossy sand
#

the real-time page updates are likely done with client-side js

inner jewel
#

so you should keep an eye on those

glossy sand
#

and probably some websocket work

inner jewel
#

^

glossy sand
#

which is all performed in a browser but won't mean anything to your single http request

inner jewel
#

if the data is dinamically added it won't work either

#

scrapping just parses static results

glossy sand
#

HOWEVER:

inner jewel
#

sent in the text the server gives you

tiny turtle
#

I figured the xml fields would stay the same right?

glossy sand
#

what you could do is reverse-engineer the webpage and figure out the websocket protocol they're using

inner jewel
#

they won't get updated

glossy sand
#

then simulate a client and connect to that websocket server

inner jewel
#

and if they get added after page loads via js

#

it won't work either

tiny turtle
#

those boxes shouldnt change

inner jewel
#

view-source:link

#

fyi

glossy sand
#

this page doesn't look like it updates in real-time

#

do you mean it updates every time you make a new request?

tiny turtle
#

I dont think I am explaining this right lol

glossy sand
#

the page makes no websocket requests

#

it looks perfectly static to me

tiny turtle
#

thats an example of of a changing value

#

you can test it in my bot and see that the scores change

glossy sand
#

so by "changing value" you mean the data you receive might change each time you make a request

tiny turtle
#

im just trying to figure out how to do this ^ with a search

glossy sand
#

it doesn't change in real-time or anything

tiny turtle
#

it could do it every 15 min or 1/2 hour

#

every 30 sec

#

im not sure

glossy sand
#

so basically you're asking how to keep the data on your bot up-to-date with whatever data the server is serving

tiny turtle
#

Maybe I dont know how to explain it. Im not sure how to lol

#

ill try discord api

#

thanks for trying though

earnest phoenix
#

how do i uh

old glade
#

mmm

#

why do you want this ?

#

@earnest phoenix

inland goblet
#

just a wild guess but to probably restart his bot

south finch
#

i wonder hmmm

fresh shuttle
#

How do you measure the servers your bot's are one, I thought it was bot.servers.

trim plinth
#

js?

fresh shuttle
#

Yeah

trim plinth
#

which lib

#

if using discord.js it's bot.guilds.size

fresh shuttle
#

Thanks, sorry I do not know my library... ;-;

trim plinth
#

np

high tinsel
#

Does anyone here know what does "rate limit abuse" mean... My bot was declined because of that and since English is not my first language idk what does it mean.

trim plinth
#

ratelimiting is going over the set amount of requests per day, hour, minutes, etc

#

ratelimit abuse is spamming an API causing ratelimiting quickly

#

or other forms of abuse

#

for a ratelimit

#

@high tinsel so in your bot's case it is that you spammed the Discord API too much, causing ratelimit abuse

high tinsel
#

Oh, I realize it now... If someone spammed that command than it would be a problem... Plus it posts messages too quickly. Thank you. I will fix it today and than resubmit that bot.

trim plinth
#

np

#

just watch out for that

solemn yoke
trim plinth
#

semicolon at the end of .get(commandName)

#

can't do that when you are doing your boi ||

solemn yoke
#

oo

#

thank you

trim plinth
#

np

solemn yoke
#

._. did i not address the commands file properly or something cause my commands aint working weirdly.

restive olive
#

nani

solemn yoke
#

🙇 sorry im quite new to programming so i may have made dumb mistakes.

restive olive
#

what are you trying to do?

solemn yoke
#

um for now is i have a command files where i can just insert new commands

restive olive
#

uhuh

solemn yoke
#

and in my main file which is the photo it seems like its not going there

#

i think

#

🤔

restive olive
#

is there like an error?

#

or like

solemn yoke
#

not at all

restive olive
#

the paths are not connecting

solemn yoke
#

well it looks connected to me ._.

#

but i aint so sure myself 😅

restive olive
#

okay

#

im going to assume you are on stable node rn

solemn yoke
#

yep

restive olive
#

so ya saying that its not reading the commands directory?

solemn yoke
#

i think so, i dont see any other reason it wont respond to my ping command

#
    name: 'ping',
    description: 'Ping!',
    execute(message, args) {
        message.channel.send('Pong.');
    },
};  ```
restive olive
#

what is client.commands set to?

#

or defined as

solemn yoke
#

umm 🤔

#

new Discord.Collection();

restive olive
#

oh ok

#

can i see that execute function thingy

solemn yoke
#

well this stretch are the ones that fetches the commands

#

below it are just cooldowns for spams.

restive olive
#

then

#

how do you execute your command?

solemn yoke
#

using const {prefix, token } = require('./config.jason) which will fetch the prefix and then if (!message.content.startsWith(prefix) || message.author.bot) return; will execute it

#

onwards

restive olive
#

that will execute your command?

solemn yoke
#

yeah

restive olive
#

how

#

all your doing on that line is checking if the message begins with the prefix or not

#

and if the author is a bot

#

and if one of those cases are true you will return

solemn yoke
#

😮 oh..

#

well

#

dammit

#

nowonder i couldn't do it after i moved it into a folder.

restive olive
#

nani?

solemn yoke
#

😅 haha sorry. im bad at coding, still working on it

restive olive
#

i mean like its okay...

#

you going to get there in your own little way

solemn yoke
#

😅 thank you for helping out

#

🙇

restive olive
#

np

high tinsel
#

If you need multiple variables listed below each other, how do you do that?

#

Like
var 1
var 2
var 3

#

In Javascript

high tinsel
#

Or just some discord thing that does that...

frail kestrel
#

what

brazen dock
#
i've even reinstalled node and everything but as soon as my script starts it stops
without an error
and it exits with error code 1```
#

@high tinsel ```js
let var0 = 0;
let var1 = 1;
let var2 = 2;

#

that's my npm error file

#

anyone?

high tinsel
#

So if I want them listed the command would be something like: message.channel.send(let var0 + let var1 + let var3);

brazen dock
#

@high tinsel give me an example of how you want the output to look like

frail kestrel
#

oh

#

to send the value of each variable

#

you just go

#
let var0 = 0;
let var1 = 1;
let var2 = 2;

message.channel.send(`${var0}`); // => sends 0 to the channel the command message was sent in
message.channel.send(`${var0}, ${var1}, ${var2}`); // => sends all 3 of your variables to the channel the command message was sent in
high tinsel
#

No, I need those variables listed only one at a line...

muted oxide
#

You dont actually list them in one line

#

Instead you list them in multiple lines

high tinsel
#

I can't, it's for a fight command and the stats need to be listed below each other...

#

And if I list them in separate messages the bot will get denied for posting messages too quickly.

topaz fjord
#

@high tinsel the use setTimeout

high tinsel
#

But it needs to be listed at the same time

earnest phoenix
#

._.

topaz fjord
#

That makes no sense

high tinsel
#
if(message.content.includes("vs: ")){
    var opponent = (message.content.replace("vs: ", ""));
    var score = 0;
      for (var i = 1; i < 4; i++) {
        var yourattack = (Math.floor(Math.random() * 100));
        var yourdefense = (Math.floor(Math.random() * 20));
        var hisattack = (Math.floor(Math.random() * 100));
        var hisdefense = (Math.floor(Math.random() * 20));
        message.channel.send("Round " + i + ". Fight!");
        message.channel.send("Your attack effectiveness is " + yourattack + ".");
        message.channel.send("Your defense effectiveness is " + yourdefense + ".");
        message.channel.send("His attack effectiveness is " + hisattack + ".");
        message.channel.send("His defense effectiveness is " + hisdefense + ".");
        var win = (yourattack - hisdefense) - (hisattack - yourdefense);
        if (win > 0) {
          message.channel.send("You win!____");
        } else if (win < 0) {
          message.channel.send(opponent + " wins!____");
          score = score + 2;
        } else {
          message.channel.send("No one wins!____");
          score = score + 1;
        }
        //mesage.channel.send();
      }
    if (score < 3) {
      message.reply("You won!");
    } else if (score > 3) {
      message.reply("Your opponent won!");
    } else {
      message.reply("No one won!");
    }
  }
#

this is the originall code

topaz fjord
#

And what's wrong with it

restive silo
#

var

topaz fjord
#

@restive silo no u

high tinsel
#

The amount of messages that it sends is too high so thy declined my bot because of that...

unborn oracle
#

If they need to be bellow each other, cant you use \n?

topaz fjord
#

Yeah

high tinsel
#

I try, but it did not work...

topaz fjord
#

How did you do it

high tinsel
#
if(message.content.includes("test: ")){
    var opponent = (message.content.replace("vs: ", ""));
    var score = 0;
      for (var i = 1; i < 4; i++) {
        var yourattack = (Math.floor(Math.random() * 100));
        var yourdefense = (Math.floor(Math.random() * 20));
        var hisattack = (Math.floor(Math.random() * 100));
        var hisdefense = (Math.floor(Math.random() * 20));
        var var1 = ("Round " + i + ". Fight!");
        var var2 = ("Your attack effectiveness is " + yourattack + ".");
        var var3 = ("Your defense effectiveness is " + yourdefense + ".");
        var var4 = ("His attack effectiveness is " + hisattack + ".");
        var var5 = ("His defense effectiveness is " + hisdefense + ".");
        var win = (yourattack - hisdefense) - (hisattack - yourdefense);
        if (win > 0) {
          var var6 = ("You win!__");
        } else if (win < 0) {
          var var6 = (opponent + " wins!__");
          score = score + 2;
        } else {
          var var6 = ("No one wins!__");
          score = score + 1;
        }
        mesage.channel.send(```"var1\nvar2\nvar3\nvar4\nvar5\nvar6"```);
      }
    if (score < 3) {
      message.reply("You won!");
    } else if (score > 3) {
      message.reply("Your opponent won!");
    } else {
      message.reply("No one won!");
    }
  }
unborn oracle
#

message.channel.send(var1 \nvar2). You need a space i believe

#

also message has 2 s, you have mesage