#development

1 messages · Page 1971 of 1

woeful pike
#

literally $2/month

#

it's so strange like people will spend much more money every week on going outside with their friends just messing around but when it comes to buying things they actually need for their hobby they're like nah king I need this to be free?

earnest phoenix
#

I hate github pages now

#

I am doing exactly what they are telling me and making a CNAME record that is pointing to <username>.github.io and they say my DNS records are invalid

woeful pike
#

dns can take a while to propagate sometimes

earnest phoenix
#

Mmm ic

#

I didn't know DNS also took a bit to propagate

#

Mmm but it seems it doesn't agree with my angular project it doesn't show my website's content 😢

slender wagon
#

bruhh fuck that pug language it's sooo annoying

each val, i in highlighted```
what the heck is this supposed to be
woeful pike
#

just use jsx

#

all other templating engines are worthless

slender wagon
#

i will but i am trying to convert this to ejs first

woeful pike
#

no stop

split hazel
#

watch me add random cpu throttling ima be rich

slender wagon
woeful pike
#

ejs is nightmare too

slender wagon
#

well it's way better than fking pug

woeful pike
#

they're equally shit

slender wagon
woeful pike
#

I've used pug before it's meh

split hazel
#

what's wrong with ejs i find it great for small projects

slender wagon
#

i am trying to go away from pug at least

#

but idk how to convert most of this shit pug js to ejs js

woeful pike
#

templating languages always have some cringe limitation. For example ejs doesn't even support the concept of components

earnest phoenix
#

Wtf bro I got it working earlier and I made a few changes and repushed and now this shit again 😢

woeful pike
#

you have to either copy paste code or implement the concept of children or slots using a dynamic import inside a layout file

#

totally disgusting

slender wagon
#
<div class="col-md-4">
       each val, i in highlighted
        if i < 2
           each articleVal, i in articles 
             if articleVal._id == val.article_id 
              a(href=`/article/${articleVal.num}`)
                .article
                  each catVal, i in category
                    each subcat, i in subCategory
                      if articleVal.category_id == subcat._id
                        p.category-label= subcat.name
                    if articleVal.category_id == catVal._id
                        p.category-label= catVal.name
                  img.img-thumbnail(src= `/uploads/${articleVal.image}` alt='image')
                  h5= `${articleVal.title.substring(0, 60)}...`
                    p= `${new Date(articleVal.date).getDate()}, ${new Date(articleVal.date).getMonth()+1}, ${new Date(articleVal.date).getFullYear()} `
                      span.fa.fa-clock
        
      </div>
#

just look at thiss

#

how is my little brain gonna go through this

earnest phoenix
#

What the actual fuck is that

woeful pike
#

dude wyd

#

you need to do this pre-processing in your controller

#

send data to your view that's ready to be rendered

#

don't put this business logic in your templates

slender wagon
#

shid

woeful pike
#

you can much more easily manipulate objects and arrays in regular js, send it to pug and simply render the data there in a clean way

slender wagon
#

i just wanna get rid of pug

#

convert this to actual js

woeful pike
#

it's not really a pug problem here tho

slender wagon
#

and not pug ejs

#

the code isn't mine

#

if it was mine i would've converted it awhile ago

slender wagon
woeful pike
#

you do need to convert this into js by moving this whole thing into a data structure you build up in your controller

#

ejs isn't the solution here

slender wagon
#

yeah but still i wanna turn it into actual js

#

not some each val, i in highlighted

#

like tf is that

woeful pike
#

ejs sucks just as much it's just syntax difference

#

in fact I'd probably use pug over ejs cuz it has actual features

slender wagon
#

i wanna get rid of pug at this moment

woeful pike
#

if you don't need i you don't need to declare it btw

#

each x in y

slender wagon
#

wish i could understand pug

#

is there a way i could convert this pug js to actual js tho

#

without me having to learn an entire templating language

woeful pike
#

you're only getting the first 2 elements from the array. So go do

const selected = highlighted.slice(0, 2)

in your controller so you don't need this i < 2 check. Use a nested .find so you don't need the article ID check in the template etc

#

templates are for taking in data and returning html. If you have all of this crazy transformations in here it means your template isn't accepting the data it actually needs

slender wagon
#

<% const selected = highlighted.slice(0, 2) %>
this would be on ejs

woeful pike
#

no

const selected = highlighted.slice(0, 2)
res.render("template", {
  selected
})
#

pass the data your template needs, not whatever you happen to have

slender wagon
#

ohhh so i can define it from the router

woeful pike
#

yes that's what a controller is

slender wagon
#

gotchya

woeful pike
#

it looks like your template is trying to render something like

const data = [{
  article: {
    category: [...],
    image: "...",
    titlePreview: "...",
    startDate: Date,
    endDate: Date,
  }
}]

but because you're not passing it that data you need to do a ton of noisy transformation on it

onyx socket
#

What does this mean?

woeful pike
#

in a templating language that's not designed to do that kind of thing

woeful pike
woeful pike
# onyx socket What does this mean?

means you kept sending bad data to discord (like an empty message that can't be posted) that made discord error out so they preemptively banned you to prevent you from triggering more errors

slender wagon
gleaming solar
#
const app = express();
const port = 8080;

app.get('/', (req, res) => res.send('Hello World!'));

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`));
'use strict';

const { ShardingManager } = require('discord.js');

const manager = new ShardingManager('./index.js', { token: process.env["TOKEN"], respawn: true });

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));


manager.spawn({ timeout: Infinity })```

This is my code but a shard died not too long ago and did not respawned why is that?
gleaming solar
#

@spark flint in my code it was const I just didn’t copy it right

gleaming solar
old cliff
#

Strange

gleaming solar
#

Why?

old cliff
#

It should according to the code

gleaming solar
#

I will keep watch on it if it ever goes down

feral aspen
gleaming solar
#

it should be true by default

feral aspen
#

What does it do, exactly? I'll check documentation.

old cliff
#

It's for the sharding manager

feral aspen
#

It is self-explanatory, but I need some slight bit of more information.

feral aspen
gleaming solar
#

if a shard dies it should respawn because of it being true

old cliff
#

What's the version of djs you're using?

feral aspen
#

Well, how would it die, exactly?

gleaming solar
#

v13

gleaming solar
#

I am not too sure tho

spark flint
#

i've made a great achievement sorta

#

i'm on r/programminghorror

old cliff
#

Nice

spark flint
#

because i did an accidental and purpose mistake

#

res.error == "true" was intented to annoy akshit

#

JSON.stringify("application/json") wasn't tho

old cliff
#

You deserve programmer hell jail

spark flint
#

ok

gleaming solar
#

@old cliff Do you know a tutorial for Lavalink and JDA? Or Nodejs?

sharp saddle
#

no

dry imp
#

yes

slender wagon
#

@woeful pike ${articleVal.title.substring(0, 60)}... sorry to bother but what are the 3 dots in here used for

#

I've seen it in a few cases in pug

pale vessel
#

that's just formatting

#

Here's a Long Titl...

slender wagon
#

so it's just text?

pale vessel
#

yeah

slender wagon
#

it doesn't matter if i get rid of it

pale vessel
#

don't think so

slender wagon
#

oki good ty

pulsar bone
#
if '69' in message.content:
     while db['que']==True:
        await asyncio.sleep(10)

as per my knowledge this code isn't reacting with discord api so I don't think it can get my bot temp banned just asking before implementing

using it so that only one command can be active at a time since my bot commands take more than 2hours to complete

lyric mountain
#

== True you never ever need to compare something to a raw boolean

#

I don't think it can get my bot temp banned
ye, you only get temp banned if you call the api too many times

#

discord (or any other service) doesn't care what you do behind the scenes

#

that said, that piece of code is a pipe bomb

#

I'd at least limit who can run it

quartz kindle
#

the heck do you do that takes two hours?

raw nest
#

Quick question I was thinking about.
What if there would be a decentralized login system. Like if you have a company and the accounts are saved in a blockchain. Wouldn't that be very secure and quite interesting to have? (Hypothetically)

slender wagon
slender wagon
#
const pug = require('pug');
const ejs = require('ejs')
router.set("view engine", "pug");
router.set("view engine", "ejs");
#

is using 2 view engines like this a thing

raw nest
pulsar bone
# quartz kindle the heck do you do that takes two hours?

broadcasting news in 1000 diff channels with cooldown of 1 sec before sending a message

using the above code to make it broadcast 1 news first and 2 news will be in queue until broadcast of 1st news doesn't end and turn the boolean into false

slender wagon
#

hmmm

#

i gotta use both for testing

quartz kindle
raw nest
quartz kindle
#

also, wouldnt you need to pay to store a new user in the chain?

raw nest
quartz kindle
#

yeah but if you use an existing chain like solana

raw nest
#

yes then you would have to pay.

modest maple
#

👏 Its a bad idea

#

dont do it

#

dont buy into the web3 shit

quartz kindle
#

creating a whole new blockchain just for logins sounds like overcomplicating something simple

raw nest
#

I won't I was just wondering about it xD

raw nest
raw nest
boreal iron
quartz kindle
raw nest
boreal iron
quartz kindle
#

you dont need a tutorial for that, its just simple logic

#

just do something like this

#
queue = [];
running = False;

on command:
  add job to queue
  if running == False:
    send_news();

def send_news():
    news = queue[0];
    running = True;
    for channel in channels:
      await channel.send(news)
    remove item from queue
    running = False;
    if queue size > 0:
      send_news();
``` idk python so idk the exact syntaxes
modest maple
#

mass message™️

quartz kindle
#

well, nothing wrong if they are properly subscribed to them

#

but yeah

modest maple
#

yeah

#

although webhooks so be your friend

tribal crow
#

Hey! My bot won't go online after starting it. It doesn't go online and the ready event isn't triggered

boreal iron
#

Check if you got banned for 24h for too many login attempts

tribal crow
#

How?

tribal crow
earnest phoenix
tribal crow
boreal iron
#

Catch the client login if you don’t handle errors yet

tribal crow
#

client.login(process.env.TOKEN).catch(console.error);

#

already do

boreal iron
#

No error, nothing not even after a few seconds?

tribal crow
#

nope, i've waited a few minutes now

boreal iron
#

If you have the chance try to start the bot on a different PC with a different IP address

tribal crow
#

ait

#

hmmmm

#

that works...

dry imp
#

banned?

tribal crow
#

wdym?

#

The bot isn't banned

#

Can't be if it works from another ip

dry imp
#

banned ip

#

rate limit?

tribal crow
#

how do i know?

dry imp
#

if it works from different ip then its either banned ip or rate limited

tribal crow
#

Idk how it may be rate limited

#

cuz

boreal iron
#

I’m theory you should receive an error if your IP got banned temporarily

tribal crow
#

or i mean

dry imp
#

it should

boreal iron
#

It might be some sort of connection issue or really an IP (range) ban even if that’s not your fault

#

Give it a few hours or at least 24h and try again

#

Host the bot meanwhile on a different IP if possible

dry imp
#

if it is on development then you could use replit and do kill 1 everytime this happens ig

tribal crow
dry imp
#

do kill 1 in terminal

#

or shell

#

or whatever replit called it

tribal crow
#

shell

#

now what

dry imp
#

if so then that might be why you get rate limited

tender violet
#

Yes.

dry imp
tender violet
#

Kill 1 always works for me

tribal crow
dry imp
#

try again

#

starting your bot

tribal crow
#

ty

#

ily <3

dry imp
#

cuz replit sucks ass

#

np

tribal crow
#

yeah

boreal iron
#

At the end any free service has major downsides

dry imp
#

true

quartz kindle
#

async is a reserved word, its incorrect to use it like that

#

client.once('ready', () => { would be correct

#

also, you can see what exactly your bot is doing by using the debug event:
client.on("debug", console.log)

earnest phoenix
ember gust
#

everything?

quartz kindle
#

it logs discord.js's internal things, like connecting to the websocket

old cliff
#

It has a tutorial

tulip ledge
#

Hi, im trying to make a bot for clash of clans which will send clan messages to our discord, I already made such thing using minecraft but I used an already existing yarn package for the actual bot in minecraft, does anyone have an idea on how to make a bot in coc?

#

Pls ping me if u answer

tribal crow
#

To use buttons, do i need a onclick event?

#

like if i want a certain code to be executed

old cliff
ember gust
lament rock
#

buttons fire the interaction event

boreal iron
#

guess hes speaking about buttons in a website

ivory siren
#

any ideas why am I getting this error on my new vps (it was working fine on the prev one tho)
Language: Python
Library Used: Pycord (a fork of dpy)

client_connection: Connection<ConnectionKey(host='gateway.discord.gg', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>
royal herald
#

ok idk how tf but it says "Error: Cannot find module 'lodash/get'"

#

but

#

loadash/get isnt a module on npm

#

and theres loadash.get but i need loadash/get

pine nova
#

u have loadash installed?

#

loadash/get probably means requiring the get dir/module from parent module i.e. lodash

royal herald
#

oh

royal herald
pine nova
#

just require it then

royal herald
#

oh

pine nova
#

require('loadash/get`)

#

or wtv lodash

#

o wait it doesnt have a dir /get

tulip ledge
tribal crow
#

Hey! How would i check if the user who clicks a button is the same user that executed the command?

boreal iron
#

Do you speak about interactions?

tribal crow
#

Yes

boreal iron
#

You could fetch the intial interaction reply

#

interaction.fetchReply()

lament rock
#

You don't have to fetch the reply. You can assign callbacks to button custom_ids in your own code and then check that in the callback

#

The easiest way to deal with buttons is to make your own callback system

boreal iron
#

But the button interaction does not contain any information about the inital reply

#

The custom id doesn't change the fact it can be used by anybody.

lament rock
#

This is true, but you can use a "nonce" system with unique custom_ids

boreal iron
#

I mean you could send an ephermal error if the user ID pressing the button isn't the one you expect

lament rock
#

ThunderStorm is my remake of Discord.js, but cacheless

tribal crow
boreal iron
#

huh what?

tribal crow
#
  .then(reply => console.log(`Replied with ${reply.content}`))
  .catch(console.error);```
#

reply.content only returns the message i'm replying with

#

same with just reply

lament rock
#

You should probably avoid using that because it would not scale well and you would hit rate limit buckets

tribal crow
#

oh ok

lament rock
#

The best way to do it is the way I suggested

tribal crow
#

can you explain that a bit easier?

lament rock
#

Not directly using what I linked though since that's for my own lib

#

You should read through the code and try to pick apart what you need

tribal crow
#

alr

lament rock
#

ThunderStorm is basically the same as Discord.js so it's just a drop and rename kinda deal

boreal iron
#

You should really cache the member ID which executed you command and compare it to the user ID of your custom button ID

lament rock
#

That would still require some relation to be made. Buttons should be callbacks anyways

boreal iron
#

Yeah you could add it to the guild cache or channel cache

#

That would be the easiest way

lament rock
#

what

boreal iron
#

The next member executing the command would overwrite the ID then

lament rock
boreal iron
# lament rock what

Store the member ID as property of your cached channel, my gosh English is bad today

#

If a button interaction is used check if the property exists in this channel, if yes, compare the value (user ID) to your button interaction member ID

#

Couldn't be easier

#

It would be a good idea to store a map of the interaction ID and the user executed the command

#

To make sure multiple users running the same command can still interact with the button after

tribal crow
#

ok

#

so

#

could you try to explain how?

#

like what to do?

lament rock
#

Everyone's code is different so that's largely up to you

#

I showed you what I believe to be the best and easiest way to go about things without doing anything jank and dependent on ideal conditions

tribal crow
#

ok

#

but

lament rock
#

Yes

tribal crow
#

Wait

#

dev or main branch?

lament rock
#

I haven't bothered looking into v14-dev yet, so main

#

Oh. wait. dev on my repo

#

dev is outdated

#

use main

tribal crow
#

ok

#

uhm

#

sorry but i dont understand anything of this

split hazel
#

same

lament rock
#

// exclude customId from data you pass since it gets overwritten
interaction.reply({ components: [new Discord.MessageActionRow({ components: [new BetterComponet(dataForComponent).setCallback(() => code()).toComponent())] }] });

#

Then you just pass the MessageComponentInteraction to the lib handle and it takes care of the rest

hybrid roost
#

is it requires Message Intent if I ping my bot?

#

If your bot requires reading the contents of a message, such as for registering a complaint, a user can ping your bot by doing @KartonMaid, and then your bot will be able to read anything within that message.

Discord sent me as answer to my application

wheat mesa
#

if your bot is mentioned in a message then the content will be sent to your bot without needing the message intent iirc

hybrid roost
#

okay, thanks

#

cause I got a little misconception about it while reading email

shy turret
#

little question: would ws or fastify-websocket be faster at handling websocket connections?

#

(ping me back pls, NPMs [node.js] btw)

woeful pike
#

but it replaces your entire webserver so maybe only use it for the ws handling on a separate webserver

earnest phoenix
#

how do I define the function that is called when a button is clicked?

sudden geyser
#

Depends on what library you're using

#

When using the API, you give Discord a structure for what the components (buttons) will look like. You can't just send Discord a function to run when the button is clicked since Discord only cares about the data on that button.

When a user clicks a button, you'll get some data and indicators for what button was clicked (usually through a custom ID you set).

sonic tusk
#

how do i log votes

sudden geyser
#

Some libraries may streamline this process for you so you can provide a function, but, under the hood, it's doing what I've outlined.

sudden geyser
sonic tusk
#

ok

round cove
#

Are you fr rn

split hazel
#

you make a loop to dm ppl

round cove
#

Speedy viviooaahh

earnest phoenix
#

Im trying to make this command where if i type the command in the chat and i mention the user it sends a direct message to the user. but ive tried the things that i know and i kept on getting errors. so anyone that knows the code to it please reply to this message

solemn latch
#

we do not spoonfeed code here

#

best to show the error instead

earnest phoenix
#

well i tried different codes and kept getting errors

solemn latch
#

probably best to fix the error rather than replace the code entirely

boreal iron
#

Well randomly copy and pasting code won’t get you far

#

The stuff you can find on the ‘net is most likely outdated

earnest phoenix
#

i did this code but it didnt work message.author.send(dm);

solemn latch
#

what error did you get?

boreal iron
#

Well you’re the message author

#

Not an user you specified

earnest phoenix
#

yeah i just realized that i didnt put user

boreal iron
#

You gotta get the member/user object from the message mentions

earnest phoenix
#

i got this error Cannot read properties of undefined (reading 'send')

boreal iron
#

Show the associated code

#

Basically the whole command

earnest phoenix
#
require('discord-reply')

module.exports = {
    name: 'dm',
    async execute(client, message, args){

        let user = message.mentions.members.first() || message.guild.members.cache.get(args[0])

        const dm = new Discord.MessageEmbed()
        .setTitle('test')
        .setDescription('Test')

        message.user.send(dm);
    }
}```
boreal iron
#

You define user as your var

#

Why do you wanna send the message to the message.user then?

#

user represents your member object

#

Use it to send the message

#

Also why do you import discord-reply?

#

You shouldn’t import stuff you don’t use

wheat mesa
#

saw this on a tutorial for working with postgres, isn't this a terrible terrible idea? Connecting and then releasing each time?

solemn latch
#

doesnt that defeat the purpose of a pool? 👀

boreal iron
boreal iron
earnest phoenix
boreal iron
modest maple
boreal iron
#

You wanna send your dm to the member you mentioned

#

Therefore it’s user.send()

#

Based on your code

earnest phoenix
solemn latch
#

has nothing to do with let, var or const

#

you are accessing message.user, but havent assigned anything to message.user

#

you assigned it to just user

wheat mesa
#

so I've never really worked that much with postgres before but I'm trying to move away from mongo because it's a hot mess

#

is it possible to make a string key and object value in postgres?

#

if that makes sense

solemn latch
#

afaik, postgres has no object value, but you can always store it as a string and convert to an object

wheat mesa
#

oh yeah that's probably a good idea

shy turret
#

~~i've been dying for the past few hours. how do you get UintContents?
||I found https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder, but I'm not using utf8, nor can find a way to just decode the numbers in Uint8Contents... or maybe I'm blind.||
I'm trying to find a way to send Int8Array() to a websocket then decode that Uint8Contents into an array like [2, 4].

what I'm sending:

let array = new Int8Array(2);
array[0] = 2;
array[1] = 4;

ws.send(array);

what I'm receiving:

ArrayBuffer { [Uint8Contents]: <02 04>, byteLength: 2 }

I'm assuming I need to put something inside TextDecoder().

let string = new TextDecoder().decode(message);
console.log(string)

-> the result i want: create an array [2, 4] (which is based off the received values). ||all i need is the numbers in Uint8Contents as an array.||
-> actual result: outputs (i think) 2 blank spaces.~~

solution: new Int8Array(message);

wheat mesa
#

also how do I query postgres safely without accidentally doing a funny injection attack

#

nvm I think I figured it out

#

nevermind again, I'm big stupid

#

never done much with SQL in general

boreal iron
#

that’s the reason why var is called var freerealestate

spark flint
#

I think my computer science teacher is el stupido

wheat mesa
#

now I'm just incredibly confused

#

I can't even get a basic query to work lmao

spark flint
#

Exam:
Write an SQL statement to select all fields from the results table where the students are in the art class
My answer:
SELECT * FROM Results WHERE "Class" = "Art"
Mark scheme:
Correct
My mark:
Wrong

boreal iron
wheat mesa
#

tried it both ways, same errors

boreal iron
#

Never saw test being an integer KEKW

quartz kindle
#

single quotes

#

'test'

wheat mesa
#

that was it

#

I officially hate sql

spark flint
#

mongo >>>>>>>

boreal iron
#

Usually it doesn’t matter if double or single quote

wheat mesa
#

time to figure out parameterized queries, and the best way to store an object

surreal knoll
#

You guys know how to update replit version?
All yt vids dont work 😕

boreal iron
#

But I’m not a Postgres user

quartz kindle
boreal iron
surreal knoll
#

spelling err

quartz kindle
boreal iron
wheat mesa
boreal iron
#

Yeah so the app might be the issue here

#

It may expects single quotes for strings

earnest phoenix
boreal iron
#

You can’t compare document based databases to complex relational (table based) databases

earnest phoenix
#

how do I give buttons functionality

sharp saddle
#

hey, what's is happen with discord.js?

#

all of my projects is giving a fetch error

earnest phoenix
#

Maybe you updated to v13?

earnest phoenix
boreal iron
earnest phoenix
#

so true 😂

sharp saddle
boreal iron
sharp saddle
boreal iron
#

Pressing a button will trigger that event

earnest phoenix
#

hmm okay I will search that up thank you

boreal iron
#

Your client receives that event

earnest phoenix
#

Yes

boreal iron
#

The event comes with the interaction object, in your case a button interaction which contains all infos about your interaction

dry imp
frigid robin
#

@lyric mountain I made lots of fixes and noticed that the bot is usually at 0.5%-2% CPU usage, but from time to time (matter of a few hours) it suddenly spikes to 100% and that's when it dies. I looked and I really have no potential infinite loops or something like that. I had many unhandled exceptions which I fixed now. I noticed the CPU doesn't go slowly up so I doubt it's a mem leak or something like that. It's about 0.6-2% for hours and could spike to 100% in a few seconds and then stay at that. I have 2 guesses now

  1. Maybe someone is stressing the bot? It died twice or 3 times at night and works pretty much flawlessly the rest of the time
  2. Can it be related to me using async wrongly? I do call some synchronous functions in my code. Namely using sqlite and querying my database for every message received.. should I be using aiosqlite (Sqlite for AsyncIO) (just found about it now)?
lyric mountain
#

but that shouldn't cause spikes

frigid robin
lyric mountain
#

try using a profiler to see where it spends the most time processing

frigid robin
#

hmm nice idea. I thought in the direction of cpu monitoring but this is also an idea

#

ty

tiny token
#

how do i get guild roles for a dashboard ?

#

using Oauth2

lyric mountain
#

remember it all runs in a single thread

earnest phoenix
#

How can I edit a previous sent message when I click a button

tiny token
#

on button click ^

earnest phoenix
#

bruh

#

tHaNks

#

xD

#

but any Idea how I can get the message?

tiny token
#

nO pRoBlEm

earnest phoenix
tiny token
earnest phoenix
#

dcjs

#

13

tiny token
#

pretty sure you need the message reference / id

earnest phoenix
#

Yes but how do I get that ID

tiny token
#

then do channel.messages.fetch()

tiny token
#

or parse a link to the message

#

or have the message id stored from when it was sent

#

you cant just manifest an id from nothing , there must be some kind of start point

earnest phoenix
#

Yes it worked

earnest phoenix
#

@wheat mesa shut up kthxbai <3

#

So me and waffle have been having issues lately when using typeorm. We get this error No repository for "Tag" was found. Looks like this entity is not registered in current "default" connection? after the connection is formed and we then run a command that utilizes the table to create an entry.

rose lance
#

yo, I am currently experimenting with a combination of flexboxes and grids to achieve some kinda layout, but somehow my flexbox seems to rather like to have some space in between instead of using the space to have no line breaks

sharp saddle
#
FetchError: request to https://discord.com/api/v9/gateway/bot failed, reason: connect ECONNREFUSED```

???
#

discord.js giving this error

lament rock
sharp saddle
#

oh

#

so isn't it DISCORD.JS?

#

oke

lament rock
#

it is not, correct

sharp saddle
#

how do i fix this error? Or is there no way?

lament rock
#

Try again later

sharp saddle
#

this has been going on for over 2 hours

sharp saddle
green kestrel
#

^^ for the curious and those who enjoy pain

round cove
#

Brain coming in

#

Okay Brain now make even more docs for D++ and examples :^)

green kestrel
#

lmao

#

have you seen how many examples there are 😄

round cove
#

Has it changed since I last checked? I swear there were only a handful.

green kestrel
#

theres about 30 lol

#

expand the example programs section

#

and also third party libs that go alongside it for stuff like youtube streaming

sudden geyser
wheat mesa
# earnest phoenix So me and waffle have been having issues lately when using typeorm. We get this ...

still stuck on this, not sure why. here's our entity: ```ts
import { Entity, BaseEntity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('tags')
export class Tag extends BaseEntity {
@PrimaryGeneratedColumn()
_id!: number;

@Column({ name: 'name', type: 'text', nullable: false })
name!: string;

@Column({ name: 'description', type: 'text', nullable: false })
description!: string;

@Column({ name: 'thumbnail', type: 'text', nullable: true })
thumbnail?: string;

@Column({ name: 'color', type: 'integer', nullable: true })
color?: number;

}

earnest phoenix
#

The entity itself isn't the issue here

#

I can almost guarantee that it is how we are creating the connection

wheat mesa
#

Most likely

green kestrel
#

and even if there was such a thing, it wouldnt have access to the native compiled bot

#

ive seen a few such "interpreters" but generally theyre trash

#

e.g. they dont support even C++03

lyric mountain
#

Imagine an interpreted c++

#

Ngl that's nightmare fuel

sudden geyser
#

Yes, but how about running an interpreted version of it? I haven't used C++, but Cling looks interesting. Plus, you can embed it (so maybe it can access the bot instance)

lyric mountain
#

Oh, you mean that

#

Java can do it

#

Tbh, jvm can run anything on it

sudden geyser
#

Pretty much any language should be able to do it

#

It's just about shipping the compiler (and runtime potentially) with the program.

lyric mountain
#

In the case of c++ it can be run almost directly by java and kotlin (idk abt other jvm languages)

#

Cuz JNI

#

So you can make a two-way communication between both languages on same runtime

sudden geyser
#

What you're talking about seems to be more concerned about communicating across languages (externals)

#

and not about how to make dynamically evaluating C++ code not take a century to load

white anvil
#

c++ was never meant to be interpreted, it has no vm like c#/java/js

#

hell it doesn’t even have a runtime

#

everything is dynamically linked at compile time

sudden geyser
#

It wasn't meant to, but that doesn't mean it can't. :p
I'm interested in if what I've described is possible and has a less atrocious output than what's currently available.

white anvil
#

yeah it’s possible, but that doesn’t mean it will ever be practical

sudden geyser
#

But will it be more practical than the current implementation?

white anvil
#

yeah probably but not enough to warrant using it

#

interpretation will always be slower than native execution and it’s just not worth it in the context of a single command for a discord bot

sudden geyser
#

All of the time right now is being spent on compiling (9 seconds), so interpreting that so it takes, let's say, 0.3 seconds, would be a net positive. Even for one command, you might as well not have it given the compile time is too slow to be useful.

#

Not having it is probably the solution, but live, dynamic evaluation of code is useful, but at odds with C++.

white anvil
#

yeah the design philosophy is just different

#

it’s cool to see traditionally compiled languages turned into an interpreted version but the debate of interpreted/jit compiled vs traditional compilation is a lengthy one

#

personally i am a huge fan of compile time errors over runtime errors and it’s not something i would ever want to give up

sudden geyser
#

I don't see it as a debate. I see it more as an integration—run a compiled bot, but, for convenience, test it dynamically. It's a different story for REPL-driven environments like lisps, but that's irrelevant here. It's just about running code and getting a response. Some platforms are just too slow or don't offer the support for that, so interpreters pop up.

white anvil
#

The issues caused by having a runtime be the source of errors is not something i think a lot of people would want to experience even in development

#

and anyway techniques like incremental compilation and optimisation strategy mean that compile times can be very minimal without an interpreter

sudden geyser
# white anvil The issues caused by having a runtime be the source of errors is not something i...

There are a lot of good things about having a runtime though. You can run and test a program interactively and not have to restart from the very beginning. Heck, lots of software like React's hot reloading and Discord.js examples on creating a reload command came from wanting to develop quicker and more lively rather than editing, compiling (can take a while, but depends, like you mentioned), and running, and still having a chance of hitting a runtime error even with a static type system.

lyric mountain
lyric mountain
#

Rython

sudden geyser
#

Iython

woeful pike
#

kekw klay having to defend dynamic typing yet again chaeyeonlaugh

sudden geyser
#

it is a hill I've died on many times

#

but as I sank into the ground, someone pulled me up, and whispered in my ear, "typescript sucks"

#

and I was reborn and kept walking

#

but my preference of dynamic typing doesn't have to do with this discussion.

solemn jolt
#
const data = {},
      coede = client.randomCode(6)
data[message.author.id] = coede;

why i have error in data[message.author.id]

earnest phoenix
#

I don't think you can assign stuff like that to an object

solemn jolt
# earnest phoenix What is the error
data[req.user.id] = coede;
^
TypeError: Cannot set properties of null (setting '735874386200100974')
at /workspace/src/routers/dashboard/create.js:17:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.4.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.4.1>;
npm notice Run `npm install -g npm@8.4.1` to update!
npm notice
#

this is the error

earnest phoenix
#

coede is null it seems

solemn jolt
boreal iron
#

data[req.user.id] as in your error is not data[message.author…] as you wrote above

earnest phoenix
#

Well the error seems to be saying you are trying to set that as null value

boreal iron
#

The code he shows is not causing the error

solemn jolt
earnest phoenix
#

I notice that now

earnest phoenix
#

create.js line 17

solemn jolt
#
const data = {};
  let coede = "";
  const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  for (let i = 0; i < 6; i++) {
    coede += possible.charAt(Math.floor(Math.random() * possible.length));
  }
  data[req.user.id] = coede;
#

this is the code

earnest phoenix
#

okay are you sure coede is actually what you think it is

solemn jolt
#

yes

earnest phoenix
#

Have you loggedd it

solemn jolt
#

yes

boreal iron
#

Please log data and coede and show us the results
Please add this line, too before logging both vars
data.test = true;

solemn jolt
#

ok

boreal iron
#

Either I’m blind or this error doesn’t make sense tho

#

cough

solemn jolt
# boreal iron Either I’m blind or this error doesn’t make sense tho
TypeError: Cannot set properties of null (setting 'test')
at /workspace/src/routers/dashboard/create.js:12:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.4.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.4.1>;
npm notice Run `npm install -g npm@8.4.1` to update!
npm notice
#

error again

boreal iron
#

What about the log results?

solemn jolt
#

nothing just the error

boreal iron
#

Wut

solemn jolt
#
const data = {}
  data.test = true;
  let coede = "";
  const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  for (let i = 0; i < 6; i++) {
    coede += possible.charAt(Math.floor(Math.random() * possible.length));
  }
  console.log(coede)
  console.log(data)
earnest phoenix
#

What

#

That makes no sense

boreal iron
#

Wtf

#

Please change the keyword of data to let instead of const

solemn jolt
boreal iron
#

Even if that doesn’t make any sense

boreal iron
#

If that doesn’t work please declare data as non-empty object

#

For example: let data = { test: "something" };

#

Will brb

solemn jolt
#
data.test = true;
^
TypeError: Cannot set properties of null (setting 'test')
at /workspace/src/routers/dashboard/create.js:12:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.4.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.4.1>;
npm notice Run `npm install -g npm@8.4.1` to update!
npm notice
#

again same error

earnest phoenix
#

🤔

solemn jolt
#

my luck in code = %0🥲

boreal iron
#

Dunno why shouldn’t be able to set properties to an empty object

#

Weird

earnest phoenix
#

I feel like smth else is going on here

solemn jolt
#

i dont now this is error with no reason 🥲

earnest phoenix
#

Mmmm

solemn jolt
#
const app = require('express').Router();
const { Client } = require("discord.js")
const client = global.Client;
const db = require("../../database/models/user.js");
let data = {}
app.get("/create", global.checkAuth, async (req, res) => {
  let data = await db.findOne({ userID: req.user.id });
  if (data) return res.redirect("/dashboard");
  if (!client.guilds.cache.get(config.server.id).members.cache.get(req.user.id)) return res.redirect("/error?code=403&message=To do this, you have to join our discord server.");
  let coede = "";
  const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  for (let i = 0; i < 6; i++) {
    coede += possible.charAt(Math.floor(Math.random() * possible.length));
  }
  data[req.user.id] = coede;
  res.render("dashboard/create.ejs", {
    code: coede,
    bot: global.Client,
    path: req.path,
    config: global.config,
    user: req.isAuthenticated() ? req.user : null,
    req: req,
    roles: global.config.server.roles,
    channels: global.config.server.channels,
    data,
  })
})

app.post("/create", global.checkAuth, async (req, res) => {
  const {
    botTOKEN,
    ownerID,
    verify,
  } = req.body;
  if (verify !== data[ownerID]) return res.redirect(`/dashboard/create?error=true&message=You need to type verify code.`)
  const cllient = new Client();
  await cllient.login(botTOKEN)
    .then(async cl => {
      const tt = await db.findOne({ token: botTOKEN })
      if (tt) return res.send({ error: true, message: "The token is already added before" })
      await new db({
        userID: ownerID,
        botID: cl.id,
        Date: new Date(),
        token: botTOKEN
      }).save()

    }) // success
    .catch(error => res.send({ error: true, message: "The token is invaled." + error })); // error
})

module.exports = app;
#

this is the all code

earnest phoenix
#

I think I see the issue now

#

Tho I can hardly tell cause that code is bleh

solemn jolt
lapis cliff
#

How do I setup multiple status for the bot?
javascript

proud oracle
#

why am I getting this error?

earnest phoenix
#

To me it looks like you are defining data twice so it likely doesn't know which one to use

#

You define it in a global scope for that file and then inside that function scope

#

Why are you replying to me with that

earnest phoenix
#

try renaming one of those variables

#

that might fix it

proud oracle
#

is this right?

earnest phoenix
#

as of right now it probably thinks you are trying to use the one in that function call

proud oracle
#

pls help

earnest phoenix
proud oracle
earnest phoenix
#

Then its not right

#

Do you get any errors?

proud oracle
#

no

proud oracle
earnest phoenix
#

Then post the error

proud oracle
earnest phoenix
#

You are giving it an invalid token when logging in

proud oracle
earnest phoenix
#

...

#

It obviously isn't a valid token if it is erroring and saying so

#

Unless djs fucked up their login method again

lunar palm
#

It's working for my bots

earnest phoenix
#

Then it is likely you are not providing a valid token Jethalal

#

So please make sure you are

solemn jolt
earnest phoenix
#

No problem

proud oracle
#

I solved the old error but I got a new one

earnest phoenix
#

What are you doing

proud oracle
#

upvote command

earnest phoenix
#

I assume that is a top.gg sdk erorr but the looks of it

#

So you need a api token for it to work

proud oracle
earnest phoenix
#

Get your api token and use it

proud oracle
#

ok

proud oracle
earnest phoenix
#

yes

proud oracle
#

ok

proud oracle
boreal iron
earnest phoenix
#

nor did i

boreal iron
#

Oh I see he has overwritten data with his database result

#

Hardly to see the scopes on mobile

#

So it wasn’t an empty object anymore

earnest phoenix
#

yep

earnest phoenix
#

How do I add more that 1 button to an Action row

#

By making more than one button and adding that other button

earnest phoenix
boreal iron
#

Just by adding a second button object to the array

onyx socket
#

what is the most preferred way of adding slash commands in python bots...Like there are many libraries, discord-py-slash-commands, disnake etc..

#

which one should i use

slender thistle
#

Try out all of them and see which one you like

onyx socket
#

...

boreal iron
boreal iron
onyx socket
#

o

dry imp
#

dont use third party lib that is specific just for slash

#

it will get outdated and you would need to refactor your code

onyx socket
#

hmm

onyx socket
bright hornet
#

can i ask here a question?

#

I have a code for fetching all members with the given role. But it keeps giving me an error like this Cannot read properties of undefined (reading 'members') Here's the full detail of the code.

module.exports = class TestCommand extends BaseCommand {
  constructor() {
    super('test', 'testing', []);
  }

async run (client, message, args) {

  const roles = message.mentions.roles.first();

  if(roles == undefined) {
    message.channel.send("Wrong syntax. Please try again")
    } else {
      const ListEmbed = new MessageEmbed()
  
      .setTitle(`Person who have this ${roles} role is:`)
      .setDescription(message.guild.roles.cache.get(role => role.name == roles).members.map(m=>m.user.tag).join('\n'))
      .setColor('RANDOM')
      .setTimestamp()
      message.channel.send({embeds: [ListEmbed]}).catch((err) => {
        console.log(err)
        message.channel.send("Something went wrong")
      });
    }
  }
}
digital lotus
#
  at Api._request (C:\Users\aweso\Desktop\Mursy\node_modules\@top-gg\sdk\dist\structs\Api.js:76:19)                                   
    at runMicrotasks (<anonymous>)                                                                                                      
     at processTicksAndRejections (node:internal/process/task_queues:96:5)                                                               
    at async Api.postStats (C:\Users\aweso\Desktop\Mursy\node_modules\@top-gg\sdk\dist\structs\Api.js:99:9) {                           
  response: Response {                                                                                                                  
    size: 0,                                                                                                                            
     timeout: 0,                                                                                                                         
   [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },                                                    
    [Symbol(Response internals)]: {                                                                                                     
     url: 'https://top.gg/api/bots/stats',                                                                                             
    status: 524,                                                                                                                      
      statusText: undefined,                                                                                                            
      headers: [Headers],                                                                                                               
  counter: 0                                                                                                                        
     }                                                                                                                                  
   }                                                                                                                                 
 }  ```
#

I just received this error

pale vessel
#

handle your errors

#

it's a site issue

digital lotus
dusty wave
#

Is AI based toxicity filter a good idea of a bad idea?

modest maple
#

bad

#

I doubt you'll have enough CPU power to make it reliable and fast

woeful pike
woeful pike
#

then it's definitely nowhere as good as perspective

dusty wave
#

It uses perspective

woeful pike
dusty wave
#

but it been trained

#

for discord

modest maple
#

sip I think

#

you dont quite realise

#

just how much load that can entail

dusty wave
woeful pike
#

how do you have an AI that uses an existing machine learning model API but is also trained by itself

modest maple
#

its not a good idea mmLul

woeful pike
#

I think if you have an ML model capable of understanding the nuances in everyday conversations without being overbearing you need to create a business not a discord bot

dusty wave
woeful pike
#

that's like an actual billion dollar problem

modest maple
#

thats...

#

2 AI does not fix things

#

it generally makes it far worse

#

because then you have two places where the computer can loose it's mind

dusty wave
#

the other AI is only few kb and is capable of learning on the fly from the main ai
Which helps decrease performance costs and increase response speed

woeful pike
#

2 AIs be like

if (await ai1.isToxic(message)) {
  return yikes()
}
if (await ai2.isToxic(message)) {
  return yikes()
}
modest maple
woeful pike
#

like I don't wanna rain on your parade but the thing you're trying to tackle is an incredibly difficult problem to solve correctly

#

but if all you wanna do is learn more about ML and use it on a bot then go for it sure

dusty wave
#

this is the general gist

#

but far more complex

woeful pike
#

so if ai1 doesn't understand the nuances you're screwed

modest maple
#

EYES that

dusty wave
modest maple
#

Okay, so basically you're using 1 AI to train another AI via Q learning?

dusty wave
#

to back that up for 50% 50%

woeful pike
#

good old filtering has never worked

dusty wave
woeful pike
#

also you can't really have that because you're relying on perspective to be right, which often gets things wrong because it's designed for long messages not short texts

#

and you don't have any way of knowing what message is a false positive and what isn't

dusty wave
woeful pike
#

your version doesn't run until perspective runs

dusty wave
#

flagged by other ais as toxic

modest maple
#

pithink Does Discord know about that data scraping

modest maple
#

128 Million Discord messages should be about what? 50-60GB of data or so.

woeful pike
#

I mean it's a cool project but it won't ever become a reliable tool because the problem is so crazy difficult and I don't think you happen to have a phd in artificial intelligence

dusty wave
dusty wave
modest maple
#

Put that into an AI and thats about some 30GB model

dusty wave
#

along with reddit , movielines wikipedia

#

new article

#

movie reviews

#

etc

woeful pike
#

the problem is unlike a side feature like a dice roll command, this feature runs quietly in the background, incorrectly flagging conversations or letting obvious cases slip by

modest maple
#

That doesnt sound right, if you've fed it some 23GB of data your model generally should be about the same size or maybe just a little smaller

#

because you're creating word vectors with NLP like that

#

Which realistically generally produces more data than the original text if done correctly

dusty wave
woeful pike
#

if even a big company can't get it right by flagging conversations about LGBT topics incorrectly then like I can't imagine you could get this to work without either being useless or false flagging too many things

modest maple
#

also, you fundamentally shouldn't be using Q learning for this task

dusty wave
woeful pike
modest maple
#

which regardless Is probably going to be far too slow to keep up with the rate of messages unless you have some insane hardware

woeful pike
#

also I feel like users need to opt into having their messages analyzed in order to improve the model and I can't imagine discord would let you do that

#

also how are you planning on adding context if you're using a pretrained model

dusty wave
dusty wave
#

to report

dusty wave
modest maple
#

You think people will willing give correct information to your AI when asked?

woeful pike
#

idk man this sounds like a cool project to learn more about ML but not something that could even come close to being accurate in the real world. If any random bot developer could've solved this problem it would already be a successful commercial product OMEGALUL

modest maple
#

also Hugging face charge $10 per 1 Million characters

dusty wave
modest maple
#

so that is... Alot of money if you plan on having hugging face host / run it

dusty wave
#

then you like make only 100 querys a day

#

to it

modest maple
woeful pike
#

wait 100 queries a day? what

modest maple
woeful pike
modest maple
#

You do understand though that you cant have an ai train another ai to be better than itself for this case though right?

dusty wave
modest maple
#

And if you're not using hugging face then you need to run the model somewhere

dusty wave
modest maple
#

yes... But a smaller model is generally less accurate

dusty wave
#

the other can run inside heruko or repl.it

modest maple
#

no.

#

no it cannot

dusty wave
woeful pike
#

I guess if the goal is to create a worse perspective api then you could maybe get there with enough training

modest maple
#

Accurate AI depends on 2 things:

  • How accurate the training data is
  • The amount of accurate training data there is.
woeful pike
#

but perspective itself is not good enough to be used for chat messages. So why would you even have that as a goal

modest maple
#

if you're making a smaller model then realistically it's going to be far worse than the big model

#

but even then even if the model is semi functional

#

you cannot seriously run it on heroku or repl.it

dusty wave
modest maple
#

maybe if you did like... 3 messages an hour

#

instead of potentially hundreds of messages second

modest maple
#

this isnt some sentient being. Its just NLP. NLP that traditionally requires an insane amount of correct and accurate data and alot of resources to be used for the task you're talking about

woeful pike
#

I mean the best way for you to find out is to try and realize how difficult the problem space actually is

dusty wave
# modest maple that sentence doesnt make sense

the memory ai is based on 2 thing an learning ai and an aiml bot
Causal ai is about 2gb (and can be hosted on google app engine for free), this is good for normal user convo like how are you etc
general ai is massive like 4-8gb this is when the user ask something really wierd like my socks smell funny

modest maple
woeful pike
#

5 minutes into machine learning: "I can't understand why noone hasn't done this yet"
5 days into machine learning: "I understand why noone has done this yet"

dusty wave
woeful pike
dusty wave
dusty wave
#

monstorsity

#

well a good basic version

woeful pike
#

sounds like you're a pro dude, go and create that bot

dusty wave
#

now i am fine tuning

woeful pike
#

what's holding you back

dusty wave
woeful pike
#

toxicity detection as a service + heroku/replit in the same concept is just

modest maple
#

what could go wrong

dusty wave
modest maple
#

mmLul I mean my only warning is, I think you underestimate this

woeful pike
#

yeah like significantly

modest maple
#

Im pretty sure just the word tokenization is enough to put significant strain on the system at larger amounts of servers

#

even if you use fast wordpiece

woeful pike
#

there are certain fields of ML where you could piggyback off existing tech like face detection and recognition etc but the toxicity recognition thing is still a field that's developing and unless you're making fairly groundbreaking research I can't see this becoming usable outside of test cases because of how much it impacts conversation when it's wrong

#

considering how wrong or inaccurate the existing technology that runs on proper infrastructure and not on repl.it is

modest maple
#

Its hard enough making a naive search engine be relevant let alone trying to detect toxicity in languages

dusty wave
#

Lol

woeful pike
#

it's a cool project but yeah I wouldn't get my hopes up if I were you

modest maple
#

It sorta sounds like you are

#

but 👐

dusty wave
#

Eh i am split on adding it to the main bot

#

Performance is amazing

#

But I am afraid of demand after verification

modest maple
#

mmm General rule of thumb, If your performance is amazing your model is probably not very accurate

modest maple
woeful pike
#

I'm living with the pains of this as we speak

modest maple
#

What are you doing with it zoomeyes

earnest mural
#

https://i.imgur.com/rjEVTgl.png I'm trying to make a command where you can search for a guild through its guild name. but im getting a return of member not found when i use "message"

bright hornet
earnest mural
modest maple
#

you know how insecure that is????

earnest mural
earnest mural
#

ik but its just for my school project thingy then i can work on making it more secure later you know hmm

modest maple
dusty wave
earnest mural
woeful pike
#

sounds like incredible cherrypicking

dusty wave
modest maple
#

As someone who has worked with Google to build AI's, I doubt yours is better than "All other alternatives"

dusty wave
#

Security first

earnest mural
#

cause my brain is stupid

dusty wave
#

Like if it manages to some load of the admin

#

Its worth it

#

Its not meant to be perfect

delicate zephyr
#

depends on how many false positives LUL

modest maple
#

they dont use AI they use defaulto is word in x

earnest mural
dusty wave
delicate zephyr
#

using AI is risky tho

modest maple
bright hornet
#

I keep getting ignored lmao

dusty wave
earnest mural
dusty wave
dry imp
earnest mural
#

guild name

bright hornet
earnest mural
delicate zephyr
#

basically

earnest mural
#

since im formatting it with json files like that

bright hornet
dusty wave
quartz kindle
#

you should really be using at least a database like sqlite

#

json will just give you problems in the future

dry imp
#

i think it is just for school project

quartz kindle
#

are those "guilds" actually discord guilds? or something external like an mmorpg?

earnest phoenix
#

dont use json as a database smiledog

dry imp
#

okay @earnest mural so you want to search the name through the same guild command, correct?

woeful pike
#

also different communities have different definitions of what toxicity is

#

some might say it's swearing, some might say our city our ciiiittyy

dusty wave
woeful pike
#

but it's not a linear scale

woeful pike
#

I'm curious if this is even possible to automate even theoretically

#

cuz there are just so many factors. Language, culture, strictness, subtext, memes

dry imp
woeful pike
#

how the hell does anyone automate that even with the most brilliant researchers out there

earnest mural
dry imp
#

it is assigned to member instead of message

dry imp
#

thats why the error tells you "Member 'hmm' not found"

earnest mural
#

ohhh

woeful pike
#

so yeah I guess the goal is minimizing false positives and not maximizing detection

earnest mural
#

cause im thinking about either pinging a user or searching the guild's name would be able to find the information of the guild being searched

dusty wave
quartz kindle
#

they probably train them with decades old books, texts, movies and conversations

#

because everything is offensive today

woeful pike
quartz kindle
#

you have to go back in time to actually listen to proper gentleman-like speech

#

lmao

woeful pike
#

there's just too much context involved

#

humans do a terrible job already for something that we should be better at than machines with what we know about ML today

#

and yet

quartz kindle
#

thats the beauty of language, its basically turing complete, you can say anything and make it mean anything with words, intonation, context, etc

dusty wave
quartz kindle
#

buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo

modest maple
dusty wave
#

Its better for many reasons like less soze

#

Size etc

modest maple
#

but that does mean I can just be toxic in some other language and the bot wont notice

#

also you shouldn't really need to have an entirely separate model for each language, you need a good set of data and a good tokenizer sure. But generally.

dusty wave
modest maple
#

yes

#

but you get that regardless

#

the additional downside you get from splitting them up is then that they cant understand compound sentences which contain diffrent languages

#

and that defeats the purpose of your entire ai

#

because ultimately you're trying to detect sentiment

woeful pike
vagrant prairie
#

is there any example code for like voting in d.js v13

quartz kindle
#

noooooo

marble juniper
sudden geyser
#

If you want to receive votes, you're in luck, because that doesn't involve Discord.js.

vagrant prairie
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const fetch = require('node-fetch')
const app = express()
const webhook = new Topgg.Webhook('me password')
app.post('/vote', webhook.listener(vote => { 
    console.log("User with id - " + vote.user + " Voted!")
    let value = JSON.stringify({
        embeds: [
            {
                title: "Voted!",
                description: `<@${vote.user}> (${vote.user}) Just Voted For \`Disminer!\`!!`,
                color: "8388736"
            }
        ]
    })
    fetch("https://discord.com/api/webhooks/me webhook", { 
        method: 'POST',
        headers: {
            'Content-type': 'application/json',
        },
        body: value
    }).catch(e => console.log('Error occured while posting webhook : ' + e))
}))
app.listen(3000)``` is what im using rn, it was a template and isnt working
spark flint
#

formatting doesn't seem right

quartz kindle
#

does console.log("User with id - " + vote.user + " Voted!") log anything?

vagrant prairie
quartz kindle
#

did you configure the webhook url in your bot's top.gg settings?

vagrant prairie
#

yeah

#

i have the ip

#

does it need to have port as well?

quartz kindle
#

yes

vagrant prairie
#

oh

quartz kindle
#

where is your bot hosted?

vagrant prairie
#

then thats probably the problem, one sec

vagrant prairie
spark flint
#

OOHHH i kno

quartz kindle
spark flint
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const fetch = require('node-fetch')
const app = express()
const webhook = new Topgg.Webhook('me password')
app.post('/vote', webhook.listener(vote => { 
    console.log("User with id - " + vote.user + " Voted!")
    let value = JSON.stringify({
        embeds: [
            {
                title: "Voted!",
                description: `<@${vote.user}> (${vote.user}) Just Voted For \`Disminer!\`!!`,
                color: "8388736"
            }
        ]
    })
    fetch("https://discord.com/api/webhooks/me webhook", { 
        method: 'POST',
        headers: {
            'Content-type': 'application/json',
        },
        body: value
    }).catch(e => console.log('Error occured while posting webhook : ' + e))
}))
app.listen(pterodactyl assigned port)```
#

then http://myip:pterodactyl assigned port

vagrant prairie
#

ou yeah

spark flint
#

i had same issue yesterday

vagrant prairie
#

does the port need to go in the url as well?

#

probably ima test now ty

spark flint
#

yeah

vagrant prairie
#

still nothing

#

could it be a code problem posivly?

#

ima try the official example

spark flint
#

what is your ptero ip and port?

#

gonna see if its publicly accessible

#

feel free to delete after

vagrant prairie
#

wait let me try smth

spark flint
#

2 secs

#

leme send a test from my bot

vagrant prairie
#

kk

spark flint
#

did that do anything

vagrant prairie
#

nope

spark flint
#

whats the webhook auth?

#

needs to match

#

set to "password"

#

?

vagrant prairie
#

let me try smth first

spark flint
#

alr

nocturne grove
#

Repost. Please ping 🙂

vagrant prairie
#

the webhook discord url supposed to go here right

spark flint
#

no

vagrant prairie
#

oh

#

i didnt have /vote before

spark flint
#

ah

vagrant prairie
#

works now ty!

spark flint
#

good to hear

valid sierra
#

Hey, i want to make a music bot but like i don't want to use youtube cause of the issues and etc
i am not sure if you can stream spotify songs via discord bots or not cause ig i read somewhere that you can't
so i was wondering how do the bots like hydra and etc play songs? like is there a platform that allows us to stream songs without downloading them and etc?

pale vessel
#

there are other platforms like Soundcloud and Bandcamp that you could use as substitutes for YT

#

playing from Spotify isn't possible and even if you could get pass the DRM protection it's illegal

quartz kindle
#

most bots use lavalink/lavaplayer

#

which comes with support for several streaming services built in

valid sierra
valid sierra
pale vessel
#

install lavalink and use a wrapper

valid sierra
pale vessel
#

the lavalink server is in java, you have to install it on your VPS/dedi

valid sierra
#

I used to see it connected a lot with JavaScript tbh

pale vessel
#

there are wrapper in many languages

valid sierra
#

Oh okay, I will look it up

#

Thanks a lot

pale vessel
valid sierra
#

Wow thanks lol

#

Do you use it? So like if I struggled with it may I ask for your advice again?

#

I am outside rn so I can't really test it

pale vessel
#

I don't use it, I only used Shoukaku and that was in node.js

valid sierra
#

Ooh okay tho thanks for responding to me

bright thorn
pale vessel
#

erela.js?

#

isn't that in node.js

bright thorn
#

Yeah

#

Lol

#

Then it is in?

valid sierra
#

I do use python lol

rigid maple
#

function outputs before logging console.log() inside the function 😃

#

what can I do

wheat mesa
#

you haven't provided any code, it's difficult to say what you're doing wrong

rigid maple
#

this function

#

this use

  console.log(await client.sendFiletoWeb())
#

this output

#

function output is before log console.log() when the function is running

wheat mesa
#

because you have a setTimeout that schedules it to be run after 5 seconds

rigid maple
#

unfortunately there is no other way to find out if the result is out

#

or i don't know

wheat mesa
#

setTimeout isn't blocking

#

you can return within the setTimeout if you wish, or you can use a sleep function that uses promises

quartz kindle
#

why do you even need the timeout there?

rigid maple