#development
1 messages ยท Page 1415 of 1
same
if(message.content.startsWith(prefix + "matchmake" )){
if(!message.mentions.users.first()) return;
var embed = new Discord.MessageEmbed()
.setTitle (message.channel.send(Math.floor(Math.random() * 100 + 0 )))
.setTimestamp()
.setImage('https://64.media.tumblr.com/54387c664752cff1b5f868ab1e37e1ee/tumblr_nm7pt6VxgF1u9ia8fo1_500.gif')
message.channel.send(embed);
}
it wont put the number in the title
it Randomly put a number
that doesnt answer my questions lmao
so you get a random number *100 +0 = random number *100
so i have sq lite db browser but if i want to edit the DB i have to export the file manually. in case something goes wrong in the db (such as the DB gets malformed), is there any possible way i can make it so theres always a backup? (aka 2 databases, but the 2nd one doesn't do that much)
since its a number and not a string
because i want it to put a random number 100 out 0
in your bot? which library are you using?
node.js
sqlite library
require("sqlite-what?")
i have require("quick.db");
ah
Math.random() * (max - min) + min; this would be for a number range
does quick.db not have a backup function?
so it need to be a string
im not sure lemme look into it
min and max are just number values
if you use + on a Javascript string you will join both strings
so 1+0 = 10
ok
meth
doesnt look like it, furthermore, quick.db doesnt expose the underlying sqlite database
there is an easy workaround tho
like this?
if(message.content.startsWith(prefix + "matchmake" )){
if(!message.mentions.users.first()) return;
var embed = new Discord.MessageEmbed()
.setTitle (message.channel.send(Math.random() * (100 - 10) + 3))
.setTimestamp()
.setImage('https://64.media.tumblr.com/54387c664752cff1b5f868ab1e37e1ee/tumblr_nm7pt6VxgF1u9ia8fo1_500.gif')
message.channel.send(embed);
}
yea there is no backup function unfortunately
tf are u doing in the title
quick.db uses better-sqlite3, so if you have one installed, you have the other installed automatically as well
so you can require("better-sqlite3")
sqlite3 has a backup function?
then initialize the database using the same file as quick.db uses, this will open the database instead of creating a new one
no. read the example again
then use better-sqlite3's backup function
oh ok thanks
db.backup(`backup-${Date.now()}.db`)
.then(() => {
console.log('backup complete!');
})
.catch((err) => {
console.log('backup failed:', err);
});
how many times is it going to back up?
only once
or can i like set an interval
you can set an interval
Is anyone else having problems downloading something on ytdl?
it got nuked a while ago and then added back. probably you need to update
uhol, okay
it got nuked? lmao
yea YT sued them
oh you mean the copyright thing
then they took it down
but that wasnt targetting ytdl, it was targeting youtube-dl no?
keyv (npm) downloads perfectly and easy on my computer but when I try it on a VPS, this happens:
node:internal/modules/cjs/loader:922
throw err;
^
Error: Cannot find module '/root/two/hidodie/node_modules/sqlite3/lib/binding/node-v88-linux-x64/node_sqlite3.node'
Require stack:
- /root/two/hidodie/node_modules/sqlite3/lib/sqlite3-binding.js
- /root/two/hidodie/node_modules/sqlite3/lib/sqlite3.js
- /root/two/hidodie/node_modules/@keyv/sqlite/src/index.js
- /root/two/hidodie/node_modules/keyv/src/index.js
- /root/two/hidodie/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
at Function.Module._load (node:internal/modules/cjs/loader:763:27)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/root/two/hidodie/node_modules/sqlite3/lib/sqlite3-binding.js:4:15)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/root/two/hidodie/node_modules/sqlite3/lib/sqlite3-binding.js',
'/root/two/hidodie/node_modules/sqlite3/lib/sqlite3.js',
'/root/two/hidodie/node_modules/@keyv/sqlite/src/index.js',
'/root/two/hidodie/node_modules/keyv/src/index.js',
'/root/two/hidodie/index.js'
]
}
I fixed this once before but I don't remember how.
but then got added again after they removed the copy righted stuff that where in the core for testing
did you copy node_modules to your vps?
no i used npm i
did the npm i show any error?
nope
up to date, audited 165 packages in 1s
4 vulnerabilities (2 moderate, 2 high)
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
just normal stuff
i should sudo
same thing
i did try that and npm i @keyv/sqlite
i should try degrading to nodejs v12
v12.18.2
try npm rebuild sqlite3
alr started downgrading, i dont want to interrupt the process
done
yep rebuilding fixed it
thanks!
if (!whitelist.users.includes(message.author.id) || !message.member.roles.cache.has('753954073694175254') || !message.member.roles.cache.has('753953764779622430') || !message.member.roles.cache.has('753953699268657264')) {
message.channel.send("You aren't allowed to announce!")
return;
}
why isnt this working if the user has the irole
if(!whitelist.users.includes(message.author.id) && !message.member.roles.cache.has('753954073694175254') && !message.member.roles.cache.has('753953764779622430') && !message.member.roles.cache.has('753953699268657264'))
because your logic is nonsense 
correct
so doing && would fix
im reading thou
ok in words :
if(USER_NOT_IN_WHITELIST && USER_NOT_IN_GROUP(x) && USER_NOT_IN_GROUP(y) && USER_NOT_IN_GROUP(z))
then return;
so liek that
message.member.roles.cache.has('753954073694175254') returns true if he has the role
...(message.author.id) && >>>!<<< message.member.roles...
Check if the user DOES NOT have this role
After all the stuff you guys told me i think i got more braindead ๐
@solemn leaf You got it?
Did you copy the code above?
no?
if (!whitelist.users.includes(message.author.id) || !message.member.roles.cache.has('753954073694175254') || !message.member.roles.cache.has('753953764779622430') || !message.member.roles.cache.has('753953699268657264')) { ... }
Still doesn't make sense
do I need to do &&
if(!whitelist.users.includes(message.author.id) && !message.member.roles.cache.has('753954073694175254') && !message.member.roles.cache.has('753953764779622430') && !message.member.roles.cache.has('753953699268657264'))
thanks
if ONE of your conditions is true, the statement is done
You need to check ALL conditions
Try to imagine your example in words compared to what I've sent.
lots of people using discord.js
Hi, I want my bot to send memes, I use discord.js, I don't want reddit api
errr... fuck markdown
@hard anchor try using random puppy
I already did, I just need code
guess you need to code it yourself...
I am relatively new to node.js
spoon feeding
@hard anchor try a tutorial as they go into depth
Welcome to a new series where I, synopNode() [also William], show you how to code a Discord Bot using NodeJs with the Discord.JS API from scratch!
This episode, we make a meme command to post some JUICY MEMES on Discord!
Next Episode... FIND OUT WHEN I UPLOAD!! XD
โฌโฌโฌโฌ CONNECT WITH ME โฌโฌโฌโฌ
โข Subscribe: http://bit.ly/officialspimy [Gaming Channe...
this uses random puppy
Thanks
The second part can use Array.prototype.every() instead
Which should look cleaner and better
<Array of IDs>.every(r => !message.member.roles.cache.has(r))```
in trying to get from the nekos.life api, nothing happens
Code?
let res = reqwest::get("https://nekos.life/api/v2/img/kiss").await?.json::<JSONres>().await?;
println!("{:?}",res);
```nothing printed
#[derive(Deserialize, Debug)]
struct JSONres {
origin: String
}
```the JSONres struct
reqwest moment
reqwest is pog
Not even errors?
shouldn't it be url, not origin?
you should've pinged him not me 
I think your code is being propagated upwards due to the ? operator holding a Result with the Err variant.
apparently its a placeholder arg on the struct
Confused. The site returns a JSON body of: ```json
{ "url": "..." }
And there being no `url` field, I don't see how it being a placeholder could be correct.
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
location / {
proxy_pass http://localhost:8000;
}
}
^ worked perfectly (wasn't example.com)
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
upstream websocket {
server localhost:8000;
}
location / {
proxy_pass http://localhost:8000;
}
}
^ but when I tried to add websocket support to the reverse proxy, it gave me an error when i tried to restart it
that error being?
is there a way to add websockets with reverse proxies?
what happens on nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/twostuff.conf:11
nginx: configuration file /etc/nginx/nginx.conf test failed
you cant have a ws connection in a server block
not http im dum
oh
put it outside of the server block
root@www:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
time to systemctl restart nginx
no errors but
oh
i think ik the problem
wait if i use cloudflare, will websockets automatically become wws?
i got a 200 error
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
location / {
proxy_pass http://localhost:8000;
}
}
upstream websocket {
server localhost:8000;
}
^^ working (not example.com) but websockets still dont work
My bot wont start up someone help me man like it needs to be up 24/7 so it can get reviewed and im so worried now i need help ASAP
uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
you need a host server then right?
????????????
but like first of all what are u using for ur bot?
where do you host your bot now?
CSS and js
for js are u using nodejs and discord.js?
i forgot
._.
i have been worrying to much about it not being bloody up
how can you forget which lib you are using lol


BECAUSE ITS BEEN || FUCKING|| FOREVER I HAVE BEEN WORRYING TO MUCH ON WHY ITS NOT WORKING
ok chill
send a screenshot of your package.json file so we can check
i swear if u dont have a package.json file ._.
chill ive been trying to fix my reverse proxy problem since yesterday afternoon
oh good
but its different my bot is under review and its offline
discord.js then
the package name cant have caps or spaces im pretty sure
well it was working fine before
lemme check
are u getting an error in ur terminal when u try to turn ur bot on?
npm init wont let u add spaces
or a general error in ur code?
anyways, back to your original question, you have to get a server for your bot then... @earnest phoenix
what do you meAN?????????????
?
._.
WHART
???????
???
?@?????
?@
@earnest phoenix @earnest phoenix @earnest phoenix
?
THERE IS A BLOODY P
i meant in ur terminal bud
bro
u typed it wrong
calm down
were/????
ima smash my keyboard
that is just a money waste but ok
lol
lol
you want your bot online 24/7 right?
man shush honestly ima bout to come round and smash the keyboard into your window
omigod
lol
lol
really you should calm down
yes i finally fixed my reverse proxy
๐ฆ
you want your bot online 24/7 right?
Yea
ok find a hosting program
i recommend https://something.host
its free!
lol
I Am already using the shitty thing
wut
??
there support is terrible
wut are u using?
they didnt help me
tf are u using boi
hey listen we are just trying to help
how can i make my bot update the membercount when someone left or join ? (i refer the membercount of all guilds)
i hope this doesnt count as advertising, there's also glitch.com (with google script pinger) and danbot hosting
most host supports dont support you on how to code just sayin
@earnest phoenix member.guild.members.cache.filter(m => !m.user.bot).size is one way to get the member count excluding bots of one guild
let member = msg.mentions.members.first() || msg.member and you can easily define member such as something like this
?
how come the discrim isnt correct when i view the app in discord dev portal
3371 is not the discrim
you need to enable server members in your developer portal, otherwise you wont receive memberAdd/memberRemove events
^
intents
@bronze bramble how are you viewing the discrim in the dev portal?
oh
Im blind as fuck
never knew that was there
@boreal iron
@solemn leaf
probably need to be escaped
escape markdown?
like all special chars
?
I don't see any in your pic
the \n is a new line
string.replace("\n", "\\n");
As you can see Discord thinks you wanna escape something, too
so no?
let title = params[0].trim().replace("\n", "\\n");
let desc = params[1].replace("\n", "\\n");
not sure but I guess it shouldn't cause issues
so I can do that
don't know why not, test it, yes
what are you trying to do ๐ค
wut
so what solution
it's an escape char
First of all I'm not sure if the title can be a multiliner
it can
gimme one sec
what are you trying to do ๐ค
his embed.setTitle escapes any \n
but what are they trying to do
but why lol
just do a newline in your message
instead of writing \n and then trying to convert it in your code
sending a message
like this
will get interpreted as sending a message\nlike this
Nah I remember he's doing an announce command using a d: param putting the text behind into the embed description
it wouldn't matter though
a newline is a unicode char like any other
the only thing special about is that it is rendered as a... new line
what is your code right now
well you need to remove the code which replaces your \n
for both vars
a newline is a unicode char like any other
aye but any input the user does should be supported, even if he uses a one liner entering \n
that's the user's fault for being dumb ๐คทโโ๏ธ

a normal user wouldn't even know what \n is
well good argument lmao
but talking like this I wouldn't expect the user neither knows to press SHIFT + ENTER
but talking like this stop calling my friends idoits

let title = params[0].trim());
let desc = params[1]);
let channel = message.mentions.channels.first();
const embed = new Discord.MessageEmbed()
.setColor(embedconf.color)
.setTitle(title)
.setAuthor(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
.setDescription(desc)
.setTimestamp()
.setFooter(embedconf.author.text, embedconf.author.image);
@earnest phoenix
but I wanna use \n
h-huh?
didn't think of that in the first place
hmm looks like the line break is escaped already
keep in mind
does discord escape it?
\n does not actually look like \n, it's just a standard to insert a newline
test\nyes\nDiscord\ndoes
discord doesn't
yes it does
I am not finding any good resources to connect my postgress with discord js bot 
\n does not actually look like \n, it's just a standard to insert a newline
lmao
if you type in \n in your message box right now and send it
the value of that message is going to be \\n and not \n
however, if you write
aye, escaped
yes 
let title = params[0].trim().replace("\n", "\n");
let desc = params[1].replace("\n", "\n");
that is effectively not doing anything
Use code tags or this discussion will never end
read what i said it's going to clear your confusion
so mark it as global with regex
wtf reges is weird? nah
discord made me do shift enter when ever I want to do enter so
there's also a new feature - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
@solemn leaf replaceAll
fr

shame on me
you're reinventing the wheel when you shouldn't need to ๐คทโโ๏ธ
well if he likes to do 
yeah
replaceAll is a new feature of the ecmascript 2021 spec doc i think
nevermind, ecmascript 2020
I mean you can still use replace() using regex
you don't need to know regex
yes I do
Embed = new Discord.Message.Embed()
.setColor('#f02016')
.setTitle(`Expert bot Commands:`)
.setDescription(`?robloxfind ,a invite bot link for unclaimed roblox group!`)
.setDescription(`?hack , fake pretend hack!`)
.setdescription(`?online ,see how many people that are online in this server`)
.setdescription(`?say ,the bot says what whatever u put in after the cmd!`)
.setdescription(`?server ,see how many members are in this server!`)
.setdescription(`?youtube ,checkout my youtube channel!`)
.setdescription(`?beg ,begs for money`)
.setfooter('Create by Jeremy');
message.channel.send(Embed);```
just incase your string with a global flag; /str/g
replace(/\\\\n/gi, "\n")
yeah
well first
not only global, also case insensitive if he's going to use \N
good point
you know he's doing weird things :D
fakje
o
what about like
and everytime you call it, you overwrite what was set before
@solemn leaf #development message
im not doing this more lol
wut?
its said ```message.channel.send(Embed);
^
ReferenceError: Embed is not defined```
i have this Embed = new Discord.Message.Embed()
you shouldn't copy and paste things without understanding the basics
let my_var = null;
this_is_not_a_var = error;
but this one works if (command === 'daily') Embed = new Discord.MessageEmbed() .setColor('#21eb67') .setTitle(`${message.author.username} recieved 1,000 JG coins`) .setDescription(`come back tomorrow to get your next 1,00 JG coins!`) .setFooter('Expert'); message.channel.send(Embed);
Message.Embed != MessageEmbed 
You really should look at the basics of js (objects) and read discord.js docs
guess he just had a typo in his message before
there's a lot of kiddos making bots without even knowing what is a language so I'm just guessing here
wait is it .setField or .setfield
I'm more worried about all those kids renting a server and have no clue how to administrate it. Watching the growing amount of bot servers and daily attacks
ok
Somebody know how to host my bot from vps ?
i have vps but i dont know how to host my bot from it
it doesn't let me type my password, but before that it let me type. This is postgress, I am trying to connect through localhost
oh
its not that good
wrong channel
@stark abyss just copy the password then paste it in the command ctrl+v and then enter
yeah ty
idek i am tryna use it through visual studio
install python or nodejs, whatever u wanna use
hm
wut?
I am using the code
@tasks.loop(hours=24)
async def my_loop(*args, **kwargs):
now = datetime.datetime.now()
next = now + datetime.timedelta(hours=24)
# Do the normal tasks
now = datetime.datetime.now()
interval = next - now
self.change_interval(hours=interval.hours, minutes=interval.minutes, seconds=interval.seconds)
@my_loop.before_loop
async def my_loop_before():
now = datetime.datetime.now()
next = datetime.datetime.now()
next.replace(hour=start_hour, minute=start_minute, second=start_second)
if next < now:
next.replace(day=now.day + 1)
await asyncio.sleep((next - now).total_seconds())
And i keep getting the error:
Unhandled exception in internal background task 'my_loop'.
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "/home/container/main.py", line 57, in my_loop
self.change_interval(hours=interval.hours, minutes=interval.minutes, seconds=interval.seconds)
NameError: name 'self' is not defined
What should i replace self with to get it to work?
Somebody help me with vps host ?
yeah
so what should i change it to?
i dont think this is defined as well
how about
my_loop.change_interval?
nvm i got it
module.exports = {
name : 'slowmode',
description : 'Limite de mandar mensagem em um determinado tempo ',
async run(message,args) {
let msgs = args[0];
if(!message.member.hasPermission('MANAGE_CHANNLES')){
let embed = new Discord.MessageEmbed()
.setDescription('Vocรช รฉ fraco, falta lhe permissรฃo de `Gerรชnciar Canais` para usar este comando')
.setColor('#9edb87')
return message.channel.send(embed).then(msg => msg.delete({timeout: 5000}))
}
else if(!args[0]){
let embed = new Discord.MessageEmbed()
.setDescription('Poucos argumentos | `,slowmode <tempo>`')
.setColor('#9edb87')
return message.channel.send(embed).then(msg => msg.delete({timeout: 5000}))
}
else if(args[0] === 'none'){
await message.channel.setRateLimitPerUser(0)
let embed = new Discord.MessageEmbed()
.setDescription('slowmode resetado a 0 segundos')
.setColor('#9edb87')
return message.channel.send(embed).then(msg => msg.delete({timeout: 5000}))
}
else if(isNaN(args[0])){
let embed = new Discord.MessageEmbed()
.setDescription('Insira um nรบmero')
.setColor('#9edb87')
return message.channel.send(embed).then(msg => msg.delete({timeout: 5000}))
}
const time = Number(args[0]);
if(time){
await message.channel.setRateLimitPerUser(time)
let embed = new Discord.MessageEmbed()
.setDescription(`<a775482737766563850> |Slowmode ativo em ${time}`)
.setColor('#9edb87')
return message.channel.send(embed).then(msg => msg.delete({timeout: 5000}))
}
}
}```
my error is in permission
can i help me?
i need help finding a good bot hosting website anyone knows one?
Discloud
ok thx
what line
if(!message.member.hasPermission('MANAGE_CHANNLES')){ this ?
you need to provide the permissionresolver
i try this,but give error
and you made a typo
MANAGE_CHANNELS
http://sc.aymdj.me/cdn/00flygaq.png the flags
Can somebody help me with vps host I have vps
what is the os of your vps
why is it sending two
and what to do then, if you do not have permission from adm or moderator, I don't know ... the user cannot use this command
no, i dont have two pythons runnig afaik
we cant help you without seeing your code
i see
What ?
is your vps running with windows ?
Yes i think
i need?
OS = operation system
^ @earnest phoenix
tnks
@graceful dock so do you know how to host it
hosting a bot on a vps is just like hosting it on your pc
I need to know what is the OS of your vps in order to help you
Vps windows
do you have a graphical interface ?
:/ no
if I have a function in DJS code, would I need to pass down the parameters or the function would be able to access them when they're defined in a if statement?
mhh then I can't help you, I've never used windows on the shell as a vps
ok
can you reiterate
They need to be passed anytime
I didn't find anything strange in my code
Just choose an OS you know and install it
ok so, I have a mute command which would do some if statement checks before executing a function that is above the if statements, I would like to know as I havent fiddled with this, would I have to pass the parameters that would be let/const defined inside the if statements to the function before its called or would it be able to access them either way
You have to pass the parameters to the function every time you use it
Err declaring vars after the function you wanna use the as parameters doesnโt work
They need to be defined before you can access them of course
basically, ```js
let yes = "ok";
myfunc(yes)
will not tell the function to retrieve the value of yes, it will pass it the value of yes directly
idk if you understand me there since its not very clear
and having the function defined before the variable doesnt change anything
It does it will result in an error
no?
ok lemme see if I can type it in code
function myFunc() {
// function code
};
if (check 1) {
let check 2 = something;
if (check 2) {
let check 3 = something;
if (check 3) {
myFunc();
}
}
}```
lmao thatโs what you mean
something like this I'm thinking of, most probably I would have to pass the parameters to the function
but not sure tbh
const ok = (arg) => {
console.log(arg)
}
const lol = "yes";
ok(lol)
what parameters would you pass if the function in your code takes 0 parameter ๐คจ
Pass in nothing
it would take parameters, the thing is as I said I haven't really fiddled with this, so I gotta check before hand if I would need to actually pass them that are in the if statement or would I not
function myFunc(p1, p2) {
if(p1 == x || p2 == y) etc.
};
if (check 1) {
let check 2 = something;
if (check 2) {
let check 3 = something;
if (check 3) {
let a = 0, b = 1;
myFunc(a, b);
}
}
}
that's what u mean
well i'd be passing the check2 and check 3
np
so the function could set up a muterole's ID in the database for a server
if I have check 2 be a mentioned role, check 3 be whether to 'set' it or 'remove' it, i'd be passing those I presume
however I'm not sure if the position of the function does play a factor in a code
that's not what we were talking about, but this:
myfunc(yes);
let yes = "ok";
hmm
but I guess we both missunderstood him
yeh its a lil bit confusing
nope the position doesn't play a role
if you use this function one time only, creating this function is useless
uhh i'll use it one time, however it'll be executed in different parts of the code
using it multiple times even outsite your statements you will have to create the function like in your example
(scopes)
for exmaple I would like to allow server owners to set up a mute role by either mentioning it, or by role ID
so I'd have do check if its mentioned, or if its just an ID followed by the function being executed
Well just check the arguments of your command being a mention or a role ID
oh that would not work
its just like using a variable before referencing it, doesnt make sense
If u donโt use a command handler, just split your content by whitespaces (slice of your command) and check if the first argument is a mention or an ID
i use command handler, as well as i will have the mute command be used to set up the mute role
and also for muting someone
Correct, thatโs what I was explaining but he was talking about something completely different lmao
as well as updating channel/category perms
Ok your command handler splits your content already and provides you the arguments, right?
yes it does, I will be doing check if its ID or mentioned role
Aye thatโs what u need to do
what is wrong lads
and when its a role ID, i need to fetch the role from the guild roles cache to check if its valid, if its mentioned role then i just carry on with the function
so thats one if statement split
okay
const member = message.mentions.members.first()|| message.guild.members.cache.get(args[0]) || message.member
This does members
What is your function supposed to do?
so if its mentioned | if its a ID | the message member
so if you change that to roles
youll get what you need
would for example this work? JS function myFunc(param1, param2, param3) { //code } if (mentionedRole) { myFunc(param1 = mentionedRole, param2 = somethingElse, param3 = somethingElse); } else if (roleID) { myFunc(param1 = roleID, param2 = somethingElse, param3 = somethingElse); }
well so far I havent tested anythign, doing an update from DJS 11.6.4 to 12.5.0
Is mentioned role and role ID the same type def?
one would be if a role is mentioned with a @ another one would be just the role's ID
so you dont have to mention the role
so
if you do
const member = message.mentions.members.first()|| message.guild.members.cache.get(args[0]) || message.member this kind of thing for it
but change it to roles
you can do
what if they decide to give me channel ID or userID, cant attach that as muterole, it'll for sure cause crash for the bot
const member = message.mentions.members.first()|| message.guild.members.cache.get(args[0]) || message.member obv for roles
function myFunc(param1, param2, param3) {
//code
}
if (member {
myFunc(param1 = member, param2 = somethingElse, param3 = somethingElse);
that will not crash it
so if its just a role ID i'd like to verify it being a valid role ID before carrying on with changing the muterole's ID in the database
Well you donโt search the cache for members, you will have to search for roles
If somebody provides a channel ID for example a role with that ID canโt be found
If so you return the user has used a wrong parameter
oh it'll give it undefined
Yes
so basically, what i sent, goes
Of course you need to check the result if youโve fetched a role
you could just do, if(!mentionedRole) return message.reply("no role supplied")
so if it does give undefined, it would tell them its not a role
Not a role or not found which is the same result
mm then yeah what ghost suggested for roles would work without the last part
yes
meaning at that point I could have everything under one if statement and not need the function at all
thats why i use it 
fish
you dont need a funtion really
as the function's main idea was to save code lines rather than have same code copied over for 2 separate occasions
You donโt need multiple statements (if and else if) just one statement checking the results
Which is less code
yeh imma head on do that
Imma not familiar with djs but as Ghost wrote, check if the argument is a mention or a role ID, then check itโs valid and then execute whatever u wanna do
So, finalDepo is over 10000, and bankLevel is 10000
yeh, its what i do rn, send out ur problem Ghost, might be able to help oout
so why is it not triggering line 26
Will be at PC in a minute
okay
const db = require('pg')
const dbClient = new db.Client({
user: "postgress",
password: "my pass here",
port: 5432,
server: "localhost",
database: "discord test db"
})
dbClient.connect()
.then(()=> console.log("Connected to Postgres!"))
.catch(e => console.log(e))
.finally(() => dbClient.end())
Error:
error: password authentication failed for user "postgress"
I am sure the password is correct
this is postgress
shit I misspelled smh
also avoid using space separated db's
Ok
for consistency and some queries
@desert hazel probably the first return of bal < depo is causing the code to cease there
have you tried to test it when that is false?
cuz probs it gives it correct and it cuts it off there
altho the thing is I havent seen such a issue as they're 2 separate IFs
Ah It finally worked yay
so both should be executed
ouch eating ice cream too fast can hurt your brain lmao
see
test means its passed
the command has ran*
so its not been captured by line 26
you changed the order of those two and still line 26 isnt being executed?
what's not working?
then the if statement for finaldepo > banklevel doesnt return true
if(finaldepo > banklevel)return message.reply(`This will take you past your ${bank.level * 10000} limit, buy more with ,buy bank`)
if changing the order doesn't execute it either way
but it should be
as i console log it all
and its coming out correctly
WAIT
hmm
NaN
banklevel is NaN
Yea
regarding your log order, banklevel1 is
yeye
which means banklevel (parseInt()) fails
I wonder the amount of vars you use
why *= and not level = bank.level * 10000
idk, i used + before and realised it adds the args after
cant u just copy the code, too lazy to write it again
wait one sec
WC brb
this is bugging me
deposit
bank is an obj?
oh yeah, see your console logs, it is
still waiting for u to post the code
oh all of it?
not gonna rewrite all
one sec
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
thx
banklevel is always * 10000 ?
yes, so it goes up in 10k increments when you use a command, ,buy bank
you will get 20k limit
and so on
I wonder about banklevel1 = bank.level *= 10000
tbh i was trying shit
Your current bank.level fetched from the DB * 10000
yes
ok last question
ok
deposit
yes
been removed from your bank account
yeah
bank.bank
lol
I am using the code
@tasks.loop(hours=24)
async def my_loop(*args, **kwargs):
now = datetime.datetime.now()
next = now + datetime.timedelta(hours=24)
# Do the normal tasks
now = datetime.datetime.now()
interval = next - now
my_loop.change_interval(hours=interval.hours, minutes=interval.minutes, seconds=interval.seconds)
@my_loop.before_loop
async def my_loop_before():
now = datetime.datetime.now()
next = datetime.datetime.now()
next.replace(hour=start_hour, minute=start_minute, second=start_second)
if next < now:
next.replace(day=now.day + 1)
await asyncio.sleep((next - now).total_seconds())
And i keep getting the error:
Unhandled exception in internal background task 'my_loop'.
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "/home/container/main.py", line 57, in my_loop
my_loop.change_interval(hours=interval.hours, minutes=interval.minutes, seconds=interval.seconds)
AttributeError: 'datetime.timedelta' object has no attribute 'hours'
doesnt it have hours as an attribute?
@desert hazel
module.exports.run = async (client, message, args) =>
{
let deposit = parseInt(args[0]);
if(Number.isNaN(deposit)) return message.reply("Provide a number, dumbass");
let balance = await client.db.get(`money-${message.guild.id}-${message.member.id}`);
if(deposit > balance) return message.reply("Not enough money in your pocket, dumbass");
let account = await client.db.get(`bank-${message.guild.id}-${message.member.id}`, { level: 1, bank: 0 });
let new_balance = (account.bank + deposit);
let level = (account.level * 10000);
if(new_balance > level) return message.reply(`This will take you past your ${level} limit, buy more with \`,buy bank\``);
await client.db.set(`money-${message.guild.id}-${message.member.id}`, (balance - deposit));
await client.db.set(`bank-${message.guild.id}-${message.author.id}`, { level: account.level, bank: new_balance });
}
tried to use understandable names
lets have a go
can't test but should do what u expect, if I understood right
yeye i understand it
still don't get what the account.level does, but okay 
oh I forgot something lel
lmao one second, forgot something
oof ok
oh imma retarded
nvm
if(deposit > balance) return message.reply("Not enough money in your pocket, dumbass");
is in there already
loool
Thanks tho man
np
Hmm some users in the client list on the right have different names than in the chat
just hit CTRL + F5
wym
W T F is happening
It didn't change in the code you provided and not in what I've sent you
If transaction is successful and the level should be increased by 1 then,
Replace
await client.db.set(`bank-${message.guild.id}-${message.author.id}`, { level: account.level, bank: new_balance });
by
await client.db.set(`bank-${message.guild.id}-${message.author.id}`, { level: (account.level + 1), bank: new_balance });
Im using pillow to create this so i saw that it didnt show other languages and was just blank so i started using the unicode fonts, now it overlaps the screen even tho i have a check for it 
How do I get all arrays to open not like blablabla[0]
wut?
i dont want this
I want it to open and give values โโthe moment I enter the command
What do you mean by open?
An array contains elements/items
What you provided in your 2nd ss is an object, not an array
I want him to give all the objects not one by one
Oh looks like the nesting limit for DJS eval is 1
its not djs
its whatever you coded your eval with
you need to show your eval code
Why does it sound like you're just using someone else's eval? ๐
stop blaming me always just because I dunno djs 
lmao
%50 %50 .d
mmkay so, the thing is, javascript's eval doesn't... do anything other than run code and return the result.
Which means, what's doing... whatever this is that you're looking to fix, is the eval command itself.
But like, if you were to eval message.author.presence.activities instead of doing the [1] it would show you the entire array?
ye thats what he wants apparently
its just sending like this
Ok well that's how it outputs, which is probably just a JSON.stringify()
its probably util.inspect
you have to figure out how to output it in different ways. One thing you can look at it util.inspect
JINX
Lol
again shynox, you need to show your eval code
we're not gonna start guessing solutions for you
(at least im not)
its sooo long
pastebin/hastebin/sourcebin/whateverbin
holy mother of sweet baby jesus
XD
my eval command, the whole thing, including comments, is 34 lines ๐
mine is 65 lul
collector things take a lot of lines
let depth = 0;
your default depth is 0, which makes it show only top level properties
your code accepts a flag to change that tho, i dont know how you coded your command arguments
something like eval bla --depth=1 maybe
but if you change the default to 1 it will show more things
how can i like make flask show a div in html?
and the div not show normally
so like when u click a button/form flask does stuff and then shows u a element if its suppsed to?
Hey, my bot stopped working for some reason and it now won't go online. There was no error or anything, it won't go online, any help? I made no changes.
try remaking token?
I did that too
No luck :/
u literally did nothing?
try running another application on same code
try it?
to see if its like a ban or something?
Yes, I made no changes
did it work?
Won't run in my VPS, won't run on my computer as well
well like try running it on another application
Alright let me try that
if it doesnt work its ur code?
try remoing parts of it
one by one
and see if that fixes it
like remove small stuff
and then ull find the problem
Ah it ran, so guess the application got rate limited/banned? The last error was caused by a scheduler event that runs every 5 seconds. Well, fuck.. @drifting wedge
Thanks, for helping ๐
mhm
fix it then
lmao
cuz if u leave it itll get banned again
not sure if ban
but just be careful ๐
@valid grotto
Yup, I was asleep when the error happened. Thanks.
Also, is my bot completely gone or may it just be a limited API issue?
prob limited
they try not to ban often
but it can be for a while
- ur account can get temp-banne
if ur bot is fucking stuff
Ah okay, if it's a ban then that sucks, 50 servers and 90k users down the drain ๐ญ
prob not a ban doe
prob gonna be like a temp thing
I hope so, massive thanks for the help
dbClient.connect()
.then(()=> console.log("Connected to Postgres!"))
.then(() => dbClient.query(`CREATE TABLE afkTable(
user_id serial PRIMARY KEY,
afk_msg VARCHAR ( 255 ) UNIQUE NOT NULL,
);`))
.then(() => dbClient.query(`INSERT INTO adkTable(user_id, afk_msg)
VALUES (20227682022769, I am trying to code)
);`))
.catch(e => console.log(e))
.finally(() => dbClient.end())
error: syntax error at or near ")"
Postgres
@stark abyss what line?
hmm ok
is there a way to figure out who banned someone on ban
You could check audit logs.
in a bot
guildBanAdd
like
when a guildBanAdd accours user who banned role remove
Yes, you could check the audit logs to see who banned who on that event
I don't think there's an event including the user who banned someone.
It's in the audit reason.
ye
nah
im not sure
do it urself
ik
also dont even know what lang ur bot is in?
js
ill make it for u in c# or c++ or in brainfuck happily
but i doubt youd have any use for it
