#development

1 messages ยท Page 1215 of 1

slender thistle
#

How about you send the cog where that error is occurring, 0Exe

drifting wedge
#

1 sec

slender thistle
#

so what happens after timeout
@modest smelt an exception is raised, asyncio.TimeoutError

drifting wedge
#

its huge tho

#

@slender thistle

modest smelt
#

ok

slender thistle
#

So you'd wrap the wait_for in a try branch

#

I hope you are familiar with try-except in Python

#

@drifting wedge paste it on hastebin

drifting wedge
#

hastebin isnt working for me

#

wut other options?

modest smelt
#

@slender thistle yes!

slender thistle
#

Don't know, pastebin or sourcebin

drifting wedge
slender thistle
#

@modest smelt

try:
    user_answer = wait_for(...)
except asyncio.TimeoutError:
    send("Time expired!")```
#

very vague pseudocode :p

modest smelt
#

ok

slender thistle
#

FIX YouR iDNenTs pleaSe

drifting wedge
#

1 sec ig

slender thistle
#

But seriously

#

Indent your commands

#

They're supposed to be under the class

modest smelt
#

@slender thistle just one more question

slender thistle
#

not outside of it

modest smelt
#

do i have to import anything

slender thistle
#

asyncio, yeah

modest smelt
#

for the asyncio.TimeourError

#

ok

#

so import asynco

#

import asyncio, right>

#

right?*

slender thistle
#

Or do from asyncio import TimeoutError and just use the TimeoutError itself

#

yeah

#

either works

ionic shard
#

ugh

user = message.author;
console.log(user.joinedAt);```
returns `undefined`
earnest phoenix
#

message.member

#

not message.author

#

@ionic shard

#
let joined = message.member.joinedAt
ionic shard
#

okay but problem is

#

i do it like this

if (args[0]) {
            user = message.mentions.users.first();
            if (!user) { return message.reply('**Error:** Invalid user.'); }
            whois(user, message);
        } else {
            user = message.author;
            whois(user, message);
        }```
#

if the guy wanna look for tagged user or himself

#

whois is a function, which the above code is written in...

#

oh wait

#

so i just gotta do message.user.joinedAt?

earnest phoenix
#

huh ?

#

wdym ?

#

i dont understand

ionic shard
#

i mean message.member.joinedAt will always return my join date

earnest phoenix
#

@ionic shard to get tag

#
message.member.user.tag
ionic shard
#

okay

#

thanks

drifting wedge
#

@slender thistle

#

indentation is good

ionic shard
#

nah thats returning undefined

drifting wedge
#

in setup
client.add_cog(help(client))

#
    client.add_cog(help(client))```
#

its this

slender thistle
#

Please for the love of Allah use Help for class names

drifting wedge
#

something to do with this

#

Help?

slender thistle
#

You have both a class and a function help under the same name

drifting wedge
#

cap h?

earnest phoenix
slender thistle
#

First letter capital whenever creating a class

drifting wedge
#

ok

#

so shoulf i change the name of the class?

#

helpcog?

earnest phoenix
#

what is cog

#

just wondering about py

earnest phoenix
#

._.

#

MESSAGE.MEMBER.USER.TAG

ionic shard
#

fuck

#

mb

pale vessel
earnest phoenix
#

ye

pale vessel
#

and no, member does not have the tag getter, users do

#

member.user.tag or author.tag

earnest phoenix
#

oh my false

#

done

#

@pale vessel :))

#

@ionic shard btw u can convert the date with

let joined = new Date(message.member.joinedAt)
ionic shard
#

i was using this

#

user.createdAt.toLocaleDateString()

slender thistle
#

so shoulf i change the name of the class?
@drifting wedge Help or helpcog

earnest phoenix
#

hmm that will works too maybe

#

idk

slender thistle
#

just anything that isn't already used

earnest phoenix
#

yes it will work

slender thistle
#

Also did you really fix indents

pale vessel
#

it's already a date object, use member.joinedAt.toLocaleString()

#

yeah that ^^^^^^^^^^^^^^^^^^^^

drifting wedge
#

for ext import

earnest phoenix
#

myabe they should make 2 channel of development development-py development-js :))

drifting wedge
#

is it the file name//

slender thistle
#

sorry what

drifting wedge
#

like when i import the cog

#

do i import file name or class?

slender thistle
#

๐Ÿค”

drifting wedge
#

file name i tinhk

slender thistle
#

You don't import anything manually

#

you use load_extension on files

#

load_extension accepts a string

drifting wedge
#

exts=['music', 'meme', 'help']

#

this is wut im doing

slender thistle
#

and how are you loading the extensions

drifting wedge
#

for i in exts:
client.load_extension(i)

slender thistle
#

In good lord's name

#

Can you send the full traceback

#

I'm not even sure if that's the right file anymore

drifting wedge
#

?

slender thistle
#

Can you send the full traceback

#

Send the screenshot of the terminal where the error is

drifting wedge
#

oh

#

no errors

#

now

#

it just doesnt send

gritty bolt
#

does anyone know how to get a unix timestamp in __ miliseconds from the current time in nodejs?

cinder sandal
#

i need to fix

#

it

#

I have a major error in my bot
TypeError: cannot read property 'MessageEmbed' of undefined

gritty bolt
#

nvm fixed my thing

cinder sandal
#

anyone

#

help me

pale vessel
#

show code

cinder sandal
#
module.exports = {
    name: 'allcommands',
    description: 'SHows a list of ALL Commands. (Includes hidden/advanced commands)',
    execute(message, args, Discord) {
        const { Client, CategoryChannel, MessageEmbed } = require("discord.js")
        const AllCommand = new Discord.MessageEmbed()
       .setThumbnail(`${client.user.displayAvatarURL()}`)
       .setTitle('All Commands')
       .addField('Commands', '`<avatar` `<ban` `<kick` `<myavatar` `<warn` `<randomnumber` `<ping` `<hug` `<die` `<channelinfo` `<roleinfo` `<userinfo` `<hi` `<invite` `<allcommands` `<corona` `<gay` `<infections` `<botinfo` `<waifu` `<say` `<whatsnew`')

       message.channel.send(AllCommand)
    },
};```
#

this is one of my commands

#

this error happens with every command that sends embeds

pale vessel
cinder sandal
#

without it same error

pale vessel
#

did you pass Discord to the execute function?

#

remove that first

#

sure it doesn't error, but it clutters the code

cinder sandal
#

i should remove discord from execute()?

pale vessel
#

you shouldn't since you're using it inside the command

#

but you should remove it and declare it instead

#

passing Discord when you can just require it yourself is pointless

#

okay here

#
  1. remove Discord from execute
  2. move that const { Client... } to the top of the file, outside module.exports
  3. change Discord.MessageEmbed() to just MessageEmbed()
#

by the way, you don't need all of those, just this: const { MessageEmbed } = require("discord.js")

gritty bolt
#

does anyone know a library like node-schedule that can schedule in unix?

#

or does node-schedule support unix?

pale vessel
#

it should support it

#

if not, you can use new Date(timestamp);

split hazel
#

one of my apps use node-schedule

#

and yes it does support both

#

both cron and dates

ionic dawn
#

So, it crashes when using youtubeAPI to search the link, at the second search it says: cant read undefined or whatever.
but when im using just the args[1] to push the song it does work, any idea? Ty CBOkThumbsUp

drifting wedge
#

do i import cog file na,e

#

name

#

or class name

#

file name right?

#

.help

#

wrong char sr

cinder sandal
#

@pale vessel will add CLient in the const {} = ...
because i have client in the code so

pale vessel
#

for what?

#

why would you create a new client

cinder sandal
#

wait

#

the command shows the bot's avatar

#

and the embed

pale vessel
#

Discord.Client, the one you're requiring is for initializing a new client

#

if you mean the client itself, use message.client

cinder sandal
#

still says the same error

pale vessel
#

message.client.user.displayAvatarURL()

#

what error?

cinder sandal
#

TypeError: cannot read property 'MessageEmbed' of undefined

pale vessel
#

i gave some tips

misty sigil
#

discord isn't defined

pale vessel
#

can you scroll up

misty sigil
#

mmulu this is literally the most basic thing ever

#
        const { Client, CategoryChannel, MessageEmbed } = require("discord.js")
        const AllCommand = new Discord.MessageEmbed()
```?
cinder sandal
#

but, it's in a command handler (command.js or something...)

misty sigil
#

it'd be just MessageEmbed

#

or am i being a fucking idiot

pale vessel
#

and please, only require MessageEmbed

#

i can guarantee that you won't need the other ones

misty sigil
#

^

#

you dont need client in a command

cinder sandal
#

finally worked tysm

ionic dawn
#

my question just get ignored CBCattoCry

quartz kindle
#

well you didnt show any code

earnest phoenix
#

Should I make my own API

#

instead of using body[0].name or body[1].name

quartz kindle
earnest phoenix
#

thx

#

@quartz kindle

#

hey @quartz kindle (our saviour) what does process.argv mean?

#

saw that in a snake game

pale vessel
#

the command that was used to start the process i guess

#

it should be node the args only

earnest phoenix
#

when running the code i can put more stuff after node shit.js and it will do some process.argv stuff to it

#

so

#

basically process.argv means all the arguments i gave in the console?

#

whats this error

honest perch
#

404 not found

earnest phoenix
#

it's an error?

#

idk

honest perch
#

404 not found

earnest phoenix
#

god that hd resolution

#

It rebooted my bot

#

i am so jealous

honest perch
#

@earnest phoenix the url doesnt exist

earnest phoenix
#

javascript

honest perch
#

thats what its saying

#

@earnest phoenix send it in pastebin

earnest phoenix
#

any help? it is bulling me
@earnest phoenix it's doing wha-

#

ok

honest perch
#

no one will open a txt

pale vessel
#

why would you say pastebin out of all services

earnest phoenix
#

hastebin is best

#
(node:29384) UnhandledPromiseRejectionWarning: Error: 404 Not Found
    at _response.transport.finalizeRequest.call.then (/root/node_modules/snekfetch/src/index.js:195:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:29384) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
honest perch
#

bro

#

i told you

#

@earnest phoenix the url doesnt exist

earnest phoenix
#

which url

pale vessel
#

the resource is not found or unavailable, check the url

earnest phoenix
#

there is no url

honest perch
#

snekfetch

misty sigil
#
    at RequestHandler.execute (c:\Users\1370979\Desktop\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)```
quartz kindle
#

@earnest phoenix yes, process.argv gives you all arguments you used in the console, including "node" and your script name

pale vessel
#

for me it gave me an array of the node path with args

#

i had to use process.title

quartz kindle
#

yeah it uses the full path

#

i was sure i saw it using only the names before tho

earnest phoenix
#

what will happend if we console.log(process) ?

quartz kindle
#

it will show you the full process object

#

including all its enumerable properties, getters and methods

earnest phoenix
#

oh no

#

nvm

#

@abstract aspen

#

wait who is he

#

so how can i get two bodies side by side?

#

bodies ? side by side ?

#

Like in the example you took.

#

where

#

I want two body inside

#

{"name":"TEST","time":1452184828000},

#

in a embed ?

#

or what

#

yeah

#

side by side

#

yeah

#

all names and times

#
let embed = new MessageEmbed()
  .addField("SOmething", something, true)
  .addField("SOmething", something, true)
message.channel.send(embed)
#

: /

#

${body.map(body => body.name && body=> body.time).join("\n")}

#

no bro..

#

i dont understand what do u mean

#

:0

#

like this
side | side ?

#

enter this adress

#

uhuh ?

#

all bodies will be taken from here.

#

:0

#

do you know the request module?

#

so you can do

let string = `${body1.name} | ${body1.time}` ?
#

side by side

#

@earnest phoenix ?

#

@earnest phoenix ik the request module

#

${body1.map(body1 => body1.name | body1.time).join("\n")}

#

no

#

we need to adjust to this

modest smelt
#

can someone help me

earnest phoenix
#

body1 => ${body1.name} | ${body1.time}

#

-ask2ask

#

smh

#

@modest smelt dont ask to ask just ask

modest smelt
#

ok

#

so my problem is my code

#

this is my code

earnest phoenix
#

oh no

#

just the error part

#

pls

#

which line

modest smelt
#

yeah ik

#

it doesnt have an error

#

thats the thing

earnest phoenix
#

so ?

fringe seal
#

is there a way to send 2 underscores next to eachother like this _ _ from a bot without them disappearing

modest smelt
#

basically

#

it is a search command

#

the bot gives 3 values to search from

#

the user picks one of them

earnest phoenix
#

bruh

#

ok ?

modest smelt
#

the code i sent is just for the search command

earnest phoenix
#

3 value

modest smelt
#

and so what happens

#

is

#

that it runs

#

and then it says that the user doesn't have an account

earnest phoenix
#

so u need to messageAwait()

#

@modest smelt wait what doenst have acc ?

modest smelt
#

w8

#

so this is the code

#

for the search command

#

and i store files of the user

#

in json files

#

so it is their id

#

.json

#

so id.json

#

and it reads the fule

#

file*

#

it first checks if the user has a file

#

if the user does, then only it gives the optionss

#

but mine gives the options (that means the user has file), but then it says that the user doesnt have file

earnest phoenix
#

oh

#

i am javascript

#

u are PY

#

ask some one who is PY

#

for example shivaco

modest smelt
#

ok

#

@slender thistle

#

can u help me

urban olive
#

how would you make your bot send a message in every guild and channel it has access too

#

im using js 12.2

fringe seal
#

that sounds like it would be really spammy

earnest phoenix
#

@modest smelt dont do that

#

dont ping ppl

modest smelt
#

k

urban olive
#

its so my bot can send a message across all channels its in when it is about to go offline

earnest phoenix
#

@urban olive ever channel in every guild ?

urban olive
#

it has access to yes

fringe seal
#

i think it would be better to just send one message per guild if u want that

#

writing it in every single channel is a bit overkill

earnest phoenix
#
client.guilds.forEach(guild => {
  guild.channels.forEach(channel => {
    channel.send("Message")
  })
})

if you have any problem not my problem

#

@urban olive ^^

fringe seal
#

how do u send text in asterisks without it becoming italics *like this* from a bot

earnest phoenix
#
\*\*text\*\*
#

@fringe seal ^^^

fringe seal
#

thanks

slender thistle
#

@modest smelt except Exception as e and then print(e)

#

See what error you're getting

modest smelt
#

wdym

slender thistle
#

What's readFromFile

modest smelt
#

its a definition

earnest phoenix
#

@humble gyro or @woeful pike How can the bot can come active

#

@urban olive what happned ?

humble gyro
#

?

earnest phoenix
#

fastest respounce ever

#

My bot is offline how bot can come online

modest smelt
#

u got to run the code

fringe seal
#

@earnest phoenix is there a way to do the same thing but with underscores? i tried using the same method and it didnt work

humble gyro
#

hahaa node bot.js

earnest phoenix
#

look
before : italic
after: *italic*
@fringe seal ^^

#

\*

fringe seal
#

i know but i wanna do it with underscores _like this_ instead of asterisks

#

using \_ in the bot doesnt work

earnest phoenix
fringe seal
#

i know

#

i wanna replace the asterisks with underscores

#

how do u do that

earnest phoenix
#

wait let me check

fringe seal
#

like instead of *this* i want _this_

earnest phoenix
#

try \\_

#

@fringe seal

fringe seal
#

thanks, it worked

dawn badge
#

Hey ๐Ÿ‘‹ I'm french so my english it's no perfect ... I have the bot "Invite Manager" and he is off line (he doesn't work) Can you help me please ?

#

@everyone

digital ibex
#

@everyone lmao

#

help me

dawn badge
#

OK thx @fleet hornet

#

ok sorry

misty sigil
#

everyone pings dont ping

modest smelt
#

@slender thistle

#

?

#

so in that code

slender thistle
#

what was the error again

modest smelt
#

there is no error

#

thats the thing

slender thistle
#

issue

modest smelt
#

go to line 15

#

everything works until line 15

#

and then it suddenly goes to line 57 and 58

slender thistle
#

Replace that except: with except Exception as e:

#

and then send e to the channel

modest smelt
#

what is e?

slender thistle
#

the exception that was raised

modest smelt
#

so basically this: python await ctx.channel.send(f"{ctx.message.author.mention}, you don't have a balance yet. Get one by doing ``e!setup``.")

#

?

#
        except Exception as e:
            await ctx.channel.send(f"{ctx.message.author.mention}, you don't have a balance yet. Get one by doing ``e!setup``.")
```so is this the code?
slender thistle
#

and then send e to the channel

earnest phoenix
slender thistle
#

You want to see what the raised exception is

#

not just blindly handle it

modest smelt
#

so what should i do

earnest phoenix
#
        embed.addField(`Ad GeรงmiลŸi`, `${body1.map(body1 => body1.name + ' (' + moment(body1.changedToAt).format("DD MMMM YYYY - HH:mm") + ')').join("\n"),false)
modest smelt
#

im confused on what u r sayin

slender thistle
#

literally

#

await ctx.send(e)

modest smelt
#

ah

#

i see

#

lemme try now

proven lantern
#

Are we allowed to embed the top.gg up vote button on our website?

modest smelt
#

name 'check' is not defined

slender thistle
#

If you can somehow get the user's auth yourself, sure

#

Or you could just link the vote page as hyperlink and redirect the user there

#

name 'check' is not defined
@modest smelt Did you create a function named check

modest smelt
#

oops

#

nope

#

w8

slender thistle
#

Wonders of d e b u g g i n g

modest smelt
#

so this was the code

#
                searchedplace = await client.wait_for('message', check=check, timeout=30)
proven lantern
#

the api call to https://top.gg/api/vote uses a csrf token

modest smelt
#

so what does check do?

#

it basically checks if that user is typing right?

#

like its that user

slender thistle
#

It's a function that must return True or False

modest smelt
#

so this would be the code

slender thistle
#

No, it checks every message sent (that's seen by the bot) for the condition

dire obsidian
#
<a href: "https://top.gg/bots/{bot_id}/vote"; target: "blank";>VOte for my bot</a>
modest smelt
#

i dont understand what u mean

#

like if the bot asks put a number from 1 - 10

#

then it would check if it is 1 - 10

slender thistle
#

wait_for waits for a message

#

and the function check

#

is called whenever a message is sent

#

if the function returned True, the code would go on

#

if not, the bot would keep waiting

modest smelt
#

ah

slender thistle
#

until it times out

proven lantern
#

maybe i could put https://top.gg/bots/{bot_id}/vote in an iframe and modify the size of the iframe and focus on the button

modest smelt
#

ok so i fixed that!

#

so now the problem is the next part

#

i say the name of the place i want to search

#

so this is the new code

#

so now when i want to search a place

#

it automatically says that it is not a valid place and says the embed saying Noob next time mention a place

#

@slender thistle

dire obsidian
#

@proven lantern i remember when my first bot got approved, there is a "widget" that you can add it to youre website, only add a href and probably thats it, or you can make yours from 0

slender thistle
#

uhhh

#

why the random.sample lol

modest smelt
#

because i want to pick 3 of the palces

#

places*

#

@slender thistle

slender thistle
#

uhhhh

#

qwe

#

What

#

Why are you stringifying the message object

#

and not getting its .content property

modest smelt
#

ok

#

i shouldn't str?

slender thistle
#

You shouldn't just rely on stringifying everything

#

well, unless you are REALLY sure it will work

modest smelt
#

ok

#

i did

#

i removed the str

slender thistle
#

because discord.Message's __str__ doesn't return the content

modest smelt
#

alright

slender thistle
pure lion
#
nginx: [emerg] host not found in "*VPS IP here:443" of the "listen" directive in /etc/nginx/sites-enabled/cosmicbotlist.tk.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed```ple help
modest smelt
#

ok @slender thistle

misty sigil
#

dont that just mean that there isnt a host

pure lion
#

mmmmMMMMMMH

#

what do then

misty sigil
#

turn the site on

#

eejit

pure lion
#

no

misty sigil
#

lmao why

pure lion
#

fine

#

i need to open another instance of putty pandasad

misty sigil
#

pff

#

just use cmd

pure lion
#

fine

modest smelt
#

@slender thistle ?

#

u there

left sentinel
#

hey

modest smelt
#

hello

#

im coding in discordpy

left sentinel
#

How long does it take for my bot to get verified ?

modest smelt
#

4 weeks i think

pure lion
#

4+ weels

left sentinel
#

WHAT

#

O wow

modest smelt
#

ye

slender thistle
#
if str(searchedplace) == which_places[0] or str(searchedplace) == which_places[1] or str(searchedplace) == which_places[2]:

could just replace this with if searchedplace.content in which_places:

left sentinel
#

i was expecting like 1hr

modest smelt
#

oh

#

i did if searchedplace in which_places , forgot the .content

#

@left sentinel look at #logs

left sentinel
#

ok

modest smelt
#

look how many there are

#

every second a new one comes up or an edit appears

#

so it will take time

#

@slender thistle what next?

left sentinel
#

Oh wow

#

thats alot of bots

#

...

modest smelt
#

even after i respond with the correct one, it says that i have picked one that is not there

#

@left sentinel i have been w8ing for around 3 - 4 weeks

#

and my bot not been accepted yet...

left sentinel
#

oh

#

:c

modest smelt
#

@slender thistle even after i respond with the correct one, it says that i have picked one that is not there

#

ye

#

๐Ÿ˜ญ

left sentinel
#

ive just made my bot,

#

I guess ill have to just update it for 4 weeks

modest smelt
#

@left sentinel what language?

left sentinel
#

English

modest smelt
#

bruh

#

ur code

left sentinel
#

What?

#

Wdym

#

I only know English so im not going to make it anything else am i...

modest smelt
#

like what language did u code your bot in?

left sentinel
#

English

modest smelt
#

?

left sentinel
#

Wait do u mean program?

modest smelt
#

yes

left sentinel
#

oH

#

i dont read properly XD

modest smelt
#

lol

left sentinel
#

Ok i use discordjs

modest smelt
#

ah

pure lion
#

saaame

left sentinel
#

and sometimes discord bot maker

pure lion
#

no

left sentinel
#

to use test stuff

#

no?

pure lion
#

no.

left sentinel
#

No.??

#

Why not??

modest smelt
#

@left sentinel

left sentinel
#

wGAT

modest smelt
#

u want to look at my bot?

left sentinel
#

sURE

#

Oml my Caps lock key is soo broke

modest smelt
#

lol

slender thistle
#

Did you update the pastebin

pure lion
#

shiv do you nginx ๐Ÿ˜”

misty sigil
#

dont forget to censor the url

pure lion
#

i do >:(

acoustic bridge
#

So uhm... I host my bot on heroku, although my music commands don't work.

#

I added these buildpacks and tried

#

my music commands are made with youtube_dl and ffmpeg

#

when deploying it - it does install it on the build log

pure lion
#

i would not use heroku to host a music bot

acoustic bridge
#

does it even work?

misty sigil
#

you physically cannot

#

no

acoustic bridge
#

I see

#

I guess that feature will be left out then.

#

I made a bot which basically can do like a bit of everything. How can i host one though?

misty sigil
#

on a vps

earnest phoenix
#

if the search word does not exist, it gives an error like this on the console how do i solve this.

undefined:1
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Request._callback (C:\Users\axe12\Desktop\autimatic bot\commands\bilgi\minecraft_skin.js:34:21)
    at Request.self.callback (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:1154:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
misty sigil
#

if(!res)?

earnest phoenix
#

I'm using the api. can i do such a thing

digital ibex
#

is that the response?

#

the response is making it error*

earnest phoenix
#

https://api.mojang.com/users/profiles/minecraft/' + args[0]

#

if it doesn't match, i want to send a message back.

misty sigil
#

if(!res) would work iirc

digital ibex
#

not quite

#

youโ€™d use the in operator

#

to check if it returns an error or the response expected if u made it good.. if that makes sense

pure lion
#

then use try catch?

earnest phoenix
#

i used

nimble kiln
#

You could try working with the HTTP status code

#
If the timestamp is not a number, too big or too small the HTTP status code 400 (Bad Request) is sent with an error message looking like this:```
digital ibex
#

im not sure quite how i done it

#

i was trying to show u an example lol but i forgot

earnest phoenix
#

if (status.code === 204) message.channel.send(error)

pure lion
#
nginx: [emerg] host not found in "*VPS IP:443" of the "listen" directive in /etc/nginx/sites-enabled/peepeepoopoo.tk.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed```pleas hep
nimble kiln
#

Show us the config line

misty sigil
#

non censored url

pure lion
#

shut

nimble kiln
#

peepeepoopoo.tk.conf line 2

misty sigil
#

dice i fucking told you

nimble kiln
pure lion
#

ok brb

misty sigil
#

better

pure lion
#
listen                  *104.243.32.11:443 ssl http2;```
misty sigil
#

pee pee poo poo lol

nimble kiln
#

just listen to 443 ssl

pure lion
#

wha-

#

wdym

nimble kiln
#

listen 443 ssl;

pure lion
#

okay

nimble kiln
#

It'll listen to any IP address

#

port 443, ssl connection

pure lion
#
    listen                  [::]:443 ssl http2;
```line 3
nimble kiln
#

that http2 option at the end may work - never used it like that - Cloudflare does that for me Kapp

#

mhm, IPv6 - Hold on

#

Ok no idea about IPV6 but that looks correct

misty sigil
#

just nginx listen 443 ssl or something

nimble kiln
#

or does it error on that line?

misty sigil
#

we have cloudflare

nimble kiln
#

yeah he has 2 entries for IPv4 and IPv6

#

listen 443 ssl - ipv4
listen [::]:443 ssl - ipv6

digital ibex
#

one question, why do people use cloudflare?

nimble kiln
#

I use it to hide my IP addresses

#

And cloudflare is so big by now, you'll actually see a performance boost (load times)

digital ibex
#

iโ€™ve heard that it doesnโ€™t make a difference, only worsens their site

#

never used it myself

nimble kiln
#

The first thing is their widespread cache servers, you'll connect to your closest cloudflare server instead of to my server in france

#

if you live in the US for example you'll connect to a cloudflare server in the US, instead of travelling over to the EU which would give you 100ms+ pings

pure lion
#

mmnm

nimble kiln
#

@pure lion No work?

slender thistle
#

What if you leave maintenance mode on

#

like 24/7

nimble kiln
#

Then you have no caching

#

You still connect to cloudflare servers, but cache is disabled

pure lion
#

no work

slender thistle
#

And Cloudflare doesn't care about that?

nimble kiln
#

They only forward your connection, it's actually less performance loss for them

misty sigil
#

i doubt

slender thistle
#

I mean, being proxied by their servers without cache

#

Yeah, makes sense tbh

misty sigil
#

still

nimble kiln
#

no work
@pure lion Show us more of your config, line 1-5

misty sigil
#

ddos protection

nimble kiln
#

^this is the best thing

misty sigil
#

etc etc

slender thistle
#

Yeah, true

nimble kiln
#

as long as you leave the orange cloud on KEKW

misty sigil
#

grey cloud bad

#

1 - it means rain

#

2 - it means no ddos protect

nimble kiln
#

The best thing are those setups:
www and root domain are cloudflare protected
subdomain (server.) or something which points to the server, cloudflare off

And then they wonder how their IP gets leaked

slender thistle
#

"leave the orange cloud on" ๐Ÿ˜‚

#

All of my subdomains are proxied so

misty sigil
#

aye fucker

#

turn on yer orange clood

slender thistle
nimble kiln
#

That problem I wrote there is a convenience problem

slender thistle
#

mhm

nimble kiln
#

Cloudflare only supports HTTP/HTTPS ports and wont redirect SSH traffic for example

misty sigil
#

it can

#

iirc

pure lion
#

@misty sigil @misty sigil @misty sigil @misty sigil @misty sigil @misty sigil @misty sigil @misty sigil @misty sigil

nimble kiln
pure lion
#

i almost fixed it

misty sigil
#

AEAEeaAEAEA

#

nice

pure lion
#

but im ratelimited

misty sigil
#

idiot

pure lion
#

by certbot

nimble kiln
#

certbot rate?- u are good

pure lion
#

:D

nimble kiln
#

gj Dice

pure lion
#

yaaaaaaaaaaaay

#

how long do i have to wait

slender thistle
#

so if you want a neat server.mydomain.com that you use to connect to your SSH, it wont work
@nimble kiln And if I don't use the domain for SSH?

#

I guess I shouldn't care?

nimble kiln
#

If you dont need to reach your server directly over any domain then it doesnt matter

misty sigil
#

why do u need a certificate tho @pure lion

#

doesnt cloudflare do the stuffs

pure lion
#

ssl

#

idc

#

stronk ssl

nimble kiln
#

@pure lion Just use a self signed certificate and use cloudflare

pure lion
#

where do i put the root of the document :D

nimble kiln
#

the root of the document?

#

/var/www/html?

pure lion
#

oh

#

eee

nimble kiln
#

I like some structure

#

/var/www/vhosts/domain.com

pure lion
#

why is it not proxy passing

#

aaaaaaaaaa

nimble kiln
#

oop now I'm out

pure lion
#

no

nimble kiln
#

Only ever proxy passed with apache ๐Ÿ˜ฆ

pure lion
#

come back

nimble kiln
#

Ok I'll try to help

pure lion
#

COME BACK ITS SO SIMPLE

#

yay

nimble kiln
#

I didnt even finish my firewall yet

#

yet I'm here helping

#

smh

pure lion
#

yaaaaaaaaaaaaaaaaaaay

nimble kiln
#

I'll find out at some point if anything is broken now ยฏ_(ใƒ„)_/ยฏ

pure lion
#

okay so

#
    location / {
        proxy_pass http://127.0.0.1:8080;
        include    nginxconfig.io/proxy.conf;
    }
nimble kiln
#

includes OhNo

pure lion
#

uwu

nimble kiln
#

show the contents of proxy.conf? ๐Ÿ˜‰

pure lion
#

okay

#
proxy_http_version                 1.1;
proxy_cache_bypass                 $http_upgrade;

# Proxy headers
proxy_set_header Upgrade           $http_upgrade;
proxy_set_header Connection        "upgrade";
proxy_set_header Host              $host;
proxy_set_header X-Real-IP         $remote_addr;
proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host  $host;
proxy_set_header X-Forwarded-Port  $server_port;

# Proxy timeouts
proxy_connect_timeout              60s;
proxy_send_timeout                 60s;
proxy_read_timeout                 60s;
nimble kiln
#

mhmmm

#

took 5 seconds to send that mhmmm

pure lion
#

yes

nimble kiln
#

What happens when you visit your domain

#

does everything go up in flames? Or some HTTP errors?

pure lion
nimble kiln
#

ok nice

pure lion
#

:)

nimble kiln
#

hold up

#

didnt you set a root directory?

pure lion
#

maybe

nimble kiln
#

is nginx-default-bla.html in that directory?

pure lion
#

how might i do that

#

yea

misty sigil
#

we're using express fyi

pure lion
#

^^

nimble kiln
#

oh express

pure lion
#

hence the proxy pass

nimble kiln
#

well yeah I'm doing something similar

#

Just with apache OhNo

#

just remove the include

pure lion
#

mmnmmmmnm

#

okay

nimble kiln
#

or comment it out

#

with #

pure lion
#

i know

#

:(

nimble kiln
#

just saying

#

๐Ÿ˜ 

pure lion
#

did nothing

nimble kiln
#

show me your whole config for that domain

#

dont forget to remove the domain name ๐Ÿ˜‰

pure lion
#

:O

#

no

nimble kiln
#

yes

pure lion
#

i wont

nimble kiln
#

oh ok

misty sigil
nimble kiln
#

yeah ๐Ÿ˜‰

pure lion
#
server {
    # listen                  *104.243.32.11:443 ssl http2;
    listen                  443 ssl http2;
    listen                  [::]:443 ssl http2;
    server_name             peepeepoopoo.tk;

    # SSL
    # ssl_certificate         /etc/letsencrypt/live/peepeepoopoo.tk/fullchain.pem;
    # ssl_certificate_key     /etc/letsencrypt/live/peepeepoopoo.tk/privkey.pem;
    # ssl_trusted_certificate /etc/letsencrypt/live/peepeepoopoo.tk/chain.pem;

    # security
    include                 nginxconfig.io/security.conf;

    # logging
    access_log              /var/log/nginx/peepeepoopoo.tk.access.log;
    error_log               /var/log/nginx/peepeepoopoo.tk.error.log warn;

    # reverse proxy
    location / {
        proxy_pass http://127.0.0.1:8080;
        # include    nginxconfig.io/proxy.conf;
    }

    # additional config
    include nginxconfig.io/general.conf;
}

# subdomains redirect
server {
    # listen                  *104.243.32.11:443 ssl http2;
    listen                  443 ssl http2;
    listen                  [::]:443 ssl http2;
    server_name             *.peepeepoopoo.tk;

    # SSL
    # ssl_certificate         /etc/letsencrypt/live/peepeepoopoo.tk/fullchain.pem;
    # ssl_certificate_key     /etc/letsencrypt/live/peepeepoopoo.tk/privkey.pem;
    # ssl_trusted_certificate /etc/letsencrypt/live/peepeepoopoo.tk/chain.pem;
    # return                  301 https://peepeepoopoo.tk$request_uri;
}

# HTTP redirect
server {
    # listen      *104.243.32.11:80;
    listen      443 ssl http2;
    listen      [::]:80;
    server_name .peepeepoopoo.tk;
    include     nginxconfig.io/letsencrypt.conf;

    location / {
        return 301 https://peepeepoopoo.tk$request_uri;
    }
}
nimble kiln
#

uh

pure lion
#

kek

nimble kiln
pure lion
#

nope

nimble kiln
#

good

pure lion
#

what do

nimble kiln
#

thinking

#

I'd say yeet the last two server {} blocks

#

i dont trust those

pure lion
#

no >:(

nimble kiln
#

xd

#

Ok

pure lion
#

i need them

nimble kiln
#

Then look at the logs

#

/var/log/nginx/peepeepoopoo.tk.access.log;

pure lion
#

okay

nimble kiln
#

/var/log/nginx/peepeepoopoo.tk.error.log; too

pure lion
#

empty

nimble kiln
#

๐Ÿ‘€

#

Get me a teamviewer/anydesk session and let me click around, I can't help like this ๐Ÿ˜ 

#

get rid of the proxy pass

#

and make it a proper domain first

#
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }```
#

let it point to a local directory with root - add an index.html file to the root directory with any content

pure lion
#

i hate this

#

aaaaaaaaaaaaaaaaaa

#

im stuck

misty sigil
#

eror?

pure lion
#

not proxy passing

#
nginx: [warn] conflicting server name ".peepeepoopoo.tk" on 0.0.0.0:443, ignored
#

h

nimble kiln
#

get rid of that vhost

#

as I told you xd

pure lion
#

@misty sigil

#

fix

#

now

misty sigil
#

bruh

#

its your nginx shit

#

i cant do anything about it on cf side

#

ffs

pure lion
#

i fix

#

poopy

#

what's the cf conf right now?

nimble kiln
#

if you have certbot redirect enabled, disable CF HTTPS redirect

pure lion
#

yeah mattt

#

:)

nimble kiln
#

SSL/TLS > Edge Certificates > "Automatic HTTPS Rewrites"

#

for easier finding^

pure lion
#

cant we just do full encrypt on cf?

nimble kiln
#

what do you want to achieve

#

Do you want to not care about the certificate on your machine?

pure lion
#

then it takes the server side ssl

#

and has a baby with cf

nimble kiln
#

If you're using certbot, and keep renewing the certificates on your server, then yes. Use Full

pure lion
#

@misty sigil

#

use this

nimble kiln
#

No dont use this

pure lion
#

we'll try both

nimble kiln
#

actually

#

"Trusted CA or Cloudflare Origin CA"

#

LetsEncrypt is a Trusted CA i believe

#

So (strict) should work, my bad

pure lion
#

it is

#

so we're gucci

misty sigil
#

ah fuck

#

OI FUCK

#

IT WORKS

nimble kiln
#

Noice

pure lion
#

gg

#

i installed

#

uh oh

warm prairie
#

what's is the preferred language for a bot? js or py ?

nimble kiln
#

@warm prairie There is no preferred language, because it depends on your personal preference

#

I guess javascript is more widespread, so you'll find more examples online

#

If you like writing in python more, then go with python

warm prairie
#

I was looking to learn more python so was thinking of rewriting my bot in py

nimble kiln
#

I tried the same and gave up KEKW

warm prairie
#

it's currently in js

#

lmao

#

good to know

nimble kiln
#

Python is not a nice language in my opinion

misty sigil
#

same

nimble kiln
#

I totally got used to JS by now, switching to python was hard

#

Their documentation also is.. special. (discord.py)

twilit rapids
#

JavaScript is easy for beginners, Java is the most efficient and most used in the big bots (250k+ guilds)

warm prairie
#

My career is in JS (Typescript) development basically so I'm hope I like JS lol

nimble kiln
#

JavaScript is easy for beginners, Java is the most efficient and most used in the big bots (250k+ guilds)
@twilit rapids that comma confuses me

#

You're talking about Java in the second half, or JavaScript?

warm prairie
#

xD

twilit rapids
#

Java

nimble kiln
#

ok good

warm prairie
#

really? most of the big bots are in Java?

twilit rapids
#

It says Java not JavaScript

warm prairie
#

that's interesting

twilit rapids
#

Groovy, Rythm, Hydra, Zerotwo, etc...

warm prairie
#

didn't even know discord had a Java SDK

twilit rapids
quartz kindle
#

jabbascuriputo

gentle wolf
#

Hey, can someone help me real quick? It's about a bot running with python, I haven't worked on it in over a year and a half, it stopped working recently, I figured out the issue is with the discord.py thing being outdated, now it's giving me the error "AttributeError: module 'discord' has no attributes 'channel'" and I can't figure out how to fix it

nimble kiln
quartz kindle
#

lmao

sudden geyser
#

scriptcoffee

slender thistle
#

@gentle wolf what are you trying to do?

warm prairie
#

scriptkiddy

radiant patio
#

how do i make it so that those who vote for my server get a role?

quartz kindle
#

servers do not have an api yet

slender thistle
#

See the role rewards panel

radiant patio
#

ive seen some servers do it

gentle wolf
#

Just
Get the bot running again?
He's supposed to just
React to stuff people say in the chat, send stuff into a certain channel etc

slender thistle
#

You're trying to do discord.channel somewhere

gentle wolf
#

Yes!

quartz kindle
#

@gentle wolf what was your previous discord.py version before you updated?

radiant patio
#

See the role rewards panel
@slender thistle wheres that

gentle wolf
#

...zero point something

#

It's been a while

slender thistle
#

Server Edit page I believe

quartz kindle
#

that might be the issue

slender thistle
#

0.16.12

quartz kindle
#

there were big changes between 0.16 and 1.0

slender thistle
#

VEEERY big changes

gentle wolf
#

Yeah probably!
What do I need to change discord.channel to for it to work? Or do I need to rework the whole bot?

quartz kindle
#

even bigger than discord.js's v11 to v12

#

xD

#

you'll probably need to rework a major part of your bot

#

check their documentation and changes guide

slender thistle
#

There's a migration guide you could refer to

gentle wolf
#

Great
Thank you tho!

Oh? I'll look for that

eternal osprey
#

hey could somebody help me witth my not working filtering system.

#

i do have this

#
async function get_country_by_skytext(text) {
    let countries = [result1[0].current]  // list all your countries
    let result = await get_data(countries);
    return result.filter(entry => entry.current.skytext === text)
 }
#
bot.on('message', message => {

                    if(message.content.startsWith(prefix + 'Sunny')) {

                        get_country_by_skytext('Sunny');```
#

it doesn't send me anything?

#
var current1 = result1[0].current; ```
#

this is the result1

quartz kindle
#

where is result1 coming from tho

eternal osprey
#
weather.find({search: 'Germany', degreeType: 'C'}, function(err, result1) { 
            if (err) message.channel.send(err)```
#

weather-js package

quartz kindle
#

and you want to use weather.find only once and then always get results from the same search?

opal plank
#

isnt that the person that i told to stop using callback hell?

eternal osprey
#

i actually do have 40 more countries

opal plank
quartz kindle
#

judging only by the pieces of code you provided, it shows a very wrong order of operations, would need to see more code to understand what is actually going on

eternal osprey
#

okay

#

are you ready for hell tho?

quartz kindle
#

used to it

eternal osprey
#

good luck

opal plank
#

pastebin

quartz kindle
#

jesus you werent kidding

#

lmao

opal plank
#

OMG

#

WTF

earnest phoenix
#

error when user uses /skin <shaped text>.

          if (response.statusCode === 204) {
                       ^

TypeError: Cannot read property 'statusCode' of undefined
    at Request._callback (C:\Users\axe12\Desktop\autimatic bot\commands\bilgi\minecraft_skin.js:28:24)
    at self.callback (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.start (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:753:10)
    at Request.end (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:1505:10)
    at end (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:564:14)
    at Immediate.<anonymous> (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:578:7)
    at processImmediate (internal/timers.js:456:21)

C:\Users\axe12\Desktop\autimatic bot>```
opal plank
#

DUDE

earnest phoenix
#

ex: [ฬฒฬ…sฬฒฬ…][ฬฒฬ…eฬฒฬ…][ฬฒฬ…lฬฒฬ…][ฬฒฬ…aฬฒฬ…][ฬฒฬ…mฬฒฬ…]

opal plank
#

AAAAAAAAAAH

#

i literally told them to learn promisification

eternal osprey
#

erwin

opal plank
#

like 3 days ago when they had 3 callbacks

#

THREE

#

THREE

eternal osprey
#

i told you that i would learn and apply it to my own code

#

after i was done with filtering

quartz kindle
#

this here is very very wrong

#

you should never have an event listener inside another event listener

eternal osprey
#

ffs

#

this code makes me sad

quartz kindle
#

what you should do, is define a certain amount of time for which these results are valid, and cache them accordingly

#

for example

earnest phoenix
#

How do I make sure that only English letters are used when using commands?

earnest phoenix
#

ex: a b c d e f g ...

eternal osprey
#

wut

#

@opal plank Okay, I will.

opal plank
#

legit

#

stop whatever you doing

#

this shit will only grow

eternal osprey
#

but first, may i complete my filtering?

opal plank
#

no

#

util.promisify

#

now

eternal osprey
#

sorry daddy

opal plank
#

this is the whole reason i was telling you two days ago to learn promisification

#

so you can await it and not deal with this callback hell

#

this has gone at least 20 steps over tho

#

calling it hell is an understatement

quartz kindle
#

@eternal osprey here's how it should be done

  1. someone uses a weather command
  2. check if the results already exist in a variable
    2a. if they do exist, check how old they are
    2aa. if they are old, use the search function again and update the variable with newer results
    2b. if they dont exist, use the search function and save the results in the variable
  3. get the results from the variable
  4. send the response
#

this should be done using async functions and await

#

otherwise its impossible to get it done correctly

#

90% of your code can be reduced into less than 10 lines

#

using arrays, loops and async await

#

however weather-js is over 3 years old and doesnt support async await syntax, so you will need to promisify it

eternal osprey
#

i am doing it right now

#

@opal plank proud of me?

opal plank
#

yes, keep going

#

if i see 2 callbacks or more, more than 10 variables, and more than 1 addField() method on your embed imm slap you irl

#

be warned

lunar dirge
#

how to i make a ticket bot with discord.js

midnight blaze
#

Promise.all([]) @eternal osprey

lunar dirge
#

@dire obsidian as i was saying

const Discord = require ('discord.js');
const client = new Discord.Client();
const prefix = "=";
client.login('{my token}');

client.once('ready', () => {
    console.log('Bot is now appearing online!');
    client.user.setActivity('=help | TixxiTicket', { type: "WATCHING"})
});

client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if(command === 'help'){
        message.channel.send('test')
    } else if (command == 'ping'){
        message.channel.send('Pong!')
    }
});```

this is all i know how to do as i learnt today, but i want a ticket bot
dire obsidian
#

oh, hmmm, i think you first need know more abaut that (discord.js)

lunar dirge
#

why?

dire obsidian
#

because i will not give you all the code

lunar dirge
#

once i learned will you?

dire obsidian
#

well, im not a profecional

#

as i say you can read the guide, see examples

#

but if you want learn, dont copy paste ok?

lunar dirge
#

i know most of it and im not going to copy and paste

dire obsidian
#

nice!

fiery canyon
#

oops

#

does anyone know how to make embed links like that, from a URL embed

dire obsidian
#

(text)[link]

fiery canyon
#

that

dire obsidian
#

as i remember

fiery canyon
#

yes but

#

one sec

dire obsidian
#

(Dashboard)[ht...]

#

hmmm

fiery canyon
#

oh wait nvm

dire obsidian
#

i dont remember xd

nimble kiln
fiery canyon
#

that doesn't work lol

dire obsidian
#

xd let me

earnest phoenix
midnight blaze
#

What exactly am I doing wrong here? Shouldnt this fetch the last 2 messages and do those reactions?

//eval 
        message.channel.messages.fetch({ limit: 2}).then(() => {Promise.all([
        message.react(':apple:'),
        message.react(':tangerine:'),
        message.react(':grapes:'),
    ])})```
For now it only reacts on one message
dire obsidian
#

@earnest phoenix tahnks, usually im kanda lost somethimes

earnest phoenix
#

you aren't doing anything with the messages you fetched @midnight blaze

midnight blaze
#

true xD

#

(m) and then m.react

earnest phoenix
#

m should be a collection

#

so doing react on it won't work

modest smelt
#

how can i code a bot such that it takes an argument of a channel

#

and welcomes people in that channel?

#

in discordpy

#

please help

low shard
#

how i can to use nitro emojis in my bot
?

earnest phoenix
#

<:emoji:id> where emoji is the name of the emoji and id is the emoji id

low shard
#

not work

earnest phoenix
#

then your bot doesn't share the server with the emoji

low shard
#

how i can do it

earnest phoenix
#

do what