#development
1 messages Β· Page 1258 of 1
@warm portal get it fix is the best solution, coding on mobile is not recommended
It can't be πππ I have to buy a new one
Rip
@earnest phoenix #memes-and-media
Alright, sell-out
@earnest phoenix no one will buy the trash but I can sell its parts maybe will get 5k rs
@warm portal Dont ask me, ask China
Guys
Stop
Its getting off topic
is there any node package which do like
starting time
time it is at
ending time
|0:00|===|1:20|=====|2:23|
like in music bot
showing how much of the song has passed?
there is some
wziy
lemme find the one I made
probably not what you want but... https://www.npmjs.com/package/easy-node-progressbar
@tight plinth shameless plug
I should do more thinge
@tight plinth shameless plug
@torn ravine not really when its on topic
You kinda right
100 seconds im guessing?
well im getting my time in this format
timestamps: { start: 2020-09-21T05:55:14.534Z, end: 2020-09-21T05:58:19.149Z },
same lol
cache
other way around
doesn't work either
oh
it returns undefined
i assume you arent -10iq'ing this and simply copying what im posting
what is undefined then?
let muteRole = msg.guild.roles.cache.find(role => role.name === "MODMAIL");
msg.guild.channels.cache.forEach(async (channel, id) => {
await channel.overwritePermissions(muteRole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
});
});```
you legit fucking with every single channel override rather than assigning a role that doesnt have SEND_MESSAGES or ADD_REACTIONS perm
why the heck would you do 20+ api calls on every channel to set its override
rather than just assigning a role?
I need to do
thats such a idiotic format you doing
for muted command
thats a mute role no?
meaning it should be muted on all channels
yes
so why not DENY SEND_MESSAGES and REACTIONS on the ROLE and then DONT FUCK with the channels overrides?
your role inherits
if your role has DENY on SEND MESSAGES it means they wont be able to send ANY messages on ANY channels UNLESS someone SPECIFICALLY allowed that role to do so
rather than 1 call with role assignment you spamming the api with channels overrides
thats stupid
YES THAT"S THE CASE
IT HAS THE TICK NEXT TO SEND MESSAGES
IN ALMOST EVERY CHANNEL
Create role => give role to user
thats it
ok
no need to fuck with any overrides whatsoever
also
how can i over write for a role
guild.roles.create({ data: { name: 'Mod', permissions: ['SEND_MESSAGES': false] } });
why would you overwrite a role?
how do i get howmany channels are there in a caegory?
no
i know its not a thing
its just an example
also, how do i create a regex with a variable
If you have the category's ID, then you have to find all channels that have the parentID property set as that ID you have
If you have the category's ID, then you have to find all channels that have the
parentIDproperty set as that ID you have
@cinder patio sounds like pain to me
Use guild.channels.cache.filter
Use
guild.channels.cache.filter
@cinder patio I want to learn more
Ok well... the most I can do for you is link you the docs
Oh and you can create regex with a variable with the RegExp class
hi i have a question
var replace = /[M][M]/;
var re = new RegExp(replace, i);
//searches MM1 - MM30??? correct me if theres an error
}```
are bots which send random messages at fixed times allowed
replace is already a regex
are bots which send random messages at fixed times allowed
@vale garden Yes I think, just don't make it less than 10minutes
replace is already a regex
@cinder patio What must I do?
You can use replace, no need to create another
hm?
guys when i do commands for my bot it send 2 messages
guys when i do commands for my bot it send 2 messages
@sand saffron uh, maybe you have 2 message.channel.send()???
i dont have 2 message.channel.send
or there is another instance of your bot running
What I mean is, Same bot running on different hosting platform
lol
vs code terminal ? @sand saffron
.
@cinder patio
make sure u dont have 2
https://codeine.is-inside.me/nW2W0dvX.png
stop ur current one
but it doesnt say powershell
ok
@sand saffron Are you using visual studio?
yes
what?
Close visual studio and reopen it
var replace = /[M][M]/;
var re = new RegExp(replace, i);
//searches MM1 - MM30??? correct me if theres an error
}```
wat do you mean
by
replace
something
You can use
replace, no need to create another
You can put the regexp inside the new Regexp
il try that
why no work
@cinder patio please teach thia guy ty
why logs nothing?!
im an idiot
i forgot cache
but still
no work
var re = new RegExp(/(MM)/, i);
console.log(client.channels.cache.find(channel => channel.name === re))
}```
That's not how you check if a string matches a regex
?!
yes
Good night.
I'm trying to create a bot, but I'm having this error that I can't solve, can you help me?
`PS D:\Documents\satania_bot> node index.js
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'D:\Documents\satania_bot\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js
47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}`
Ok
@carmine summit Please
Srtop
Yoir clearly dont know anythinf
@earnest phoenix first of all
Dont do that
Dont do what cwickks said
??
The error told you that youre require a module that doesnt exist
Which is th moudle name D:
you donβt rename the

folder
lol wtf
@earnest phoenix could your give me your index.js?
@carmine summit You
Are
Fucking dumb
Pelase stop
Cwickks please, just stop
ok
Youre not fucking helping
@earnest phoenix what is the file called where your code is
@misty sigil matthre
matthre
No.
Nvm
that happens when you start a nonexistent file too
I changed the folder to index.js, but nothing changed
Ok, @earnest phoenix you are in the wrong folder
@carmine summit thanks so much, you fucked this man folder
nice job cwickks

rename the folder back
ok
type dir
do npm i discord.js --save
@carmine summit STOP

in the power shell
@earnest phoenix hey matsu
ok
Wheres the project folder located?

try typing node index.js
Se eif that errored out for you
yes
type dir
And show what responded
try
C:\
then
Wait
Wait
@earnest phoenix hey
Type C:\
oi
ok
Press enter
Next step dont press enter until i said so
Damn
try
cd C:\

work?
why?
I thin kyour bot file is on C:\
Which located on document in your users file
But rn your in D:\documents
Can you show me where is your index.js file???

@carmine summit shut
Up
@earnest phoenix so you have tp cd to C:\
ok
so
cd C:\Users\YOUR USERNAME\Documents\satania_bot\
How do I find a voice channel that its name starts with "MM"
@carmine summit you use discord.js ?
so it is indeed hue hue language
FUCK IT
yes
Ok will dm you in a sec
Fuck
fyi i understand hue hue br if you need some translation @earnest phoenix
entende?
yeah, but only english here

#general-int you can speak other languages, so if you get stuck i might be able to assist there
don't use regex for that, use string.startsWith()
?
don't use regex for that, use string.startsWith()
@pale vessel how do i use that to do a search?
what method are you using to check the name?
client.channels.cache.find(channel => channel.name === /^[M][M]/)
message.channel.name.startsWith()
no?
startsWith() returns a boolean you can do find(channel => channel.name.startsWith("MM"))
that will get the first channel it can find that starts with MM
how do I get a string's character by position
use string.indexOf()
"hello world".indexOf("h"); // 0
"hello world".indexOf("e"); // 1
"hello world".indexOf("z"); // -1```
while True:
print("hi")
ok
if (channel.name.length < 3) return
let mm = channel.name.indexOf(3)
channel.setName('MM'+mm)```
So, If a channel's name starts with MM, then if it has less than 3 characters, return. then get the number of the MM, then finally rename it to MM+number
think its safe to run
a
@carmine summit string.indexOf returns the index of a character/word in a particular string
.
module.exports = {
name: 'work',
aliases: ['job'],
cooldown: 3600,
description: "Work every hour and earn credits",
usage: '<job>',
type: 'fun',
execute: async function(message, args) {
if (!args[0]) {
let workListEmbed = new $()
.setColor(config.color)
.setTitle("Avaliable Jobs")
.setDescription("Here is the work list for Void bot. Different jobs have different salaries. Higher salary jobs generally have harder tasks to complete. You can work every hour. Type `-work <job>` to work")
.addField("Fast Food Worker", "Salary: **300 credits**")
.addField("YouTuber", "Salary: **400 credits**")
.addField("Teacher", "Salary: **500 credits**")
.addField("Developer", "Salary: **800 credits**")
.addField("Scientist", "Salary: **1000 credits**")
return message.channel.send(workListEmbed);
}
}
}
``` i want there to be no cooldown if there isnt args, but an hour cooldown if there is. l
@carmine summit string.indexOf returns the index of a character/word in a particular string
@pale vessel is indexOf(3, 4) a thing?
don't think so
olright
it is
hm?
but it's only for specifying which index it should start first
the way you're using it is incorrect, i'm not sure what you're trying to grab from the channel name
is it the value after MM?
only one character or the rest?
so..
so two digit after MM?
yes
you should use slice for that, ```js
"MM1234".slice(2, 4); // 12
it gets from index 2, which is after MM and until 4, which is until two characters after MM

HAHAHHAHAHA
my code is faster than moobots and nightbot
god bless my library caching
faster 10/10 times than the other two
lmao is that elon
can you show me what the names can look like?
MM1, MM2 - MM30
@pale vessel indeed it is
yes indeed
what's your code?
console.log(i)
let channel = client.channels.cache.find(channel => channel.name.startsWith("MM" + i))
console.log(channel.name)
if (channel.name.length > 4) {
if (channel.members.size == 0) {
let mm = channel.name.slice(2).slice(':')
channel.setName('MM' + mm)
console.log('ehhhhhhh' + 'MM' + mm)
}
}
}```
?
you can't put a string for slice
ok
in fact, you don't need that last .slice()
slice(2) would do just fine, if i understand correctly
im making a public command ?code which they can put their 6-digit code in after the MM
and i don't think channel names can have :
so it's a command?
.addField(Roles [${roles.length - 1}], roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None')
this working in other servers, only my one. it says utils is undefined
you must mean split(":")
for instance "hey".split("e") would return ["h", "y"]
you can use "MM12: hello".slice(2).split(":")[0] to get 12
"MM12: hello".slice(2).split(":") would return ["12", " hello"] and you need the first element, so you need to add [0]
can you show the code?
for (i = 1; i < 31; i++) {
console.log(i)
let channel = client.channels.cache.find(channel => channel.name.startsWith("MM" + i))
console.log(channel.name)
if (channel.name.length > 4) {
if (channel.members.size == 0) {
let mm = channel.name.slice(2).split(":")[0]
channel.setName('MM' + mm)
console.log('ehhhhhhh' + 'MM' + mm)
}
}
}
defining it?
can't see ehhhhhhh
uh
tht only happens when
ok wait
MM9 has members in it
while MM8 doen't have any
if (channel.members.size == 0) this no work
well
you only defined the correct name there
so anything that isn't mm would be wrong
huh?
this isn't mm
yes
the name isn't correct since the channel doesn't have any members in it
look where you defined it
oof it overlapped
so basically use mm and in order to use that, you have to define it outside the block, maybe after let channel
hm?????????
uwotm8
the correct name is mm, that's what you defined it as
of course the values in the console isn't right, you're outputting channel.name, which is the raw name
mm is the formatted name
yeah right
and you only log mm if there's no members
i fixed my bot lol
you need to define mm outside the if (channel.members.size == 0) block and use that (mm) instead of channel.name
WHAT?
what are you trying to do
if there is no members inside the vc channel, and if its .length is more than 4, delete the 5charcacter to the last
also, i think i should use 2 for loops to make this happen
and rename the 0-9 to 00-09
yes, seems like it
@pale vessel
it works
but skips 2 and 3
for (j = 1; j < 10; j++) {```
01 - 30??
My bot crashes saying ```1|index | RangeError: Source is too large
no, that last one stops at 9
parseInt()?
thx
because it works in browsers too
that was just the first example i found π
im assuming youre using node.js and discord.js or eris or such?
let somenum = parseInt("666"); /* somenum = 666 */
hmm ignore that example
its over the top
its just showing all the different strings that will get accepted to convert to int
That makes sense. 03 + 1 = 4
for (i = 0; i < 3; i++) {
for (j = 0; j < 10; j++) {
let rawNumber = `${i}${j}`
console.log(rawNumber)
//returns 01
let number = parseInt(rawNumber) + 1
console.log(number)
//returns 4
}}
That makes sense. 03 + 1 = 4
@lament rock please no
i want to keep the 0
?
What do you not understand?
JS removes extra 0s from Numbers. Discriminators from Discord's API are strings because of this
i need it to count from 01 to 30
use padStart()
If the number is lower than 10, add a 0 at the beginning
padStart aint function
use number.toString().padStart()
padStart is a String prototype function. Not a standalone
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.member;
const roles = member.roles.cache
.sort((a, b) => b.position - a.position)
.map(role => role.toString())
.slice(0, -1);
//code stuff....
.addField("member", `${roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None'}`,)
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'utils' of undefined
show the error stack
oh nvm
this.client is undefined
If you're using a class based command handler, try logging the value of this just to make sure this is referring to the command instance. Inside other functions, it may refer to the function it is inside
so im using a command handler in discord.js, does anybody have any idea of how a help command should work? each file has name, description and category
long time no see glassy
yes!
what happened?
anyway, i'm assuming you have a collection of command somewhere in your client as a property
do you store the command category in the command's module.exports?
if so, you can use cosnt data = client.commands.get(userInput) and use data.category for example
you can grab other properties too
user's input, args
so something like commands.get(args[0])
that would get you the command
by the way, i have an array that contains all the commands
you hardcode them?
maybe i can get every command and organize them into categories?
ah, you can use if (client.commands.has(command)), no need for hardcoding
you can sort commands as category like:```js
const formatted = {};
client.commands.map(command => formatted[command.category] ? formatted[command.category].push(command.name) : formatted[command.category] = [command.name]);
formatted; // { "General": ["ping", "help"], "Moderation": ["kick", "ban"] }```again, depends on how you name your property, this is just an example
did you set it first?
yes
i guess client.commands.get("help").description
thanks
how do i access the commands collection from another file in the commands folder
it's under client
since you don't pass client through your handler, you can use message.client
so message.client.commands
Constants
Primitive Types
Dynamic Typing
Objects
Arrays
Functions
Types of Functions ```
**ARE THESE THE BASCIS OF JAVASCRIPT**
hmm...seems like everybody got corona...
Hello world
Constants Primitive Types Dynamic Typing Objects Arrays Functions Types of Functions ``` **ARE THESE THE BASCIS OF JAVASCRIPT**
@silk chasm NO THEY'RE THE BASICS OF JAVASCRIPT NOT BASCIS
can someone help me with voiceStateUpdate
i cannot understand the docs
so i am here
i want to run a code if someone left the voice channel
check if the channel of the state before is defined and the channel of the state after undefined
i also want to fetch the voice.channel the user left
there is an event for that
client.on('voiceStateUpdate', (oldMember, newMember) => {
if (!newMember.member.voice.channel) return console.log('left')
})
one sec
If the oldmember has a channel and the newmember doesn't, the user has left a voice channel
if the oldmember doesn't have a channel but the newmemberdoes, they've connected to a voice channel
Try it and see!
it's not supposed to be oldMember
ok wait
client.on('voiceStateUpdate', (oldState, newState) => {
if (!newState.member.voice.channel) return console.log('left')
})
https://discord.js.org/#/docs/main/stable/class/VoiceState this is what you get.
@carmine summit https://discord.js.org/#/docs/main/stable/class/VoiceState?scrollTo=channel returns the channel which you can fetch
client.on('voiceStateUpdate', (oldState, newState) => {
if (!newState.voice.channel) return console.log('left')
})
Ok now try it
let bal = db.get(`${message.author.id}.bal`)
if (bal === undefined) {
db.set(message.author.id, { bal: 0 })
}
message.channel.send(`:credit_card: | **${message.author.username}** you have a balance of **:dollar: ${bal} credits**!`);
quick.db, says bal is null
client.on('voiceStateUpdate', (oldState, newState) => {
if (!newState.channel) return console.log('left')
})
???
?????
dude just fucking try it
im here to learn bruh
yeah trial and error are part of learning
i need to know why removing voice corrects it
because voicestate does not have a voice property
@silver lintel null and undefined are two different things, so try just if(!bal). Also, if you do have an undefined bal and you set it, bal is still undefined, since you didn't get it again.
@silver lintel
nullandundefinedare two different things, so try justif(!bal). Also, if you do have an undefinedbaland you set it,balis still undefined, since you didn't get it again.
@umbral zealot i console.loged, and it passed through both of those
maybe because you didn't read docs
Ok so again, the variable called bal is still not what you want.
i read docs multiple times
It's still undefined
So you need to get () twice, or you need to figure out if there's a way to check if the key exists first
then do i asign another variable to db.get(${message.author.id}.bal)?
is discord.js officially made by discord, or some random guy who likes to code?
the latter
Well discord.js is an entire team of developers not just one guy.
so some random guys who like to code?
A team of professional developers that have been working on it for the better part of a decade.
how have they been working on it for that long if discord was founded in 2015/2016
2015
It feels like it's been 20 years. alright fine. For the better part of 5 years.
lmao
@silver lintel you probably want to use https://quickdb.js.org/overview/docs#has in order to check if the key exists, if it doesn't, create it. Do this before using get.
Oh no, I completely forgot about .has(), ty
Is there a way to add localizations into a bot easily without needing to rewrite everything?
nope
k thx
You have to add localization support to every single string you want to localize
guess i need to change like 200 files now
Ok this is not really support but can someome give me a name for my website for my bot? (Bot name is bow bot)
Discord.js => Can we make it so that if there is a permission error anywhere in code it gives the code in console log in orderly fashion rather than restarting or shutting down the bot ? Or do i have to check in each feature individually ?π§
if (command === 'kiss') {
var mentioned = message.mentions.members.first() || message.author;
var autho = message.author.id;
var say = "You kissed " + mentioned.member + "!"
if (mentioned === message.author) {
message.channel.send(":warning: You need to mention someone :warning:");
} else {
if (mentioned.id === message.author) {
message.channel.send("You cant kiss youself :");
}
else {
var avatar = message.author.avatarURL();
console.log(avatar);
var img = `kiss`[Math.floor(Math.random() * `kiss.length`)];
const kissembed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setAuthor(say, avatar, img)
.setImage(img)
message.channel.send(kissembed);
}
}
}```
why does it say undefinied
If you're using author which i think you are you cant use mentions in that @peak osprey
like the id ones
You should use description i think that would be better and do icon of embed as avurl
ok
come dm and explain me better i will tell the solution
ok
if (!message.member.voice.channel) return message.channel.send('You are not in a MM voice channel.')
if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
let defaultName = message.member.voice.channel.name
let defaultPosition = message.member.voice.channel.position
let replaceName = defaultName.replace(/MM../, '[IN LOBBY]')
message.member.voice.channel.setName(replaceName)
message.member.voice.channel.setPosition(0)
setTimeout(() => {
message.member.voice.channel.setPosition(defaultPosition)
message.member.voice.channel.setName(defaultName)
}, 60000)
}```code goes buggy when used 2 times in a minute
I am trying to make a webhook for handling votes from all bot lists, but I can't figure out if this will work or not.
app.listen(9123);
app.post('/vote', (req, res) => {
if (req.body.user && client.users.cache.get(req.body.user)) {
require('./voted.js')(client, req.body.user);
} else {
console.log(`no user`);
}
});
I've tried testing it using cURL, but it doesn't seem to do anything, although I don't know the cURL syntaxes
Well finding the music I need command to get the bot into the audio room
But the application of the bot:bot desinger for discord
@summer acorn #topgg-api
@carmine summit define "goes buggy"
You need to be precise, we can't guess what that means.
and also, you should specify the channels to change
or else people can change vcs like general vc
if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
setTimeout returns a timeout object
@carmine summit that wont help it
use clearTimeout to cancel the timeout
if they run the command inside of the music vc, and then they go to general
IDs are strings bruh
IDs are strings bruh
@earnest phoenix thats why i use !=
that won't matter
since you're not specifying variables
you're still using a number to represent a snowflake which will overflow and wrap incorrectly
Yea, because JavaScript doesn't have support of Big Ints, that's why ID needs to be an string
im well confused
Well there's that BigInt type
what are you confused about
about why the channels wont return to their defaults when the timer ends, when command is executed 2 times in a minute
you create two timeouts
how?
lol
what do you actually want to do
Asking about your attempted solution rather than your actual problem
How to remove something from an array? Like ["one", "two", "three"] how do I remove 2 from the array?
if the command is run once in a minute, the code works perfectly
.splice() .slice() .shift() and .pop() @silver lintel
Is there a good GitHub code file for changing the bot's language in a guild in discord.py?
but when the code is executed twice in a minute, the bot redefines the variable to the new channel
causing the old channel to not return
to the default
let?
i asked you what do you actually want to do, because this is an xyproblem and you wrapped your head around the wrong solution
which by the time the second timeout is up
and you're asking why the wrong solution doesn't work
yes
if (command == 'l') {
if (!message.member.voice.channel) return message.channel.send('You are not in a MM voice channel.')
if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
var chan = message.member.voice.channel;
let defaultName = message.member.voice.channel.name
let defaultPosition = message.member.voice.channel.position
let replaceName = defaultName.replace(/MM../, '[IN LOBBY]')
message.member.voice.channel.setName(replaceName)
message.member.voice.channel.setPosition(0)
setTimeout(() => {
chan.setPosition(defaultPosition)
chan.setName(defaultName)
}, 60000)
}
a simple variable can fix everything
??
look at the difference
you're using
if (command == 'l') {
if (!message.member.voice.channel) return message.channel.send('You are not in a MM voice channel.')
if (message.member.voice.channel.parentID != 699877474925936683) return message.channel.send('You are not in a MM voice channel.')
let defaultName = message.member.voice.channel.name
let defaultPosition = message.member.voice.channel.position
let replaceName = defaultName.replace(/MM../, '[IN LOBBY]')
message.member.voice.channel.setName(replaceName)
message.member.voice.channel.setPosition(0)
setTimeout(() => {
message.member.voice.channel.setPosition(defaultPosition)
message.member.voice.channel.setName(defaultName)
}, 60000)
}
message.member.voice.channel is subject to change in that minute
YES
and inside a timeout, the code is like a new function
unless you specify the variables outside of it
it only takes for account what you're telling it to change, is when the code executes
unless you use variables
you're never specifying a variable for the channel
Is there a good GitHub code file for changing the bot's language in a guild in discord.py?
making the channel subject to change
which means if they switch to general vc during that minute
general go byebye
How to make a user's avatar inverse colors?
do setPosition() have a ratelimit???
@carmine summit all endpoints have a ratelimit
you probably aren't getting ratelimited by setPosition but rather by setName
as per this change:
Hello
May I ask how to keep track of how many servers my bot is in?
Im using discord js
How to remove something from an array? Like ["one", "two", "three"] how do I remove 2 from the array?
@silver lintel
Ok thnaks
How to make a user's avatar inverse colors?
@silver lintel use an API for that, or a library to do it for you
How can I make my bot (made by DBM) 24/7 online? I cant understand it
Tag me while answering Tnx
In order for a bot to be online 24/7 it must be on a computer or server that runs 24/7.
Yeah I know but I can't do it
can't do what
how the bot is made is irrelevant. You're just hosting a nodejs application.
Do you have a video of this?@umbral zealot
I mean I can google for you
I tried
@faint prism I'm not assuming anything, DBM is discord bot maker, it's based on discord.js
lmgtfy
OK Tnx Im gonna try it
how do i make it so that when people do ".meme" it sends a random meme
im using JS
is there docs or something
I don't have paying profile I can do it without paying profile?
There are some free hosts but they all have limitations.
If you have a source for where you're gonna get the memes from, you would check the api docs for the source. I think DankMemer picks it's memes from some select Reddits. Other options are just hosting your own memes and then making an API to return a random one
There are some free hosts but they all have limitations.
@umbral zealot Ok where can I find them?
you'd need to consider NSFW censoring as well @peak osprey
Take a look at repl.it and heroku for 2 of the current top contenders for "bot hosting that doesn't actually suck that bad"
KK tnx?
reddit API docs is a good place to start for retrieving the meme. discord.js docs is where to start for setting up a simple bot @peak osprey
hey how do i make an add money command?
by picking a prefix and implementing the behavior?

You have to explain what the add money command will do
Well the thing is, when you constantly require handholding and spoonfeeding and seem to have trouble thinking on your own, it's really hard to respect you as a dev, y'know?
i haven't asked for spoonfeeding
Mostly you always ask for direct answers or code instead of actual programming problems.
i literally just want an example in rough lines
I mean, what are you asking? How to design it? well, then what are your requirements for that user story?
Hello world
uhhh rough lines: ```
if command is give money
db.givemoney(theuser, amount)


Which db @eternal osprey
okay so i have to make an if statement
Well you have to write a command, just like every other command you have
^
How that command is made depends entirely on how your bot is written
if(user.presence.status === ("dnd")) {
ctx.drawImage(dnd, 20, 20, 35, 35);
}```
would this work if i put it in the middle of the canvas?
i am using ls
hastebin
Is?
Then you have to add the money to their account, and how you do that depends entirely on how your currency system is built.
that's one way ig. you still haven't described your requirements
this is what i get when i win in a dice game:
ls.set(message.author.id + "profile", Number(ls.get(message.author.id + "profile")) + amount);
Debugger attached.
Waiting for the debugger to disconnect...
c:\Users\linds\Downloads\MyBot\MyBot.js:31
name: 'meme',
^
ReferenceError: description is not defined
at Client.<anonymous> (c:\Users\linds\Downloads\MyBot\MyBot.js:31:11)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (c:\Users\linds\Downloads\MyBot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (c:\Users\linds\Downloads\MyBot\node_modules\ws\lib\websocket.js:797:20)
Process exited with code 1
Uncaught ReferenceError: description is not defined
i bet i can use that too
I forgot why i came to this channel
Oh yea
Hw do i change the little image beside the website title in HTML?
favicon.ico is how you do it
@peak osprey define description
favicon.icois how you do it
@umbral zealot you telling to me?
yes
<link rel="icon" href="http://example.com/favicon.png">```
that icon, it's called favicon
Kk
i would recommed to learn some html first then starting over with your project
I feel like that's exactly what they're doing π
No i had forgot it thats why i was asking
okay
I had forgot how to bold text this morning 
I had forgot how to bold text this morning :GWtloMarioFP:
@hazy sparrow that's not HTML that's CSS
sorry its to big
@peak osprey rich embeds are v11 use v12
@earnest phoenix u can bold text in html
Hello, I have filenames array. I have to learn about files. fs.stat don't work..
Hello, I have filenames array. I have to learn about files. fs.stat don't work..
@hybrid roost please explain your problem better
<b>Bold text here</b>
Okay. I have array of strings. It is filenames. I have to learn, is this files exists. And if it isn't, I need to create this files.
There is a method called exists() that checks if the path exists or not
Okay. I have array of strings. It is filenames. I have to learn, is this files exists. And if it isn't, I need to create this files.
@hybrid roost so basically for every file in the array you check if the file exists and if it isn't it creates the file?
it is JS question*
@hybrid roost so basically for every file in the array you check if the file exists and if it isn't it creates the file?
@earnest phoenix yep
fs.exists() to check the file
it takes a callback function
the callback will only be run if the file exists
There is a method called exists() that checks if the path exists or not
@vernal rivet it is too slowly. forEach, or for alredy end checking, but this methods no. Because if this, I can learn about 1 file
yes it is
ok
"updated 1 package..."
it said + node-fetch
That means it added that specific package
It is installed
if you want to really confirm that it's added, package.json should show it, and there should be a node-fetch folder in your node_modules
ok
if (command === 'meme') {
const bot = new Discord.Client();
const fetch = require('node-fetch');
const subsreddits =[
'memes',
'DeepFriedMemes',
'dankmemes',
'funny',
'wallstreetbets'
];
module.exports = {
name: 'meme',
description: 'Sends Memes',
async execute(bot,message,args){
const data = await fetch(`https://imgur.com/r/${subsreddits[Math.floor(Math.random() * subsreddits.length)]}/hot.json`)
.then (response => response.json())
.then(body => body.data);
const selected = data[Math.floor(Math.random() * data.length)];
return message.channel.send(new Discord.MessageEmbed().setColor(0xff00).setTitle(`HERE IS YOUR MEME`).setFooter("Requested by "+message.author.tag, message.author.displayAvatarURL({ dynamic: true })+"?size=512").setImage(`https://imgur.com/${selected.hash}${selected.ext.replace(/\?.*/,'')}`))
}}```
so why wont this command work
oh god
what?
@peak osprey SUBSREDDITS WHAT THE FUCK
const bot = new Discord.Client(); <--- remove this line, first of all. you should only have ONE of those lines in your entire application.
if the command is equal to meme, you're creating a new client instance and for some reason you're exporting an object
Also, you now have a module.exports inside of a command, which cannot work, as exports only work when they're at the top level of a js file
@peak osprey please learn javascript https://grasshopper.app
you can't just give us a glob of code and ask "wHY DonT WORK??????"
find out what exactly doesn't work and we can diagnose and fix it from there
It seems like you're just copy/pasting random code from the internet with little understanding of how it works, which is also called "shoveling code". That isn't going to work: you need to understand code that you want to use, and adapt it to your own structure.
So guys basically, I didn't even created the command called ;help for my bot but whenever I type ;help it shows the weird shit in the server in which the bot is added. Discord.py. if you guys know Py then help
So guys basically, I didn't even created the command called
;helpfor my bot but whenever I type;helpit shows the weird shit in the server in which the bot is added. Discord.py. if you guys know Py then help
@sick fable wow we can definitely help without seeing your code
No need for the sarcasm, though.
So guys basically, I didn't even created the command called
;helpfor my bot but whenever I type;helpit shows the weird shit in the server in which the bot is added. Discord.py. if you guys know Py then help
@sick fable
https://discordpy.readthedocs.io/en/latest/ext/commands/api.html?highlight=help#discord.ext.commands.Bot.help_command
Lol wait
There ain't a code named ;help it still shows some weird ass shit
πππ
see the doc link i sent you
It's built into the library.
read the docs? https://discordpy.readthedocs.io/en/latest/ext/commands/api.html?highlight=help#discord.ext.commands.Bot.help_command literally tells you how.
Hmm .k thanks
fs.exists() to check the file
@earnest phoenix so..
yeah
it created one long-named file..
fs.exists('./GuildConfigs/guilds/' + key + ".json", (ex)=>{
if(!ex)
{
fs.writeFileSync('./GuildConfigs/guilds/' + keys + ".json", JSON.stringify(new guildClass(key, '!', 'en')));
}
});
oh god, DBL on a mobile pphone
Well, yes.
@hybrid roost please read https://discordapp.com/channels/264445053596991498/272764566411149314/756493131842584687
However, i'm not going to be
for bot makers go complain to the developer of the app
no one gives support for it here because you don't have direct control over the code
@elfin adder DBM has a support server, you should join it instead. they'll be better equiped to help you.
it created one long-named file..
@hybrid roost okay
ahahaha
it is working
i just...
"working", perhaps, but if you read what I sent, you'll understand why you shouldn't do this.
I just mixed up key and keys variables
It's harder to use json directly than to use a simple database wrapper like enmap, nedb or quick.db
to use it properly*
Actually, that's even more difficult.
because if you start dealing with atomic writes and write queues, you're in for quite a treat.
which is exactly why things like enmap, nedb and quick.db exist
i was about to also mention being thread unsafe but then i remembered that threading in node is almost non existent
You guys can see my another doubt by seeing this outπ
@sick fable BRUH it's${}not{}
@sick fable BRUH it's
${}not{}
@earnest phoenix discord.py
oh
@sick fable use f"string"
just put f right brefore your string
description = f'Blah blah blah'?
yes
@charred kindle thanks :)
np
It worked π:
@hazy sparrow that's not HTML that's CSS :KEK:
@earnest phoenix nitro flexer smh
does anyone know why im getting this error? ```js
MongoError: not authorized on lost-bot to execute command { find: "guilds", filter: { id: "446067825673633794" }, projection: {}, limit: 1, singleBatch: true, batchSize: 1, returnKey: false, showRecordId: false, lsid: { id: UUID("ab15804b-774b-4ef0-b616-a9be75e6a230") }, $db: "lost-bot"
i cant think of a reason for it to be unauthorised since the db users r the same
works on localhost, when i move it to the vm it errors
i don't believe thats a thing
well an account with admin perms
i wouldn't have perms for that since its a shared vm
or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1
+ index .
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (index:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
``` got this as a error can someone help me what it means
"CommandNotFoundException"
Hu
are you sure you didn't mean to run node index
you clearly changed something
make sure your package.json looks like this ```
"main": "index.js",
"scripts": {
"start": "node index.js"
},
and that you do have a file called index.js in our folder
node . checks the package.json iirc
yep.
cock
json is checkt its fine
Logger = require('./helpers/logger')
const Discord = require('discord.js')
const client = new Discord.Client()
const { token, prefix } = require("./config") // Load the config file
const path = require("path")
const fs = require('fs')
client.commands = new Discord.Collection()
// Load for all commands
fs.readdir("./commands/", (err, directories) => {
Logger.log(`Loading a total of ${directories.length} categorie(s).`, "log")
directories.forEach(dir => {
fs.readdir("./commands/" + dir + "/", (err, commands) => {
commands.forEach(cmd => {
if (cmd.endsWith('.js')) {
try {
let command = require(`${"./commands/" + dir}${path.sep}${cmd}`)
Logger.log(`Loading Command: ${command.name}.`,"ready")
client.commands.set(command.name, command);
} catch (e) {
Logger.log(`Unable to load command ${commands}: ${e}`,"error")
}
}
})
})
})
})
// Load for all events
fs.readdir("./events/", (err, eventFiles) => {
Logger.log(`Loading a total of ${eventFiles.length} event(s).`,"log")
eventFiles.forEach((dir) => {
let eventName = dir.split(".")[0]
Logger.log(`Loading Event: ${eventName}`,"log")
let event = new (require(`./events/${dir}`))(client)
client.on(eventName, (...args) => event.run(...args))
delete require.cache[require.resolve(`./events/${dir}`)]
})
})
client.login(token);```
It looks just like this
ok and is this file called index.js ?
also package.json is not the same thing as index.js
they're 2 different files.
also hey, that looks like my code π
if your package.json has the correct main and scripts config, and doing node . doesn't work, then something else is wrong in your nodejs setup
Oui
oh well the first time, you wrote index . not node .
Logger is global variable
and now, you simply do not have nodejs installed on this machine.
Correct i tranferd it on my new laptop
So go install nodejs
But i did if i go to command prompt and check node -v it works
was vscode opened when you installed node?
maybe i should restart my pc maybe that refreshes it'
just closing and re-opening vscode should work
usually it returns the file and then the error
does anyone remember that one pokemon bot called smt like poke`cord? i last saw it 2 years ago and now i cant find it and im wondering if it still exists
Are we still getting bot developer badge tho?
error usually comes first for callbacks actually
no sloth
@opal plank rip
yeah
huh weird
ok node works again
Damn
people were likely abusing it and overpopulating discord with even shittier bad bots
Send the discord developer's server invite in my dm's
people were likely abusing it and overpopulating discord with
even shittierbad bots
@opal plank oh
feel free to go there screech at mason or night
Β―_(γ)_/Β―
oh yeah u right
error comes first
thats so odd though
always has been π«
fuck





