#development
1 messages ยท Page 1777 of 1
So every time an on_guild_join event is ran, I want to first add 1 to a global variable called added_servers and then to update a message in a channel with that number.
Idk how python or whatever language you're using works, but if your code is all in one file, you can declare an integer in the root scope and then assign your client's guild count once your client reaches the ready state and then increment that value on guild create.
If you need that variable across multiple files for whatever reason, you can have a file which exports an Object and assign that number to a property of that Object and then require that mutual file across multiple files. If python caches required files, then assigning properties to the object should allow you to access those properties across other files
hmm
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-06-09T05_24_32_955Z-debug.log
exit status 1```
can anyone help mee to fix it...
You need to add a start script to package.json.
how can you tell
It says it's missing the script lol
Google package.json start script
Better, google the error.
i have fixed that but after that another error comes..
> discordjs-moderation-bot@1.0.0 start /home/runner/discordjs-moderation-bot
> node index.js
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module '/home/runner/discordjs-moderation-bot/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! discordjs-moderation-bot@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the discordjs-moderation-bot@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-06-09T05_37_44_088Z-debug.log
exit status 1```
You script tries to run node index.js most likely you index.js file is in a folder .
so what i have to do..
Learn basic NodeJS.
if(!message.guild.me.hasPermission("CONNECT")) return message.channel.send({embed: {
title: "Invalid",
description: `**I dont have permission to connect**! ${message.member.voice.channel}`,
color: "RANDOM"
}})```
When I use this bot is not connecting to vc and sending me this message
How can I check the permission of channel on which member is connected
message.member.voice.channel.hasPermission("CONNECT")
remember voice can be null, if user is not connected to any vc
If my bot has no permission?
wdym, this is how u'll check the permission
I mean if my bot has no permission to connect that vc so he send message
u mean, no permission globally??
if(message.member.voice.channel.hasPermission("CONNECT")) {
// has permission
} else {
// No permission to connect to member's vc
}
hasPermission is deprecated
Nope only for members vc
On which he was connected
if(!message.member.voice.channel.permmission.has("CONNECT"). for(client.id)) return message.channel.send({embed: {
title: "Invalid",
description: `**I dont have permission to connect**! ${message.member.voice.channel}`,
color: "RANDOM"
}})```
Like this?
yes but what is this part?
. for(client.id)
Checking permissions for client
na thats not valid js
For rate limit, in this case on_message, is it per server or overall (all servers added up)?
Code
if(!message.member.voice.channel.permissionsFor(client.id).has("CONNECT")) return message.channel.send({embed: {
title: "Invalid",
description: `**I dont have permission to connect**! ${message.member.voice.channel}`,
color: "RANDOM"
}})```
Thats not api
you try to get a member connection permission from a channel
its not, client.id its client.user.id
but using only client.user will also work
I didnt mentioned for u
I was finding that channel for me
lol. how intelligent
(Discord.js) im doing a custom embed for guilds, i have to convert for example {author.username} (the text requested to put in the description/title/author) in a placeholder like ${author.username}, how can i do?
hi
im new to sql
does anyone know how to insert a dict into a table
basically i need something like this
i'm not using sql, sorry but i can't help you
{
"bal": 0,
"iron": 0,
"minerals": {
"diamond": 0,
"ruby": 0,
"sapphire": 0,
"emerald": 0
},
"structures": ["mine", "barracks"]
}
oof ok
i basically just need this, but in sql
try to search a doc
You will likely need a jsonb column in your table.
yo minecraft?
you can just pass it into a string if you use `` these to define the string
e
so ```js
const string = ${Value}
ok, but where i do the changes (event guildCreate) author isn't definied so it will be undefinied
then use something else than the author, you could get the guild owner as example
you could use links, there are probably ways to store subobjects but idk for now
you can also serialize the minerals object
Anyone help me to approved my bot 4week+ I do not get a single reply that my bot approved or not
wrong channel
oh
lol no its just the currency system i have
i might change it tho
replace might with most probably will
you tried JSON.parse() ??
It'll turn the dict / object into a string and then you can save it in db
or just use Mongo nosql
SQL is based on tables, there are rows and columns and thats it, there is no depth or children, you cannot have objects/arrays inside objects/arrays
so you have to either make separate tables for them and link them
or you need to serialize the children into something like json strings
so youre making an mc bot?
oh
pm2
using the same id?
right
yes
okay thanks
although if you have variable columns then its not a good idea
for example
lets say you have a table for a user
and another table for minerals
thx bro
it would be like this
table users
| id | username | bal |
| 01 | "abc" | 999 |
| 02 | "xyz" | 241 |
etc...
table minerals
| id | diamond | ruby | sapphire | emerald |
| 01 | 0 | 0 | 0 | 0 |
| 02 | 0 | 0 | 0 | 0 |
etc...
note that you cannot easily add/remove columns, because its a big performance hit to do that
so you have to define all possible minerals you will ever have ahead of time
and just give everyone 0 of them at the beginning
mmm
you could also just put all minerals in the users table as well
and have one big table with dozens of columns
the number of columns doesnt affect performance, you can easily have hundreds of columns if you need it, but they have to be fixed, you should avoid dynamically adding/removing them
now arrays are more complicated
there is no way to reliably represent an array in SQL without using addons
the easiest way to store "structures": ["mine", "barracks"] would be to serialize it to string
for example ```js
table users
| id | username | bal | structures |
| 01 | "abc" | 999 | "mine,barracks" |
| 02 | "xyz" | 241 | "mine" |
etc...
and convert them back and forth between array and string
["mine", "barracks"] -> "mine,barracks" when saving data
"mine,barracks" -> ["mine", "barracks"] when loading data
hm yeah
in a string
?
as columns
table users
| id | username | bal | structures | diamond | ruby | sapphire | emerald | iron | ...
you could also save it as a string yes
the difference is that if you save it as a string, you cannot access it individually
for example if you want to know how many diamonds a user has
with columns you can access it directly
with string you have to first access the entire string, including all minerals
then convert the string and extract the diamonds value from it
bro im so dumb help me what am i supposed to do? the name of my bot or "index.js"?
whatever your main js file is
ah ok
oh yeah
if its index.js then its index.js
phew
ok thx lmao
i feel kinda dumb now
im felling more
no matter how dumb you are, there will always be people dumber than you :^)
use it on your VPS not on your PC
ahhhhh
inb4 they ask what a vps is
Viral Pirated Software, duh.

anyone here? ;-;
Yes?
oh i used googletrans but its givign me an error
Exception has occurred: AttributeError
'NoneType' object has no attribute 'group'
I believe it's a bug with the library
@bot.command(aliases=['tr'])
async def translate(ctx, lang, *, args):
a = Translator()
b = a.translate(args, dest=lang)
await ctx.send(b.text)
oh :<
Iirc my friend had the same error
so any other way?
lol
how can i have a different presence for each shard with internal sharding?
how can i check if toBuy === {} and price === {}? I put this but it doesn't return
!toBuy && !price ??
i tryed that but it still logs {}
you cant compare objects like that
an empty object is a reference, it exists
so its not false
so i need to check length?
and comparing to {} doesnt work because {} creates a new different object with a different reference
you can check key length yes
ok
??
i dont find it in the docs :((
setPresence({..., shardID: number})
ok thanks
message.channel.send('dm or bot not allowed')
}```
```DiscordAPIError: Cannot execute action on a DM channel
you're not ruling out dms completely
you're ruling them out only if a bot dms you
guild equals null AND bot
meaning if a user dms you, it will not pass that test
and continue normaly
message.channel.send('dosomethinghere')
}```
same thing
you're checking if the message is a dm AND if the user is a bot
the "dosomethinghere" will only run if BOTH are true
meaning these will not work: if is a DM but the user is not a bot, or if the user is a bot but its not a DM
Tim have you ever used mongoose?
Mongoose is relatively easy to use
i am new in mongoose i am trying to do a inventory system with an object and i want to store items and in the items i want to store the amount of that item
how can i do that
For items you can use schema.push() if schema is already fetched
And inside push you pass your array variable
Sadly i cant help you with full efficency, i have to work soon and im on my phone rn
ok thx
np
nope never used mongoose
tim go back t- oh wait
ha! gottem
dev related question (obviously)
would ya say deno is worth using or not
this
I mean i used it before but
would u say its worth using it at all
lol
meh
if you care about security, performance, es6 imports and tahpscrept then go for deno
deno needs you to add flags to the command to allow stuff like network or reading from the env
sounds useful for running in a sandbox
lol
^ that's the security
and it uses URL imports instead of npm so there's no require
Smexy
but if you want to load node modules then there's websites like esm.sh that can compile js in the cloud and make it importable in deno
I heard though that deno is less stable for web servers
yeah I used deno already
even made a deno package myself
and a small discord bot in deno
did you put it on deno.land/x?
also im trying postgres rn using deno too
yeah
i heard somewhere that deno will never be faster than node because of how its designed
I mean deno uses typescript and rust
the http library only supports http 1.1 yet
but they're working on adding a native http api to deno
ye
I know that deno has a "node compatibility layer"
saw that in thier std module
their std repo is literally just node http apis made to work in deno
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module '/home/runner/Fun-Moderation-Bot/index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
exit status 1
๎บง ```
here's a simple webserver made with std/http:
can anyone help to reolve this problem
import { serve } from "https:/deno.land/std/http/server.ts";
const server = serve({ port: 8080 });
// we have top level await :)
for await (const req of server) {
req.respond({
body: "Hello World!"
})
}
How can i make one bot for activity, i mean if i write !On, bot begin to count time. and when i write !Off its finished. But i need bot counts and all time what i do since last 7 days and only the refresh.
Hello. I'm new and my bot just wont make embed text. Can someone help me pls ? I use discord.js
I cant write on my 1st acc where I also made my bot on bc I need phone number to Chat, but I already have my phone number conected with this acc
@quartz kindle Is there already a djs-light version available for djs 13?
are you sure index.js exists?
yes, master version is based on v13
its a bit behind on commits but it will be updated eventually
alright, great
if you don't plan on making a live counter, just store the millis when you use !On and compare with millis when you use !Off
O(n!)
aka rip your cpu and ram
shhh
Does nodejs load the package.json automatically if found in the root path?
node itself doesnt touch package.json
Need to get into npm and nodejs somehow since I'm gonna need to do more than 1 project with nodejs 
Oh... so vscode does that for the people. That's what I saw on all these screenshots being shared in here probably
does what?
creating node_modules in the project root path and downloading the dependencies
npm does that
tim did u know this exists? https://www.geeksforgeeks.org/timsort/
then npm install yourmodule all your shit
i think i saw that somehwere yeah
lmao
yeah for now I just installed packages globally and used them in all projects, but now I need different version of the packages which requires to create separate modules for every project
more useless time and work to spend on
projects should always use local versions of modules
otherwise you risk all sorts of issues
yeah NOW I know that, too
just had one project before only
Congratulations! You're my new "project-manager". I'm gonna send u bling-bling via PayPal and you gonna do the rest for me.

How do feel about your new responsibility?
looks like i might pass 100k servers the same time as 10 mil users ๐ that would be awesome ๐
๐
lmao sure
gib bling bling
lmao

can someone help me
How does your master version include djs v13?
wheres my settlement and employer benefit
That benefit is for employees ONLY working here for more than 12 h
i added my server on top.gg yesterday but when i searched it up today it didnt show up (it showed up in my profile but not in public search)
its not nsfw or 18+
it has djs master as a dependency, with a specific github commit hash
"dependencies": {
"discord.js": "12.5.3"
}
Am I blind?
ty
๐ still these annoying dudes
hey @quartz kindle do you know db trigger stuff?
const {MessageEmbed} = require("discord.js")
module.exports = {
name: "ehelp",
description: "reaction help",
execute: async(client, message, args)=>{
const emojis = [
"โ",
"โ",
"๐",
"๐",
"๐",
"๐ญ",
"๐ฎ",
"๐ผ",
"๐",
"๐ ",
"๐",
"๐ผ",
"๐ค"
]
const m = await message.channel.send({embed: {
title: "Help Menu",
description: "Which category you want to see!",
color: "RANDOM"
}})
for (const emoji of emojis) await m.react(emoji);
const reactionCollector = m.createReactionCollector(
(reaction, user) => emojis.includes(reaction.emoji.name) && !user.bot,
{ time: 120000 }
)
reactionCollector.on('collect', reaction => {
reaction.users.remove(message.author);
if(reaction.emoji = "๐"){
message.channel.send("Done!")
}
})
}
}```
Error : if I react to any emoji its still sending done!
like, I have a case where I need to update a row's ID column (which is referenced in other tables) so I created a before update trigger which inserts a new row with the new data and change references to that one
however, after all that is done I need to delete the original row and keep only the new one
is there anyway I can do that on after update?
"still sending" as in "spamming done"?
Nope
sending to any emoji?
reaction.emoji = "๐"
Code is if I react to ๐ then it sends done but I react to ๐ค and others emoji its still sending dine
you're assigning not comparing
How can I fix
===
Still
assignment always return the new value, which in javascript will always be true except for null, undefined, [], '' or alike
you need to compare
[] is truthy
you're comparing types also
can't npm just install github modules without git?
don't think so since there's no way to get repo stuff without git
npm i https://github.com/username/repo/tarball/branch
ah ye, tarball
yeah you copied the example from the site I tried as well, but no
npm install https://github.com/timotejroiko/discord.js-light/tree/master
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
this
https://github.com/timotejroiko/discord.js-light/tarball/master
Fixed thnx to all
"version": "4.0.0-dev",
"dependencies": {
"discord.js": "github:discordjs/discord.js#dec191aa1e4f22690285ca06c6eee7e6086b2930"
}
yeah finally I'm on the correct version
Is there a FAQ about v12-v13 differences already?
is there a v13 already?
No.
in that context, it'll evaluate to true even if it's an empty object/array since they didn't explicitly do == true
hm, true
No but Tim posted something yesterday?! showing differences... but I can't find the URL anymore
ah nvm got it
When I try to run the code locally, it works, but after I deploy the bot to Heroku, it doesn't connect to VC.
But rest all commands work, except join and leave.
Please Help :')
@client.command()
async def join(ctx):
channel = ctx.author.voice.channel
embed=discord.Embed(title="Joined", color=0x000000)
embed.set_thumbnail(url="https://media.tenor.com/images/16972299a4e2fb332170398ef2fdd7c2/tenor.gif")
embed.add_field(name='Connected To -', value=f'{ctx.author.voice.channel}')
await channel.connect()
await ctx.send(embed=embed)
I have imported the following
import discord
from discord import colour
from discord.ext import commands, tasks
from discord.ext.commands import bot
from discord.ext.commands.core import has_permissions
from discord.gateway import DiscordClientWebSocketResponse
from discord.voice_client import VoiceClient
import youtube_dl
import asyncio
from random import choice, random
Requirements -
discord.py==1.7.2
youtube-dl==2021.6.6
asyncio==3.4.3
could you please recommend any other free hosting service?๐
There are no good free hosting services
if you want something that's pain free and pretty fast, you could use repl.it
im trying to remember this one hosting server that gave me like 6 GB memory and 30ms ping
for free
theres a work around
oh
i'll check it out, thank you :)
Correct
That's why uptimerobot is used
Heroku doesn't support voice
ohhh, okay, thank you :)
It does
Eh well
use cf to route it to your vps then use nginx to route the subdomain to the port
How can I get all commands of a directory
it does...
Like
Commands/mod/files
My music boat runs on heroku
flazepe explained that
im trying to make a simple bot to show the stats of my minecraft server every minute but I keep getting undefined errors when i try to reference anything in the returned JSON, anyone know a fix?
const response = await got('https://api.mcsrvstat.us/2/ip_redacted');
console.log(response.body);
const data = JSON.parse(response.body)
if(data.online == "true") {
let onlineEmbed = new discord.MessageEmbed()
.setTitle("Online")
.setColor("#BFFF00")
.setPicture("./icon.png")
.addField("IP Address:Port", data.ip)
.addField("Port", data.port)
.addField("MOTD", data.motd.clean)
.addField("Player Count: " + data.players.online + "/" + data.players.max, data.players.list)
.addField("Server Version", data.version);
message.edit(onlineEmbed)
}```
```TypeError: Cannot read property 'online' of undefined```
Data is undefined
how do I define it
Try logging it
i got the same thing when i'd do response.body
but response.body isn't empty
I logged data and I got this
ip: 'redacted',
port: redacted,
debug: {
ping: false,
query: false,
srv: false,
querymismatch: false,
ipinsrv: false,
cnameinsrv: false,
animatedmotd: false,
cachetime: 1623252086,
apiversion: 2
},
online: false
}```
Response body or data?
data
Use semi colons at line endings
semicolons are not needed in JS
ok berry
oikhjawdhjo[iawdiohjawd
subdomain flask no worky worky
i added the cname to cloudflare
added the subdomain="" thing
and also added nginz
nignx
HALLP
HAHH
AHH*
are you getting 500 from cf?
redirect too many times
your nginx is probably setup wrong
show the config
why is this function not running even though data.online is false?
if(data.online === "false") {
console.log("The server is offline.");
let onlineEmbed = new discord.MessageEmbed()
.setTitle("Offline")
.setColor("#FF0000")
.setPicture("./icon.png")
.addField("IP Address", data.ip)
.addField("Port", data.port);
message.edit(offlineEmbed)
}```
GNU nano 4.8 domain.xyz
server {
listen 80;
listen [::]:80;
server_name domain.xyz www.domain.xyz status.domain.xyz profile.domain.xyz payments.domain.xyz gift.domain.xyz admin.domain.xyz api.domain.xyz dashboard.domain.xyz me.domain.xyz>
return 302 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name domain.xyz www.domain.xyz;
add_header X-XSS-Protection "1; mode=block";
location / {
include proxy_params;
proxy_pass http://localhost:6969;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name domain.xyz dashboard.domain.xyz;
add_header X-XSS-Protection "1; mode=block";
return 302 https://dashboard.domain.xyz/;
}```
@crimson vapor
this is only a part of it
cuz its so long
what are you trying to do?
archbot.xyz -> localhost:6969?
doesn't look like you have any setup
how so?
i edited it
cuz its supposed to be a secret lmfao
but whatever
it has the real domains
oh
server {
listen 80;
listen [::]:80;
server_name domain.xyz www.domain.xyz status.domain.xyz profile.domain.xyz payments.domain.xyz gift.domain.xyz admin.domain.xyz api.domain.xyz dashboard.domain.xyz me.domain.xyz>
return 302 https://$server_name$request_uri;
}
``` its probably this block right here
like i ddidnt add it yet
why not just move them to this block
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name domain.xyz www.domain.xyz;
add_header X-XSS-Protection "1; mode=block";
location / {
include proxy_params;
proxy_pass http://localhost:6969;
}
}
oh
i dont understand nginx well
listen 80;
listen [::]:80;
server_name archbot.xyz www.archbot.xyz;
return 302 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name archbot.xyz www.archbot.xyz;
add_header X-XSS-Protection "1; mode=block";
location / {
include proxy_params;
proxy_pass http://localhost:6969;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name archbot.xyz dashboard.archbot.xyz;
add_header X-XSS-Protection "1; mode=block";
return 302 https://dashboard.archbot.xyz/;
}```
now its this
looks like dashboard is redirecing to its self
are you just trying to make it go to the webserver?
yes
all of them?
I think you should be able to do
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name archbot.xyz *.archbot.xyz;
add_header X-XSS-Protection "1; mode=block";
location / {
include proxy_params;
proxy_pass http://localhost:6969;
}
}```
You're comparing a boolean to a string which is never true
yea i just figured that out
ok well it works
BUT
its not using the subdomain
but?
like it just ignores the subdomain
so like if u go to like
dashboard.domain.xyz it treats it as domain.xyz
basically
i think i didnt explain enuf
am not sure then
hmm
simply don't use *.domain.tld
that means "everything that ends in domain.tld should be handled here"
Make sure your DNS settings are right
If thereโs no wildcard set or the actual hostname for the subdomain the route will fail
Since thereโs no target
if i have a <div/> with contenteditable="true" how do i detect when the content changes?
Wait ok I'm super confused
I have a specific set of subdomains
How do I like allow them to pass thru to flask
Ping me please
^
im using react
wdym?
like, you can just get the current url
or pass the original url as a custom header in nginx
๐ with cname?
Cname records?
you want the subdomain to be a different endpoint entirely right? youd use A records for that.
cname is just an alias.
Check if you have actually setup a wildcard hostname
OHHHHH
unless i dont understand my records.
nothing at all
Dammit, wrong channel, huh
Is the subdomain target a different one than your domain?
No
nginx will just supply the proper content for the specified url
Well then extra records are not required
kinda like a mailman
Just add a wildcard A(AAA) record with the same target as your domain
use cname for subdomains
Bullshit
A RECORDS OR CNAME
if you want them to be an alias, you use a cname
I'm going crazy here
Whatโs so complicated to create a wildcard record?
If you wanna route all possible domains to your webserver. You can then use and define any subdomains in NGINX you want
nope, same address
Nonsense since the target is all the same
You usually create 2 CNAME records for www and ftp
As well as pop, smtp etc. if you actually need it
CNAME record with the actual identical target are nonsense
Just takes more time to resolve than an A record (wildcard)
except you can use the address on nginx to redirect to different endpoints
I made the a records
so even if all 4 in my example point to the same address, they're effectively 3 different endpoints (www doesnt count)
afaik, typically you want endpoints to be separate a records.
that if you use different ips
well, it functions, it doesnt mean its right
Correct
is EasyApplications down right now? havent been able to use it in almost 3 days
id wrongserver, but i have no idea if thats even a bot ๐
The CNAME record actually makes sense to redirect your FQDN to an external target
woops, my bad. my buddy sent me this discord and told me to ask here, thanks guys!
how do I make the response of a slash command only visible to the user that ran it?
A wildcard record?
ephemeral messages
how do I do that
i have this right now
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: "text here"
}
}
})
}
});
what would I need to change?
no
how do i make one?
with cloudflare
*?
wildcard a record?
it shows the server ip tho
Yeah same target as your domain
Huh Iโm not dealing with cloudfare, canโt actually tell you
wats dat
^ this
whats that
a message only you can see
oh
that disappears
so like clyde
yea
cool
i cant find anything on them though
there
All this new trash features nobody needs 
the text highlighting is pog tho
๐คฆโโ๏ธ
like, client-side arg check and messages are really nice
@solemn latch
but idk, could've been done better
i get that but how do I do one
how to change this preview
i have one that just sends a message, but how do I make that message that type
welp, probably there's a way to in d.js
look around slash cmd stuff
since they can only be sent as a slash cmd response
thats a response to a / cmd
@gritty bolt
{
"response_type": "in_channel",
"text": "It's 80 degrees right now."
}
{
"response_type": "ephemeral",
"text": "It's 80 degrees right now."
}
Should be obvious what is what 
how would that go into my code though
instructions unclear, cat is stuck in tupperware
Just add the response type to the data json string and test it 
0% creativity
poor cat
uploading files with ssh is scp filename.extension user@host:~ right? to upload to the users home directory
I installed pm2, but it says the cmd pm2 is not found?
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
There you go
Interaction responses can also be publicโeveryone can see itโor "ephemeral"โonly the invoking user can see it. That is determined by setting flags to 64 on the
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: "text here",
flags: 64
}
}
})
}
});
Thatโs enough?
@gritty bolt & @lyric mountain
Get your cat out there! 
ohh thats all I needed?
Because you have installed a npm package and no system package
Your system even suggests to install pm2 if you wanna use it
๐คฆโโ๏ธ One more bot server in the verseโ yay
try npx pm2
you need to install it globally: npm i pm2 -g
@lyric mountain ok so if I only want to add 1 subdomain
Right
And it not be a alias
Aka not redirect to the base domain
What do u do?
I use an A record for master domain and CNAME for subdomains
but that's up to you ig
Oh no it begins again
either way you get the same result
Resolving your CNAME record to an internal A record 
๐
Stop following me. Iโm scared
but dev and general are my two main channels 
Great! Letโs begin 
trolling is ok, trolling people about site function can make users leave top.gg for no reason isnt.
Did you mean to put "isn't" at the end
ty
I'm a good buy! boy!
I may or may not be playing valorant.
What are you going to do now? I'm confused.
I mean I just want to understand how it works
Ok so in theory, if I wanted to make for instance a admin subdomain
How do I go about doing that @boreal iron
Is the target of domain.com the same as sub.domain.com? Target IP/FQDN (server)
For example:
ftp Alias (CNAME) www
@ Host (A) 255.255.255.255
* Host (A) 255.255.255.255
mail Host (A) 255.255.255.255
www Host (A) 255.255.255.255
As long as the target of domain.com and sub.domain.com is (always) the same, just add a wildcard A(AAA) record.
It's the same server
You can then configure your webserver to listen to any endpoint (FQDN) you want, for example woo-is-weird.domain.com
It's needed anymore to add records for the "endpoints" you wanna define.
And I want endpoint1.domain.com to go to that
But still show endpoint1.domain.com
You can also use paths as endpoints, however you wan't
No problem, you will tell your webserver the document (root) path
For example
ServerName domain.com
DocumentRoot "/var/www/domain.com"
ServerName endpoint1.domain.com
DocumentRoot "/var/www/endpoint1.domain.com"
or
DocumentRoot "/var/www/domain.com/enpoint1"```
Of course just in the right syntax for your webserver software.
Hello, What should I do for making voter only commands? djs btw
check if user has voted
How
topggApi.hasVoted()
b r u h
then?
Where I need to add that
i assume you know what function parameters are
Hmm Yeah. But a little bit confused about it.
Ok
Ohk
Oh Ok
let Has_The_User_Voted_The_Bottum_On_Top_G_G = await api.hasVoted(user.id)
@earnest phoenix
I see ok
i would disencourage doing that tho
and using a database + webhook instead
so you dont massivelly spam topgg's api
^
Oh
I am planning to make that for my entire music commands. The bot is multi purpose tho
use an webhook
save to db
then fetch it
Oh Ok
thats also another thing i would dis-encourage. Multi purpose bots dont do well anymore , been like that for a few years now. If u doing it for fun, keep going, but if u doing to in the hopes of getting a lot of servers, this is not the right approach
and btw
discord.js is BAD
Switch to erwin.js aka DETRITUS.js
No i don't care about my server growth. I am just making it for test for some days or weeks
then its fine
also this
I need honest review on voting commands from my users
Will do thanks ^-^
Isnโt it Erwin.ts?
just use discord.js light lol
detritus better tho
alright so i have a index.html page. how would i have https//website.com/home use the index.html page?
without making a home.html bc i constantly update index.html so itd be annoying to update bothj
hmmm index.html is actually the first place you're sent to in web stuff
Depends on the webserver configuration or htaccess but yes - usually yes.
You can also use rewrite rules to create an imaginary folder system but it will automatically add .html behind for example
For example domain.com/home/sheep
Redirect to domain.com/sheep.html
Or pass the path as parameter
Or just domain.com/?sheep
The possibilities are โendlessโ
doesnt express routers accept regex/fills?
i could've sworn it had
1 sec
oh yeah it does use path-to-regex
expressjs moment
koa better tho
uwebsockets > nanoexpress > 0http > restana > fastify > koa > express
UwUsockets
yeas
or YouWeebSockets
weebsockets when?
Hello people. I am having a problem in getting my Bot to clouds. I ran my code on the The amazon EC2 server. Some commands require an get request from a rest API outputting a json file. But the get requests arent going through. Any solutions?
Like every other commands without a get request is working fine. Just the commands involving a get request isnt outputting anything
that's amazing
// package.json
{
name: "uWeebSockets",
description: "Same as uWebSockets but for weebs",
main: "index.js",
dependencies: {
uWebSockets: "*"
}
}
// index.js
module.exports = require("uwebsockets");
npm publish

i'll take the whole stock pls
LOL
.. Help
?
@ripe prairie
nice scam
show the code
lmao i fucked up my steam ac one with this.
Which code? The whole code or just the command.
the command that doesnt work
Dming ya wait a sec
if it doesnt have any sensitive info its better to post here so other people can input their thoughts
Okay
I am a noob programmer. So ignore the noob ness lol..
also EC2 works in the UTC time. I am GMT +5:30hrs if that might have created the issue.
Everything works perfectly fine when the code runs in my laptop. Idk whats the issue with EC2
time to make my own tcp socket layer and have the states and messages and methods be fucking cursed
weebsockets
Otherwise the command seems alright
Command is right bud. As i told above, everything works fine in my laptop.
try logging the request result to see if the website is accessible from EC2
its possible that the website is blocking EC2 for some reason
do you have access to a console/terminal?
Yep
you can print the request body
Oh the request status you meant?
Oh lemme see.
r.text should be the body
r.status()
im getting illegal base64 character 3f but the thing is that a normal online base64 decoder decodes it just fine
the actual base64 itself
its an image
ive tried it with and without the data:image/png;base64, at the start of it
now it is giving my connection time out. Smh. This EC2
Forbidden!
anyone with any idea how to manage VNC please DM me
Yes it is fetched
imo use get_user if you cache users
if it's None (meaning there's no mutual guilds with the user) then don't send the message
I canโt cache user
Not poggers
Replit doesnโt have much memory
Iโd be only sending messages to people who is connected to my economyโs database which means they are an user of my economy bot
Only if they are allowing for example a reminder for dailyโs
would anyone know a reason why my bot would work in one channel, but after making a new one and replacing the old id with the new one, it wouldn't?
okay i've actually narrowed it down to heroku, would there be any reason that it just wouldn't be running on there?
If you wanna avoid using three rate limit buckets (Get User, Create DM, Create Message) to send a DM, you would make a POST request to /users/@me/channels with a json similar to this
{
"recipient_id": "put user id here"
}
that returns a DM channel, in which you'd send the message to the returned channel
does it return a 404 for POST /channels/:channel_id/messages
is this channel restricted to development help pertaining to using discord's api itself (or using a wrapper), or can I ask questions about general development for my bot not necessarily related to discord api?
it can be for anything development related, however most people are best prepared to answer discord bot related questions, so you may not get an answer
ok thanks
Itโs part of the ksoft api
@scenic kelp
Which VPS is actually like a virtual desktop? Digital Ocean is only a console
huh?
just install xrdp
and xfce4
boom, your linux is now a "virtual desktop"
On Digital Ocean, correct?
im pretty sure every major hosting vps allows u to boot whatever OS u want in it
its regardless of vps my dude
its like asking if your pc is AMD or NVIDIA, like it matters, if you want to watch youtube
Ok
You can do it, but it is a bit of a waste of resources.
Way past SSH. Use docker and kubernetes lol.
unless you using it for gaming(which you would've chosen a windows os instead, if that were the case)
fuck kubernetes
just VSC into it
vsc + ssh
Does ssh'ing require me to open a port on my firewall?
yes
Guys I just got muted the dumbest way possible-
you need a port for incoming connections
I host my bots on a cluster with 100's of other services, so SSH isn't the best option.
Someone posted a pic of their cat and I said I wanna eat it- and i got muted lol
ssh WOULD be the best option, yeah
Shit, can't do that because I don't own the router
specially if your bots store stuff in there
imagine having a non secure environment for bots
rip all user data
I'm looking to transfer all my bots to the VPS temporarily due to my internet timing my current box out randomly
what
And host the bots on the VPS
any decent provider show allow u to open ports
Generally docker is more secure than a VPS, your process is run in a sandbox.
The ISP account isn't mine
well yeah, but still should have an ssh setup to access it
what
u using digital ocean
why would it matter about what ISP they use or not
Yeah, you can still shell into your docker container.
I'm talking my HOME internet
why u opening ports on ur home internet
are you hosting your ssh server there?
That's what you said
well theres that
you asked on digital ocean
not in ur home
you dont need any setup on ur personal pc
just install putty and ssh into your vps
i sure hope they have it setup for you, cuz otherwise you'll be in a world of pain
Yeah
It's been a while since I have used DO, but don't they install your SSH key into the VM for you?
Don't even need to setup an SSH server.
const Schema = require('../../models/custom-command');
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'cc-list',
description: 'list of custom commands',
execute: async (client, message, args) => {
const data = await Schema.findOne({ Guild: message.guild.id });
if (!!data === false)
return message.channel.send('**There is no custom commands**!');
message.channel.send(
new MessageEmbed()
.setTitle('Custom Commands list')
.setColor('RANDOM')
.setFooter(message.author.username, message.author.displayAvatarURL())
.setDescription(
data.map((cmd, i) => `${i+ 1}: ${cmd.command}`).join('\n')
)
);
}
};
Error : data.map is not a function
what is github's new codespace is all about?
You can code on it
like github1s?
coz, data should be an object not an array
does anyone know how i can do this https://zt0ht.is-inside.me/LHC1kMcW.png
the links part
Does anyone here know how to escape a variable in RegExp?
let string = `dog "cat" fish`
let mark = `"`
let quoted = new RegExp(`${mark}[^${mark}]+${mark}`, `g`)
let quotes = string.match(quoted)
console.log(quotes) // result: ['"cat"']
Above is valid when the mark is ".
However, when I want to mark to be ^^, the result is null.
How do I make the result ["^^cat^^"] if the string is dog ^^cat^^ fish?
got it solved on the other server, thanks tho
suggest me a command asap
random dog images command
a command that generates 0.001px x 0.001px on a 1000 x 1000 canvas randomly
a command that runs itself
insert a double backslash before the character you want to escape
that will output the regex \^ and escape the ^
i do
an exception and also an enum relying for HTTP status codes in case i have to throw one outside of my main scripts
easy to infer upon
although it's 4 in the morning
i'm losing my shit slowly
i think i'm writing worse code by the minute now
is an embed generator worse than writing a file reading class?
because im making one
well i have to make a feeder for sanity checking
which is what I feel like the computer needs to do it me more right now
and not to it
if(message.content.includes(a)){
const data = await schema.findOne({Guild: message.guild.id, Command: a})
if(data) message.channel.send(data.Response)
}```
Its not sending any message
I want to make it wildcard
how does your schema looks like?
also it should be parsed as a object on data, so if you dont have a Response property it should be undefined
Hi I want to make a music bot. I got him to join the vc but he doesnt play the Musik can you guys help me ?
Yes
Now I'm gonna track down your location,
Take 18 hours flight
Go to your house
Break in
steal your pc
Avoid the cops
Come back to my house
Fix the code
and give it back to you
Ok xD
and then he writes code in assembly
so you wasted 36 Hours in a plane
then add few more steps
- Take the pc to area 69
- Ask the aliens to fix the code
Thats 100% the best way to do it
it would help us to help you if we knew some stuff
like what language you use and lib
and if you get errors
Ah I just fixed it but thanks that u guys wanted to help me
Let's say that I have an array of guilds. How can I divide it into 2 or more arrays, where each array has similar (or in an ideal world, equal) total sum of guilds' member counts? Pseudo code would be really appreciated
There are a few ways to do it
๐น๐พ๐๐๐๐๐๐พ๐๐
This Fond is bad for my eyes
that looks like my notebooks
@drowsy crag
smh I was gonna ping nom
yeeted alr
lel
hey, i'm using repl.it to run my bot but it's showing some errors, i've installed all the modules required
it's working fine on VS Code ;-;
are you sure you have the correct py version
try python
Yeah too much real
py launcher works for windows
yep
@earnest phoenix bro you okay?
You've been typing for like 10 minutes
Hello. I need help with an reaction poll (I dont use it as a poll) and thats why I want the @ to get out of there, but I just cant do it. Like it says : @earnest phoenix won the poll (I change the answer later so it doesnt say "the poll") but I want it to be like "won the poll" (bc as I already said I wanna use it for something else
I littleary had the whole text writen in the wrong language
...
So you don't want
@Green won the poll
Instead you want
Won the poll
?
Yes
we still dont know the language / lib you use
Bc I want to use it for something else
Show code where you do it
||Please don't bring assembly||
I just realised that it ist a poll more like a vote
Assembly: When you want to reinvent the Wheel for doing basic stuff.
message.react('๐').then(() => message.react('๐'));
const filter = (reaction, user) => {
return ['๐', '๐'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '๐') {
message.reply('won.');
} else {
message.reply('won.');
}
})
.catch(collected => {
message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
});
pls use a codeblock next time
I did i thaugth
bcs sometimes discord fucks with code
change
message.reply
`message.react('๐').then(() => message.react('๐'));
const filter = (reaction, user) => {
return ['๐', '๐'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '๐') {
message.reply('won.');
} else {
message.reply('won.');
}
})
.catch(collected => {
message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
});`
Bruh
with message.channel.send
Oh
message.react('๐').then(() => message.react('๐'));
const filter = (reaction, user) => {
return ['๐', '๐'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '๐') {
message.channel.send('won.');
} else {
message.channel.send('won.');
}
})
.catch(collected => {
message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
});
fixed
const filter = (reaction, user) => {
return ['๐', '๐'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '๐') {
message.reply('won.');
} else {
message.reply('won.');
}
})
.catch(collected => {
message.reply('you reacted with neither a thumbs up, nor a thumbs down.');
});```
Wtf it no work for me
anyway back to topic
replace message.reply with message.channel.send` and it should work
Ok thx
Let me try
hello how cn we update node in terminal
pls say
i use node 12 now i want use node 14 so
pls say
sudo apt-get update
sudo apt-get upgrade


