#development
1 messages ยท Page 1039 of 1
Ohh
and it'll be converted to the id
add a for animated
but using :kekw : wont
wont matter if it isnt animated
just do \ and copy it
it'll default to gif if its animated
๐
my bot have rock paper scissor also
can I ask for support for coding in here
how do I check if a json file contains someones id
i have this in a json file
"ID": "632114178995257344"
}```
and the file is called bl.json
aham
Bro can u help me make commads
...
{
ids: ['id1', 'id2']
}```
since you only asked how to get the property, i assume you already know how to load that json into your file
yes
i am urgent and need someone to help with overwrites
TypeError: __new__() got an unexpected keyword argument 'allow_new'
pls someone help
@opal plank yeah i still dk how
you are accesing the array in your code?
i am trying to make a black list command
const commando = require('discord.js-commando');
const path = require ('path');
const {MOD_ROLE} = require("../../libs/main.js");
const db = require("quick.db");
const fs = require('fs');
const CommandoClient = require('discord.js-commando');
const client = new CommandoClient.Client({commandPrefix: '!'});
module.exports = class blacklistCommand extends commando.Command {
constructor(client) {
super(client, {
name: 'blacklist',
group: 'devs',
aliases: ['bl'],
memberName: 'blacklist',
description: 'Blacklists a user from using the bot',
argsType: 'multiple',
argsCount: 2
})
}
async run(message, args) {
if(message.member.id == '632114178995257344'){
let user = args.join(" ");
client.userid = {
ids: [user]
}
fs.writeFile("commands/devs/bl.json", JSON.stringify(client.userid, null, 4), err=> {
if (err) throw err;
message.channel.send("good")
});
}
}
};
thats the entirety of what i have so far
ignore that whole thing, lets get one thing a time
first you want to see if an id is in the array, correct?
i want to see if it is in the json file
indeed, for that case arrays would probably be the best
indeed
ok
once you load the json, you'd need to access id property of it
json are loaded like objects onto your code
you know how to access it?
i was using fs.readFile
idk
you get the 'ids' property inside of it
how
can u give me an example of what this would look like
you already know how to access properties inside objects
you've been using it thus far
message object contains channel property
would it be like
how do you access channel of message then?
fs.readFile(bl.json, ids
no
rip
check the example i sent with message
lemme give you an example in practice
l.eval console.log(message)
oh, right, this bot isnt ehre
n.eval console.log(message)
see message up there?
ye
see type ?
ye
to access it, you need to do message => channel => type
message.channel.type
h
how do you get ids from it?
bl.json.ids
now how do i check if it contains
in this example, would be ['id1', 'id2']
check this
well i need it to go through the whole listt to see if any of it contains the id
not really, there are methods to find a specific element of an array
check the first example from the link
if(fs.readFile("commands/devs/bl.json.ids").find(message.author.id)){message.channel.send("You are blacklisted!")}
like this?
i got an error
prob in fsread
Error: ENOENT: no such file or directory, open 'commands/devs/bl.json.ids'
yup
thats fs
because your path is incorrect
try with ./commands/....
./ is parent directory
@opal plank
why
wdym
to put it in simple terms, move it to somewhere else before you get into issues
i have hosted my bot here before
my old bot
which was in 700 servers
never had any issues
their platforms are for webservers websites and other services, its not for bot hosting, they aggresively try to remove bots from their platform
also both heroku and glitch put your bot into stasis when its idle, which makes people use uptimers
not anymore
glitch changed
u can pay for full uptime
which i did
and they allow bot hosting
if you are paying for it why not use a vpn instead?
vps?
i am just using this so I can get the bot started up
once i gett it to be a lil bit bigger i switch to vps
well its up to you, i highly discourage people from using heroku or glitch when it comes to bot hosting
they aggressively remove bots from their websites
r u sure it wouldnt be like this
if(fs.readFile("commands/devs/bl.json").ids.find(message.author.id)){message.channel.send("You are blacklisted!")}
before commands
just a wild guess
usually commands are one dir after where your index is
TypeError: path must be a string or Buffer
if(fs.readFile("./commands/devs/bl.json".ids).find(message.author.id)){message.channel.send("You are blacklisted!")}
o
if(fs.readFile("./commands/devs/bl.json").ids.find(message.author.id))
like that
indeed
TypeError: Cannot read property 'ids' of undefined
try this
also is the inside of the json file supposed to look like this
{
"ids": [
"632114178995257344"
]
}
fs.readFile('./commands/devs/bl.json', 'utf8', (err, jsonString) => {
if(err) console.log(err);
const s = JSON.parse(jsonString);
if(s.ids.find('id')) message.channel.send('your message')
});
error
path again?
TypeError: id is not a function
at Array.find (native)
if(s.ids.find('id')) IT is this
not id
this id
you PUT the id
i did that too
the one you want to search
still said not a function
{ ids: [ '632114178995257344' ] }
hmmm maybe contains() might be better
fs.readFile('./commands/devs/bl.json', 'utf8', (err, jsonString) => {
if(err) console.log(err);
const s = JSON.parse(jsonString);
if(s.ids.includes('id')) message.channel.send('your message')
});
Can anyone tell me the whole procedure of hosting JDA bot on heroku or anywhere?
you shouldnt use heroku
@opal plank works
so where should i host for free and get it up 24/7 up?
type n.tag host in #265156322012561408
hey
how to add cooldown
to my meme command
people are using it like anything
is there any way i can add cooldown per user
Is there other website for coding a bot beside glitch
what should be my JDA Procfile content... after worker:
aws needs a creditcard too
any device can run bots nowadays
@lusty quest yes
@opal plank i have a raspberry pi should i try n host on it
if you have a Raspberry you can host it on there
absolutely
but for larger bots you probably want more bandwith
raspberry pi's are a really good alternative
in any case better than glitch or heroku
when my bot gets verified i will probably switch to raspberry
i just dont feel like setting it all up lol
its a one time thing, shouldnt be that bad
i know but i havent used my pi in a long time
linux makes it easy to get a production enviroment running
im even thinking about setting up a command to create commands so i do it remotely
so i wont have to touch the raspberry pi at all
i created the command with the command -Thanos
indeed
though syntax might be an issue, so i'll just deploy it from VSC onto it
maybe a git pull
decisions
wouldnt i have to install all dependencies ontto my pi
yes indeed
and last time i tried i couldnt get node.js to install properly on it
this should give a rough overview on it
the whole point of the command to make commands is to not need to ssh onto it
deploy commands on the go
u could do it from ur phone that way too
i think a git pull would be nice, you can update the repo without being bound to any location
indeed thats what i was thinking
fuckit imma try n do my raspberry pi rn
do a small script to fs the whole commands, then restart it
ok
i bought google vps
now how to host my bot
over it
pls someone help me
๐ฅบ
docs
@delicate shore which os?
anyone knows how to warn in node js
@delicate shore and which library r u using?
@delicate shore
Hosting a bot is easy. You just have to have a basic knowledge of linux. For this tutorial lets use Ubuntu. Begin by connecting.
- SSH into your VPS
- Make sure you have root permissions
- Install nodejs
4.One nodejs is installed pull your repo or wherever else your code is stored - Use cd <folder where your bot stored> to enter the folder
- Install your requirements.
7.You should have requirements installed . - To exit use screen ls to get a list of screens
10> Exit by using screen -Xs [screen_id] quit
This is how I did. You may use tmux or systemmd as well.
https://www.youtube.com/watch?v=_OZVJpLHUaI
Version Management is key when it comes to efficient project and code management. For this purpose, most programmers use Git, so in this Git Tutorial for Beginners, we'll have a look at the Git basics and and learn what repositories, branches and commits are. So let's get star...
simply console log?
kk
:/
omg
@ornate needle thanks
i dare you to do d!help right here and set your status to online
d!help
ok
oof
const { MessageEmbed, ReactionCollector } = require('discord.js')
module.exports = {
name: "b!verify",
run : async (client, message, reaction, user) => {
const reactmessage = await message.channel.send('React with ๐ to get your role!');
await reactmessage.react('๐');
const filter = (reaction, user) => reaction.emoji.name === '๐' && !user.bot;
const collector = reactmessage.createReactionCollector(filter, { time: 15000 });
collector.on('collect', async reaction => {
const user = reaction.users.cache.last();
const guild = reaction.message.guild;
const member = guild.member(user) || await guild.fetchMember(user);
member.roles.add('73059468924741');
}
)}
}
how do i make this be unlimited, can be used many times
the reaction
remove time lol
@opal plank how do i upload my bot to my pi now that I am ssh'd into it
Sftp is a good way to move files around
do i need a start.bat thing in my bot or anything
make the prefix a variable
@delicate shore did the guide you where linked not work?
which
well nvm
of google cloud? @solemn latch
i haven't tested yet
but
first
i wanna know about cusotm
custom
prefix
any guide?
or something
docs
Kinda depends on what databases you already use @delicate shore ideally you'd use one db
You can research videos on google
okk
thx
lol
That's just spoonfeeding. That's not what this channel is here for.
@coarse hearth look into the ReactionAdd event
if you use reactioncollector it will end after some time (its limited) if you use the even with enabling partials it will work even if the bot restarts
is there any way to have or function in .endsWith()?? i tried a few ways but it doesn't work
if(!time.endsWith('s' | 'm' | 'h' | 'd')
if(!time.endsWith('s', 'm', 'h', 'd')
if(!time.endsWith('s' || 'm' || 'h' || 'd')
you can use regex I guess
Then you can't use endsWith tho
hey
my code for custom prefix
but it is not wokring
no error
it says successfully seted
but
it doens't wokr with it
work
Are you using quick.db?
actually, you can console log it before too, because PREFIX could be undefiend, and you are strictly checking if it's null
yep
quick.db is somehow a troublemaker, every time someone uses it and has low knowledge about it he ends here asking bcs stuff doesnt work
@cinder patio i found
the probelm
but not the sol
even if i change the prefix
it's logging the same prefix
s!
s!
s!
s!
s!
this is what it logs^
Even if you do !PREFIX?
yes
I found the problem
Is there better website or app for coding and command
in your setprefix function, you set the key as PREFIX_GUILDID
But you get it as prefix_GUILDID
no @cinder patio
x
x
s!
x
x
s!```
this is what its logging
it's changing it back to s!
s!seprefix
s!setprefix
the problem is
if i run a command
it resets the prefix
but you need to define default settings for a guild, otherwise the bot will not work
Shouldn't args[0] be your prefix?
no
and not args[1]?
i tried
i logged
args[1]
is correct
i checked by logging
@cinder patio i think i found the error
no
Hmmm
if (message.content.startsWith(`${prefix}botinfo`)) {
const help = new Discord.MessageEmbed()
.setFooter(
`Requested by ${message.author.username}`
)
.setTimestamp()
.setAuthor("Information:")
.setColor("#FF4500")
.addFields(
{ name: 'Servers:', value: client.guilds.cache.size + " guilds" ,inline: true},
{ name: 'Users:', value: client.users.cache.size + " users",inline: true},
{ name: 'Channels:', value: client.channels.cache.size + " channels", inline: true },
{ name: 'Node Version:', value: '12.16.2', inline: true },
{ name: 'Library:', value: 'Discord.js', inline: true },
{ name: 'Library Version:', value: '12.2.0', inline: true },
)
message.channel.send(help);
}
});```
when i use -botinfo the bot spams this
many times
How would I have it fetch the data that is inside the {}'s of owner
I already have it so it gets data.owner but I tried adding .username and it didn't work
https://gyazo.com/a5ca4471de0afa036ad78d234a1996b2
how can i make a command in which if bot get's pinged
it replies with it's prefix
in the specififc servevr
serverv
i use quick.db
@cinder patio
Get the servers prefix and reply with it
Read quick db docs
hm
quick.db is somehow a troublemaker, every time someone uses it and has low knowledge about it he ends here asking bcs stuff doesnt work
@lusty quest me uses it because i gave up on SQL so i'm the reverse
WHAT EVEN IS THE BINDINGS FILE THAT I KEEP REINSTALLING BUT DOESN'T WORK
/rbd/pnpm-volume/a942381f-ffd2-4139-a741-0fafbfe74da9/node_modules/.registry.npmjs.org/bindings/1.5.0/node_modules/bindings/bindings.js:135
throw err;
^
Error: Could not locate the bindings file.
Ik glitch
glitch is my hosting provider

That's why I left glitch
so uh about mongodb atlas, which provider is best?
||buy a good vps||
@surreal notch u should also do if(message.author.bot)return
That's why I left glitch
@restive pebble but can you fix it?
OkK
No
but how to do that
intensifies
Also hey Boeing
How is you?
@restive pebble it is still spamming
so uh about mongodb atlas, which provider is best?
And how is the fuck I do this
Ok wait
I'm alright, I started re coding alebot
Yes
Botinfo one?
How would I have it fetch the data that is inside the {}'s of owner
I already have it so it gets data.owner but I tried adding .username and it didn't work
https://gyazo.com/a5ca4471de0afa036ad78d234a1996b2
@errant hornet object lol
What?
@restive pebble
@surreal notch return message.channel.send(help)
Clarify
It's an object
Show me an example code
owner.userId
I did that and it didn't work.
@restive pebble ok
help
why does my bot keep showing errors after i updated it to v12.2.0 discord.js
they aren't discord API errors, they are errors with node.js and npm
help
Ok
But why my other embeds are not spamming?@restive pebble
i can't keep my pc on 24/7
It becmes a loop I think
@earnest phoenix use a vps
But why my other embeds are not spamming?@restive pebble
@surreal notch then use those methods ๐คฃ
the emoji name... bruh moment
excusemewtf
how can i make this send images?
if(message.author.id === bot.user.id){
return}
if(message.channel.id == botconfig.CHANNELID){
let tmp = message.content
message.delete()
message.channel.send(tmp)
}
});```
what are you trying to do
lol
Anyone got a good music bot replacement for Erela.js? thing always breaks for me, never loading the first track until it leaves and rejoins.
Erela is gay
honestly yeah
Auric was also saying
U can take a look at mine it uses discord ytdl core
when you fix your error but node restarts and brings it back again
oh alright
Which is the best provider for mongodb
you open sourcing the code?
Hhhhhh
It is
define "best"
Open
ah nice
yeah if you could send that link to me that would be great
thanks man
Music boat

Flexboa-
lol
Only the music module
It has some features like nightcore effect
Oh
So I'll ask again, does anyone know which mongodb provider is most reliable
I don't wanna go with the "shit" one
@restive pebble it is still spamingggg
someone please help why glitch is giving errors witht he bindings file https://glitch.com/~codecodiscordbot
Oh hi thanks for checking out my discord bot! Visit the support server at discord.gg/NZYPF23 ๐ Glitch is the friendly community where everyone can discover & create the best apps on the web.
Idk
a
Does it spam like infinite times?
maybe 6-7 times
Hmmmm
sometime less sometime large
FIXED BINDINGS FILE
Ik how
@restive pebble so maybe glitch is good
U switched workspace
i did npm i node-gyp -g and then did npm i discord.js
What is erela
@restive pebble lets you do music stuff with discord.js which uses lavalink
Okk
Hmmm
just use this to run lavalink (in a second file not your main file plz)
require('shelljs').exec('java - jar Lavalink.jar')
lol
Lol
Tho ffmpeg is crystal clear
It eats ram but gives worth
It's bass is like super hot
Minimal disortion
well im fine with lavalink
Hmmmm
cuz it does sound good
Idk how to use lavalink
Ffmpeg sexyyyy ngl
ยฏ\_(ใ)_/ยฏ
Link pls
I cannot find it
wait
Npm?
Official documentation for the lavalink client, Erela.js
the docs say everything you need
you should give it a try lol
K thx bro
just go to lavalink github page, and then theres for many languages wrappers and yeah (bad english yes)
I deleted it x)
Slow
I am asking
Nope
Ok
Does anyone know how i can make graphs for my discord bot
canvas
Is there any example you can link?
Guys can this kick command work in VSC v12.2.0
bot.on(const sim = require("string-similarity");
module.exports = {
name: "kick",
description: "kicks a member",
execute(message, args) {
if (!message.member.roles.cache.has("730187390328504381"))
//Do they have the role?
return message.channel.send(
"You do not have the permissions to run this command!"
);
if (args.length == 0 || args[0].length == 0) {
//If no args were provided
return message.channel.send("You have to specify an user to kick!");
}
const member = message.guild.members.cache.get(
(args[0].search(/<?@?!?([0-9]+)>?/gm) == -1 //Is there a mention in the first argument?
? undefined
: args[0].replace(/<?@?!?([0-9]+)>?/gm, "$1").toString()) || //If so then return the id
message.guild.members.cache.find(
//Or else then look for the best match
member =>
member.user.username ==
sim.findBestMatch(
args[0],
message.guild.members.cache.map(member => member.user.username)
).bestMatch.target
).user.id
);
if (!member) {
return message.channel.send(
"You have to mention an user in this server to kick!"
);
}
if (member.user.id == message.author.id) {
return message.channel.send("Why would you want to kick yourself?");
}
let reason = args; // Get the reason
reason.shift();
member
.kick(
reason.length == 0
? "You were kicked from Server Staff Support server."
: reason.join(" ")
)
.then(() => {
return message.channel.send(Sucessfully kicked ${member}!);
})
.catch(Error => {
message.reply("I was unable to kick that member");
return console.log(Error);
});
}
};
Does it wokr?
bot.on(const sim = require("string-similarity");
already no
Ok
bot.on(const sim = require("string-similarity");
already no
@slender thistle lol
Knew it
But if I delete it then the bot.on?
@slender thistle
lol
Probably
https://prnt.sc/telc2s how can i get this text?
try putting an image
it's message content
sorry no
๐ฆ
RIP
Are u compiling tsc
?
I also encounter that while compiling
Vsc dosent have admin perms
SOLUTION:
Open normal cmd
And run
@earnest phoenix
@restive pebble Can I DM?
Bruhh
U have git bash?
HUH
Normally run cmd prompt
Use bash then
what is bash?
Run with admin perms
k
And that powershell
Cmd with admin
start either PS or CMD as administrator
it works with PS if you know how
cd D:
cd /way/to/ur/file
cd/D:/Bot/ModBot
cd D:/Bot/ModBot
Yea
@restive pebble bro take alook at the shit i posted
no
Idk why they removed open cmd. Here
@earnest phoenix ima show u
@earnest phoenix I get the same error when compiling typescript
K
don't use cd
Powershell is gay
just put D:/
@earnest phoenix
where on here would i put
if (message.author.bot) return
const Discord = require("discord.js");
exports.run = async (client, message, args) => {
const responses = [
"&{{weaponname}}value | &sb"
];
message.channel.send(responses[~~(Math.random() * responses.length)])
}
exports.data = {
"name": "hsb",
"category": "Fun", // used for help command i made - can be removed.
"usage": "question", // used for help command i made - can be removed.
"description": "Sends a help script", // used for help command i made - can be removed.
"aliases": ["q"] // other ways to run the command (i.e ;leaderboard or ;lb ect...)
};
Nice trick dude
Yass
@cobalt spruce Thnx
Lol
@earnest phoenix np
i think he needs Admin permissions.
otherwise the shell in VSC should work too
Idk about permissions
WAT DA FUC i do
Sorry
where on here would i put
if (message.author.bot) return
const Discord = require("discord.js");
exports.run = async (client, message, args) => {
const responses = [
"
&{{weaponname}}value | &sb
"
];
message.channel.send(responses[~~(Math.random() * responses.length)])
}
exports.data = {
"name": "hsb",
"category": "Fun", // used for help command i made - can be removed.
"usage": "question", // used for help command i made - can be removed.
"description": "Sends a help script", // used for help command i made - can be removed.
"aliases": ["q"] // other ways to run the command (i.e ;leaderboard or ;lb ect...)
};
Superbrain8 vsc uses powershell
i know
It messes with compiling
My typescript compile also dosent work
GUYS
help
?
Enjoy then
@cobalt spruce you dont send a array or collection for the permission override
where on here would i put
if (message.author.bot) return
const Discord = require("discord.js");
exports.run = async (client, message, args) => {
const responses = [
"
&{{weaponname}}value | &sb
"
];
message.channel.send(responses[~~(Math.random() * responses.length)])
}
exports.data = {
"name": "hsb",
"category": "Fun", // used for help command i made - can be removed.
"usage": "question", // used for help command i made - can be removed.
"description": "Sends a help script", // used for help command i made - can be removed.
"aliases": ["q"] // other ways to run the command (i.e ;leaderboard or ;lb ect...)
};
@earnest phoenix did you use a command handler?
nope
then this will not work
actually
copy/paste is not a way to code a bot
i dont copy and paste
@cobalt spruce How to make this work in visual studio or PS
the exports will override the export of a other command in the same file. this is why a command handler that uses a file for each command
hold on
otherwise use it in a client.on("message") event
How?
Run powershell as admin
try to run it in ps it will throw a error with instructions
I did
Set-ExecutionPolicy RemoteSigned
What to do with that?
Paste it lol
In?
That's not powershell
there are litteraly instructions in how to
VC =?
It won't worl bruh
or Ctrl + รน
What is VC?
@earnest phoenix visual code
That worked for me
k
@restive pebble it has
No
Bruh
Never mind
U have to do it from powershell
Since vsc also runs with powershell
@earnest phoenix wat cha wana do in the cmd
Yo guys
can you help me make a setActivity code
IDK how
That can count online people in other server
make full please
No
LOL
Docs
What is nodemon
Set-ExecutionPolicy Unrestricted
This would worked
It worked for me
It auto starts when I have made anychanges to the file
I dont need to off and On it again and again
Sounds good
bot.on("ready",() => {
console.log("Bot is online");
bot.user.setActivity("with " + bot.guilds.cache.size + ' server(s) || Type ' + bot.prefix + 'help');
setInterval(() => {
bot.user.setActivity("with " + bot.guilds.cache.size + ' server(s) || Type ' + bot.prefix + 'help');
},60000)
});
This is my bot that count srver
server*
not member
@restive pebble
Epic
I want my bot to count other server online members
example
You added my bot to another server that u owned
so
it will count total my server and u together
Like u 100 me 100 = 200
this.guild.members.cache.size
Can someone help me wurhe smeksmes
Fuck I'm so tired
Mongodb/mongoose
Help
More info coming soonโข๏ธ
It's nosql
I have to learn sql
but me learning TS
No not work
Websocket
Socket.on
It's gotta be message.guild
This is just aaaaaa thing that tells the client where the guild is, as a placeholder for your collection
yes
Tf help
Feed him
What does reduce do agaianddjs
Bro
Ew goitch
U ran out of the 500 hours limit
tf
Heroku
Oh rhshrsh horkekrk
It is
Okay good clever
Heroku
how can i revive poor deku bot
Spspsssp I don't know these things
U ran out of 550 hours limit
Pay?
U need to wait for next month
WTF
1st of august
SHIT
๐ข
@pure lion u deleted bot?
@restive pebble off of top yeah
Heroku limits you to a certain amount of hours a month in hope you'll pay them
Error is not enough
Heroku limits you to a certain amount of hours a month in hope you'll pay them
@short siren WHY
MY BOT
WHY ๐ฆ
Spoonfeed coming
Jsjsjssjsjsjsjs
Complete spoonfeed
should have read the heroku terms of sevice lol
Lol
I've just said "in hope you'll pay"
And I'm sure u are running more than 1 app
let spoonfeed = await spoon.spoonFeed(userResolvable)
u talking to me?
Yes
K
U using ffmpeg?
you passed a wrong variable to an event listener
Oh lol
uhh my bot is working again tf
๐ญ
If your desperate get a github student account
Yea
?
That's for american
whats that
.edu
You get loads of free stuff including credit
Emails
doesnt heroku give you 1000 hours if you verify your account?
"that's for American"
No I'm in UK
UK squad
Btw Tim djs light is really good, thank you :)
:3
Yes lol




