#development
1 messages · Page 986 of 1
@obtuse jolt read about cronjob in js, and this https://stackoverflow.com/questions/1590247/how-do-you-implement-a-stack-and-a-queue-in-javascript
Those things will get u a very easy queue system
But wouldn’t this be a good use for json though
I know guild name and Id is useless
Idk why I added it
It looks good I guess
json is ok if its read-heavy
but its terrible if you need write-heavy
also, to make json good, its actuall data set needs to be stored in memory
It’s mostly read because it checks the config when someone sends a message (assuming auto scanning is on and somethings are also correct)
a good json data store is essentially an in-memory database with json files as backup
similar to how redis operates
most likely not
which library?
d.js
is that heap or rss?
you have 64gb of ram, and one core
how are you measuring it?

yeah I was confused on how to get cpu usage
I think its supposed to be 4.0% in the image above
getting cpu usage from within node is a bit more complicated, it involved measuing process.cpuUsage() over time
Yeah
because process.cpuUsage() returns system/user cpu time
so what, an average over the past few seconds?
i have a sample you can use
id love to see it too
"Converting millis into something"
--------- How to measure your CPU 101
Number(Math.round((await new Promise(async r => {
let start = [process.hrtime(),process.cpuUsage()];
await new Promise(r => setTimeout(() => r(),100));
let elap = [process.hrtime(start[0]),process.cpuUsage(start[1])];
r(100.0 * ((elap[1].user / 1000) + (elap[1].system / 1000)) / (elap[0][0] * 1000 + elap[0][1] / 1000000));
}))+'e2')+'e-2')
this is what i use lol
in an async function
yeah that wont work
it needs to be done over time, ie, two measurements
i wait 100ms between each measurement in the above example
I need to measure it like at the time tho
yes but that's not possible
node doesnt know how much cpu its using at any given time
it needs to measure it over an amount of time
so it can understand how much exactly its the process itself and how much its the system
but if that’s the case tho isn’t that solution already measured over time just my integration is poor
yours is not measured over time
I just though like who actually cares about the cpu usage

i like looking at that stuff
wow ok then
and really, your trying to impress me 
I mean I have these but ok
Which is weirder because that say 0.7
And the bot never goes below 20%
It says it doesn’t
because the bot is not measuring it correctly
my bot sits around, 2-0.3% at idle
it has a few checks it does to get to that 2%
My bots without databases idle at like less then 0.1%
yours will likely also show 1-2% if you measure it correctly
But I guess that what you get from server grade chips
well yeah 0.1% if we take into consideration you have a dedi with 8 cores
^
yeah
im on a single core, and the bot idling is actually still doing stuff
nice
It’s pretty speedy
im on a single core vps lul
i get 25ms
Idk
I took that yesterday
It happens if I keep spamming it for long enough
Just gotta hope
Ain't VirusTotal a copyrighted brand?
The ping is very up and down because of the amount of minecraft servers using the bandwidth
I actually emailed them about the API limits and they said what I was doing was a cool idea
And wanted €15k/yr for private API access
Ain't VirusTotal a copyrighted brand?
This can be an issue if you want to grow it big
I do say it’s unofficial
Like on bots lists it says Unofficial VirusTotal BOT
I could probably email them and check if it’s alright with them
It'd be safer to do that
And you might get some perks for advertising their site
Who'd deny free marketing?
I might get a 1% discount off paying 15 grand
lmao

Something makes me think that they won’t care because of they are mostly known online or they might care a whole lot because they don’t want their brand image being ruined
The person I was talking to seemed hella chill
They were saying that they thought the idea was pretty cool
Holy shit
ITS JESUS
They are always a hella cool
You just need to make sure your bot is as good as possible to make their brand have a good image
Yeah I really need to rewrite it because the bot was originally made to prevent account compromises but I guess a half working bot won’t do well at that
I already have the basics of how to make the bot work
I just need to build off that
And make it better
@lyric mountain is there an easy guide that doesn’t just give a huge chunk of code and say that’s how you do it
what is it actually
google hasn't complained about my bot luckily
even when we sent an email
What does your bot do?
Here's a site: https://www.sqlitetutorial.net
I already want out
lol
This looks confusing af
Do you have knowledge on SQL?
Sql is a separate language
@lyric mountain
This is confusing
You can’t
It’s part of the website
¯_(ツ)_/¯
This is confusing
@obtuse jolt sql is a bit confusing when you're too used to programming langs
But keep researching about it
I think I said that about json at first
Treat it like a new programming lang
@torpid forge inspect element
because json isn't meant to be used as a db in the first place
it's a notation
JavaScript Object Notation
hence JSON
theres really only one line that matters when acessing a database, the rest is just structure/syntax
It might work well now, but later on you'll regret relying on json
and then you also gotta port everyones info over ^
or just drop all their info
which is terrible for your users
But since it happened many times already...
well, he was going to swap when he has more users 🤔
which is more frustrating for everyone
@obtuse jolt you can look into mongo
unless you specifically need sql for something
but mongo is closer to the "normal" programming stuff most people do and isnt like INSTERT INTO x ...
Yes, but not all programmers like that syntax
I hate it
I'd rather db.collection("x").insertOne({})
Sql is good if you need relation between entities, other than that it's just really a matter of taste
What's the step for making bots online
Step one - code
Which code
Yes
Jokes apart, you gotta code ur bot's behavior
Find a programming language that's easier for you and start writing
Note that without prior ps knowledge you'll have some rough time understanding things
docs for libraries ^^
also no matter the language you use.. dont just jump right into discord bots
learn the basic-to-intermediate concepts first
Ok
so is python-
Python is a bit too abstract, and might confuse beginners
It's easy if you have prior ps knowledge tho
Read my last comment
ps?
Programming science
ok? some of those people had no programming experience
python is like the top beginners language suggested these days
I have almost has perfect experience for that
from what ive seen atleast
python is a beginner friendly language
- it's knowig something like js or java beforehand that trips people up
python breaks away from the braces, etfc
that and ruby
Duh..at begining until now took me 3 days if i was right
to learn... what?
a specific programming language?
Duh..at begining until now took me 3 days if i was right
@dusk sphinx
python is a beginner friendly language
- it's knowig something like js or java beforehand that trips people up
@earnest phoenix probably that's the issue
Python is the most high level lang i know of
but a complete beginner will never be used to js/java
and ruby is higher IIRC
and you've clearly never seen cobol :p
its.. special
A whole of bot creation
Cobol is low level af
A whole of bot creation
@dusk sphinx im sorry what? if you learned "all of bot creation" in 3 days, you might wanna go back and read the 50 chapters of the tutorial you skippd
Cobol is low level af
@lyric mountain is cobol not the english-like-lang-for-boomers?
SUBTRACT A FROM B
``` etc
ugly yes, confusing.. is it?
Let's say cobol is in its own tier
xD
Cobol is like if delphi and sql had a child
isnt cobol like old and sql young 
Sql went back in time to ensure its future generations
nightmare fuel
Only blind people will do
Umm..any other step for Activate the bots
Host it
How
Buy a vps or host it locally
host it locally for starters
Where
On a computer
..your pc
or an rpi ;3
I am on my mobile no computer
Buy a raspberry pi I you don't have one
oh god
Raspberry pi is like 20 dollars max
30* for a 4b 1GB
Beside that
No other way unless you have a spare PC which you apparently don't
think you should get atleast a laptop, mobile is pain to code with
or even a bt keyboard..
You can pay 3-10 dollars fora good vps from gakaxygate or something
I need no no payment step please
pebblehost is 2.50/mo for 1GB
Oh lord
you arent gonna get anything decent for free..
Lol
there is no free lunch
what do you mean which "step"?
I mean which way is the simple for activate the bot
Localhosting is easiest if you have a pc
hack a smart fridge, use a spare pc, rpi, vps
Vps? What it mean
Virtual private server
Where can i find it
google, or check pins here
Can you send me the link
I recommend galaxygate, rhythm and dank memes use it
What's next
providing support, maintaining it, growing it, and then just maintaining again
Well, maintenance
The full cycle is:
1 - develop
2 - test
3 - implement
4 - feedback
5 - repeat
You need to provide good and fast support for your bot too
This will keep going forever, until you stop maintaining it
You need to provide good and fast support for your bot too
That's step 4
Most developers spend hundreds of hours a month working on their bots
And most good projects take about 1 month before being able to be released publicly
I would recommend making a test bot to test new features instead of pushing to main bot before testing it
And always, ALWAYS backup your bot's code and database
but it really just depends on the developer
Github is your best friend
Is making bot worked were hard
Depends
Some people can code as if it was a second nature, while some have a hard time grasping to coding principles
there are almost always example bots with code on github, normally you can learn a lot from there
also, read the code, see what it does, try figure out what each line actually does, then you can adapt the code to suit your needs
The link for github
hello how to use the permission integer with discord.py ?
Each permission has a integer representing it, you'll need to sum the bytes iirc
Like, 0x8 is admin perm
Ok , so now i got the byte what do i do with it ?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i got it thanks
npm i package@version iirc
with node?
It'd be like npm i nodejs@12.1.1 or something
hm
Just an example tho, further research might be required
everything is telling me the hardest things
when I run node -v:
V14.4.0
Then sudo n 10.16.0:
node -v:
V14.4.0
Sudo n?
Um, trying to get node-fetch to work with Heroku Buildpacks, i have figured out a way by using both errors and a currently compatible module and it needs a compile folder and i am not completely sure how to get it to work?
Using ffmpeg for help, Heroku needs a "compile" folder with code that looks basically like the image i am about to send but i don't know how i am meant to get a link for download url as i would assume it needs a .tar.xz file??????
Can anyone give me a bit of help because i don't know of a download link for node-fetch that i can put in my compile file
Um nvm i think i did it, just gotta check if node-fetch will properly work, i finished it all and got no errors deploying to Heroku
The bot started with no errors but my meme command does absolutely nothing, doesn't throw any errors at all either, it just doesn't do anything at all
Yeah doesn't matter i figured out why it isn't working sorry for bugging people with my questions
Just have one small problem that i don't fully understand how to fix UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'msg' before initialization
There is the code
message.channel.send
I use msg not message
Then your variable name after let needs to be something else
let memeMsg = . . .
memeMsg.edit . . .
for some reason that idk what is, my ${message.author.id} is returning false, can someone help me?
Ahhhhhh right, i feel a little bit stupid 🤦
What code are you running for it to return false?
console.log(`Comando "${command}" utilizado por "${message.author.username}#${message.author.discriminator}" cujo id é "${message.author.id}" no servidor "${message.guild.name}"`);
all my commands that use some if to check if the user is certain user with the id, its returning false
in that console.log instead of putting their id it puts false?
Hmmm
if(message.author.id == '435228312214962204') return message.reply("hey")
This just return <false>
i created a test command, that just says your id
for other people returns their id, but my id return false
it's like my id has been canceled or something
Haven't heard anything like it before. Maybe you have something set up somewhere else that is messing with it?
In one of the main files maybe?
I read all of my main file, and there's nothing in conflict, if someone dm my bot, he send me with a client.users.cache.get(myid) and the message goes to me, but it cant say that its mine
i will show
this send me a message
and i recieve, but show that my id is false
Which discord.js version are you using?
what changed since yesterday ? was it happening today at the beginning of your testing?
I went to modify a command, which pointed out the error of the id. so I went back to the old version of the code, but even then the error continued
The red point?
When your bot starts do you fetch all members?
it has a line that take the amount of users that the bot has with a client.users.cache.size
he cant even take my profile pic in the footer
if i try a mod command, it cant look my permissions
this changed in V12
yeah but, its just to my id, other people can do
the bots returns that my id its false
did you use the member object or the me object?
member
so you want to check the permissions for a guild member?
guild.me.hasPermission(['MANAGE_CHANNELS']) this works for me to check the permission of the bot
go to #265156322012561408 and use m!moon, it will show your discord id, but if i use, it will return false
this is the code
theres no line of code creating an exception to my id
why should it return something else than your ID
usually you get locked out from starting the bot if you get ratelimited. and i dont think you can hit it fast with a client
What shows if you console.log(client.users.fetch("435228312214962204"))
let me see
Since it seems you can get your username and discrim but not the avatar and id...
nice id
yeah haah
gg
i dont know what happened
contact Discord Support i guess
i guess i need to
but the ability to troll some badly coded bots with this bug is tempting
Ehh I fetched him through my eval command and it showed his actual id and not false..
apparently the problem is with my code
but how?
i ahve just one main file
i dont get how you can edit the stuff that is requested with a /get call
on small bots its not a issue
if you get a ton of commands having a handler is nice but not really a thing you need
like, i handle all the commands, and in my index file, nothing like edit my id or something to the rest of the code
its strange. bcs the stuff in your code requests your member object from the Discord API so there is no way that its edited. (maybe some strange caching issue)
maybe ask someone in the Discord.Js discord server
they know probably more about the api
I will talk to them, thanks for the help guys
its working now, idk what happened, but its ok now
its hidden by the black and white square
the black part is covering the rounded top left corner
@surreal sage
the black part is covering the rounded top left corner
@topaz fjord how
do
i
fix
that
add a margin to the top of pf-child
how much
up to you
thanks i think
I want my bot to approval now please check it
How much ram, needs a small teamspeak 3 Server?
be safe and go with 32gb
Okay, thx
that was a 1:30 am joke pls dont be serious about that
delete Room[user[message.author.id] .oda].members[i]; Although I have done this, the Room[user[message.author.id] .oda].members.length does not decrease, what should I do?
just bind the value into some variable and start decreasing it.
possible way to test vote system on my TestBot before publishing it to my original bot?
SQL doesnt have any limitations right?
It is flat data. Meaning it can't store objects
I mean those are visible for lets say a bot with like 100k regular users
Yeah no prob for that need not to use objects
how do i display permissions for a certain role??
Is SQL safe?
Like can it get corrupted like JSON And is it secure?
@lusty spade Which Library?
discord.js
These both might be what you are looking for
ok thanks i will take a look
@small prairie it is safe
new webkitSpeechRecognition() || new SpeechRecognition();
webkitSpeechRecognition is not defined
how can i make this work
it's supposed to use the other if the first doesn't exist
Cannot read property 'bot' of undefined
Heya I always get an error no connection established within 15s, I've gotten it for a while and can't use voice commands
how do i fix that?
Can I see your code
return receivedMessage.channel.send("I can't mute a bot!");
}```
user is not defined
let user = receivedMessage.mentions.users.first();
no lol
@wide sage user is undefined
so that would mean either:
receivedMessage doesn't exist
no users were mentioned
Hey, does anyone know how to get specific values from a json? I'm stuck and I'm not sure how to do weather-js
hello i have a bot i already developed some commands but i also trying to work the welcome masg
but i cant seem to get it work
here is the code lines i aded into index.js
client.on('guildMemberAdd', member => {
const channel = member.guild.channels.cache.find(ch => ch.name === 'member-log');
if (!channel) return;
channel.send(`Welcome to the server, ${member}!`);
it doesant give any errors
Well
Maybe
You could search for the system channel ID?
Because then everyone with your bot would have to make a channel named member-log
What with?
Ok so you wanna do
member.guild.channels.cache.find(c => c.id === member.guild.systemChannelID)
Np
@pure lion thank u soo much
Np :)@distant bramble
Can yo uhelp me Dice?
npm i discord.js@version
@royal tree why would you want that
My bot is not working with 12.2
Oh
but 12 is stable
try to fix the problem
you just need to update your code
dont downgrade
Easy fix imo
^ guide on upgrading from v11 to v12
@royal tree any red lines?
member.guild.channels.cache.find(c => c.id === member.guild.systemChannelID)
@pure lion
member.guild.channels.cache.get(member.guild.systemChannelID)
Isnt this more direct?
Either one works, that's just how I did mine lol
I believe get works based on ID's (not entirely sure)
python help?
What's up
async def on_dbl_vote(self, data)
lmao Probably not thicker then mine
not working
@gentle cipher #topgg-api
Show your DBLClient line
#api
Don't you love it when your console log has no errors
I actually like it when it errors
Im worried if its working or not
getting an error sometimes is actually good for me lmao
I know its working somewhat if i get an error
Do you know json? I could use some help-
Aight
i'll reply in a few
I know how to add certain role permissions (like if a user has a role called Mod they can use the commands) but can I make it so only my user ID can use the command?
how do I restart the bot
I know how to add certain role permissions (like if a user has a role called Mod they can use the commands) but can I make it so only my user ID can use the command?
@inland aurora yes. check if message author id is your id
ok thanks
can someone help me to update from v11 ti v12
What do i need to do in github.com
Is the webhook url webhook from discord text channel?
Or your own webhook endpoint
Ook thanks
its not a discord webhook
top.gg webhooks are not compatible with discord webhooks
i am trying to get my canava work it loads but the welcome is messed up
i use sans serif
but the font wont load
pls help
i am new to canvas
show code
check the registerFont method
ok
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "np",
description: "Show now playing song",
run: async (bot, message, args) => {
const queue = message.client.queue.get(message.guild.id);
if (!queue) return message.reply("There is nothing playing.").catch(console.error);
const song = queue.songs[0];
let nowPlaying = new MessageEmbed()
.setTitle("Now playing")
.setDescription(`${song.title}\n${song.url}`)
.setThumbnail(song.thumbnail)
.setColor("#ff9900")
.setAuthor("LegendaryBot")
.setTimestamp();
if (song.duration > 0) nowPlaying.setFooter(new Date(song.duration * 1000).toISOString().substr(11, 8));
return message.channel.send(nowPlaying);
}
};
how to define the song thumbnail? song.thumbnail doesn't work
prob copy paste or bought from fiverr or freelancer
i solved it, but ty for saying that i'm copying it from somewhere 🙂
Question, if i have a command that fetches a json api which can get memes from say 3 sub reddits, is there a way for me to set up a way for e.g. the 1st sub reddit has an image just with the number 1 as a thumbnail and the 2nd sub reddit as an image with the number 2 as a thumbnail?
The api is laid out like this
{"postLink":"originalpostlink","subreddit":"asubreddit","title":"posttitle","url":"originalpostimage"}
Yes
Could you possibly show an example?
You would need to be more precise on where you want to set this thumbnail
One of the subreddits would be r/memes, so just "memes". It would be .setThumbnail() in a message embed
Doesn't matter what the image is for what subreddit, just like say like i said image that says 1 for memes, then image that says 2 for like dankmemes or something
Just pass the custom image/thumbnail in the embed
How would i make it so a specific image will show for a specific subreddit?
Check it in your code
Because the way my command is setup, the api just chooses randomly from 3 different subreddits, so 1 command shows a random post from a random subreddit
You already know which subreddit you are fetching the post from, so you should also know which thumbnail to use
Yeah, but i use json.subreddit to get from the api what the subreddit is, i don't know how to get it to assign a specific image for a specific subreddit if the subreddit isn't referenced in my code
I use 1 single api that randomises through 3 different subreddits, i don't have 3 separate embed outputs for 3 separate subreddits
Isn't the subreddit returned in the response?
It is using r/${json.subreddit}
Which outputs in the embed which subreddit it's from
Please show your code, this is getting confusing
if(command === "meme") {
let memeMsg = await msg.channel.send("Getting meme");
fetch("https://meme-api.herokuapp.com/gimme")
.then(res => res.json())
.then(json => {
const embed = new Discord.MessageEmbed()
.setColor("#FF5700")
.setAuthor(`r/${json.subreddit}`, `https://i.imgur.com/nWtRlHA.png`)
.setTitle(json.title)
.setURL(`${json.postLink}`)
.setImage(json.url)
.setFooter(`Custom Reddit API`)
memeMsg.edit(embed)
});
}
you can use directly reddit to fetch memes
How do you get a avatar command to show the animated avatars as well? I use Discord.js
You could have an object with subreddit name as key and thumbnail as value
@wheat valve use the dynamic option
Would i put that just after fetch?
Honestly, i have no idea how to do that, i haven't ever done any coding like what i'm trying to do
Like specifically the question, not like bot making in general
In that case I'd recommend learning the basics first before trying to create a bot
No no i know all the basics of javascript near enough, just not how to do the "an object with subreddit name as key and thumbnail as value" thing
Is there a post or something on how to do it specifically for Discord or is there not?
const theObject = {
"subreddit": "thumbnail link",
};
So with that i could have different message output for different subreddits then? So have a completely different embed for one subreddit and another different embed for another subreddit?
Your initial question was how to display different thumbnails, not different embeds
Doesn't matter, not thinking straight
So do i put that at the end so when it outputs a certain subreddit, a certain image will be added to the embed thumbnail?
what to block certain commands on a server and if the owner wants to activate them he can activate them?
@earnest phoenix in short: database.
ok
I'm not 100% sure where the const goes for it goes but do you reckon would this work?
Try it out
Not a well formed url, i believe for .setThumbnail
Think i know what i did wrong though
That's not how you access an object property
user = payload.member
for x in user.roles:
if "team" in x.name.lower():
roelf = teams.find_one({"_id" : str(x.id)})
pass
first = guild.get_member(int(self.players[0]))
if not first:
rolef = 10
pass
for x in first.roles:
if "team" in x.name.lower():
rolef = teams.find_one({"_id": str(x.id)})
pass
print(rolef)
if rolef == roelf:``` Someone help, my code is fine until an hour later, everything works then anhour later, it says rolef referenced before assignment, any ideas?
Yeah ik i don't know how to get it to use the thumbnail url i set in my object
roelf
Oh but it shows the thumbnail for all subreddits
if(!db.has(`test_${message.guild.id}`, "true")) return message.reply("You need to set the command to true!")
will this check if the value on database is set to "true" ? (quick.db)
I have it so anything in r/memes will show the thumbnail but only for r/memes but it still shows thumbnail for all 3 subreddits
No big surprise, as you hardcoded the thumbnail
Anyone here?
How to make the bot send gifs and videos
I need code
Sorry if I am disturbing
Wait, so how do i get it to just show the appropriate thumbnail for the subreddit, would it literally just be to put setThumbnail as (subredditThumbnails) or do i need to add a bit extra to my code?
Pls give the code @hasty sparrow
How to make the bot send gifs and videos
@reef mantle
Pls tell
@dapper lynx @hasty sparrow
I read through the link and i am still confused as to how to call a specific value from my object based on the value of my subreddit :/
message.channel.send("Link of your gif/video/photo")
Question, if i have a command that fetches a json api which can get memes from say 3 sub reddits, is there a way for me to set up a way for e.g. the 1st sub reddit has an image just with the number 1 as a thumbnail and the 2nd sub reddit as an image with the number 2 as a thumbnail?
@dapper lynx my original question
But i don't know how to use my thumbnail object to where a specific subreddit has a specific thumbnail in the MessageEmbed
Pls tell
@reef mantle
let image = new Discord.messageattachment(
'image link', image.jpg
)
Thanx
H
How do i get it to use the value of a specific value in my object based on what subreddit it's from for my Discord messageembed thumbnail
const { MessageEmbed } = require("discord.js");
const db = require("quick.db");
module.exports = async (oldMember, newMember) => {
if(!oldMember) return;
if(!oldMember.guild) return;
const tag = db.get(`Tag_${message.guild.id}`)
let role = db.get(`ServerRole_${message.guild.id}`)
if(!role || !tag) return;
if(oldMember.displayName.contet === tag) oldMember.roles.add(role);
if(newMember.displayName.content === tag) newMember.roles.add(role);
}
I want to check if a user has a specific word in their name, and if they have the bot assign a role to them, why this dont' work ?
Please make sure you have the correct access rights
and the repository exists.
trying to pull
Right now all i can get it to do is output the full thing shown at the bottom
So I have this array: ["item1", "item1", "item2"] now is there a way that I can detect how many times item1 is in that array?
That just shows the memes thumbnail regardless of what subreddit
.. As in if the subreddit is memes, then specific thumbnail, but if it is e.g. dankmemes it doesn't show a thumbnail
it just won't show it
Who sees AoT?
But if i wanted a thumbnail assigned to each of the 3 subreddits, and it will output the corresponding thumbnail to what the subreddit is
define the subreddit as keys then
the value would be thumbnail link
get the value by using the key, which is the subreddit
it'll get their corresponding thumbnail
That's what i have currently
setThumbnail(subredditThumbnails[json.subreddit]) then

tell me you understand what that code does
Yes, picks out of the values i have in my object based on the value of the subreddit
is that what you wanted?
Yeah, thanks so much i couldn't figure it out :/
epico
I just wasn't aware that i could do the [] part to get the values of my api
if it has a space or something, object["hi world"]
should have make that more clear
you can also use variables
Oh damn i didn't realise you said that, that would've been plenty help, sorry
object[subreddit]
Ah yeah sorry i wasn't 100% paying attention to those messages
hey guy
just developing a bot atm
im worried about the safety of the bot
can anyone breach it? Since the bot is no as modified as other bots
As long as you don't share your code when your bot token is visible, or as long as you don't share your token
I mean ideally the token is stored outside of the code
Yeah, but if it does show in shared code then that is an easy way to compromise your bot ig
discordClient = new DiscordClient(new DiscordConfiguration
{
Token = File.ReadAllText("./Token.txt"),
TokenType = TokenType.Bot,
UseInternalLogHandler = true,
LogLevel = LogLevel.Info | LogLevel.Debug,
AutoReconnect = true,
});```
Likely not the most ideal, but I've got mine stored in a separate file for safekeeping
Doesn't really affect how the bot works really so if anything it's better to do so
Also I'm really confused right now, because any exception I hit and the bot shoots the connection
System.Collections.Generic.KeyNotFoundException: The given key 'register' was not present in the dictionary.
[2020-06-23 07:59:16 -04:00] [WebSocket] [Debug] Connection closed. (1000, '')
I've never run into that issue before so i wouldn't know how to help sorry
Yeah me neither.
Before it worked just find
Hopefully I can handle the SocketClosed event, and try to get the bot to reconnect
Nope
what library is that? dsp?
Yes
For some reason my exception handling is breaking the socket so far that it refuses to reconnect .-.
I comment out client.CommandErrored += MyExceptionHandler and suddenly that same invalid command doesn't kill my bot
I don't know what about that is magically killing the socket
@earnest phoenix
I never said it was good
am using D#Plus
yes
the API with absolutely egregious docs that use features from nightly but put them in the stable docs
is it possible?
but people can breach the bot
@dire stag people can only "breach" the bot if they either have access to your discord account or if you share your token whether it is an accident or not
i don't use dsp's commands so i wouldn't know how it works per se, but if the socket's closing run the app in debug mode, you might be getting an exception that's getting swallowed
ahh ok
i don't use the libs built in commands in general
someone could breach without my consent and use the bot to give him perms to terminate my server
because one time
a random person managed to remove me form the owner role
vs has a debug mode that lets you break on any exception and you're able to read resources used by the app
My stomach hurts
ok
ooo wrong chat
...
vs has a debug mode that lets you break on any exception and you're able to read resources used by the app
Yes, except it provides almost meaningless information at times because of async; assuming it manages to break on the exception to begin with.
the debugger is great, but in my experience trying to catch exceptions when making a bot is quite difficult.
but
I'll run it in VS and let you know what happens
yes
Yes
I think they mean the Discord Developer website
yes
Where you create your app for the bot
so whast the point of storing it
You need to login somehow
No one can access your bots token from the website unless they have your Discord account details
It's like trying to login to discord and asking "why remember my login" imo
it can't as long as you don't leak anything
It's quite difficult to brute-force a massive string, but as long as you keep your own account secure you're fine
And ofc don't leak the token
alirght thanks
But if your token does get leaked, iirc you can generate a new token, which makes the old one invalid
i mean the first part of token is the bot id in base64
you guys recommend anything before i start?
but that's like one third of the token
Also @earnest phoenix Ran in VS, no exceptions caught
Tried setting breakpoints as well, no luck
So I have a issue, I am trying to make a command that makes it so I can change the bots status however I get this error:
Code:``` if(message.author.id !== '553649764177149972') return message.channel.send("Sorry you can't use this command!");
let msgArgs = args.slice(1).join(" ");
bot.user.setActivity(msgArgs, {type: 'CUSTOM_STATUS'}).then(message.react('✅'));```
So, I've figured out the socket is closing when I return Task.CompletedTask, but, I'm not sure why. Same code worked like an hour ago
you're on nightly?
Me? I'm on heroku
what is your client defined as?
const bot = new Discord.Client(); //discord bot itself
you're on nightly?
Yes because the stable version hasn't been updated in like 3 years,
But I haven't updated, and this code worked fine before
Oh god
to hell if I'm asking emzi.
I'll try and figure it out, I appreciate the help though
are you using a command handler @spark breach
I am yes
did you define bot
or pass client to the handler
if not you can probably use message.client or something
oh ok I'll try that then
message.client.user
seeing the colour already is making me have the feeling it isn't correct :/
how do i make a web dashboard?
code it
no shit
code it
r/basicallythetruth
can somebody please help me make all files run at once
pm2
bc i cant find a good tutorial on yt
pm2
node . is running all the files at once
yeah but pm2
what
use pm2 its easier
no node is kinda shit
ok
yes
if you pc goes to sleep bam your bots offline if you close your cli boom goodby bot
doesn't work @digital ibex
if you're targeting performance node is the last thing you want to use
i think its your code proboably
@fresh hatch use this code
name: 'kick',
description: 'kicks user',
usage: '<user>',
guildOnly: true,
premission: ['Admin','Owner'],
execute(message, args) {
console.log(args)
console.log(message.guild)
if (args[0].substr(1, 1) == "#") {
return message.channel.send(`I can't kick channels, ${message.author}!`);
} else if (args[0].substr(1, 2) == "@&") {
return message.channel.send(`I can't kick roles, ${message.author}!`);
}
args[0] = args[0].replace(/[>#@!&<]/g, '');
if (/^\d+$/.test(args[0]) && args[0].length == 18) {
const member = message.guild.members.cache.get(args[0])
if (member) {
if(member.kickable) {
member.kick()
return message.channel.send(`kicked <@!${args[0]}>`)
} else {
return message.channel.send(`i can't kick <@!${args[0]}>`)
}
} else {
return message.channel.send(`i can't find <@!${args[0]}>`)
}
} else {
return message.channel.send(`Do i look stupid? i want an actual user please <@!${args[0]}>`)
}
}
}```
wtf is that emoji?
spoonfed
Rule 7a
Because you spoonfed an entire command
well they were strugglin
also your breaking that same rule
your attacking a begginer
lemme try @placid cobalt
in what way is anyone attacking anyone
If you're talking about me, didn't really "attack" i just pointed out that you spoonfed an answer 
that code won't even work
still doesn't work lmao
Lol
How do i turn on my bot
they're not using a command handler
your bot might not have the correct permissions
lmao
-faq 3
How do i turn on my bot
@dusk sphinx you need node.js
it'd error if they don't
-faq 13
@placid cobalt
no you don't....
you can use a different Lang
well i use that kick command and it works perfectly fine
Is that it
yup
Owen just cause it works for u
See what hell spoonfeeding beginners causes
why are you still fucking bringing up a fucking mistake for you asshole @slender thistle
.
No need to get hostile
yes you dont piss someone off thats having a bad day ok
Damn chill, he was just saying that spoonfeeding an answer to someone doesn't always solve problems
What should i do with node.js
and it was a fuckign mistake how many mistakes have you made in your life huh
how would you feel if i started bringing them up constantly
uh you know you could’ve just said sorry I won’t do it again and explain how to do it
I think the guy who’s asking also would like to learn how the code works
O_O
can you all just stop being assholes towards me okay
(-_-•)

O_O
can someone send me a good command handling tutorial on yt in dms
not many on yt but if you go to faq there are good web tutorials
Do i need download it
YouTube tutorials aren't reliable most of the time
learn 
you shouldn't follow a tutorial, you should make ur own. what the tutorial is doing is basically spoonfeeding the code to u
https://youtu.be/XH1Fp77D-js This a good one but i don’t know if it’s v12
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
This series is outdated!! We have a new series playlist here!
https://www.youtube.com/playlist?list=PLdnyVeMcpY7_IiC977keSLBXXJG_I3vUo
Thank y...
@digital ibex yes but its best to follow a tutorial when getting started as the code will get explained
It’s ez to update tho
for a beginner?
might as well just read docs
not a node.js tutorial
So hard tho for the chip mark
If you don't know js, first place to start is discord.js docs and js basics
if its plain js then yeah, not node.js
Discord bots is what got me into JavaScript because JavaScript alone isn’t very interesting
wut
if you dont know js then dont make discord bots
O
unless you're me 
But if you want to make a discord bot, you learn js
or another lang
or py 
True
Or any programming language that supports websockets and HTTP
or
brainfk
It drain alot of brain cells for that lol
what shiv said 
I just personally find that js is a bit easier to understand
Eh you indent your code to make it look understandable and pretty anyway 
um O_O
Ye ig
It's basically just down to personal preference or possibly just which works better for what you are coding
The tab-space issue I understand though, but a proper IDE should help you with that
my code is all on one google search
It's basically just down to personal preference or possibly just which works better for what you are coding
this
lol
Someone please code a bot with google search bar
My code is all in binary in a txt file compressed in a zip then compressed in a .rar
my code is comic sans
😳
I've gathered a hypothesis about why my websocket was being killed.
I don't see any thing about the activation system for the bot
@dusk sphinx
What langague
Eng
programming language
lmao
Is it in discord.js?
How do I make my html look good
oh
it looks okay, maybe a <code> for commands?
wdym?
oh
also the problems are
buttons don't show unless hovered on
and image is not circled/bordered
and this isn't in center alignment
use css
i did
then it should solve your problems
body {
background-image: url('https://i.redd.it/f0mpjw4ddzv41.png');
}
div.a {
text-align: center;
color: #fff;
font-family: Arial, Helvetica, sans-serif;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
}
img {
border-radius: 50%;
border: 5px solid #555;
}
h3 {
color: gray;
}
.button {
background-color:#44c767;
border-radius:28px;
border:1px solid #18ab29;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:17px;
padding:16px 31px;
text-decoration:none;
text-shadow:0px 1px 0px #2f6627;
}
.button:hover {
background-color:#5cbf2a;
}
.button:active {
position:relative;
top:1px;
}
</style>```
Would this work?
Like is that the proper layout for using images as thumbnails from bot directory?
you would need to use attachFiles()












