#development
1 messages ยท Page 911 of 1
for example 'rpg' is one i intend to bid on once i update my bot fully to discord v 12 ๐
i dont really even have a tag that suits my bot
lol really
except perhaps 'fun', all bots should be fun right?
ive listed before under fun and social, both worked ok
i must of been on trending new bots gained 440 servers and now its gone completely silent no one has added it
i got tons last year, its slowed down now
im only upto 80 now, and its been like 2-3 months since i was featured ๐
im pushing for 2k
i am so grateful im not saying im not
oohh nice, gz!
nah i get it dood, obviously you want to keep growing ๐
whats your bot do?
mines a learning chat bot with the ability for server owners to add their own javascript
๐ฎ
Hi
how do they add their own code? how do you validate that their code isnt hacky?
yeah, its sandboxed in a system that even limits how much cpu time per request
what should i write
write what data you store and how did you secure your systems, like it says lol
i use a javascript interpreter embedded inside a C++ bot, so theres no "client.token" and not even a client object to query, it has its own simple api within the js
"i store all the data on a napkin by my bedside table"
I using glitch lol
oohhh nice one brain
okay.
btw, @green kestrel, you should use the brain from lil dickys image as your avatar imo ๐
Omg its so hard
https://github.com/brainboxdotcc/sporks/wiki/Examples#a-karma-script scripts look like this, theres no discord.js ๐
lol, not pinky and the brain?
filled mine out a few days ago playing the waiting game now lol
thats where my nick comes from, pinky and the brain
you know, off topic af. but there is a fan theory that 'the brain' was the one who was insane, and pinky was the genius, because he was able to constantly foil brains world domination plans. ๐
i always thought that was obvious rather than a fan theory ๐
brain so there's like no exploits like managing to read memory and breaking out of the sandbox?
you can tell the difference between homepage and not now lol
or accessing stdlib apis
- What specific Discord data do you store? ** | What does he mean here? I don't have much English
**
@earnest phoenix none that any have found yet, i was careful. youre limited in terms of cpu, ram, and even how complex regexes can be, as well as number of messages sent, amount and size and time for web requests
@toxic jolt exactly what it says lol, what do you store from discord
@earnest phoenix https://github.com/brainboxdotcc/sporks/wiki/Execution-Limits
so you programmed a custom js interpreter then?
no, i embedded one called duktape thats pretty much modern js compatible
instead of V8
smart
ahhh, interesting ๐
its much more lightweight, with duktape i can support thousands of scripts on my dedicated server at once, with node and V8 i'd struggle to support 50
@toxic jolt exactly what it says lol, what do you store from discord
@earnest phoenix hmm, message.author.id , guild.id ? Should I write them?
yes
Okay thanks
the source codes on github for my bot if youre interested ๐
//do something
setInterval (interval => function () {
if(active !== "active") return clearInterval(interval)
}, 1)
//do something
}, defined); ```
Why doesn't work this?
https://gyazo.com/83e66b84ca8fc426ec7dc7c29cf86abf urgh this annoys me lol
server maintenance read announcements
already looking at it brain ๐
it's smart to put strict limitations on it, i've seen people break out of "sandboxed" evals by just accessing the kernel api and reading memory of other processes lol
you want modules/js/js.cpp if you want to see how it does the javascript
oops i didnt even see announcements lol
ah, i dont have a kernel api or even filesystem access, it only has the functions i explicitly code into it ๐
thats not how upscaling works (โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
those and any javascript builtins
how can you even make a channel follow like that
since october
...
but i gave coding on it a break since feb, as ive been working on a game
that's a news channel @earnest phoenix
had to come back to coding it to fix some bugs, and make users happy, and also to support intents ๐
but: the bot is based on a previous bot for IRC
iirc only partnered/verified and guilds from people with the dev license thingy have it
just to make you feel better, that bot is 18 years old
thats so trash
all that one did was learn stuff, he knows 8 million responses
lmao
you can get a news channel with enough boosts too iirc btw @earnest phoenix
I have issue i don't know how to fix it, when i change bot volume to 50 for example it will change to 50 in every servers... Anyone can help >_<
@neat ingot see #265156322012561408
i mean, you have basically coded a custom javascript discord api in c++ thats only usable within your bot ๐
zynb, i unfortunately donated my crystal ball to healthcare workers to help fight covid-19 so you'll have to give us a bit more details
how do you get news channels lol you gotta be a partner or something
yes
or buy the dev license thing
Buy a developer license 
How have you secured access to your systems and infrastructure? | what did that mean help @earnest phoenix
what securities do you have to prevent people from breaking into your server and database
Hmm.
oh god
what security should i have 

considering you're using glitch probably none lol
@toxic jolt You gotta answer them on your own 
@toxic jolt @earnest phoenix lets keep the off-topic emotes in #memes-and-media as this is for development help.
Same for you @rich hazel
Sorry m
so you know trending new bots im 5th with 92 votes i have more votes than 1st how comes its 5th haha
am i missing something
like how does it work
yusss. i totally got away with it all ๐
i was there for like a day and a bit ๐
lucky ๐
i was gaining bout 150 servers a day when it first got approved now its quiet lol
tbh i wish my got was getting approved now
so many more potential users with the corona lockdowns
approved on what top gg
yea, cause then i'd be on trending while there are like 5x more people using the site
im on trending i was getting loads id wake up and have like 50 added servers
woke up today didnt have any
how to make command that if i triggering it that will send random message
let array = ["random", "message", "you", "can", "place", "here", "many", "things", "u want"]
let msg = array[Math.floor(Math.random() * 10)]
//then send the msg to channel with random msg``` example in js
create an array of the random responses, and randomly choose one.
Function: bot.on("message", async message => {
await sleep(zz);
I want to wait for sleep() but it says error: "SyntaxError: await is only valid in async function"?
await is only on async function
<client>.on("event", async (event, arguments) => {
console.log("event emitted");
});```
u cant change it
Seems so
ye
nice
oh
xD
But it doesn't work for content
wait let me see in the website
try it with that ?
kk
<div class="content">
try this
div.longdescription
<div class="longdescription">
div.longdescription
{
background-color:black;
}
this?
div.longdescription
<div class="longdescription">
div.longdescription
{
background-color:black;
}
only
div.longdescription
{
background-color:black;
}
yep
mhm
Yep me too
so .longdescription .content
Query for : "Cannot send messages to this user"?
nah ncm
nvm
Oh I almost solved it using margins
how ?
im messing around and trying shit
so make ur width longer
yep
or add some padding
#bot-details-page #details .container {
border-bottom: 1px solid #18191c;
border-top: 1px solid #18191c00;
padding: 40px 0;
}```
yw ๐
@zenith terrace cuz there are no boder
@earnest phoenix https://i.imgur.com/L3nWniw.png im messing around with this in imspect element
i have made a mistake
me to myself
boder
omfg it finished!
yea... that really wasnt worth the 3 hour wait time.
note to others: dont bother using waifu2x to upscale videos.
@zenith terrace ?
@neat ingot It depends on the quality, 360p to 720p
is much better than 720p to 1080p
@earnest phoenix boi ๐
just not worth the wait time for an ep of south park i already seen ๐
yea, for sure its pretty neat. but the time it takes it just obscene ๐
No defined
Error: ENOENT: no such file or directory, open 'path\node_modules\canvas\build\config.gypi' anyone ever gotten such an error when trying to install node-canvas? I updated my node version to latest but that broke tons of things so reverted and now I'm getting this
yes
umm
sec, i wrote down how i fixed it
I legit cant find it now wth, im gonna need that again as well lmao
there was a thing i had to make sure my environment had
do you use npm or yarn?
npm
in my dockerfile i use yarn, i feel like it was to resolve that issue
yarn install --production
rebuilds the things from source or something
im sure np will have a similar feature
Also I get different errors too:
fatal error C1083: Cannot open compiler generated file: \node_modules\canvas\build\Release\
obj\canvas\BMPParser.obj Permission denied
fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory
everytime it's different
what is the machine bots running on?
Windows 10 64bit
ahh, mine was a docker container which runs super minimal linux i beleive
oof, this is really annoying
oh, apparently the production flag is only to ignore devdevependancies wth
npm install --build-from-resource
fatal error C1083: Cannot open compiler generated file: 'path\node_modules\canvas\build\Release\obj\canvas\BMPParser.obj': Permission denied [path\node_modules\canvas\build\canvas.vcxproj]
I have other packages that require node-gyp and they get installed just fine
So I am not sure it's really a permission error
yea, i had tons of issues with canvas when i moved to docker containers
which canvas version?
"canvas": "^2.6.1", is what im using atm
yeah this one
This is happening cause I installed node v. 14.1.0 to try the latest features, had to rebuild canvas, rebuilding did not work, so I just switched back to my previous version (12.16.3)
v0.13.0
I have to go rn but later I'll try to downgrade node-pre-gyp and I'll ping you with updates. Thanks
np dude, gl! ๐
Hi. Im trying to update a database (with quick.db) and then send the data in that database whenever the command is run but for some reason it sends the old data from the last time i ran it... im trying to do db.set() and i might be doing something wrong...
setInterval(() => {
snekfetch.post(`https://discordbots.org/api/bots/${bot.user.id}/stats`)
.set('Authorization', 'DBLtoken')
.send({ server_count: bot.guilds.size })
.then(() => console.log('Updated stats.'))
.catch(err => console.error(`Whoops something went wrong: ${err.body}`));
}, 3600000)```
does this work for updating top.gg stats?
๐
Hi. Im trying to update a database (with quick.db) and then send the data in that database whenever the command is run but for some reason it sends the old data from the last time i ran it... im trying to do db.set() and i might be doing something wrong...
quick question how do u make a cooldown for a command
adding on to that, is there anyway to make a cooldown for a specific user for a command?
@cosmic girder my idea would be use the time.time() function to record when the command is used
create a variable that stores the last time the command was used successfuly
eaach time someone tries to use the command, check to see if the current time - the last used time is greater than some cooldown period
if so, run the command and updaate the value of the last_used variable
ty
np
quick question how do u make a cooldown for a command
@cosmic girder which library do you use?
@thin jacinth wdym
Discord.py, discord.js, etc
discord.js
what library do u use for a bot
typical that its js when they dont even know a lib
Oh okay
I use discord.py
depends on what the command cooldown is
is it a simple 5sec cooldown
or something like 24h
u can use a set
@cosmic girder if you're going to store the timestamps you'd better make a dictionary to make independent cooldowns for different servers
and some setTimeouts
ok
Depends on your purposes but still
{
guild_id: {
member_id_1: timestamp,
member_id_2: timestamp
}
}
again thats not needed in this case
Kk
I didn't read the dialogue above, my bad
but more than 2h i would store in a db
Yeah in case the bot shuts down
If your bot shuts down, the server will probably be offline for enough time to not matter much for 2 minutes
pretty good
Yeah
idk if this is the right place u would ask tho
Make the buttons bigger though
maybe in #memes-and-media but a mod can clarify if u want
msg.channel.awaitMessages(() => true,{ max: 1})
.then(collected=>{
console.log(collected)
})``` hey, im trying to await for messages in a channel, thats my code but nothing happens in the console after i write a message... any help?
const quiz = require('./quiz.json');
const item = quiz[Math.floor(Math.random() * quiz.length)];
const filter = response => {
return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};
message.channel.send(item.question).then(() => {
message.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
.then(collected => {
message.channel.send(`${collected.first().author} got the correct answer!`);
})
.catch(collected => {
message.channel.send('Looks like nobody got the answer this time.');
});
});``` thats an example from docs
so ur missing time
do i have to put time?
for how long to wait for a message yes
u can use a set
i prefer Map
@pallid marsh nerden รงaldฤฑn amk malฤฑ
@flat pelican
a mod pls -notr
turkish slurs...
ooo @crisp crown naber ya gรถrรผลemiyoruz
@flat pelican tanฤฑyamadฤฑm?
tanฤฑลtฤฑrayฤฑm, ben ban hammer
eee
๐
Anyway know how to use Sequelize to check all rows with X for Y?
**Example: **
//I want to check if the MatchList Database already has a user already in a match
//This finds the row we want to check.
const CheckUser = await MatchList.findAll({ where: { GameID: args[1] } });
//This checks the GameID row's UserID and if it equals the message author's ID and if does, it says you're already in the game/match.
if (CheckUser.UserID === message.author.id){return message.reply("You're )}
This seems like it should work in theory but the MatchList.findAll does not check all of the rows with the same GameID, only the first row with the GameID
Any one know how to change text coller red in discord
where
oh
u cant change message colors
just the little bar on the side of embeds
dude
thats a codeblock
they literally ignored us
that page tells you how just open your eyes and fucking read
u cant see codeblock colors on mobile
it doesnt work on mobile bro
Oo
cool
this guy doesn't fucking read
Anyway know how to use Sequelize to check all rows with X for Y?
**Example: **
//I want to check if the MatchList Database already has a user already in a match
//This finds the row we want to check.
const CheckUser = await MatchList.findAll({ where: { GameID: args[1] } });
//This checks the GameID row's UserID and if it equals the message author's ID and if does, it says you're already in the game/match.
if (CheckUser.UserID === message.author.id){return message.reply("You're )}
This seems like it should work in theory but the MatchList.findAll does not check all of the rows with the same GameID, only the first row with the GameID
speaking of changing colors, my bot randomly selects a color from all available embed colors when replying
i thought that was kewl, mostly because the embed color is so tiny that it doesnt give a good enough indication for the responding message
@wanton wasp you're missing a
"
and use nested for loops
one for x and one for y
for (let i = 0; i < rows.x; i++) {
for (let j = 0; j < rows.y; j++) {
// do crap with the j and i cords
}
}
don't ask me where you can get the rows object bc this is pseudo code
I have one problem to deal with
My bot organizes kind of Clan Wars on discord servers
I store every clan in my DB but every time someone wants to edit a clan, he has to provide the exact clan name as a command argument which is not cool
So I decided to add "searching system" but there are 2 ways to make it
- Load all clans linked to the server where the command was used and let author to provide a number of the clan he is looking for
- Load only names, perform search and load the matching clan from DB after the author choice
1st way cons are:
-> A lot of memory is going to be used while performing search
2nd way cons are:
-> 2 DB requests in a row, which slows down the process
2 database requests shouldnt slow anything down. but you added an additional action which technically "slows down" the process to begin editing a clan. I don't see that as a bad thing though
I think it makes sense to load all clan names, and ask the requestor to input their choice, and then load that specific clan.
how do the clan editing permissions work?
im assuming edit permissions are restricted, and you have that info stored as well? And can one clan leader have multiple clans? If not, you could just check if they are a clan leader and instantly load their respective clan. If they can have X clans, you could then load X number of clans they are associated to. It might reduce the amount of memory used
i love refactoring idiot systems that i have made https://img.thaun.dev/5h36g.png
hey thats like my job at work, except im refactoring the poor code others wrote.
um, weird question, but does this "RoleRank" class still change the values in the list even when its taken away from the list
https://img.thaun.dev/rz2oa.png
oh wait, right yeah it does nvm im dumb
@wanton wasp you can also findAll() then filter that array with a game id that matches args[1]
that should return an array of what you want
imma be so happy when everything i do stops working
the more changes i do, the more anxious i feel about breaking it all
Is that C#?
@neat ingot Same error :L "Error: ENOENT: no such file or directory, open projectDir\node_modules\canvas\build\config.gypi"
Can anyone help me how do I make this wall of the bot available by asking an answer
You mean an embed
guild.role?
yes
I don't know js
message.guild.roles.client?
how i do that?
https://gyazo.com/d7635c651dfb2d6b5ecf4301e12bc9ee
You would be on mobile
to my bot
u cant
Apparently you can
rlly?
you can
yes
verify is not a function what is this?
u can set ur bot status as mobile yes
bc apparently a lot of ppl don't read
Can anyone help me how do I make this wall of the bot available by asking an answer
i dont know how to read ||xd||
@lost kettle read
It is called an embed
their answer: yes
Have a look
I just looked at the docs
and found this
I haven't worked on discord.js bot for ages
like 5 months
so
ยฏ_(ใ)_/ยฏ
for what
For embed object
This is not what I am looking for @unique nimbus
maybe he meant perms
oh
Very vague question
they don't even know what they're looking for lmao
Can anyone help me how do I make this wall of the bot available by asking an answer
the fuck does this even mean
that's some next level engrish
but wall = embed 
Probably google translated
How do I give my bot mobile presence? (Discord.js)
ws options
You can't, they're fooling you

You can
client.options.ws.properties.$browser = "Discord iOS";
set this before you login
you can lmao
Don't spoonfeed
don't be ignorant
That's not easy to find, it's not documented at all
If it's not documented, they don't support it
I am trying to integrate so you can mention the bot for commands or still just run the prefix I am using this if (message.content.startsWith(prefix)) { and can not seem to get anything to work
what is prefix
guild.prefix which fetches the DB for the guilds prefix
It is just saying command not found
well then show more code
if (message.author.bot) return;
if (!message.content.startsWith(prefix));
if (!message.member) message.member = message.guild.fecthMember(message);
if (message.channel.type === "dm")return;
const args = message.content.slice(prefix.length).split(/ +/);
const cmd = args.shift().toLowerCase();
const Mention = message.mentions.users.first()
if (message.content.startsWith(prefix) || Mention) {
let permissions = message.channel.permissionsFor(client.user);
let command = client.commands.get(cmd);
let aliases = client.aliases.get(cmd);
if (permissions.has("MANAGE_MESSAGES")) {
message.delete()
}
if (!command) {
let embed = new MessageEmbed()
embed.setColor("#00FFFF")
embed.setFooter(`Infinity Bot was made by Cam & IceyyM8`)
embed.setTitle('Error')
embed.setThumbnail(client.user.displayAvatarURL())
embed.setDescription(`That command was not found, try ${prefix}help`)
return message.channel.send(embed).then(w => setTimeout(() => { w.delete() }, 5000));
}```
you didn't even return
3rd row yeah
oh :/ okay
Certified*
okay i understood
thats wrong
use css
if u want to customize ur page use css
hey, does anyone know if there is a way to add message content (so i can @mention someone and they get pinged) to a message that also contains an embed? using discord.js v12
there should be
channel.send("CONTENT", {embed: someEmbed}) afaik
endpoint allows content and embed content so should do
read the error
What is client.db?
Client.db is data file
client.db = new sqlite3.Database("./data/public/guildinfo.sqlite");
db.get takes a callback. The first argument is the error (if one occurred) and the second one is your data if any was found.
If you want to use promises, use the sqlite npm package.
if u want something better use better-sqlite3
Ok
Ok .. any documentation for sqlite
i typically use underscores because at a past job oracle db would have a tendency to automatically uppercase object names
do whatever you want, but avoid spaces. it causes weirdness to happen
try it out and see
Yeap perfectly run
@sudden geyser always use https://tryitands.ee
too much work
im assuming edit permissions are restricted, and you have that info stored as well? And can one clan leader have multiple clans? If not, you could just check if they are a clan leader and instantly load their respective clan. If they can have X clans, you could then load X number of clans they are associated to. It might reduce the amount of memory used
@tardy estuary thing is that administration can also edit clans
2 database requests shouldnt slow anything down. but you added an additional action which technically "slows down" the process to begin editing a clan. I don't see that as a bad thing though
@tardy estuary yeah I came to this decision in enother community
Thanks for participating
i guess in that case if admins were editing it would create higher memory usage, but if that is an a-typical use case, I think going from most common to least common use case (which would cause increasing memory usage) would be reasonable as well.
AKA automatically load the clan if permissions AND only one clan. Otherwise load all of the associated clans and prompt. Worst case scenario would be for admins, best case scenario would be single user with only one clan.
How would I sense whether ANY message is sent? I'm creating a "leveling" system and want to check whether an user sent a message.
Ex.
if (user_sends_message) {
energy+1
}
I'm using Node.js by the way.
so you just want to know how to detect a message event?
yes.
i saw the documentation but it was a bit confusing
yes ive tried:
client.on('message', message=> {
});
client.on('message', message=> {
if (message) {
let rawdata = fs.readFileSync('./energy.json');
let energyF = JSON.parse(rawdata);
var user = message.member.id;
var add = energyF;
add[user] = {
energy: 2 + (energyF[user]!=null && energyF[user]["energy"] != null ? energyF[user]["energy"] : 0)
}
}
})
Sorry prob should have sent some code
i'm using json files for tracking the exp
but it doesn't seem to be working
the numbers next to the member id dont go up; they're just static atm.
i mean are you saving the json afterwards?
like i dont know js, but that might be the issue
that's not saving
so now im trying to actually add the exp for every msg
you need to save it within that block of code
are you replacing the user in the json every time?
though I'd avoid using json as a database
Guys how would you copy, let's say, only the VIEW_CHANNEL permissions from a voice channel to another?
yeah I would utilize a regular db, sqlite perhaps
and kinolite yes ive thought about using a db. i hvae experience in mysql but i was brainstorming sme ideas and thought it would get quite complex afterwards
cause i have to insert the data, update it every single time an uesr talks, and it might start lagging behind a little bit
i might upgrade to a db in the future
you can also use quick.db
but considering its a small bot in a community server i dont rlly want to use it yet
link maybe
but id prefer using mysql. its something im familiar with
quick.db may not be the best and stuff and there are probably better things
but its easy to use
and itd be gud to get some experience in json lol. i might use it in the future
how do i PM a specific user using discordjs?
specific
remember that at any time you write your data could become corrupted. with an actual db it's less likely
send
okay
the problem is with that json file is you are reading a single file from disk
hi i have a question
then you have the object
kinolite yes. i know the possibility of it getting corrupted. hopefully this wont happen which is why i made a !backup cmd xD
you cannot write to it simultaneously, if that happens
only works if the user is cached ofc
We may have an answer, Liberius.
I made a ping command. But it doesn't work. NaNms writes
unless you have your commands coming through synchronously, you could save a previous state
show code
code show
okay but there are turkish words in the code so don't be surprised :d
const Discord = require('discord.js');
exports.run = async (client, message, args,) => {
const useruser = "Komut " + message.author.username + " tarafฤฑndan รงalฤฑลtฤฑrฤฑldฤฑ";
const userurl = message.author.avatarURL;
const bayrak = "๐น๐ท";
const ping = ${Math.round(client.ping)}ms;
let embed = new Discord.MessageEmbed()
.setTitle('๐ก๏ธ Anlฤฑk Gecikme Sรผresi ๐ก๏ธ')
.setColor("#00FF00")
.addField("Ping :", ping)
.addField("Lokasyon :", bayrak)
.setFooter(useruser, userurl)
.setTimestamp();
message.channel.send(embed);
}
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};
exports.help = {
name: 'ping',
description: 'Gecikme sรผresini gรถsterir.',
usage: 'ping'
};
what version of discord.js
i dont now
How would I assign a role to an user for a certain period of time? Ex. tempmute command.
store timestamp in db
Liberius you're using v12.
client.ping is not a thing I believe.
I believe it's client.ws.ping
Okay thx flazepe.
client.ping doesn't work
since client.ping aint a thing
and client.ws.ping is the websocket ping
it would work on v11
also avatarURL in v12 is now a function.
yes

because you said it wasn't a thing
it isn't one anymore
ye
in the newer ones
ig
hm
Guys how would you copy, let's say, only the VIEW_CHANNEL permissions from a voice channel to another?
anyone knows?
I don't know what you mean by that with copy a permission
to a voice channel
like what
I believe it's
client.ws.ping
@sudden geyser THANKS BRO ฤฐTS WORKฤฐNG
thank you all
was about to say
I don't know what you mean by that with copy a permission
I want to create a channel with the same permissions as another one, but only certain permissions not all
but im slow af
yeah np
but that's websocket ping
not the ping of how long it took to send the message.
yea
you can do that by making a new date object then editing the message and then making a date object again
and then just minus
okey
I would have sent a code with it but im on mobile so
good thing you're on mobile
yes
thanks
is it possible to store the messageid from an embed you create in the same command?
@acoustic mural lan bende tรผrkรผm sen insanlarฤฑ kฤฑz taklidiyle kandฤฑrmaya mฤฑ รงalฤฑลฤฑyon lan
Turkish in #memes-and-media
its not even related to development
Has the await verify command changed?
whats an await verify command
command not working
can u try to make more sense
ok wait
const verification = await verify(message.channel, opponent) this is a command
When he writes yes or no he gives an error when he needs to answer
what is verify? this is not standard code, are you using a module/package?
discord.js
there is no verify in discord.js
verify is a custom function you made, or someone made for you, or you copied from somewhere
are you sure you didnt copy from anywhere?
if it worked in v11 but doesnt work in v12, then you have to modify the function to work in v12
we need to see how the function works to be able to help
It works in v11 or v10.
I received this command from my friend
a long command duel command
what is the error?
how do i delete the user command after the bot performs the command 
yep
hmm i was doing this message.delete().catch(O_o=>{}); it deletes and gives an error
what error?
(node:163) UnhandledPromiseRejectionWarning: TypeError: verify is not a function12:02 AM
Jump Toat Object.exports.run (/app/komutlar/dรผello.js:19:44)
(commands)/(duel.js)
this is error.
And Command:
const verification = await verify(message.channel, opponent);
if (!verification) {
this.fighting.delete(message.channel.id);
return message.channel.send('write');....
@earnest phoenix show error
one sec
@lost kettle show full code
Duel command?
yes
There are Turkish words in the command. so the words the bot will answer are turkish, codes english
its ok
So anyone know why my autorole works on my test bot but not on my main bot
permission maybe
@earnest phoenix cannot send empty message
No main bot has same perms
yep the command i did was (*say hi) and its not an empty msg but i still get the error
something somewhere is trying to send an empty message
I am using this ``` const guildDoc = await Config.findOne({ guildID: member.guild.id });
console.log(guildDoc)
if (!guildDoc || !guildDoc.welcomechannel) return;
if (guildDoc.autorole === null) {
return;
}
if (guildDoc.autorole !== null) {
member.roles.add(guildDoc.autorole)
}```
show the full command
me?
V12
if(command === "say") {
const sayMessage = args.join(" ");
message.delete().catch(O_o=>{});
message.channel.send(sayMessage);
}
i have problem with the invite manager its show me he is offline what i can do?
this is not the support server for invite manager
this is the server for the website top.gg
I put the console.log in the if (guildDoc.autorole !== null) { member.roles.add(guildDoc.autorole) console.log(guildDoc.autorole) } and nothing was logged
theier invite not work
where's the mod smh
wrong server

``bump: (msg) => {
con.query(SELECT * FROM settings WHERE guildid = ${msg.guild.id}, (err, result) => {
if (err) return console.log(err)
let cooldown = (60 * 60 * 1000)
if (result[0].premium === 1) {
cooldown = cooldown / 2
}
const now = Date.now()
const lastTimeBumped = result[0].last_time_bumped ? result[0].last_time_bumped : 0
if (now - lastTimeBumped > cooldown) {
con.query('SELECT * FROM settings', (err, row) => {
if (err) return console.log(err)
msg.guild.fetchInvites().then(invites => {
if (row.length - 1 <= 0) {
sendEmbed(msg, 'There are no other guilds for your advertisement to go, `p%invite` and setup the bot on other guilds before trying again.')
return
}
if (invites.size > 0) {
const invite = invites.first()
bumpLogic(msg, row, invite)
} else {
let channelID
const channels = msg.guild.channels.cache
for (const c of channels) {
const channelType = c[1].type
if (channelType === 'text') {
channelID = c[0]
break
}
}
const channel = channels.get(msg.guild.systemChannelID || channelID)
channel.createInvite().then(invite => {
bumpLogic(msg, row, invite)
sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`)
})
}
})
})
con.query(`UPDATE settings SET last_time_bumped = NOW() WHERE guildid = ${msg.guild.id}`, (err) => {
if (err) console.log(err)
})
} else {
sendEmbed(msg, 'You must wait **** before you can use this command again.')
}
})``
basically its a bump command that lets you bump to other servers but its meant to update database so that you have to wait 1 hr before
you can do it again
some reason i can do unlimited bumps
proper codeblock pls
shows everything for the guild
prefix welcomechannel leave channel and the autotole
autorole which is not null
what if you do console.log(guildDoc.autorole) there, at the beginning
put it again right after the first if
Nothing
then there is no welcomechannel
anyone able to help with my issue id appreciate it
console.log guildDoc.welcomechannel
proper codeblock pls
@pale vessel
Thanks
},
bump: (msg) => {
con.query(`SELECT * FROM settings WHERE guildid = ${msg.guild.id}`, (err, result) => {
if (err) return console.log(err)
let cooldown = (60 * 60 * 1000)
if (result[0].premium === 1) {
cooldown = cooldown / 2
}
const now = Date.now()
const lastTimeBumped = result[0].last_time_bumped ? result[0].last_time_bumped : 0
if (now - lastTimeBumped > cooldown) {
con.query('SELECT * FROM settings', (err, row) => {
if (err) return console.log(err)
msg.guild.fetchInvites().then(invites => {
if (row.length - 1 <= 0) {
sendEmbed(msg, 'There are no other guilds for your advertisement to go, `p%invite` and setup the bot on other guilds before trying again.')
return
}
if (invites.size > 0) {
const invite = invites.first()
bumpLogic(msg, row, invite)
} else {
let channelID
const channels = msg.guild.channels.cache
for (const c of channels) {
const channelType = c[1].type
if (channelType === 'text') {
channelID = c[0]
break
}
}
const channel = channels.get(msg.guild.systemChannelID || channelID)
channel.createInvite().then(invite => {
bumpLogic(msg, row, invite)
sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`)
})
}
})
})
con.query(`UPDATE settings SET last_time_bumped = NOW() WHERE guildid = ${msg.guild.id}`, (err) => {
if (err) console.log(err)
})
} else {
sendEmbed(msg, 'You must wait **** before you can use this command again.')
}
})
},```
@pale vessel
how do you host a discord bot???? DM me and tell me
@quartz kindle you said to post here
@earnest phoenix whats the problem with it?
@abstract spruce which part of hosting? how to upload it to a vps? how to code it?
tim basically it is not updating the database
so i can keep bumping
its meant to update the time
so i cant keep bumping till an hour has passed
which database?
mysql database
Ah no worries I fix it
i cant seem to get it to update so it wont let me till an hour has passed
what is the data type of the column?
btw for ur sql i wouldnt straight up just do something like WHERE guildid = ${msg.guild.id}
use ? then offer the guild id
this also works better for args
is my sql database settings for last time bump configured correctly as shown above
what did you think it was
i cant and dont want to read code on mobile
haha
so yeah it not updating the time i up
so obvs when i do p%bump its not updating the lasttimebumped table
does anyone know how to make it so if this command and command then do this
if u cant type fast do it in one message
so if(command === "!help" and if(command === "-help"
using the or operator..?
instead of doing that use some kind of prefix variable
if(command === "help" || command === "halp") {
yeah i dont know how to get it to update the table when you do the command
thats not how it works
@earnest phoenix is the database actually not updating? have you console.log(lastTimeBumped) to see if you're not getting a string instead
wrap it up
yes
pls make command file loading
and proper command handler
i assume ur using 1 file
^ everyone should have this
event handler
if(command === "help" || command === "halp") {
is this how?
but i think its kinda ass
tryitandsee
faster and stronger ay
yes
lol
@royal portal yes that's fine
if you use a switch you could've done case "help" case "halp":
also
tim wheres the best place to put that log thing underneath
sendEmbed(msg, 'You must wait **** before you can use this command again.')
imo - if your bot doesnt have a command handler thats capable of loading/unloading/reloading a command - so that you dont need to reboot every time you fix a bug or add a new command - then your doing it wrong.

theres an example on how to have such features incase anyone wants info
i meant sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`) sorry
same
i mean console.log(lastTimeBumped) right after you define it
but i dont have a load command function
๐ฎ
or unload
i have a reload command where it clears the collection and load every command again
and a command for reloading one command of course
mine doesnt use a function but i do have a reload command
i just do some require cache deleting stuff idk
so i have reloadall and reload command
and readd it to the collection
no
so i can reload a command that wasnt even loaded
it's fast
lmao
i have 100+ commands but they reload in less than 2 seconds
time it came back with 2020-05-06T21:00:38.000Z
Your bot doesn't have 12 million commands?
no, just one million
@earnest phoenix then thats your problem
my 40 bot commands used to load in like close to a second
the database is updating correctly, but you're getting the timestamp as a string from the database, so your time checking doesnt work
My most popular bot has ...6?
imagine a very popular bot without reload, the number of shards it will have to restart
how would i make it check it properly then
@amber fractal they're out there
tim the entry says 9pm but its 11pm
My bot is in ~900 servers and it has no reload; haven't needed it yet
yeah that's still 1 shard though
I mean a fully sharded bot
@knotty steeple a bot in 2 servers will still boot faster than one in 900
unfortunately
i mean the same count without sharding
a bot in 2 servers will still boot faster than one in 900
well yes and no
if you choose to ignore certain events with intents then the latter will be faster
a lot of info is returned in the READY event
all I care about is message, ready, guildCreate and guildDelete
if there's events I have to opt-in to ignore, please let me know
how do i convert it so its not a string its just date and time
new Date(date string)?
i was gonna suggest that lol
@earnest phoenix try this: SELECT UNIX_TIMESTAMP(last_time_bumped) FROM settings
why does javascript use milliseconds
that sql syntax ๐
such a pain to compare
otherwise yeah, you can just new Date(rows[0].last_time_bumped).getTime()
but MySQL uses seconds right
yes
yes but i'll have to do that a lot
if you have the 'moment' library then you could do
moment("2014-02-27T10:00:00").format('DD-MM-YYYY');
are you concerned about the speed cost of dividing by 1000
no
i do that lol
yeah, you could just store timestamps as a big int, but then you lose access to mysql's native date comparison functions
i don't use that so I'm good
mongodb/mongoose ftw โค๏ธ
sqlite here as well
about discord.js' caching, since ```js
message.channel message.guild.channels.cache.get(message.channel.id)
client.channels.cache.get(message.channel)
//these are all the same
opposite for me, sql is confusing asf for me
how
imo mongoose allows you to work very differently to how you would woprk with raw mongodb
sql is ez
it's just confuising
normally mongodb is schemaless. mongoose adds schemas.
@grizzled raven they are the same yes, only their type changes
everything is linked by reference
ram is taken by the amount of instances, be it from channels, users, members, roles, voice states, emojis, presences, etc...
I just dont like sql syntax
I'd rather .findOne({id:"a-1274bhasd"}) than SELECT * from some_other_stuff_that_I_dont_know
sql speed though
mongodb is not slow.
I've never had speed problems with mongo
never said it was slow
is this db wars holy shit just use whatever you're most comfortable with
just meant to say that some sql dbs are just a bit faster
but i probably wont ever need to worry about speed 
not like my bot is gonna get that big anytime soon
where would i put new Date(rows[0].last_time_bumped).getTime() time?
in that code
not happening anytime soon lol
this issue is annoying me so much ahhhh
if someone could say where to put new Date(rows[0].last_time_bumped).getTime() in that code id really grateful lol
idek what you want though
just use timestamp like me
im using timestamp...
like its logging the time its just 2 hours behind
ok mongo shill
๐
...
update it with a statement
oracle is known for making slow shitty and unoptimized products
mysql being one of them lol
each to their own ๐
so flaze i guess you wont help me with it
id be happy if you would
good luck
because idk what you're trying to do tbh
to troll people asking for help ofc ๐



