#development

1 messages Β· Page 1416 of 1

sudden geyser
hollow sedge
#

it's not required for everything

drifting wedge
#

o ok

#

SYNTAX ERROR

#

o ok;

#

@hollow sedge;

hollow sedge
#

all good now;

drifting wedge
#

poggers bro;

sudden geyser
#

aight end

drifting wedge
stark abyss
#

@drifting wedge nvm I didn't find the error lol I had to go kek

drifting wedge
#

o ok

stark abyss
#

nvm I did

#

kek

#

I misspelled the table name

#

wait I am still getting the error wtf wth

stark abyss
#
dbClient.connect()
    .then(()=> console.log("Connected to Postgres!"))
    .then(() => dbClient.query(`CREATE TABLE afkTable(
        user_id serial PRIMARY KEY,
        afk_msg VARCHAR ( 255 ) NOT NULL,
    );`))
    .then(() => dbClient.query(`INSERT INTO afkTable(user_id, afk_msg)
        VALUES (20227682022769, I am trying to code)
    );`))
    .catch(e => console.log(e))
    .finally(() => dbClient.end())

error: syntax error at or near ")"

safe creek
#

ha nub

stark abyss
#

hey that's not nice

#

@opal plank ~~ hey fellow postgres supremacist know what I am doing wrong here?~~

opal plank
#

first that callback hell

#

postgres supports await/async

stark abyss
#

oh noted

opal plank
#

thats not the issue tho

stark abyss
#

ofc

sudden geyser
#

I mean, that is async/await

opal plank
#

thats just a callback hell

stark abyss
#

right

opal plank
#

await exists so you dont have to chain 30 things

sudden geyser
#

masked callback hell :^)

stark abyss
#

so that aside where is the issue?

opal plank
#

why you creating a table every time though?

stark abyss
#

I don't know I am just trying to learn how this works

safe creek
#

nerd hehehehe

stark abyss
#

creating, and inserting

opal plank
#

thats legit just SQL syntax

safe creek
#

wait

#

what

opal plank
#

you dont need to create anything everytime

sudden geyser
#

See

INSERT INTO afkTable(user_id, afk_msg) VALUES (20227682022769, I am trying to code));```
opal plank
#

also VALUES is prepared statements

sudden geyser
#

Notice the extra ) at the end.

opal plank
#

you shouldnt use them like that tbh

safe creek
stark abyss
#

I see

safe creek
#

you did it all wong

#

but

#

we all make mistakes

#

some irreversable PepeKMS

sudden geyser
#

It's better to point out the issue at hand, then provide info on the other stuff unless it's not easy to answer the question without

stark abyss
#

Bruh I have no SQL knowledge or postgres I am noob like you said

sudden geyser
#

Learning SQL shouldn't take too long

stark abyss
#

Yeah I watched some video

safe creek
#

so why use sql if you have no knowledge? learn it first before using it that s always what you should do

earnest phoenix
#

Is it nessecary to ALL CAP sql command

safe creek
#

think of it as a test

prisma oriole
stark abyss
#

Well to learn I gotta start somewhere

safe creek
#

and if you dont learn the material you fail

opal plank
#

first issue:callback hell

second: POOL is a thing so you dont have to create connections like that

third: prepared statements should use stuff outside. 'INSERT INTO a (COLUMS) VALUES($1)', [Value1];

fourth: it'll error if a table already exists

sudden geyser
#

it's a convention

#

You can have lowercase, or have it lIkE ThIs

prisma oriole
#

imagine using allcaps

#

CONSOLE.LOG("HI")

opal plank
#

yes and no

#

SQL is uppercase

earnest phoenix
#

time to bring out that CAPLOCKS

opal plank
#

postgres is case sensitive

stark abyss
sudden geyser
#

C#'s capital method name convention scares me

opal plank
#

this =/= THIS

stark abyss
#

Clearly not copied code

safe creek
stark abyss
#

Yeah I watched videos on YT and at the time I am trying to put that information to test

opal plank
#

how about we read the docs?

#

and not use youtube?

safe creek
#

or that

opal plank
#

youtube is bad

safe creek
#

you could use the docs

#

if there is docs

stark abyss
#

I also read docs kek I am just bad at shit

opal plank
#

outdated shit, shitty people talking random shit they half know about stuff

#

bad practices

#

you got everything that could be bad on youtube

safe creek
#

yes

opal plank
#

trust the people who made the stuff, docs are reviewed

stark abyss
#

Right

prisma oriole
#

yeah youtube is mostly people who just read the docs anyways

safe creek
#

always

opal plank
stark abyss
#

Like I said I read em WeirdChamp

#

I am just bad

opal plank
#

you read the docs on POSTGRES

#

not on the lib you using

stark abyss
#

That is correct

sudden geyser
#

my god those docs are beefy

opal plank
#

you need both

#

well, its a proper database

#

what were you expecting? 20 lines like quick.db?

prisma oriole
#

you really only need to read the first two chapters erwin sent

sudden geyser
#

most docs I've read are not that long even for proper stuff

prisma oriole
#

other than that, its pretty ez

stark abyss
#

they got like 400 hours of audiobook or something

opal plank
#

postgres isnt just DELETE INSERT CREATE UPDATE queries

#

its a LOT more complicated than you think

#

relational databases offer a lot more stuff 90% of the people barely look into

#

postgres specially

prisma oriole
#

yeah

opal plank
#

postgres is like LOTR

#

the one ring to rule em all

#

postgres offers everything you look for, and more

stark abyss
#

lol

#

Erwin in the zone

sudden geyser
#

imo for beginners its better to start off with something lighter, like SQLite. you probably aren't going to need 95% of what Postgres is offering, but this doesn't really relate to the original topic

opal plank
#

the ONLY thing you MIGHT, and i emphasize this, MIGHT, need is more speed, which then you'd go for SQL or something like Cassandra

#

but you talking insane shit speeds there, avarage users wont need it all

#

none of us owns platforms as big as discord to be able to cap postgres speeds

#

small flex, i did manage to clog postgres with that twitch slave project

stark abyss
#

What if I secretly do thinkLul

#

lol

prisma oriole
#

yeah wtf bro

#

im the ceo of microsoft

opal plank
#

try 4 million viewers on twitch talking at once mmulu

stark abyss
opal plank
#

that does the trick

#

welp, enough flexing, i explained and gave you the info you needed

prisma oriole
#

tl;dr erwin promotes yaml and json databases

opal plank
#

Now its up to u

stark abyss
#

Alright

#

Thank you

#

Sorry for pinging

opal plank
#

I'll slap u so hard your dog wont recognize ur smell anymore @prisma oriole

prisma oriole
#

i dont have a dog

stark abyss
prisma oriole
#

now that i think about

#

it

#

a yaml database sounds quite cool to make

#

granted its a ginormous waste of time

#

but its a cool thingie

stark abyss
safe creek
#

whats the difference between an .db and .sql?

sudden geyser
#

.db is the binary

#

.sql is where you write your stuff

#

though it doesn't need to be called either

safe creek
#

ahh ok i see

shy turret
#

this isnt related to bot dev again but

#
let touch = {
  ogx: 0,
  ogy: 0,
  x: 0,
  y: 0
}

function touchscreenStart(event) {
  touch.ogx = event.touches[0].clientX;
  touch.ogy = event.touches[0].clientY;
}

function touchscreenMove(event) {
  let x = event.touches[0].clientX;
  let y = event.touches[0].clientY;
  if (touch.ogx < x) {
    keyA = false;
    keyD = true;
  } else {
    keyA = true;
    keyD = false;
  }

  if (touch.ogy < y) {
    keyW = false;
    keyS = true;
  } else {
    keyW = true;
    keyS = false;
  }
  touch.x = x;
  touch.y = y;
}

function touchscreenEnd(event) {
  keyW = false;
  keyA = false;
  keyS = false;
  keyD = false;
}

document.addEventListener("touchstart", function(e){e.preventDefault()}, false);
document.addEventListener("touchend", function(e){e.preventDefault()}, false);
document.addEventListener("touchmove", function(e){e.preventDefault()}, false);
document.addEventListener("touchend", function(e){e.preventDefault()}, false);

document.addEventListener('touchstart', touchscreenStart, false);
document.addEventListener('touchmove', touchscreenMove, false);
document.addEventListener('touchcancel', touchscreenEnd, false);
document.addEventListener('touchend', touchscreenEnd, false);
#

ive been trying to simulate touchscreen movement

#

it works on a computer's touchscreen, but for some reason, it doesnt support phone touchscreen

earnest phoenix
#

I can't import commands i have discord.py installed

#

How can I load it?

shy turret
#

by making a command handler

earnest phoenix
#

Making a command handler

#

I'm just trying to import commands

#

@shy turret

shy turret
#

idk any py

earnest phoenix
#

im making a discord webhook

#
{
  "embeds":
}```
#

one of the parameters is embeds

#

but

#

Like

#

How do I format the text

#

so its an embed

#

like

#
local HookData = {
  ["embeds"] = "what here?"
}```
#

how do I format it so it knows what is the title, description, date, etc...?

shy turret
#
{
    color: 0x0099ff,
    title: 'Some title',
    url: 'https://discord.js.org',
    author: {
        name: 'Some name',
        icon_url: 'https://i.imgur.com/wSTFkRM.png',
        url: 'https://discord.js.org',
    },
    description: 'Some description here',
    thumbnail: {
        url: 'https://i.imgur.com/wSTFkRM.png',
    },
    fields: [
        {
            name: 'Regular field title',
            value: 'Some value here',
        },
        {
            name: '\u200b',
            value: '\u200b',
            inline: false,
        },
        {
            name: 'Inline field title',
            value: 'Some value here',
            inline: true,
        },
        {
            name: 'Inline field title',
            value: 'Some value here',
            inline: true,
        },
        {
            name: 'Inline field title',
            value: 'Some value here',
            inline: true,
        },
    ],
    image: {
        url: 'https://i.imgur.com/wSTFkRM.png',
    },
    timestamp: new Date(),
    footer: {
        text: 'Some footer text here',
        icon_url: 'https://i.imgur.com/wSTFkRM.png',
    },
};

it shows this except you need to add the quotes

#

like make it like

earnest phoenix
#

oh

#

so

#
local HookData = {
  ["embeds"] = {
  
  }
}```
#

so its actually aa table

shy turret
#
{
  "embeds": {
    "title": "Hi"
  }
}
earnest phoenix
#

ok gotcha

shy turret
#

idk if it's a array or that though

earnest phoenix
#

yeah sorry i keep switching language

#

Im doing this in lua, but it sends the webhook message as JsonEncoded

#

Can someone help with import commands

#
    local HookData = {
        ['username'] = "Activity Logger", 
        ['embeds'] = {
            ["title"] = "Activity Logger";
            ["description"] = "test"
        }
    }```
#

@shy turret this doesnt seem to work

shy turret
#

idk much py

#

sry cant rly help that well

earnest phoenix
#

@shy turret its lua

#

do i need to fill out all the embed arguments?

shy turret
#

no

#

at least im pretty sure it isnt required to do that

earnest phoenix
#

@shy turret fixed it

#
    local HookData = {
        ['username'] = "Activity Logger", 
        ['embeds'] = {
            {
                ['title'] = "Activity Logger";
                ['description'] = "test"
            }
        }
    }```
#

for some reason i had to add the extra {

#

makes sense since the parameter is called embeds

shy turret
#

ok

earnest phoenix
#

is it possible to ping someone from a webhook

#

without knowing their tag or user id

#

only knowing their username

sudden geyser
#

I don't think so.

hollow sedge
#

Why would you only have their username?

sudden geyser
#

You'll at least need the ID.

earnest phoenix
#

im making a roblox webhook

hollow sedge
#

Oh

earnest phoenix
#

im already using bloxlink to link their discord name to their roblox name

#

so

ivory seal
#

hi
My code:

const lbmessage = await channel.send(embed)
setTimeout(function(){
lbmessage.delete()
}```
but my message isn't getting deleted
#

can someone help

rustic nova
#

errors?

ivory seal
#

none

opal plank
#

@ivory seal then you arent checking the proper console

#

you didnt specify a second parameter nor did you end the )

ivory seal
#

its run by pm2 on vps

#

its fixed anyways

tight scaffold
#

Is there a css selector for when the site goes into mobile mode

ivory seal
#

bootstrap?

near stratus
#

Like

@media only screen and (max-width: 600px){
    /*Here*/
}
delicate shore
#

How to get this thing

outer niche
#
    @commands.has_role('Support Team')
    async def lockdown(self, ctx):
        await ctx.message.delete()
        home = self.bot.get_channel(701882814219550720)
        await home.set_permissions(ctx.guild.default_role, send_messages=False)
        await ctx.send("**SERVER HAS BEEN LOCKED DOWN**")```

All right so I have this command and it is removing permissions from the every one roll how can I make it specify my member role
graceful dock
outer niche
#

i got it now

graceful dock
#

smh

unborn perch
#

So how can i get the webhooks to work for voting? Im pressing the test button and nothing is logging out in the console

const server = http.createServer(app);
const dbl = new DBL(client.config.dbltoken, { webhookAuth: client.config.dblpass, webhookServer: server });

dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://xxx.xxx.xxx.xxx:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
    logger.info(`User with ID ${vote.user} just voted!`);
    logger(vote);
});

app.get('/', (req, res) => {

});

server.listen(5000);```
rustic nova
#

remember that you need to submit your webhook url before being able to test it

#

@unborn perch

foggy wasp
#

I'm having issues with the command prefix. I changed the default to "doom" and added it into my bot code. However, when I try to command my bot, I get nothing. Any ideas?

lucid prawn
#

why is it doing it 30 times
```js
client.on('guildMemberAdd', member => {
const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome');
if (!channel) return;
channel.send(Welcome to the server, ${member});
});

pure lion
#

@lucid prawn you may have 30 instances of your bot

lucid prawn
#

wym

amber thistle
#
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::5000
    at Server.setupListenHandle [as _listen2] (net.js:1313:16)
    at listenInCluster (net.js:1361:12)
    at Server.listen (net.js:1447:7)
    at DBLWebhook._startWebhook (C:\Users\User\OneDrive\Desktop\Kimberly\node_modules\dblapi.js\src\webhook.js:45:18)
    at new DBLWebhook (C:\Users\User\OneDrive\Desktop\Kimberly\node_modules\dblapi.js\src\webhook.js:27:12)
    at new DBLAPI (C:\Users\User\OneDrive\Desktop\Kimberly\node_modules\dblapi.js\src\index.js:69:22)
    at Object.<anonymous> (C:\Users\User\OneDrive\Desktop\Kimberly\Codes\main.js:55:13)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)

i suddenly got this error

pure lion
#

Your bot may have started 30 times

#

What happens when you run a normal command?

amber thistle
#

the bot dosent logon

#

and yea i have restarted it a few amount of times

pure lion
#

@amber thistle port 5k is already being used, run netstat -tulpn

amber thistle
#

aight

quaint peak
#

is there any way i could make a command DM only AFTER it's been triggered?

pure lion
#

Then kill the process by PID

quaint peak
#

i made a command thats meant to be used in dms

#

but if they type in chat it catches it as an input in the dm

amber thistle
#

if(message.guild) return;

pure lion
#

You could use a sep message listener?

quaint peak
amber thistle
#

oh i thought its js nvm

quaint peak
#

yeah

pure lion
#

if message.guild

quaint peak
#

if message.guild:
return

#

?

pure lion
#

Either that or pass

#

Not sure what return would do in this context

quaint peak
#

alright, thanks.

pure lion
#

Np

quaint peak
#

also hum..

pure lion
#

hUm?

quaint peak
#

is there any way you can retrieve a delete bot

#

kinda got mad and delete it LOL

#

was in like 30 servers

pure lion
#

Bots can't be deleted

quaint peak
#

not the code, the token.

#

the application

#

on the site

pure lion
#

When you create a bot ye cannae delete

quaint peak
#

u can krista

pure lion
#

That's weird

quaint peak
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'message' is not defined

lucid prawn
quaint peak
#

@pure lion

pure lion
#

Oh

#

Uhh

#

Hmm

#

Wait for shivtaco

#

Don't know enough pie

lucid prawn
#

ok

quaint peak
#

ctx.guild should work

#

ill try it out

#

yeah that did not work at all

#

ill wait for shivaco

lucid prawn
clever vector
#

Hello developers

#

TypeError: Cannot read property 'first' of undefined

rustic nova
#

Hello fellow Developer

#

code and full error please

lucid prawn
#

why is it doing it 30 times

client.on('guildMemberAdd', member => {
  const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome');
  if (!channel) return;
  channel.send(`Welcome to the server, ${member}`);
});
sturdy vine
rustic nova
#

For example put a . at the beginning

#

if that changes only on one message, then you most likely have multiple instances running

clever vector
#

How can I fix this

#

TypeError: Cannot read property 'first' of undefined

rustic nova
#

again

rustic nova
sturdy vine
#

pls help me

rustic nova
#

your agree.js is most likely missing

#

check your /src/commands/ folder and see if it is there

sturdy vine
#

no

#

it is there

rustic nova
#

can't help you then, wait for someone who knows what the problem is

sturdy vine
#

ohk

#

src is folder which has index.js main file

#

and in src there is one more folder

#

commands

#

which has all command files

fathom nymph
#

Hey So How Do I define args.join?

sturdy vine
#

args.slice(0).join(" ")

fathom nymph
#

oh thx

pale vessel
#

slice(0) fullbruh

#

just don't slice then

strong fractal
#

Is it ok to show CPU usage and used ram in percentage

#

Of a bot

pale vessel
#

Yes?

#

why not

strong fractal
#

Maybe it’s dangerous or smth

#

πŸ˜†

clever vector
#

TypeError: Cannot read property 'first' of undefined

#

Anybody help?

rustic nova
#

Duuuuuuuude

#

third time

#

post your code

pale vessel
#

No because you provided us no context

rustic nova
#

and the full error

pale vessel
#

We can only tell you something before that first() is undefined

#

Which is basically what the error told you

pure lion
#

@clever vector send code

rustic nova
#

i swear if they ask that again, i'm going to lose it

pure lion
#

Bro

stone haven
#

who is ping me

strong fractal
pure lion
#

Yes

rustic nova
#

yeah

strong fractal
#

Ok

slender thistle
#

Doubt many people care about that but it's safe

upper drift
#

How do I make my bot talk with custom emoji?

#

Or it is not possible

rustic nova
#

that's possible

upper drift
#

Oh

#

then how do I do that?

pure lion
#

<:emoji_name:emoji_ID>

#

If it's animated then

#

<a:emoji_name:emoji_ID>

upper drift
#

Oh

#

I will try to do it

#

But thanks for helping πŸ™‚

#

yeah it is working

#

thanks

pure lion
#

np

dense void
peak venture
# sturdy vine i checked

You should link it to ./commands/agree.js instead of./src/commands/agree.js considered the index is already inside the ./src folder

earnest phoenix
#

Hi guys

#

How can I make a dashboard?

rustic nova
#

with html, css, php and maybe js

earnest phoenix
#

js

rustic nova
#

try making a general html design first before starting with the mechanics

earnest phoenix
#

First of all I want hosting, but I don't know how

#

I searched youtube

#

I want to be free

rustic nova
#

dashboard with free hosting

#

you're definitely out of luck with that

#

you will need to pay for hosting a dashboard

earnest phoenix
#

Ok

#

Do you pay for bot hosting?

rustic nova
#

I pay for my VPS, where i host my bot on

#

yes

#

and most likely a dashboard for my bot sooner or later

broken sentinel
#

@rustic nova You host bot from vps?

rustic nova
#

Yes

broken sentinel
#

Can you show me how? Because i have vps but i dont know how to use it

rustic nova
#

you will most likely need a bit of experience with linux (if your vps is linux)

broken sentinel
#

Its not linux

earnest phoenix
#

Existing free vps?

#

???

rustic nova
#

if you really want a dashboard, you will have to pay for hosting

clever vector
#

@pure lion ok

#
let user = message.mentions.users.first() || message.author;
 let avatar = user.displayAvatarURL({ dynamic: false, format: 'png' });
        let image = await canvacord.Canvas.trigger(avatar);
        let attachment = new Discord.MessageAttachment(image, "triggered.gif");
        return message.channel.send(attachment);
earnest phoenix
#

Is a free metod for hosting?

clever vector
#

Yes

#

Heroku

#

GitHub

#

FalixNodes

#

BlueFox

earnest phoenix
#

How to do with Heroku?

clever vector
#

Something.Host

earnest phoenix
#

I don't know

clever vector
earnest phoenix
#

Can you help?

clever vector
#

Hmm

earnest phoenix
#

I don't understand

clever vector
#

Dashcruft

#

And look in his channel

earnest phoenix
#

k

clever vector
#

There is a video that say

#

24/7 Hosting on Heroku

earnest phoenix
#

Ok

#

Thanks

peak venture
earnest phoenix
#

β–Ί [NEW] HOST YOUR OWN DISCORD.JS BOT 24/7! - 2020! (UPDATED)

If you want to try out another free Hosting Service, Check this video out. People liked this video and its easier to setup:
β–Ί https://youtu.be/Vs8IOL-uVq4

β–Ί Join into our Official Discord Server! We help people on there too
https://discord.gg/gMxAzs6

LINKS IN THE VIDEO:
1️⃣ https://...

β–Ά Play video
#

Is this?

#

@clever vector ?

tribal vessel
#

anyone know how to make a link become a video?

rustic nova
#

meta tags

tribal vessel
#

:))

#

ah

#

meta

#

ok thx

dense void
tribal vessel
#

thx aurel

rustic nova
river thistle
#

anyone knows how some bots can react to messages so fast ?

rustic nova
#

having a good ping

#

and reacting to it right after the message

lusty quest
#

depends a lot on different things. like most frameworks add some latency, there are bots that dont use any framework and connect directly to the api

river thistle
#

oh ok

#

Does discord.js add a cooldown or something ?

lusty quest
#

there is a global api cooldown

river thistle
#

okay

#

thanks !

void hill
#

Hi

lusty quest
#

hi

quartz kindle
#

you can change that in the client options

ivory seal
#

so every time someone sends a message i check their presence.activity
console.log(message.author.presence.activities)
and i get this https://i.imgur.com/TdyyPJA.png
but if i do (message.author.presence.activities.state) it returns undefined

restive furnace
#

because it's array what has object(s) inside

ivory seal
#

oh

#

i did (message.author.activities[5]) but nada

restive furnace
#

if the user doesn't have 6 activites, of course it's undefined/null.

#

since you accessed the 6th element of the array

ivory seal
#

oh

#

ye

#

im so stupid lol

#

ye i got it

#

it was message.author.presence.activities[0].state

eternal osprey
#

hey

#

i have recently made a !setchannel command

honest perch
#

Json pepowot

rustic nova
#

json peepoFatBonk

eternal osprey
#
 let rawdata4 = fs.readFileSync("./data3.json");
let channel4= JSON.parse(rawdata4);
            let msg = await message.channel4.send(text);```

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
    at Timeout._onTimeout (c:\Users\bilal\Desktop\coding\gtamap\program.js:697:46)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
rustic nova
#

stop using json

#

i highly recommend it

eternal osprey
#

i know guys, thanks.

lusty quest
#

use sqlite or some free aviable database like firebase or mongodb

eternal osprey
#

so it should not be a really big deal?

lusty quest
#

if its temporary you could even use redis

eternal osprey
#

anyway, does anybody know why that error is occuring?

honest perch
#

Channel 4 is undefined

eternal osprey
#

yeah why

#

it should be defined

lusty quest
#

define channel 4

quartz kindle
#

thats not how channels work

honest perch
#

You cant send by id

#

You would need to find the channel

#

And then send to the found channel

quartz kindle
#

console.log(channel4) then console.log(message.channel) and you'll see the difference

eternal osprey
#

or wait

#

for example

#

and then pass on the code with the normal message.channel.send

pure lion
#

channel4.send?

#

also channel4 is probably an ID if you're parsing it from your JSON db

quartz kindle
#

first of all console.log(channel4)

#

its probably not even an id, its likely an object containing an id if you saved it as json

earnest phoenix
#

can i have a playing status without a game license

pure lion
#

no its the channel name

earnest phoenix
#

rich presence can be set by normal applications amirite?

pure lion
earnest phoenix
#

ok

pure lion
#

if the game doesn't handle rp and discord doesn't either then no rp

eternal osprey
#

@quartz kindle it is an id. And i just used: if (message.channel.id == channel4){

my whole code
}

#

it worked

#

thanks for the help boys

quartz kindle
#

not sure that will do what you want, but then again idk what you want

eternal osprey
#

that the code will only send those messages if the message.id is the same as the !setchannel

quartz kindle
#

ah ok

eternal osprey
#

and it worked

quartz kindle
#

i thought you wanted to send a message to that channel from another channel

eternal osprey
#

owh no

river thistle
eternal osprey
#

sorry my question was kinda unclear.

delicate shore
#

How to do this stuff

lusty quest
#

on a website?

honest perch
clever vector
#

How to fix this

#
TypeError: Cannot read property 'first' of undefined

Codes :

    let user = message.mentions.users.first() || message.author;
    let avatar = user.displayAvatarURL({ dynamic: false, format: 'png' });
    let image = await canvacord.Canvas.trigger(avatar);
    let attachment = new Discord.MesssageAttachment(image, "triggered.gif");
    return message.channel.send(attachment);
honest perch
#

Users is undefined

clever vector
#

Can you mention where to fix that

#

@honest perch

honest perch
#

No, but @quartz kindle will happily help you

quartz kindle
#

are you sure the error is coming from there?

#

can you show the full error?

quartz kindle
pure lion
#

@clever vector there's no mentions in the message

fathom nymph
#

Hey I have error pls help

#

Link to code and pic

#

dblSmile Help!

teal plover
#

hello everybody

#

so i just update my bot and realised the on_dbl_vote i recently added isnt working

fathom nymph
#

This Is Not Chat

teal plover
fathom nymph
#

oops wrong

#

so what is error

teal plover
#

its just not being called

fathom nymph
#

oh no

#

its a Language idk

teal plover
#

python

fathom nymph
#

yea

#

idk that

clever vector
#

@pure lion I want mention and no mention

#

Both

fathom nymph
teal plover
#

oh thanks anw

fathom nymph
#

Hey So I need help

#

JavaScript

#

Please Help

clever vector
#

@fathom nymph how you host on Falix

#

Can you explain

fathom nymph
#

Its not falix

#

Its DANBOT

clever vector
#

Free?

#

Can you explain how to host on it

#

@fathom nymph

fathom nymph
#

No

#

I need help

#

not here to host teach

clever vector
#

:(

fathom nymph
#

Help Please

rustic nova
olive rune
#

the one at the top

rustic nova
#

I can tell you in a second, but i recommend waiting with modifying your page for now

#

xetera said that there's going to be some css-breaking changes soon

teal plover
#

ay hope

#

uk python?

#

cz im facing a certain problem

rustic nova
#

nope

#

i only know java

teal plover
#

sad

olive rune
#

I know a bit of python

teal plover
#

oh great

#

well my on_dbl_vote event isnt working

olive rune
#

are you triggering it?

#

or dispatching it*

teal plover
#

shouldnt it trigger when someone votes?

#

automatically

olive rune
#

if you have webhooks set up

rustic nova
#

@olive rune the Bar is caused by #bot-details-page #details .container

through the border-top parameter

teal plover
#

hmm

teal plover
#

i didnt rly get what u mean

olive rune
#

you need a webhook listener set up

teal plover
#

a cog?

olive rune
#

that listens for post requests

teal plover
#

ok i'll try that

#

thanks

earnest phoenix
rustic nova
#

true

#

but gunsus

delicate shore
#

Thanks tim and Misly

slender thistle
#

Y'ALL ISTG

slender thistle
#

It's a dictionary

rustic nova
#

shivaco raging because someone uses his api wrong reee

#

if that's your api afaik

slender thistle
#

My library at least

#

I mean, has anyone ever just read the damn dblpy docs

rustic nova
#

Nope probably not

slender thistle
#

Which is why I'm thinking of allowing both indexes and properties

earnest phoenix
#

how do you "restart" a bot? node.js can't run a process after killing the first

bitter haven
#

omg

earnest phoenix
#

@pale vessel quick question about canvas

#

ctx.drawImage puts the top-left corner of the image at the x y co-ordinates right?

pale vessel
#

I think so

earnest phoenix
#

ok

teal plover
earnest phoenix
#

(node:17176) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[0].name: Must be 256 or fewer in length.

old latch
#

it tells you what the problem is

#

the name property of your array is too long

earnest phoenix
#

soo

#

ok

teal plover
#

could it perhaps be a mistake in initialization ?

slender thistle
#

Show your DBLClient parameters

teal plover
#

dbl.DBLClient(DClient, "eyJhbGciOi..")

slender thistle
#

Well, fuck

#

You didn't initialize the webhook

teal plover
#

isnt that optional?

slender thistle
#

Not for on_dbl_vote/test

teal plover
#

ohhh

slender thistle
#

Since that requires the webhook to run and listen to requests

placid iron
#

with discord.py with bot.guilds always return all the servers that the bot is in regardless of shards? if not then how can i get the total number of servers that the bot is in (not just the current shard)

teal plover
#

seems like it needs some kind of authorization

slender thistle
#

webhook_auth is a password you create

teal plover
#

and the port?

slender thistle
#

any port that isn't already used on your machine

teal plover
#

and i keep the path as "/dblwebhook"?

slender thistle
#

top.gg will send you an HTTP request each time someone tests your webhook or votes for your bot

teal plover
slender thistle
#

It's running somewhere

teal plover
#

same principal

#

ok ok

#

thanks

slender thistle
#

you're welcome

storm sigil
#

Hey

pure lion
#

in my bot, the prefix only works if there's a space between the prefix and the first arg

#

i want to make it so it works with or without a space

#

Here's my code

#
    let user = await User.findOne({userID:msg.author.id});
    if (!user) user = {userPrefix: "demo"}

    const prefixx = msg.content.substring(0, user.userPrefix.trim().length);
    const args = msg.content.toLowerCase().substring(user.userPrefix.trim().length).split(/ +/g).slice(1);
    if (msg.author.bot) return;
    if (prefixx.trim() == user.userPrefix.trim()) {
            // ...
    }```
earnest phoenix
earnest phoenix
#

😭

pure lion
earnest phoenix
#

ok

#

ok

#

tnk you

pure lion
#

code13 are you just gonna not help me ooohhhhh

earnest phoenix
#

nope

#

cuz idk how

pure lion
#

meanie

young flame
#

yes

pure lion
#

hel!

young flame
#

hel?

pure lion
#

p

young flame
#

hM

pure lion
#

do you know? :)

pure lion
#

w e l l

young flame
#

well i dont know alot of rust-

#

but i think it's just the prefix?

pure lion
#

thats js

young flame
#

like with panik

#

the prefix normally is -

#

but if i changed it to something like

#

pog

#

i would have to run commands as pog help

#

not -help

pure lion
#

yes but

#

thats js not rust

young flame
#

i'd assume it would do the same for rust

#

since it does for lua

#

and lua is trasH

pure lion
#

dude

young flame
#

H

#

give me a second

pure lion
#

alrighty

young flame
#

you using serernity?

pure lion
#

ITS JS

#

THE CODE IS IN JS

young flame
#

OH

#

ITS NOT IN RUST?

pure lion
#

i said that three times moon

young flame
#

OH

#

UH

pure lion
#

THREE TIMES

young flame
#

YOUR CODING IS DISCORD.JS??

pure lion
#

THIS IS A DIFFERENT BOT

young flame
#

OR OH

#

HERE

pure lion
#

-bots

gilded plankBOT
#
Bots

@terse thicket
@slow lodge
@somber finch

pure lion
#

demoman

young flame
#
if(message.author.bot) return;
  if (message.content.indexOf(ur prefix i dentifyer ect config.prefix) !== 0) return;
  const args = message.content.slice(ur prefix i dentifyer ect config.prefix.length).trim().split(' ');
  const command = args.shift().toLowerCase();
#

remove the ur prefix i dentifyer ect config.prefix

#

part doe

#

and put like

#

prefix or what you have your prefix in

pure lion
#

ok ill have a try

young flame
#

like config.prefix process.env.prefix ect

pure lion
#

i know

earnest phoenix
humble rock
#
const { Structures } = require('discord.js');

Structures.extend('Guild', async (Guild) => {
    class CustomGuild extends Guild {
        constructor(client, data) {
            super(client, data);
            console.log("Work!");
        }
    }
    return CustomGuild;
});

I got this error:

TypeError: The extender function must return the extended structure class/prototype (received object).
#

PLSSSSSS

bright flame
#

hii

#

do anyone has vps

#

?

humble rock
humble rock
young flame
bright flame
#

sure

tulip ledge
#

u need to return guild

#

not the class

#

u're .extend

humble rock
#

Oh

#

Thanks

tulip ledge
#

just say

humble rock
#

const Guild = .....

return Guild;

tulip ledge
#

Guild = new CustomGuild(stuff)

#

return Guild

humble rock
#

Ok Ok Thanks

tulip ledge
#

no not const

#

guild is alr defined

humble rock
#

Ok

#

Ok

pale vessel
gloomy python
#

Hey so I'm making a bot which show meaning from urban dictionary
And on reacting next, it would show the next meaning
So the problem is that it works only if the bot reacts
And i'mnot able to figure out how to solve that

dusky sundial
#

What language are you using @gloomy python ?

gloomy python
#

Discord.js

#

I mean JS lol

dusky sundial
#

Would you please send the code for that :)

gloomy python
#

Sure

#
async execute(message, args) {
        // if (!message.channel.nsfw) return message.channel.send("You can only send messages in a NSFW marked channel.")
        let worder = args[0];
        if (!worder) return message.channel.send("Specify a word")
        let defin = await ud.all(args.join(' ')).catch(e => {
            message.channel.send("Word not found")
            return;
        });


        message.channel.send({ embed: generateEmbed(defin, 0) }).then(message => {
            if (defin.length < 1) return
            message.react("➑️")
            const filter = (reaction, user) => {
                return ['⬅️', '➑️'].includes(reaction.emoji.name)
            };
            console.log(message.author)

            message.awaitReactions(filter, { time: 1000 })
                .then(collected => {
                    const reaction = collected.first();
                    // console.log("this is the reaction", reaction)
                    let currentIndex = 0
                    message.reactions.removeAll().then(async() => {
                        reaction.emoji.name === '⬅️' ? currentIndex -= 1 : currentIndex += 1
                        console.log(currentIndex)
                        message.edit(generateEmbed(defin, currentIndex))

                        if (currentIndex !== 0) await message.react('⬅️')

                        if (currentIndex + 1 < defin.length) await message.react('➑️')
                    })

                });

        });
    }
#

So what happens is, when I run the command, it shows one meaning, and then the bot reacts the right arrow, and the embed changes to the next one

dusky sundial
#

I think you just need to add && user.id === message.author.id; to the filter

gloomy python
#

Yeah I tried that too

#

Doesn't work

pure lion
#

@gloomy python why are you passing in a timeout?

gloomy python
#

Yes 1 sec

pure lion
#

no but whY

gloomy python
#

Shouldn't I?

pure lion
#

well you want it to last for more than one second right?

pale vessel
#

Why are you using awaitReactions() for pagination amandathink

#

and the bot reacts first, that's why it stopped It reacts before

gloomy python
#

No I mean, I would wait for reactions for 1 second

dusky sundial
#

Doesn't that mean that after 1 second the reactions won't work anymore?

gloomy python
#

But I await reactions after the bot reacts right? So technically the bot react shouldn't count

pale vessel
#

It can

gloomy python
pale vessel
#

You didn't await the react()

#

Try awaiting it first

#

You await it to make sure that the bot reacted to it first

#

Otherwise it can react the same time as you await for reactions

gloomy python
earnest phoenix
#

make the function async?

#

it literally tells you

gloomy python
#

It is

earnest phoenix
#

it wouldn't give you that error if that was the case

pale vessel
#

Is it?

gloomy python
#

oops

pure lion
#

wait is that

#

mixing sync and async

gloomy python
#

Sorry if it was dumb

#

I'm a noob haha

teal plover
#

what is the webhook_path?

#

i assigned webhook_auth but idkw wts the path

#

been trying to get on_dbl_test/vote to work

lusty quest
#

the path is where the webhook gets exposed by your bot

tribal siren
#

how to enable discord reply feature?

lusty quest
#

eg yourIP:port/path

earnest phoenix
lusty quest
earnest phoenix
#

it will come to all servers eventually

tribal siren
#

no i mean how to make the bot use it

earnest phoenix
#

oh

#

which lib are you using

tribal siren
#

discord.js

earnest phoenix
#

not sure if they implemented it yet

tribal siren
earnest phoenix
#

they're using JDA lol

tribal siren
#

oh

#

ok

#

thank you

earnest phoenix
#

it's not implemented yet

#

there's an open PR

#

if you want it, create a fork of discordjs and merge it yourself

pale vessel
#

or just request it manually using client.api.channels(id).messages.post(data) with message_reference

sudden stirrup
#

hey, is there a way to minify cpu usage of music bot?

earnest phoenix
#
  • dont use java
  • dont use node
pale vessel
pure lion
#
  • just dont code ever
cinder patio
#
  • don't make a music bot
lusty quest
#

use a compiled language

#

they tend to be more efficent

pure lion
#
  • use rust
earnest phoenix
#
  • use C#
lusty quest
#

^

old latch
#

quick question

#

after setting up a server on dsl, can I remove the bot from the server?

earnest phoenix
#

afaik no

old latch
#

lol

lusty quest
#

the bot sends statistics to dsl

old latch
#

ah ll

#

kk*

#

because somehow they don't...

#

that's in the settings of the server

south aspen
#

how to make a bot send random reply?im stuck at this

[Math.floor(Math.random() * message.length)];
solemn latch
#

Random reply from a list of responses?

south aspen
#

yea

old latch
#

woo do you know?

#

if bots should appear there?

old latch
solemn latch
#

Make an array of responses, then do what your doing in that code clip but with the array.length

south aspen
#

ow alr

solemn latch
#

@old latch iirc they need to be on the top.gg bot list to show.
It was broken a week or two ago aswell.

old latch
#

well they are

solemn latch
#

I dont know if it was fixed yet. Would be on the github presumably

old latch
#

alright

solemn latch
#

Its not on the github, so no idea if its solved yet.

#

Well, if it was attempted to be solved.

stable loom
#

Nobody can use the command even if perm is 0. Can you help me?

sudden geyser
pale vessel
#

He's a CS boi

earnest phoenix
#

^

pure lion
earnest phoenix
#

if you really want to squeeze out performance

#

use cpp and interop ffmpeg binaries

stable loom
quartz kindle
#

isnt the bulk cpu usage from ffmpeg anyway?

earnest phoenix
#

i don't think so

pure lion
#

@stable loom send

quartz kindle
#

it doesnt matter what language you use to hand off the stream if the culprit is ffmpeg itself

stable loom
#
const db = require('quick.db');
const ayarlar = require('../ayarlar.json')

exports.run = async (client, message, args) => {
  if(!client.ekoayarlar.admin.includes(message.author.id)) return message.reply(`bunu yapabilmek için gerekli yetkiye sahip değilsin!`)
  const silinecekkllnc = message.mentions.members.first();
  let para = args[1]
  if(!silinecekkllnc) return message.channel.send(`Bir kullanΔ±cΔ± belirtmelisin!`)
  const bakiye = await db.fetch(`bakiyecdare-${silinecekkllnc.id}`);
  const hesapdurumu = await db.fetch(`hesapdurumcodare-${silinecekkllnc.id}`);
  const hesapismi = await db.fetch(`hesapismiΓ§odare-${silinecekkllnc.id}`);
  
  if(!hesapdurumu) return message.channel.send(`KayΔ±tlΔ± olan bir kullanΔ±cΔ± belirtmelisin!`)
  await db.add(`bakiyecdare-${silinecekkllnc.id}`, para)
  
  
  message.channel.send(`:+1:`)
}

exports.conf = {
    enabled: true,
    guildOnly: true,
    aliases: ['ekle'],
    permLevel: 0
}

exports.help = {
    name: 'ekle',
    description: 'KullanΔ±cΔ±larΔ±n kullanΔ±cΔ± adΔ±nΔ± tarar.',
    usage: 'tag-taramasΔ± <tag>'
}``` @pure lion
earnest phoenix
#

it's mostly the end user's fault for not using the correct arguments

#

i know i've handled music streaming with ffmpeg super easily

pure lion
#

tbf making a music bot is really simple

earnest phoenix
#

ffmpeg can be extremely powerful if you know how to use it

quartz kindle
#

simple if you know what you're doing

#

for most people, making a music bot is dealing with magic, they have no idea how it works

pure lion
quartz kindle
#

Lol

pure lion
stable loom
#

@pure lion Did you find the problem

pure lion
#

looking**

stable loom
#

oke

pure lion
#

client.ekoayarlar?

stable loom
#

english : settings.json

#

bot is a Turkish bot and I could not find a Turkish developer @pure lion

pure lion
#

ah

#

not sure

#

also how does mongoose handle maps? can i just get the doc and then set the new stuff into the map?

#

if not then how

stable loom
#

I think

pure lion
#

alrighty

sinful bear
#

what event is triggered when an user leaves a server?

rustic nova
#

GuildMemberLeave

sinful bear
#

oh, thanks

safe creek
#

for giveaways and stuff am i able to make an .json file to store data for each server?

#

ive done it for my prefixes so it should be possible right

misty sigil
#

yes but don’t

#

please

#

don’t

#

use a real database

vale garden
#

hi

#
import pygame

pygame.init()

screen = pygame.display.set_mode((800, 600))

while True:
    pass
pure lion
#

gg

vale garden
#

this is all i have in my code and it says assertion error

#

lol

#

helpp plzz

pure lion
#

send the stack

vale garden
#
Repl.it: Updating package configuration

--> python3 -m poetry add pygame
Using version ^2.0.0 for pygame

Updating dependencies
Resolving dependencies...

[AssertionError]

exit status 1


Repl.it: Package operation failed.
#

this is the erro

#

and im new to pygame btw i have no idea about anything lol

#

oh wait nvm

pure lion
#

hmmmmm

vale garden
#

i had to specifically select pygame in repl

#

lmao

#

nvmmm

pure zealot
#

One message removed from a suspended account.

rustic nova
#

Nope

pure zealot
#

One message removed from a suspended account.

#

One message removed from a suspended account.

pure lion
#

alright i have a command that pushes stuff into a map

#
2|Demoman  | [
2|Demoman  |   {
2|Demoman  |     title: 'Mortal Kombat 11 All Fatalities &amp; Fatal Blows on Joker (Killer Smile Skin)',
2|Demoman  |     url: 'https://www.youtube.com/watch?v=kjk2pscSLpw',
2|Demoman  |     desc: "On this video I'll be performing All Fatalities & Fatal Blows on Joker (Killer Smile Skin).",
2|Demoman  |     id: 'kjk2pscSLpw'
2|Demoman  |   }
2|Demoman  | ]
2|Demoman  | {}```
#

this is console output from said command

#
            await theUser.playlists.set(name, client.queue.get(msg.guild.id).songs);
            console.log(theUser.playlists.get(name))
            msg.channel.send({embed: {
                title: "Added yer playlist!",
                description: `${theUser.playlists.get(name).map(s => s.title).join("\n")}`,
                color: "#FB524F"
            }});
```and here is some relevant code
#

name is a string

pale vessel
#

Moved back to JS I see

pure lion
#

nah just working on my js bot

#

cos i dont want to d i e

pale vessel
#

What's wrong with it?

pure lion
#

its pushing to the map but not saving

pale vessel
#

Not saving? What do you mean?

pure lion
#

like

pale vessel
#

also you don't need to await map.set()

pure lion
#

s

#

yes but when it does set its not persistent

#

notice the {}

#

thats from here

pale vessel
#

I see

pure lion
#
        if (args[1] == "dev") return console.log(JSON.stringify(theUser.playlists));```
gilded gull
#

What language do you all use? I use d.py

sudden geyser
#

a number

pale vessel
sudden geyser
#

it's a library

gilded gull
#

Library

#

I meant

pure lion
#

flazepe this is mongoose docs

gilded gull
#

Autocorrect messed it up

pale vessel
#

Oh

#

You never told me that

sudden geyser
#

but I don't make discord bots often

gilded gull
#

Wow that’s a lot

pure lion
gilded gull
#

I just use d.py for bots

sudden geyser
#

they all do roughly the same task but with their differences

pure lion
#

serenity is poggest

gilded gull
pale vessel
#

What's theUser.playlists?

sudden geyser
#

I'd say the first three are the easiest. Serenity is a bit difficult since it's written in Rust. The main differences are the languages it's written in.

pure lion
#
    playlists: {type: Map, default: new Map()}
#

theUser is just a mongoose document

gilded gull
pure lion
#

F#

gilded gull
#

F#? What’s that

#

I’ve heard of c# never f#

pale vessel
sudden geyser
#

I like using Python as my main scripting language over JS. I know Java but not that well

pale vessel
#

A model?

pure lion
#

i pressed f1 shitshit

sudden geyser
#

F# is a language I believe.

gilded gull
#

I knew that

pure lion
pale vessel
#

There's no model.set() fullbruh

#

Try updating it

#

Like a normal person would

pure lion
#

nO

#

because

#

in

#

mongoose ver

#

5.1

#

they introduced full map thingy

pale vessel
#

Just try

pure lion
#

fine

pale vessel
earnest phoenix
#

Hey can anyone help me, i am trying to make an express verification system to verify users, like when I press an "verify" button the bot gives the verified user a spesific role to spesific guild. But the problem is that I have no knowledge how to assign a role to a particular user in a particular guild.

#

I have already tried to define guild with client instance, and member with members.cache.find method. + I only get one error in console which is Cannot read property 'roles' of undefined

pure lion
#

@pale vessel how would i do this ooohhhhh

pale vessel
#

How do you store your stuff

pure lion
#

in what context

#

the db or command or model

pale vessel
#

Model

pure lion
#
const User = Schema({
    userID: {type: String, index: true, unique: true},
    blacklisted: {type: Boolean, default: false},
    bal: {type: Number, default: 0},
    userPrefix: {type: String, default: "demo"},
    cooldown: {type: Number, default: 0},
    playlists: {type: Map, default: new Map()}
});```
pale vessel
#

So model.findOneAndUpdate({ userID: <id> }, { playlists: <updated map> });

#

(not sure)

#

Worth a shot

pure lion
#

poggers it was .set and then .save

#
            await theUser.playlists.set(name, client.queue.get(msg.guild.id).songs);
            await theUser.save()
pale vessel
#

Oh you didn't save it

#

Wait theUser is an object you doofus

pure lion
#

no its not

#

mape

#

if it would kindly upload to my media proxy

pale vessel
#

Sorry, meant theUser

#

You said it was a model

pure lion
#

poggers

pale vessel
pure lion
#

i just did the ultimate funny

hollow sedge
#

Are you using mongo?

#

@pure lion

pure lion
#

yes

#

@hollow sedge

hollow sedge
#

Cool

#

I was just interested :)

versed spade
#

Hi

hollow elbow
#

I can't make my bot online.
It was online when I closed my pc.
But I opened it again. But I can't make it online.
Pls help me

#

There isn't an error in logs.

#

But it doesn't go online.

#

I regenerated my token two times.

#

Still doesn't working.

sturdy vine