#development

1 messages ยท Page 1768 of 1

opal plank
#

i can give u guys a hand if you dont wanna wait and wanna do it manually for now

long marsh
#

It was actually insane difference going from Python/JS -> Go. The performance increased and size of the code diminished by 10x

stiff lynx
#

message.channel.overwritePermissions([
{
id: message.guild.id,
['SEND_MESSAGES']: true,
},

rocky hearth
#

really??

stiff lynx
#

like this?

prime mist
#

I have generally found the inverse to be true.

long marsh
prime mist
#

But go definitely performs faster

long marsh
#

Yeah, youโ€™re definitely correct.

snow urchin
long marsh
#

I meant to clarify that the compiled code was 10x smaller

#

50mb for Python ... while 5MB in GO

#

Iโ€™d still choose JS/Python over the others due to the vast support from third party libraries & documentation

vivid fulcrum
snow urchin
vivid fulcrum
#

what's the code?

visual goblet
#

whats the python import for buttons?

sudden geyser
#

Although undocumented, buttons are available in the library's master branch on GitHub.

vivid fulcrum
#

and the title property has a value, yeah?

snow urchin
#

yup

vivid fulcrum
#

strange

#

maybe it's some kind of a cache?

#

try incognito or clearing the website cache

snow urchin
#

๐Ÿ‘ seems to have done the trick, how odd, but not complaining ๐Ÿ˜„

earnest phoenix
#

well it wont be issue for end users anyway

ocean yew
#

Why i can't split catch error content?

clear marlin
#

wdym?

ocean yew
#

like try {} catch(err) { err.split("") }

stark abyss
#
INSERT INTO user_accounts(email, hash)
VALUES (randomemail, emailhash);

ERROR: column "randomemail" does not exist
LINE 3: VALUES (randomemail, emailhash);

restive furnace
stark abyss
restive furnace
cinder patio
radiant ravine
#

hi and speak Spanish??

cinder patio
#

It's <Error>.message I believe

earnest phoenix
radiant ravine
#

hello

earnest phoenix
#

what do you need help with?

radiant ravine
#

yes

umbral zealot
earnest phoenix
clear marlin
#

why do you want to split the error though

earnest phoenix
#

hi

#

does anybody know how can i make a WebSocket on my website?

#

i mean

#

i know how to do it in localhost

#

but idk how can i make my url a wss://

vivid fulcrum
#

create a websocket server and keep it open

#

for wss you need to have an SSL cert

earnest phoenix
#

ok

#

and will be just wss://domain.com:port

#

right?

earnest phoenix
#

Anybody teach me coding

solemn latch
#

probably wont find a teacher here, best bet is to hire one or learn on your own.

sudden geyser
regal jacinth
#

Hi, i have made about 10 tasks.loop() in my bot (each one has a separated role)
so like when i tried calling them like this

if __name__ == "__main__":
   if not taskName1.is_running():
        taskName1.start()
   if not taskName2.is_running():
        taskName2.start()
   #And so on with the rest of the tasks
   client.run(TOKEN)```
the problem is the bot goes offline after 5 minutes
no errors, and in the terminal it shows the on_ready message
earnest phoenix
regal jacinth
#

alr

sudden geyser
#

Nope.

earnest phoenix
#

Can anyone teach me coding

sudden geyser
#

Nope.

earnest phoenix
#

Anyone else

regal jacinth
earnest phoenix
#

I am your brother pls teach me coding

slender thistle
#

Wow it's almost as if you didn't read what you didn't like

earnest phoenix
#

Bruh you will teach me will you teach me @slender thistle

#

I am your brother

slender thistle
#

We will not teach you

opal plank
#

@slender thistle I AM UR BROTHER, PAY MY COLLEGE TUITION

slender thistle
#

like it was said multiple times

regal jacinth
#

lol

earnest phoenix
#

Why @slender thistle

#

@opal plank can you teach me

sudden geyser
opal plank
solemn latch
#

this isnt a teaching server, its unrealistic to expect us to teach you

slender thistle
#

Because:

  1. We are not a teaching place. You have the internet and online courses for that;
  2. We aren't obligated to;
  3. It's time and effort, and that's paid. And I doubt you're gonna pay anyone here to teach you.
#

If you expect to be a good developer, learn to be independent

earnest phoenix
regal jacinth
#

alr

slender thistle
#

Asking for help is one thing. Asking someone to give you everything on plate and break it down to you is a different story

#

Eugh. Back to suffering with episode scripts.

opal plank
slender thistle
#

It's not PTSD, it's pain of trying to come up with creative ways to deliver shit to people without sounding repetitive

opal plank
#

i got the solution for u

slender thistle
#

I know you have beer

opal plank
#

just use a tag system

#

no need to ever repeat urself

slender thistle
#

A tag system for weekly news

opal plank
#

yes

#

kek

sudden geyser
#

does anyone actually use that

opal plank
#

yeah

#

you clearly havent been in dapi

#

and it shows

sudden geyser
#

talking about the contents of the tag

opal plank
#

of THAT specific tag?

sudden geyser
#

yes

opal plank
#

yes, i do and a lot

regal jacinth
#

@earnest phoenixso does it automatically print or do i have to do print(something) ?

opal plank
#

evie is more sophisticated and has a link instead

#

i just yolo and post the whole thing over again in a massive wall of text

lyric mountain
#

well, mostly everything

regal jacinth
#

it didn't tho

sudden geyser
#

evie is more sophisticated and has a link instead
i just yolo and post the whole thing over again in a massive wall of text
single source of truth vs. multiple sources of truth

lyric mountain
#

impossible

misty sigil
#

just get it pinned /s

regal jacinth
#

nothing in my terminal

#

and the bot's offline

lyric mountain
#

what's the issue again?

opal plank
#

@misty sigil heres another

earnest phoenix
#

Pls lien ftnl

regal jacinth
#

and it's still running

opal plank
sudden geyser
earnest phoenix
#

Lien ftnl

#

plsss

opal plank
#

the fuck's that

misty sigil
lyric mountain
#

@regal jacinth what's the issue again?

#

oh

earnest phoenix
#

I am french

opal plank
earnest phoenix
#

Je veux le lien du >bot ftnl

opal plank
lyric mountain
#

maybe one of the tasks is deadlocking your bot

earnest phoenix
#

You can actually just manually check though if something is blocking by inspecting the code

misty sigil
#

another what

regal jacinth
#

hmmm

sudden geyser
#

I made the comparison as a joke but I don't think you see the difference between the two

lyric mountain
#

remember python is pseudo-multithreaded

opal plank
#

cuz im inconsiderate

earnest phoenix
#

Anyway, if you setup the log properly, it'd debug something like this

misty sigil
#

oh

regal jacinth
#

should i use a wait_till_ready method?

lyric mountain
#

no, you need to find what is hanging the process

misty sigil
#

another incompetent dev as well :โ€™)

lyric mountain
#

use debug mode with breakpoints to see where it's stopping

regal jacinth
#

i previously used the same tasks but in functions

opal plank
regal jacinth
#

it was working fine but i would get a python error from it

lyric mountain
#

use breakpoints

regal jacinth
#

like it was looping the function

slender thistle
#

What do you do in those functions?

regal jacinth
#

some auto actions like
temp unmute
temp unban
auto trivia (sends trivia questions)
and some others

regal jacinth
slender thistle
#

How are the temp-x actions done? What do you use?

#

inb4 time.sleep

earnest phoenix
regal jacinth
opal plank
slender thistle
#

It does

opal plank
#

then i will shut my mouth

narrow fractal
#

It has breakpoints pogumagik

lyric mountain
#

pycharm has eveything

earnest phoenix
#

recursion? mmulu

regal jacinth
#

idk how to use them

opal plank
#

forced indentation?

#

sorry

slender thistle
#

nah what are those function names seriously

regal jacinth
#

oh wait

slender thistle
#

This is too vague to even understand wtf you're doing

regal jacinth
#

hmm alr lemme get a pastepin lol

clear marlin
#

hastebin

#

pastebin

sudden geyser
#

am I the only one who has hastebin not work 3/4 the time

opal plank
#

use github

#

stop using those shitty pastebins

clear marlin
#

use gitlab

sudden geyser
#

github gists are only good when you want it tied to you

#

if it's just a throw-away bins are better

#

it's in the name

clear marlin
#

ditch github get gitlab

opal plank
#

u can make as many as u want and they dont decay

regal jacinth
#

oh

lofty cedar
#

does ctx.author return the tag like @lofty cedar ? (That is actually <@! 652590649735905303 >
(Discord.py)

regal jacinth
#

well it's easy to make

slender thistle
lofty cedar
opal plank
slender thistle
#

Since Member subclasses User, you can use Member.mention

slender thistle
opal plank
#

m

earnest phoenix
#

rtfd >>

opal plank
slender thistle
lofty cedar
earnest phoenix
opal plank
earnest phoenix
#

read the fucking docs

slender thistle
opal plank
#

read the fucking manual.

slender thistle
#

ctx.author returns either a User or a Member

opal plank
#

docs are manuals

slender thistle
#

which both have a mention property

earnest phoenix
#

docs ๐Ÿ˜ 

opal plank
#

rtfm

regal jacinth
slender thistle
#

Oh my God

regal jacinth
earnest phoenix
#

Tell 'em, shiv :^)

narrow fractal
regal jacinth
#

hmm is it something i did wrong?

earnest phoenix
#

Though apart from that, the issue might be related to your synchronous db

slender thistle
#

I feel like db methods are at fault here

regal jacinth
#

oh

slender thistle
#

Apart from that

#

All them branches

#

God

regal jacinth
#

what are branches lol

earnest phoenix
#

Must be pain maintaining it

slender thistle
#

It hurts to read

earnest phoenix
clear marlin
slender thistle
#
if x:
    # if branch
else:
    # else branch
regal jacinth
#

oh

slender thistle
#

I'm so tired that I can't write 4 lines without messing it up

clear marlin
#

oh wait, wrong branch definition

#

nvm

regal jacinth
#

so the main problem is with the db thing?

earnest phoenix
#
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
``` ![mmulu](https://cdn.discordapp.com/emojis/587328389929500692.webp?size=128 "mmulu")
earnest phoenix
regal jacinth
#

then how am i supposed to get data from the database ?

earnest phoenix
#

Migrate to async driver

slender thistle
#

Make it async

regal jacinth
#

hmm, may i have some examples about it?

slender thistle
#

Well what's your db in the first place

earnest phoenix
#

import this

slender thistle
#

cuz like

slender thistle
#

nah, that

sudden geyser
#

return to declarative

regal jacinth
slender thistle
#

took like a second

regal jacinth
#

oh i didn't fully understand what you meant lol
i thought adding some sort of async function

slender thistle
#

Well you could slap everything into an executor

#

But God forbid you touch that right now

regal jacinth
#

oh lol

earnest phoenix
#

Things probably would've been simpler

slender thistle
#

Oh, who knows

earnest phoenix
#

This for example, the else is superfluous

regal jacinth
#

i don't think it works

#

it's searching for a json file

#

i don't have a json file lol

stiff lynx
#

permissionOverwrites is not defined How can I define this? discord.js

#

I'm trying with permissionOverwrites = require ('discord.js')

regal jacinth
#

@slender thistlei can't seem to connect it to my firebase real time database with async-firebase

#

more like, it works for android and ios notifications?

pale vessel
stiff lynx
pale vessel
#

Are you trying to access/update a channel's permission overwrites?

stiff lynx
#
   permissionOverwrites.update({
   'SEND_MESSAGES': true
   })
   .then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
   .catch(console.error)```
pale vessel
#

Ah

stiff lynx
#

now I'm trying with this

pale vessel
#

permissionOverwrites should be a property of a GuildChannel

pale vessel
#

It's a collection of PermissionOvewrites

slender thistle
stiff lynx
pale vessel
#

That's not how you define it

#

You need to get that property from a channel

stiff lynx
#

SO MESSAGE.CHANNEL?

pale vessel
#

Yeah, sure

#

Loop through the overwrites

stiff lynx
#

// Update permission overwrites
channel.permissionOverwrites.update({
'SEND_MESSAGES': true
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error)

#

^

#

?

#

const channel = message.channel;

pale vessel
#

channel.permissionOverwrites is a collection

#

You need to loop through the items and update them individually

#

You can use a for loop js for (const permissionOverwrites of channel.permissionOverwrites.values()) permissionOverwrites.update(...);

#

Did you copy your code from somewhere?

stiff lynx
pale vessel
#

I see

stiff lynx
#

why?

pale vessel
#

Try to understand the code you copied. Docs will help you if you're unsure what something is/does

stiff lynx
#

this is not so easy

#
channel.permissionOverwrites.update({
    'SEND_MESSAGES': true
    })
    .then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
    .catch(console.error)
)));```
#

like this?

#

opsie

pale vessel
#

Uh, try to correct the syntax

stiff lynx
#

idk

pale vessel
#

What code editor are you using?

stiff lynx
#

for (const permissionOverwrites of channel.permissionOverwrites.values()) permissionOverwrites.update({
'SEND_MESSAGES': true,
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error)

#

like this?

stiff lynx
pale vessel
#

It should tell you what's wrong

pale vessel
#

Sorry, gotta go.

stiff lynx
lyric mountain
#

@scenic kelp

#

tank u

pale vessel
#

parm useless

rose warren
#

Anyone else getting ETIMEDOUT errors from Discord's cdn?

earnest phoenix
#
client.on('message', message => {
    if (message.author.bot) return;
  if (message.content === "+invite") {
     let embed = new Discord.MessageEmbed() 
    var user = message.author;
    message.guild.fetchInvites()
          .then
      (invites => {
        const userInvites = invites.array().filter(o => o.inviter.id === user.id);
        var userInviteCount = 0;
        for (var i = 0; i < userInvites.length; i++) {
          var invite = userInvites[i];
          userInviteCount += invite['uses'];
        }

        message.reply(`**has ${userInviteCount} invites!.**`) 
      }
      )
  }
});

Everyone hello I tried to make an indicator of invitations in embed but I did not manage maybe need to add something ?

lyric mountain
#

first of all, remove var

#

never use it unless you understand what it does

#

use let instead

#

now lemme format that for better reading

client.on('message', message => {
  if (message.author.bot) return;
  if (message.content === "+invite") {
    let embed = new Discord.MessageEmbed();
    var user = message.author;
    
    message.guild.fetchInvites().then(invites => {
      const userInvites = invites.array().filter(o => o.inviter.id === user.id);
      var userInviteCount = 0;
      for (var i = 0; i < userInvites.length; i++) {
        var invite = userInvites[i];
        userInviteCount += invite['uses'];
      }
  
      message.reply(`**has ${userInviteCount} invites!.**`) ;
    });
  }
});
#

way better

#

so, at first glance there's this

#

so it's not guaranteed to have an inviter property

#

also you can simply do invite.uses

#

other than that, remove vars

#

@earnest phoenix

stark abyss
#
    const userQuery = {
      text: "SELECT * FROM user_accounts WHERE (email) values ($1)",
      values: [email]
    }
    let user = await pool.query(userQuery)

error: syntax error at or near "values"
I forgot how to do this

sudden geyser
#

If you want to find all user accounts where the email matches, you should be writing SELECT * FROM user_accounts WHERE email = $1

stark abyss
#

ah wait never mind I got it

#

yeah thank you

earnest phoenix
#

Make sure to check if they have sql statments or not

lyric mountain
#

email = $1 is quite safe regarding sql injection

earnest phoenix
#

Oh

lyric mountain
#

it gets parsed to the correct value

earnest phoenix
#

i dont used that sql much

lyric mountain
#

like, that's only an issue if you do concatting

#

like SELECT * FROM USERS WHERE NAME = ${name}

#

this could allow sql injections

opal plank
#

no

#

bad

#

$

#

one escaped character and u fucked

#

i've seen databases fall cuz of that

boreal iron
#

Most SQL libraries should already escape strings

opal plank
#

you know what else they have?

#

fucking safe injection

#

values()

#

dont ${thing} in a string

#
'SELECT (fields) FROM table WHERE name = $1 AND city = $2',[name, city]```
boreal iron
#

Yeah

#

The lib should escape your vars already

inland pulsar
#

use prepared statements

boreal iron
#

If itโ€™s not a crap lib

inland pulsar
#

if you read the docs*

pale vessel
#

real toxicmushroom

inland pulsar
#

I am

opal plank
#

imagine this scenario of using injection yourself

`SELECT * FROM USERS WHERE NAME = ${name}`
// input = 'test'; DELETE SCHEMA self
#

big brein

inland pulsar
boreal iron
#

Yikes Iโ€™m aware of what SQL injections are KEKW

#

I wonder you didnโ€™t advertise the all new detritus database engine

opal plank
umbral zealot
opal plank
#

first cuz its shit, second im 100% sure people use admin users for their bots

#

with all the permissions to drop the whole database and backups

#

if they even make any

umbral zealot
#

drop the database.. .unless you're using a more modern database engine, which lets you, say, run arbitrary external scripts on the OS.

#

whoooooooops there goes /root

#

Oh sorry did you need that /mnt thing? it's gone now.

opal plank
#

poof

boreal iron
#

Seen lots of times

inland pulsar
boreal iron
#

Already forgot once a time to escape user names on a panel I made

#

You can imagine what happened

opal plank
#

just open ur eval and i guarantee they wont target your other vulnerabilities

earnest phoenix
#

200 iq

#

Pretty good idea

opal plank
#

why would they go for copper when you openly offering gold, amirite?

earnest phoenix
#

And lets hope they cant escape sandbox

boreal iron
#

Well that disaster with escaping things just proves the world is evil.
Gonna lock my room door right now, just to be prepared!

earnest phoenix
#

Yes

valid oar
#

hay

#

can i add the api on this code (javascript)

require("dotenv").config();
module.exports = (bot) => {

setInterval(() => {
const dbots = require('dbots');
const poster = new dbots.Poster({
    clientID: bot.user.id,
    apiKeys: {
      discordbotlist: process.env.DBLAPI,
    },
    serverCount: async () => `${bot.guilds.cache.size}`,
    userCount: async () =>
       bot.guilds.cache.reduce((a, g) => a + g.memberCount, 0),  
    voiceConnections: async () => 0,
});

poster.post();
    console.log (['Update discordbotlist Analytics']);
    console.log('<------------------------------->',);
    console.log([bot.user.username])
    console.log(['Servers'], `${bot.guilds.cache.size}`);
    console.log(['Gebruikers'], `${bot.users.cache.size}`);
    console.log('<------------------------------->',);
}, 300000)};
crimson vapor
#

yes but it would probably be easier to just use topgg-autoposter

valid oar
#

but i can create a nieuw topgg.js

regal jacinth
#

like it's not working as firebase it self

#

i can't find any methods to connect to my real time database

opal plank
#

define real time database

#

all databases should be "real time"

sudden geyser
#

most databases are real time, but not all servers will utilize real-time data

boreal iron
#

No more โ€˜real timeโ€™ okeh

opal plank
boreal iron
lofty cedar
#
@client.command()
async def play(ctx, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None, arg6 = None):
    if arg1 == None or arg2==None or arg3 == None or arg4 == None or arg5 == None or arg6 == None:
         await ctx.send("Please specify 6 players (first 3 for team 1 and the others for team 2)")
    else:
        match = 0
        if not os.path.exists("/rldiscord/match" + str(match + 1) +".json"):
            f=open("match"+str(match + 1)+".json","w+")
            f.write("{}")
            f.close()
        match = match + 1
        matchfile=json.load(open(f"match{match}.json"))
        matchfile["team1"] = {"player1":arg1,"player2":arg2,"player3":arg3}
        matchfile["team2"] = {"player1":arg4,"player2":arg5,"player3":arg6}
        await ctx.send("Match started!")

Can anyone explain me why it doesn't work? (it doesn't set team1 and team2)

boreal iron
#

I just canโ€™t resist sometimes...

sudden geyser
#

So much unnecessary None

lofty cedar
#

to show the error if you haven't set all args

sudden geyser
#

You can set the argument type to its correct type to make it required (e.g. str)

opal plank
#

is that a json database in python?

lofty cedar
opal plank
#

sounds like something u should keep in a database with an expiry set time or in memory then

lofty cedar
#

no, it will be deleted after someone stops the match

opal plank
#

same deal

sudden geyser
#

As for your issue, I'm not entirely sure, but these things stand out to me:

  • You're trying to write to match(...).json yet also checking for /rldiscord/match(...).json's existence (and never writing to it in that part of your program & it may be the root path of your computer directory).
  • You only ever write to it in that if not condition. And it won't be persistent for the next command usage since it's local to the function.
lofty cedar
#

I mean everytime i tryed to install mysql or sqlite or something i had some troubles and this is a small thing so don;t need database

lofty cedar
slender thistle
sudden geyser
#

So hex can just remove the default assignment

slender thistle
#

Mhm

#

Type is str by default in d.py anyway so explicit type hint to str might only be helpful with type checking

#

Dear God, just use f-strings

sudden geyser
#

and some with open(...)

slender thistle
#

Exactly

slender thistle
lofty cedar
slender thistle
#

Congratulations

#

Do you save matchfile to your file

lofty cedar
#

omg i'm dumb i always forget it

slender thistle
#

Plz don't mix concats with f-strings

#

And use context managers. Looks prettier and less confusing

earnest phoenix
#
client.on('message', message => {
  if (message.content === '+say') {  
    const args = message.content.split(' ').slice(1).join(` `);
    message.channel.send(`${args}`);
    message.delete();
  }
});
#

When writing the command +say in response bot ignores me what is wrong with this command ?

vivid fulcrum
#

you're checking if the message content is only +say

#

so, obviously when you pass arguments, that statement won't be true

#

I'd like to order. and I'd like to order a cheeseburger. are not the same

earnest phoenix
#

Could you please complete my code? Since I don't understand how to do it right.

vivid fulcrum
#

if you pay me, sure

nova basin
#

Woajjj

pale vessel
#

Are you legal yet cry

earnest phoenix
#

xd

nova basin
#

I don't think xD

vivid fulcrum
#

7 more days ๐Ÿ‘‰ ๐Ÿ‘ˆ

pale vessel
#

oh damn

earnest phoenix
slender thistle
#

Ain't ya a special one

#

ะœะพะถะฝะพ ะฑั‹ะปะพ ัะฟะพะบะพะนะฝะพ ัะพะตะดะธะฝะธั‚ัŒ ะตะณะพ ะฟั€ะตะดะปะพะถะตะฝะธะต ั ั‚ะฒะพะตะน ะฟั€ะพะฑะปะตะผะพะน ะบะฐะบ 2+2 ะธ ะฟะพะฝัั‚ัŒ, ั‡ั‚ะพ ั‚ะตะฑะต ะฝัƒะถะฝะพ ะฑั‹ะปะพ ะธัะฟะพะปัŒะทะพะฒะฐั‚ัŒ startsWith

lofty cedar
#

do you know how to use replace() on a full text that i don't know? like replace a full file

slender thistle
#

A?

lofty cedar
#

like i should use replace() but replacing an entire file

#

np i got it

earnest phoenix
#
client.on('message', message => {
  if (message.content.startsWith('+avatar')) {
    embed = new Discord.MessageEmbed()
      .setColor("RANDOM")
      .setDescription(`+avatar [ping]`)
      .setImage(`${message.author.displayAvatarURL({ dynamic: true, size: 2048 })}`)
      .setTimestamp()
  }
  message.channel.send(embed)
  }
});

When writing the command +avatar, it gives an error what is wrong with the code?

slender thistle
#

Well what's the fucking error

earnest phoenix
boreal iron
#

Horrible to see on mobile but thereโ€™s one } too much

#

Right before you gonna send your embed

visual goblet
#

im using the code if ctx.message.author.server_permissions.manage_messages: but it throws an error that manage_messages doesnt exist am i doing this right?

cosmic forum
#

Anyone know any css libraries similar to tailwind css that can be used on raw html sites without the need for nodejs or react?

slender thistle
#

And you might wanna refer to channel permissions instead of guild ones cuz that can be overwritten

vivid fulcrum
#

though you'll start finding raw css less and less

#

react and css-in-js is getting popular for a good reason

prime mist
#

css-in-js FTW. typestyle is pretty nice.

woeful pike
#

also nobody writes raw html anymore

#

it's like writing assembly

#

but even less useful

visual goblet
regal jacinth
# opal plank define real time database

hmm async-firebase can't connect to my database in firebase
like there is this config that contains API info so the bot can modify/read/delete the data in it
async-firebase can't access it apparently

#

also when i use tasks the bot doesn't respond and keep going offline (while the code is still running)

stiff lynx
#

but a bot can use every emoji in discord?

solemn latch
opal plank
#

they can

weary crypt
#

How should I fix this?

opal plank
#

with the new components u can use whatever emote as long as u have the id

weary crypt
#

Should I contact discord about this?

opal plank
weary crypt
#

oof

opal plank
#

they'll tell you to simply wait it out

solemn latch
#

it explains what to do in the message

weary crypt
#

I got over 100 servers in one day

opal plank
#

thats most likely suspicious growth

#

thats likely why u got flagged

weary crypt
#

Ah alright

#

shit sucks :/

weary crypt
lyric mountain
weary crypt
#

Lol

long crow
#

Meanwhile my bot still with it slow growing numbers

sudden geyser
#

try harder

weary crypt
#

I didnt even try tho

#

Mine just prints images of dogs...

#

It is based off of a wrapper that I wrote for Dog.ceo api

#

I donโ€™t think it is based on how hard you work on your bot. But more of how original your bot is. Cause making another music bot, wonโ€™t compare to something like Groovy

woeful pike
#

oh you also posted it over here lol

#

damn being able to bonk the same person's ads in multiple servers

woeful pike
#

why do you have a literal type called "${bigint}"

blissful coral
#

Thats discord.js

woeful pike
#

show code

blissful coral
#
 async sendLog (guildID: string, caseNum: number): Promise<void> {
    const guildConfig = await this.client.db.guildDB.getGuild(guildID)
    if(!guildConfig.moderation.log_channel) return

    const modDoc = await this.client.db.moderationDB.getModeration(guildID, caseNum)
    if (!modDoc) return

    const moderator = modDoc.mod_id
      ? this.client.guilds.cache.get(guildID)?.members.cache.get(modDoc.mod_id)
  }
woeful pike
#

you're passing bigints into cache.get?

blissful coral
#

I am passing a string

#

But it is saying I need to pass a bigint

woeful pike
#

where's the error again

blissful coral
#

But when I do guildID as bigint I get the same thing

woeful pike
#

what the hell

#

that's not even a bigint it's literally

type Wtf = "`${bigint}`"
blissful coral
#

Yeah exactly

woeful pike
#

what does the type definition for that cache manager look like

blissful coral
#

hell

woeful pike
#

not the base but the one for guilds

blissful coral
#

monbrey cant replicate in the djs server

#

let me restart ts server

woeful pike
#

yeah that is extremely weird

blissful coral
#

That didn't fix it

#

tf

woeful pike
#

i still don't know what the type of the cache manager where you call get looks like tho

#

you sent the base manager

blissful coral
#

Yeah

#

@woeful pike do you see what they are saying KEKW

woeful pike
#

yeah

blissful coral
#

that is the get

#

Idk where it is setting that typing one sec

woeful pike
#

yeah no I saw

blissful coral
#

ok

prime mist
#

Is there a type Snowflake that you can use instead of string.

#

Most ts libraries use Snowflake as an alias for```
${bigint}

crimson vapor
#

yep

#

when he typed it as string it wanted it to be a string with a number inside it

stark abyss
#

for my password reset I was thinking to email them their password hash and have them go back to the app and use their email and that hash to update the password. Is this a good idea?

prime mist
#

Generate a new hash per reset request that expires after a certain amount of time.

long crow
# sudden geyser try harder

It is created for specific game and not the fancy "fun", "music", or any kind of over saturated bot out there. So I kinda know it will take some time to grow. Beside, not publishing it for popularity, but more of "how any further can I push with my skill" kind of stuff when I decided to publish it here

drifting wedge
#

so im using speech_recognition this py lib and recognize_google as the speech type

#

but it doesnt recognize names

feral aspen
#

Anyone knows what reason could cause this dupe glitch?

#

I spam pay someone and it takes from me one time, but pays him two times.

solemn latch
#

Hmm two of the same command in code?

feral aspen
#

No..

earnest phoenix
#

does anyone know how to do music with discordjs/opus?

sudden geyser
#

that's a very broad subject

feral aspen
#
if (!userData) {
    const noArgsAccount = new MessageEmbed()
    .setColor(red)
    .setDescription(targetUserEconomy.replace("${user.user.username}", user.user.username))
    return await message.channel.send(noArgsAccount);
} else {
    userData.money += parseInt(amount);
    authorData.money -= parseInt(args[1]);
    userData.save().catch(err => console.log(err));
};
#

That's the code...

earnest phoenix
sudden geyser
#

still a broad subject

#

there are guides for it though

lyric mountain
feral aspen
#

Oh god.

#

So?

lyric mountain
#

You need to guarantee that the balance object is only being modified by one task at a time

#

So start off by making changes to it sync not async

feral aspen
#

Can I share my code and slowly show me or else I won't progress. not spoonfeeding.

lyric mountain
#

What db u use?

feral aspen
#

MongoDB.

lyric mountain
#

Meh

feral aspen
#

๐Ÿ˜

lyric mountain
#

But anyway, see if mongo has something akin to optimistic locking

#

Actually, pessimistic locking might be better in this case

feral aspen
#

I've never used that in any of my code.. so why now?

#

.. now.. I guess, can it be since one of the save() is at this line and the other save() is somewhere else?

lyric mountain
#

Because object modification take time

#

For example

#

Imagine a highway with 2 cars

feral aspen
lyric mountain
#

One is red and other is blue

#

Red starts first, followed by blue

#

What car will reach first?

feral aspen
#

Red?

lyric mountain
#

Who knows

#

Maybe red tire flattens

#

Or the engine shuts down

#

Or it hits a hole

feral aspen
#

Yeah... things can take more than 1 second in code as well...

lyric mountain
#

That's the thing, you can never guarantee sequential modification of database objects without some kind of lock

#

Lets say the balance instance has 1000 coins

#

Two tasks get it and add 5000 before saving it again

#

It'll end up with 6000 coins

#

Why not 11000? Because both see the balance as starting with 1000

feral aspen
#

Hm.. but is it similar to my case? I start with 1000, the other has 1000.. I pay 500 two times.. he ends up with 2000 and I end up with 500

lyric mountain
#

Because it was you who suffered from racing condition

#

The target went fine, but you fell victim to it

feral aspen
#

Oh...

lyric mountain
#

There are only 2 ways you can guarantee sequential updating

feral aspen
#

Using async/await on the save function, that's one?

lyric mountain
#

Nope

feral aspen
#

What?

lyric mountain
#

The issue can't be solved by code waiting

#

Because the issue begins as soon as two instances of the object exist in parallel

feral aspen
#

Oh..

lyric mountain
#

For that, you can solve it either by optimistic or pessimistic locking

#

Optimistic uses a version property which is checked whenever the object is saved, if the version to be saved is less than the database version the it aborts so it allows only incremental saves

#

Pessimistic simply doesn't allow read/write until transaction finishes

feral aspen
#

Goodness...

lyric mountain
#

Yeah, that's a long material to read

feral aspen
#

I never dealt with those so I'll be lost... ๐Ÿ˜

lyric mountain
#

That's something all dbms face sooner or later in life

feral aspen
#

Really annoying and unfortunate...

#

There are no other temporary solutions, right?

lyric mountain
#

You can try to fight it by decreasing as much as possible processing time

#

But you can only go so far without properly locking entities

feral aspen
#

The code I sent above is the processes it does.. 3 databases or models..

lyric mountain
#

For one, try to retrieve data only when you're about to save

#

Like, get-add-save

#

Or get-remove-save

#

Never get-dostuff-add-save

feral aspen
#

.. the do stuff are the if statements.

#

๐Ÿ˜

#

.. to check some conditions.

lyric mountain
#

Simply get the object again after you do the conditions

feral aspen
#

Can you check the code on how I do it?

lyric mountain
#

You need to remove as much distance as possible between retrieval and saving

feral aspen
#

Oh..

lyric mountain
#

Also, stop using var

feral aspen
#

I need it a public variable.

lyric mountain
#

You start the race at line 24 and ends at 187

#

That's a big distance

feral aspen
#

No.

#

.. that's the availability distance..

lyric mountain
#

There's a lot of possible delay between thpse points

feral aspen
#

We are dealing with the Data database.

lyric mountain
#

So 44

#

Only 20 lines closer

clear marlin
#

you could use let instead for a public variable

lyric mountain
#

Repeat the findOne just before you save it

feral aspen
lyric mountain
#

FindOne -> add/remove balance -> save

#

No checks, no processing, nothing

feral aspen
lyric mountain
#

Get add save

lyric mountain
#

The older the instance is the more susceptible to racing condition it is

lavish bramble
#
message.channel.send({embed: {
  title: "Song Playing...",
  color: "RANDOM", 
  description: `Song : ${song.name}\nDuration: ${song.formattedDuration}\nQueue: ${status(queue)}`,
  thumbnail: song.thumbnail
}})```
Thumbnail is not showing
feral aspen
#

.. if we're dealing with Data Database.

lyric mountain
#

I'm at mobile

#

Just do what you did there

#

Retrieve the object again

clear marlin
lyric mountain
#

Add/remove whatever value you must

#

And save it

clear marlin
#

try console.log(song)

#

before message.channel.send

#

and check if there's something called thumbnail

feral aspen
#
Data.findOne({ userID: user.id }, async (userData) => userData.money += parseInt(amount));
#

?

lyric mountain
#

Then save

near stratus
feral aspen
#
userData.money += parseInt(amount);
await userData.save().catch(err => console.log(err));

authorData.bankLimit += 5;
authorData.money -= parseInt(args[1]);
await authorData.save().catch(err => console.log(err));

I wanted to do this but this kinda won't work...

feral aspen
#
Data.findOne({ userID: user.id }, async (userData) => userData.money += parseInt(amount));
await userData.save().catch(err => console.log(err));
lyric mountain
#

That's it I guess

#

Regarding syntax there's little I can help since I didn't go too far into js let alone mongo

#

But the concept is the same

#

Keep distances between database transactions short or face races

lyric mountain
#

Authordata is the old object right?

#

But anyway, you get what I mean

feral aspen
lyric mountain
#

Yes, do the same procedure for both

#

Get modify save

feral aspen
#

๐Ÿ‘

lyric mountain
#

Gtg now, too late here

#

See ya

feral aspen
#

Alright. Have a great day! ๐Ÿ˜„

lavish bramble
clear marlin
#

is there any error arising?

lavish bramble
#

Nope

#

Just thumbnail is not showing

#

Am I using right
Thumnail?

#

@clear marlin the thumbnail is in URL

clear marlin
#

the only reason thumbnail must not be showing is because thumbnail is undefined

lavish bramble
#

can I do
Like : thumbnail: {
url: song.thumbnail
}

clear marlin
#

nope

#

try this

lavish bramble
#

What?

clear marlin
#

gimmi a sec

pale vessel
lavish bramble
#

Really?

clear marlin
#
message.channel.send(new Discord.MessageEmbed()
  .setTitle("Song Playing...")
  .setColor("RANDOM")
  .setDescription(description: `Song : ${song.name}\nDuration: ${song.formattedDuration}\nQueue: ${status(queue)}`)
  .setThumbnail(song.thumbnail)
)
#

just another cheat code ๐Ÿ˜›

#

if that doesn't work surely thumbnail is undefined

lavish bramble
#

Ok

clear marlin
#

npnp!

summer torrent
#

anyone here using lexure?

pale vessel
#

yargs gang

#

lexure poop

summer torrent
#

no u

lucid prawn
#

let friendbuyCheckoutCallbacks: CbCallbacksInterface = {
  [SUCCESS](hostedPageId, data) {
    let friendbuyData = data.friendbuy && data.friendbuy.data;
    if(friendbuyData) {
      window['friendbuy'] = [];
      window['friendbuy'].push(['site', data.friendbuy.app_id]);
      window['friendbuy'].push(['track', 'customer',
        {
            id: friendbuyData.customer.id,
            chargebee_customer_id: friendbuyData.customer.id,
            email: friendbuyData.customer.email,
            first_name: friendbuyData.customer.first_name,
            last_name: friendbuyData.customer.last_name
        }
      ]);
      window['friendbuy'].push(['track', 'order',
        {
          id: friendbuyData.subscription.id,
          amount: friendbuyData.invoice && friendbuyData.invoice.amount,
          email: friendbuyData.customer.email,
          coupon_code: friendbuyData.coupon_code
        }
      ]);
    }
frosty haven
#

@spare fossil

upbeat cape
#

-bots

gilded plankBOT
pale vessel
#

no

rocky hearth
#

is anyone experienced with react native here?

astral schooner
#

-bots

gilded plankBOT
lusty quest
velvet venture
#

-bots

gilded plankBOT
#

tickNo This user has no bots

velvet venture
#

-servers

#

-server

slender thistle
#

Are you people blind

gilded plankBOT
lusty quest
#

idk why people refuse to read

#

indeed a weird one

wary flame
#

Accidental

lusty quest
#

also WSL 1.0 or 2.0?

#

weird, without sudo i cant ping stuff, and if i use sudo it works just fine (Debian, WSL2.0)

#

pinging stuff from ubuntu also works, with both non sudo and sudo

earnest phoenix
#

this error?
ping: socket: Operation not permitted

cinder patio
#

@ripe prairie scam ^

stiff lynx
#

How can I get the id of an animated emoji and put it as a reaction?

cinder patio
stiff lynx
#

i use discord.js

cinder patio
#

for example

stiff lynx
#

and I put this ID between ''?

cinder patio
#

wait lemme look it up cause I actually forgot, I think you need to put the entire thing in a string

#

no it's only the ID

stiff lynx
#

client.emoji.cache.get(emojiid)?

cinder patio
#

<Message>.react("emojiid")

stiff lynx
stiff lynx
cinder patio
#

yeah

stiff lynx
#

tysm

#

idk why but after the backslash it sends me the same the emojiname and not the id

cinder patio
#

wdym?

prime glacier
#

um hey
i am getting channel from mentioning it can someone tell me how can i get channel from id?
like
?send <channel id> <something>

formal pulsar
#

msg.mentions.channel.first()

#

like this

prime glacier
#

i am using this

#

but i wanna mention multiple channel from their id's

#

const channel = message.mentions.channels.first()

currently using this

formal pulsar
#

i dont know how do it

prime glacier
#

ook

lusty quest
#

so you want to have a channelid as argument?

earnest phoenix
lusty quest
#

just use channel.get() or channel.fetch() on the guild object

prime glacier
lusty quest
#
const channel = message.guild.channels.cache.get(arugment)
#

this can however fail in some cases, then you need to use fetch instead of cache.get()

earnest phoenix
#

arugment

stiff lynx
earnest phoenix
#

noice

earnest phoenix
#

you have to put the emoji in a codeblock

stiff lynx
stiff lynx
stiff lynx
#

like this?

earnest phoenix
#

remove the extra backticks

#

`:emoji:`

stiff lynx
#

ty

#

\:emoji:

earnest phoenix
#

or
mybot eval /* :emoji: */ message.content

stiff lynx
earnest phoenix
#

wot

#

umm

#

when in doubt ping@quartz kindle

ember wraith
#

Can anyone can teach me how to make vote rewarding?

lusty quest
#

use webhooks to recive a event when someone votes

#

then do something with the information

ember wraith
#

That the problem

lusty quest
#

you have to recive them

#

the dbl docs should work for it

ember wraith
#

Hmm

lusty quest
#

there are the docs pinned

copper cradle
lusty quest
ember wraith
#

I dont understand that code tbh

lusty quest
#

language?

ember wraith
#

Yes

lusty quest
#

this one is new, common answers are:
english
turkish
java script
java-script
java
py
python

vivid fulcrum
#

yes yes i speak a language dummy!!

lusty quest
#

then escaping it should work, if its a custom emoji you get an id, if its unicode you only get a name

stiff lynx
lusty quest
#

they wont have the same id

#

they are snowflakes iirc

stiff lynx
#

and how can I reat the message with a custom emoji?

thin quarry
thin quarry
# thin quarry u mean read?

if you read it as plain text then the custom emoji translates to something like <:yt_views:831613308561522708>

zinc path
#

Can we use the money from top.gg to buy nitro??

#

Please answer fast if yes.

feral aspen
#
const owner = message.guild.owner.user.id;

owner.send("message");
channel.send("oof");

Sometimes owner isn't cached, and if it isn't.. i want to skip the owner.send().

zinc path
feral aspen
#

Why are you pinging me?

zinc path
#

I was just asking a question

pale vessel
#

(message.guild.owner || channel).send();

feral aspen
#

.. the answer is no.

zinc path
#

oh

feral aspen
zinc path
#

How can we use that money?

feral aspen
pale vessel
#
message.guild.owner ? message.guild.owner.send() : channel.send();```
zinc path
#

oh can we buy prem bots?

#

I'll check sorry for disturbing

feral aspen
#

It's message.guild.owner.send, right?

pale vessel
#

both user and member has the send method

feral aspen
#

๐Ÿ‘

woeful pike
#

it's auctions credits, not real money

stiff lynx
#

why my embed Is like this?

#

.addFields()

lusty quest
#

you send a object without parsing it

stiff lynx
stiff lynx
lusty quest
#

parse the object to a string

thin quarry
#

print the message with desired emojis to console

#

copy the emoji text from there

stiff lynx
#

.addField( {name:'attenzione', value : **prefisso attuale in ${message.guild.name} รจ ${settings.prefix}** },
{name: 'aggiungi NOVABOT al tuo server', value : 'LINK},
{name: 'entra nel server', value: 'LINK'}
)

thin quarry
#

emoji text

stiff lynx
thin quarry
#

take the content of the message

#

and console.log it

#

or print

#

idk what u use

#

the approach in these cases is the same

#

if u use python

#

i can give you the code

stiff lynx
#

heroku

#

and VS code

#

nono, discord.js

thin quarry
#

then console.log the message content

#

the message with emojis

stiff lynx
thin quarry
#

for the comfortable use of emojis i made a file with a dictionary of emojis

thin quarry
#

@stiff lynx

stiff lynx
thin quarry
stiff lynx
thin quarry
#

ok

earnest phoenix
#

u cant pass an object

#

if you want to add multiple fields at once use .addFields with an array of objects

stiff lynx
#

but I've already did in that way

earnest phoenix
#

how tf did it work lmao

earnest phoenix
south sinew
earnest phoenix
#
{
  "Bruh": "bruh"
}
south sinew
#

It's just passing one index of addFields

earnest phoenix
#

the docs say the first and second parameters are strings

south sinew
#

I've always used an object, typings also want you to use an object

earnest phoenix
#

wut

thin quarry
#

but dictionaries work too

#

not a big fan of json files

earnest phoenix
#

yeah but

#

a json file makes more sense

thin quarry
#

yes

#

and a txt file too

#

lol

earnest phoenix
#

ps to import stuff it's literally just require("./thing.json")

thin quarry
#

i think i should learn json

#

and how to use it

#

actually i dunno js

#

i know python

stiff lynx
#

and work s

earnest phoenix
#

I dunno python but maybe you use json.load to read json in python

thin quarry
stiff lynx
alpine osprey
#

Is there any rate limit for changing status?

thin quarry
earnest phoenix
#

ofc

alpine osprey
#

time?

earnest phoenix
#

we dont know tho

thin quarry
#

it sure exists for changing bot avatars

alpine osprey
thin quarry
#

but changing anything in your bot too fast is api abuse

#

and can get ur bot banned

alpine osprey
#

yeah that's why asking what is time limit

thin quarry
#

let`s assume its 1 in 10 seconds

#

to be safe

alpine osprey
#

Yes i am

#

But my doesn't change every 10s

#

It change 20s

earnest phoenix
#

the rate limit is 5 seconds

#

but you should do 1 minute updates just to be safe

alpine osprey
thin quarry
earnest phoenix
#

ig yeah

alpine osprey
#

Ok 30s fix

visual goblet
#

uhhhh so im using discord.py and i updated my help command and deleted the other but the old help command is still sending with it

#

i dont know why it is

thin quarry
#

the default&

visual goblet
#

no

#

its my own

#

it sends both when i do >help

visual goblet
#

yeah ill reset the token and stuff see if that helps

earnest phoenix
#

yo

#

you only need to restart the bot when you make a change

#

not reset the whole token

thin quarry
#

a smart help command

visual goblet
thin quarry
#

it reads the commands` docstrings

visual goblet
#

but it didnt work

#

so im doing token too

thin quarry
#

hmm

#

no need

#

did you remove the old code?

visual goblet
#

yeah its long gone

thin quarry
#

that`s prolly that

#

check

visual goblet
#

its not there

thin quarry
#

and press ctrl + s

visual goblet
#

i dont have to check the file is no longer there

thin quarry
#

a couple of times

visual goblet
#

i deleted the entire file along with the code

#

its nowhere in my files at all

thin quarry
earnest phoenix
#

Are you hosting your bot on replit

visual goblet
#

i mean sure but i dont think that will help the current problem

#

no heroku

earnest phoenix
#

That's your problem

thin quarry
visual goblet
#

how is it the problem?

#

very vague

thin quarry
#

is the problem like the file really deletn`t?

#

but it appears tht it was deleted?

#

@earnest phoenix

earnest phoenix
#

yeah

visual goblet
#

well heroku isnt the problem if thats the case

earnest phoenix
#

happens on replit all the time

visual goblet
#

all my files are stored in github

earnest phoenix
#

Might happen on dipshit like heroku too

visual goblet
#

how did you fix your issue then?

earnest phoenix
#

refresh the page

visual goblet
#

alright ill give it a try

thin quarry
#

is hosting on replit easier?

visual goblet
#

nah didnt work

thin quarry
#

than on heroku

visual goblet
#

its still doing both

#

the help command doesnt even exist anymore why is it sending them both?

near stratus
visual goblet
#

i dont get it

visual goblet
#

ive done everything but it doesnt fix it

thin quarry
#

i use replit actually

ember wraith
#

Can anyone can teach me how to make vote rewarding?, cause i dont understand how to setup it

visual goblet
#

fuck it ill try token

ember wraith
#

That the problem

earnest phoenix
ember wraith
#

I dont khow how to make it tbh

#

..

#

Can anyone teach me..

near stratus
thin quarry
earnest phoenix
#

ikr