#development
1 messages ยท Page 1166 of 1
no
eh
js is meh
donโt care
Do i put my 4 apps that are part of my bot in one git repo or do i make one repo for each? all run on different vps.
The 4 apps are: 1. node.js bot docker, 2. node.js website docker, 3. database docker 4. manager server docker
Can you save files with a custom extension but with a json format and still open it the same as json?
You realize everything you put in a file with a json extension an for example change the extension to txt, the content still stays right?
yes
I mean the content would only stay if you change the extension to something that can be opened as a text file
yes
So yes
Awh
That's great then xd
Also I still remember my bot removed for leaking the eval command, any better way to do it than "return"
?
@earnest phoenix
What you mean by any better way to do it than "return"
Like make the eval only usable to the owners or wot I'm confused
let ownerIDs = ["ID of owner", "ID of another owner", "ID of the another owner"];
// There can be one owner too, this just depends how many owners the bot has
// Start of the eval command
//
// If owner ids array doesn't include the user's ID, just return
// Or just send a message by `return message.channel.send("You\'re not an owner");` for example
if (!ownerIDs.includes(<message>.author.id)) return;
// Do the eval command
// End of the eval command```
Oh okay thanks
Why use a \ on an apostrophe if you are using speech marks
Wot
Yes, if there's 2 of them, this would not work
Because you are using speech marks
What
uh
Well
It is supposed to tell the discord gateway which events to send you, and which not to send
And also which properties you need to access
Such as presence
Or guild members
Recieving... Specific events?
like dnd online invisible
Saving of memories, it just identifies what to send and what not, for example it doesn't return the properties that is not used
@golden condor presence of users?
@delicate shore yes, that is a special intent
It also saves memory
but my bot can tell if user is dnd , online or offline
Only returns the properties used
without it
but my bot can tell if user is dnd , online or offline
@delicate shore won't be able to after October
You need the presence intent after October
It is required.
Discord is using 90% CPU and 2 GB RAM dfq...
oh
Intents usage is required after October 7th of 2020
but now i said i don't need intent
You have to declare intents after october
Events will be intents
I've already done it
You have to declare intents after october
@golden condor and how to use it i my code
Declare it in the client
hey you know how to see where my bot have joined server (maybe with web or something?)

guildCreate
@delicate shore https://discord.js.org/#/docs/main/stable/typedef/ClientOptions look at ws
see all server list
<client>.guilds.cache.map(g => g);```
ok and @golden condor do i need to change something in command file also?
k
ok
ok
Hi
could anyone help me with removing decimals from a python calculation
:-
?
hello, I am making a bot that will send photos of cats when requested. anybody know how to make a command that will pick a random photo each time but with the same command?
you have to create a databasse for that
or scrape it from an existing source
beatifulsoup is a good library for that
or an api
but i am not that good with python
am i allowed to ssend pastebin links here?
because i am trying to remove decimals
sure
from my calciulation
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@ionic warren try using this api https://api.thecatapi.com/v1/images/search
ty ill take a look
you need to send a GET request
owh yeah that is a good one
could anyone help me with my code please?
what exactly are you trying to do?
to remove the extra decimals
in my calculation
look:
i am trying to make it a whole number
k
?
if you have nothing useful to say, don't say these useless things.
i am asking for help and you respond with k?
like you don
care
questionnnn: how do i even use the cat api paha
python or javascript?
i'm not entirely sure @eternal osprey, i guess try asking someone who knows python when they come online
sorry
@ionic warren you need to use a module to make a GET request to that URL i sent earlier
https://www.npmjs.com/package/axios something like this
the response body will contain JSON, and you just need to extract the URL from there
ohhhh okie ty
if you're still unsure, feel free to ask lol
don't worry too much about the api itself, that is pretty simple
it will just return a response which looks something like:
[
{
"breeds": [],
"id": "1it",
"url": "https://cdn2.thecatapi.com/images/1it.jpg",
"width": 500,
"height": 375
}
]
but in order to get that response (which returns a random image btw), you need to make a GET request to a specific URL
do i need to download axios?
yeah, you can npm install axios or any other module you may prefer to use, if any
okay its installed
it is pretty simple to use (this is the example given on the npm page)
axios.get('/user?ID=12345') // this is the URL you are sending the GET request to
.then(function (response) {
// this is the response returned by the api
console.log(response);
});
and the response, looks something like this https://canary.discordapp.com/channels/264445053596991498/272764566411149314/745593276937011293
the URL you want to be sending the request to is https://api.thecatapi.com/v1/images/search
so just replace the '/user?ID=12345' bit with the api URL
@sinful belfry out of curiosity
Do you also use discord canary version?
if yes then what's so special about it
Updates all the time
^
You get features early
Oh
But it's unstable
features like
yeah there are lots of dumb bugs lol
nice
@sinful belfry where abouts in the code will i put the url to be exact?
i was confused on when you sent the ' ' because they were in the image sorry
oh lol
okay is there anything i do after that?
so you need to extract the URL of the image from the response
how does one do that?
and then send the URL/put it into an embed etc.
i think axios parses it for you, so you just need to do response[0].url to extract the URL
nice
im so confused rnnn im new to all this aaa
i feel like that one kid who tries to blend in with the others by pretending he knows what hes talking about
true
no clue
not used either lol
actually i probs use medium more to follow tutorials

where do i extract the url huh
do i replace anything?
nope, no need
only the user12345 thing
yeah
okie ty
what do i do once i put the link? sorry for back tracking im just trying to wrap my head fully around it so i can learn it
you need to then add your code which handles the response you get from the api
which goes inside the .then
yo
no idea how to do that ๐ญ
top.gg/bot/api doesn't work for me
Immause medium then, I wish it supported markdown tho ๐
it says bad request
no idea how to do that ๐ญ
@ionic warren don't worry, just break it down into smaller steps
if you console.log(response); , you will see this https://canary.discordapp.com/channels/264445053596991498/272764566411149314/745593276937011293
@ionic warren you are new to coding ? right ?
mhmm
ok
all you need to do is extract the URL from the response https://canary.discordapp.com/channels/264445053596991498/272764566411149314/745595625193603132
i should probably start with something a lot more basic but we roll
and then do whatever you need to with that URL (this is the URL of the image returned from the api btw)
u
then you can just send that URL in a discord embed, or just as an ordinary message
you need to do channel.send(response[0].url); in order to just send the url to the channel
and in most cases, you can just get the channel from the command message
will it upload the photo its self or a link that takes you to the photo?
it will show you the photo within discord
okay nice
discord handles all that
like this:
i just sent a url, and discord has automatically turned it into a viewable image
oh nice yay
ok so because you're making a request to the api, it takes time and the response will not be instant. so as soon as the api has returned a response to your request, the code in the .then will run (which is just a function)
you can do .then(function (response) { // code here is run when a response is given });
i dont need to change anything in the .then right?
you just need to add to it
Or you can use async but let's like not do that rn lol
so as soon as the api has sent you the stuff you want, you just need to extract the stuff you truly want (the url) and then send that into a channel
im not sure what im meant to add- aghhhh
do i copy and paste that?
you can, yeah
also whats an embed?
@ionic warren Discord Message Embed
but you need to make sure you're defining channel
how var works in discord.js?
okay we are getting somewhere ig
it is just a variable @cinder sandal
so how do i define channel?
can you use it everywhere in the code?
but you need to make sure you're defining
channel
@sinful belfry I mean. u can do <message>.channel.send
^
tried to put it in another block, but it says undefined
that is how it is accessed in pretty much all cases when using commands
@cinder sandal can u send ur code
ohhh i get it
why i did <message> is because some people async it to msg
how
varworks in discord.js?
@cinder sandal Global variable,varis not scoped butletandconstare block scoped
so they need to replace it with thing they defined it as in event
what do i put after message.channel.send?
within the .send(), you need to put the url in that you got from the response
as shown in the linked message
message.channel.send(<MessageEmbed> <'Text'>)
No Actually
how would i make a collector for a user's DM channel?
message.channel.send(<Text>, { embed: <embed> });``` @cinder sandal this is how it's
im so lost oh dear god.
i use the embed constructor istead of this
@ionic warren dont worry about embeds
you had the right idea
just send the image link
const(or let) Embed = new Discord.MessageEmbed
i use those
so where exactly do i put the message.channel.send part
within the .then
as soon as you've gotten a response from the api, you want to extract the url and send it to the channel
.then(function => {
// some things
}```
hhh
.then can take both js <Promise>.then((...parameters) => {}) and js <Promise>.then(function(...parameters) {})
hey boys i am back
if i use $po weather (and i dont include a place or name) the bot exits out with these typerrors:
var current = result[0].current;
^
TypeError: Cannot read property 'current' of undefined
if (result.length === 0) {
message.channel.send('**Please enter a valid location.**')
}```
i want it to send this code
how would i make a message collector in a users dm?
it clearly doesn't
Just js if (!result) { // Send the message }
is that meant for me?
Yes
okay
can anyone help me pls?
my random status changes to the same status sometimes, how do i stop that?
so it would select a diffrent status and not the same every time
''TypeError: Cannot read property 'length' of undefined
Did you even do what i said
my random status changes to the same status sometimes, how do i stop that?
@cinder sandal
@west agate i think you can use this: if ( message.channel.type === 'dm'){
message.channel.createMessageCollector(filter, { time: 15000 });
i am not sure tho
@west agate This
let dmChannelU = await <Message>.author.createDM();
dmChannelU.createMessageCollector(...parameters);```
That third = means type specific as well. Is .type a string?
oh thanks
@faint prism type of the channel
Right, is that property a string?
@eternal osprey u can use if special type of para is undefined
then it can return
returns an string
if (!result === 0) {
message.channel.send('**Please enter a valid location.**') ```
Bruh
var current = result[0].current;
^
TypeError: Cannot read property '0' of undefined
Is result an array? And not null?
if (!result) {
return message.channel.send('**Please enter a valid location.**');
}```
i know i've done that
var current = result[0].current;
^
TypeError: Cannot read property 'current' of undefined
@eternal osprey i mean if result.parahere === undefined return
i did
result is not an array then
@eternal osprey which package?
weather-js
i also use that
What's result defined as? @eternal osprey
It would show that if the 0 indexed element doesn't exist?
and u know what i do
if (result === undefined || result.length === 0)
return msg.channel.send("**Invalid** location");
@split hazel No, it would show it if the result isn't an array
Why do people use packages for everything
@golden condor because it makes it easier , lol
okay
Or it's undefined
Just use an api
^^
Not an API wrapper
Using api for everything is a bad practice, sometimes you gotta make things native
You don't do your own currency
You don't do your own currency
@golden condor no
Remember that apis don't always return a response
Sometimes I just code stuff into my code
ok
return msg.author.send("Invalid location");
^
TypeError: Cannot read property 'send' of undefined
wha
ya
my random status changes to the same status sometimes, how do i stop that?
@cinder sandal still not answered
have u defined msg?
bruh what is msg defined as
please try to understand and integrate the code into yours instead of just straight up copy pasting
didn't work
let msg = message.content.toUpperCase();
@cinder sandal Just make it iterate through the array of status without picking a random index from the array
code?
just replace msg with message
@eternal osprey
k
setInterval(() => {
const randomStatusMessages = // random status messages
const randomStatus = randomStatusMessages[Math.floor(Math.random() * randomStatusMessages.length)]; // does math to make them random
client.user.setActivity(randomStatus); // bot status
}, 300000); // updatd once 5 min```
How to make it not select the same status sometimes
you have 2 options:
let activityList = [<activities here>];
let copyActivity = [ ...activityList ];
setInterval(() => {
<client>.user.setActivity(activityList[0]);
if (activityList.length === 1) {
return activityList = copyActivity;
} else {
return activityList.shift();
}
}, <Amount of time in milliseconds to change activity in>);```
what to put in the copyavtivity list?
a. keep track of which status is currently selected, for example by saving the status number in a global variable or attached to client
b. before setting a new status, get the current status, find its index in the status list and prevent the same index from being used again
Just exactly what i put
you need to put the activities again in let copyactivity?
No in the activityList
c. instead of random activity, make them sequential instead
bruh
i sent this msg 8 mins ago
it reached now
anyways
how can i use set timeout for every changing status
@fiery light console logs client.shards and client.shard
every 5 mins
use an interval
setInterval(() => {
const randomStatusMessages = // random status messages
const randomStatus = randomStatusMessages[Math.floor(Math.random() * randomStatusMessages.length)]; // does math to make them random
client.user.setActivity(randomStatus); // bot status
}, 300000); // updatd once 5 min```
i found this above
but i think
something
@cinder sandal How did it go?
hm
!invite
@fiery light console logs client.shards and client.shard
@honest perch [Wed Aug 19 2020 11:42:15] Launched shard #2
@cinder sandal How did it go?
@earnest phoenix changes status, but sometimes not every 5 minutes because it changes it to the same status
do i need shard for 600 guilds
Invite bot server?
Invite bot
what ?
My discord
How do I invite the bot to my discord server?
@fiery light which one was that for
@honest perch console.log(client.shard)
^
TypeError: Cannot read property 'shard' of undefined
should i put something in the let copyActivity [ ... ativityList]
How do I invite the bot to my discord server?
i need help
i want my bot send a message to a channel when it joins a server
can someone help me ?
How do I invite the bot to my discord server?
@vapid moat which one ?
i need help
i want my bot send a message to a channel when it joins a server
can someone help me ?
@lean wing
yes it's easy
but how ?
i have
then u have to get a channel with id
guild create event for my data
F
@earnest phoenix changes status, but sometimes not every 5 minutes because it changes it to the same status
@cinder sandal Huh?
What does that mean?
Lol
i dont want to have channel id i ust want when the bot join to send a message to a text channel @delicate shore
client.channels.cache
.get("channelid")
.send(message here)``` @lean wing
i dont want to have channel id i ust want when the bot join to send a message to a text channel @delicate shore
@lean wing u need to get channel id
of the channel
can i use the bot to find all channels ids and use the first one ?
U wanna do something like this
nope
like rythme when it join a server and send a message like default
i have this event
he wanna send a msg to frirst chanen
@delicate shore im not sure thats allowed
first channel*
as you are publicly posting server names
@earnest phoenix bot starts too long with that
as you are publicly posting server names
@honest perch
Oh really?
mhm
then
What does that mean?
@earnest phoenix You're referencing a value in your config you haven't defined
or just make it private
@faint prism what?
@earnest phoenix bot offline, logs don't show the error
They are probably using a forked bot from github
Guys? I have a question
I try make a ModMail Bot and when I type node . this is shown
Not you
hey, how do i make sure someone cannot use the commands in the dms of a bot (python)
i know how to do it in node
ok
You don't have to double post. I can scroll up..
Read the mod mail setup docs
it says everything
hey, how do i make sure someone cannot use the commands in the dms of a bot (python)
@eternal osprey anyone that knows the answer on this question?
@split hazel these kind of bots cannot be approved for top.gg right ?
as it's simply clonning
It cannot be a direct clone but as long as its significantly modified we allow it
Do u guys check it ?
if it is modified
because u cannot remeber eveyr bot structure
every*
We can see if it's been modified or not
git diff - Compare the difference between two project's source files using git-scm
Most have a github page linked and we remember a lot of commonly cloned bots
i think that hey have programs for that
oh nice
git diff - Compare the difference between two project's source files using git-scm
ooh nice but what if they don't have a github page @faint prism
i am talking about one who is clonning
If you have a copy of the source you can compare, otherwise you'd just have to check it's behavior differences
how do i block commands from working in dms ? In python.
if(message.channel.type === "dm") return
that isn't python
oh sorry
iss okay
He doesn't has an idea of what hes using..
he keeps making fun of people when they make mistakes using this emoji:
He doesn't has an idea of what hes using..
@pallid igloo who

PGamersX

if someone makes a mistake
or does something wronmg
why tf are you using this command

yeah
you make fun of other people
but this is your channel lmao
but i will be warned
i just want to prove you that karma can be a pain in the ass
do not make fun of anyone if the makes mistakes
you think that you are sooo much better than other
he copy pasts code and says msg isn't defined
i never used this emoji as insult
instead of making fun of me, you could also tell me that that wouldn't work
i told u
would you like it if you made a mistake
Yes
Stop.
Thats it.
This is development
move to #general
or #memes-and-media in your case.
because we laugh at copy pasters read #rules-and-info and come #general
i already stopped
despite me saying
twice
i laugh at your youtube channel lmao
@eternal osprey I cannot see that you stopped
both of you, drop it now
Yeh
i already did anyways
Is it more efficient to fetch all messages and the filter them, or fetch them with a filter?
i don't think you can filter using fetch
^^
but you can filter the cache
so if you need to filter using fetch, you have to fetch them first
@cinder sandal This is what i tried and it worked for example
let activities = ["Bruh moment?", "Nani", "Wtf", "Hol up", "Wot"];
let copyArray = [ ...activities ];
setInterval(() => {
bot.user.setActivity(activities[0]);
if (activities.length === 1) {
activities = copyArray;
} else {
activities.shift();
}
}, 300000);```
didn't work
Did you try the exact way i did?
yea
What's the problem tho
changing them from const to let works fine
In the ready event?
constants cannot be changed..
hey boys, how do i block comamnds from working dms in python language?
yes
Oh wait..
hey boys, how do i block comamnds from working dms in python language?
@eternal osprey Could you please elaborate?
You want commands to only be used in servers?
@cinder sandal You need to put what i said inside the message event
i can still use my distance bot in the dms of the bot
Are you using discord.py's commands extension?
the python equivalent of if(message.channel.type == 'dm') return;
Are you using discord.py's commands extension?
i don't think so
Do you have your commands in on_message with if statements or @commands.command()?
no
Idk python so iamma head out..
it was one or another, not a yes/no question
no
that wasn't a boolean question..
Are you using discord.py's commands extension?
no is not a boolean but okay
So that's a yes, then
xD..
oowpsie
In any case, you can use the @commands.guild_only() decorator
okay, thanks!
Decorator is like the python name for methods?
(or go the "fuck all" way and do if not message.guild: return)
XD
wahahhah okayyy
๐
The difference between that if and the decorator is that the decorator will raise an error that you can handle in the on_command_error event
My bot got flagged for discord whitelisting
Will it take more time to verify ?
It has already been one month and 5 days
Decorator is like the python name for methods?
No, methods are the same methods
Classes are called decorators?
My bot got flagged for discord whitelisting
Will it take more time to verify ?
It has already been one month and 5 days
@delicate shore It's infact unknown but surely will take more time than usual
oh sad pikachu noises
how can my bot send a message to the first channel that can find when it join a discord server ?
how would i get a channel in a message?
i was wondering how people do that thing in which if i did !Hell bot will not respond
But if i edit msg to !help it will respond
Essentially, a decorator can modify what the function happens to be
>>> from discord.ext.commands import Bot
>>> a = Bot(command_prefix="None")
>>> from discord.ext.commands import command
>>> @command()
... async def yeet(ctx):
... return "yeet"
...
>>> yeet
<discord.ext.commands.core.Command object at 0x0000021E419A3880>
>>> del yeet
>>> async def yeet():
... return "yeet"
...
>>> yeet
<function yeet at 0x0000021E419A4D30>
hi
hi
how would i get the channel in text? like if i say "i select #random-chanel"
with a client.on(message function how do you get the guild id?
i was wondering how people do that thing in which if i did !Hell bot will not respond
But if i edit msg to !help it will respond
@delicate shore listen for the message edit event and check the message content
oh, you mean physically send another one.
@delicate shore but message.guild.id doesn't work
message.content.startsWith("!help")
@lean wing js <JoinedGuild>.channels.cache.filter(c => c.type === "text" && c.permissionsFor(<client>.user).has(["VIEW_CHANNEL", "SEND_MESSAGES"])).first().send(<content>);
aka don't use toLowerCase or anything of that sort
pls help
@ivory seal Show your current code
why is my bot taking so long to get verified?
one sec
top gg
It might be whitelisted or discord staff doesn't have much time to verify bots as they say just like DBL mods
Oh top.gg

i mean in
const Enmap = require("enmap");
const client = new Discord.Client();
const scoopEnmap= new Enmap({
name: "scoop",
autoFetch: true,
fetchAll: false
});
const guildEnmap=new Enmap({
name:"guild",
autofetch: true,
fetchAll:false
})
const guildprefix="";
client.on("guildCreate",function(guild){
scoopEnmap.set("sahhasdetails",`${guild.id}`);
console.log("New Server Joined. ID: "+scoopEnmap.get("sahhasdetails")+" Recorded on Enmap");
const structure={
id:`${guild.id}`,
name:`${guild.name}`,
welcomemessage:"`Welcome to server ${member}`" ,
welcomechannel:"general",
prefix:"!"
};
guildEnmap.set(`${guild.id}`,structure);
});
client.on("guildMemberAdd",function(member){
var guild=member.guild.id;
var welcomemess=guildEnmap.get(guild,"welcomemessage");
console.log(welcomemess);
});
client.on("message",function(message){
var guildformessage=message.guild.id;
const prefix=guildEnmap.get(guildformessage,"prefix");
console.log(prefix);
if(message ==`${prefix}prefix`){
message.channel.send("The Prefix is"+prefix);
}
});```
@lean wing
js <JoinedGuild>.channels.cache.filter(c => c.type === "text" && c.permissionsFor(<client>.user).has(["VIEW_CHANNEL", "SEND_MESSAGES"])).first().send(<content>);
@earnest phoenix
thanks
but should to be clear, i should remove the @bot.command() and replace it with @commands.guild_only()
No
var guildformessage=message.guild.id;
const prefix=guildEnmap.get(guildformessage,"prefix");
console.log(prefix);
if(message ==`${prefix}prefix`){
message.channel.send("The Prefix is"+prefix);
}
}); ```
this is where i have a problem
listen for the message edit event and check the message content
does message edit event comes under message event?
i mean in
message.guild.id doesn't work
@bot.command() marks the function as a command, you don't remove it
You just put the second decorator above or below the command one
@earnest phoenix , the problem with the same status is fixed. i just needed to change const to let.
var guildformessage=message.guild.id; const prefix=guildEnmap.get(guildformessage,"prefix"); console.log(prefix); if(message ==`${prefix}prefix`){ message.channel.send("The Prefix is"+prefix); } }); ```
@ivory seal What is the error? cannot read property of x of undefined or smth else?
message.content.startsWith("!help")
@delicate shore you'll need the thing above
I was wondering if you are discord.js or py since u are asking questions of both lib
Show the full error please
@cinder sandal Of course, i already stated that earlier
@slender thistle are u asking my error
Yup
it says undefined
I'm not so sure abt enmaps so sowwyy..
it just says undefined
Screenshot or send the error here please
What says undefined and where?
undefined in console
Seems that console.log(prefix); returns undefined
@ivory seal i really appreciate you helping me and everyone who doesn't know how to install bot on vps
@bot.command()
@commands.guild_only()
``` is there any way to check if the channel is dm, then it will say this: this command cannot be used in dms?
@delicate shore NP
because now it sends the error to the console.
ok one sec
@ivory seal btw don't do js if (message == `${prefix}prefix`) { because you're comparing a message object to an string
then what should i do @earnest phoenix
but let is better
or message.content.startsWith
i tried both suggestions
so if someone does !prefix wrg rwhw hrheh
But the best of is
if (message.content.startsWith(`${prefix}prefix`)) {```
it stilll reples
bot or bot help?
bot
wat
he means a bot for a server i guess
no free code here
server code
cant make it more clear than that
u can find on top.gg/bot
is there any cath(err) in python?
Two options, @eternal osprey.
The event below is triggered whenever a command errors out.
@bot.event
async def on_comamnd_error(ctx, error):
# You need to check if the error is coming for a command with "@commands.guild_only()" being ran in DMs.
# For that, you would need "commands.PrivateMessageOnly".
# To actually check that, you need to use the built-in "isinstance" function and compare the error to the class above.
if isinstance(error, commands.PrivateMessageOnly):
await ctx.send("Command(s) must be used only in DMs.")
2) In the command itself,
```py
if not message.guild:
await ctx.send("Command(s) must be used only in DMs.")```
Spice up your Discord experience with our diverse range of Discord bots
you can find best bots here
ah okay
hold on
no
lovely shivaco
Remember Kids: Do not copypase code from here.
there we go, edited the message
i have a problem with luffybot
luffybot have a problem from discord he disconectted auto and
when i test the files with testing token
he is work
why

Remember Kids: Do not copypase code from here.
@cinder sandal Correction:
Remember kids: don't copy paste code from anywhere
except stackoverflow
^^
^^
snort some blow and leave it to stack overflow
uh
is there any cath(err) in python?
@eternal osprey
There is the thing calledtry-exceptthat can be used as following:
try:
a_function_that_raises_an_exception():
except Exception as e:
# the `except` branch will handle all exceptions and Python will store the actual exception under the `e` variable```
i am maybe dumb
inside your command itself
Remember Kids: Do not copy paste from anywhere including discordjs guide except stackoverflow
what oh
i just made a mistake on where to put the code
mhm
"in the command" as in,
async def your_command(...):
if not message.guild:
# la la la```
i opened stackoverflow 1 million times fear me
Opened it only 50 times 
ive only copied a regex from stackoverflow, everything else was from docs
@opal plank That's the biggest lie i have ever seen
nah, actually
We all been to stack overflow many times to learn something
I don't even copy regexes tbh, regex101 is nice
Wtf
this regex here is the one
Haven't learned much from StackOverflow tbh
We all been to stack overflow many times to learn something
@earnest phoenix ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
learn? yes, absolutely, ive been there many times, never have i copied shit from there
except that regex up there in sc
i even let var for that reason
if you find vars in my code, know its not mine
let > const
two cases for each
let is mutable, const is immutable
use it for which cases needs it
Actually none are better, their use cases are just different, they must seem the same to beginners.
the noob rule is: change everything to const and fix the errors
it'll error the ones you trying to change the value of, so just switch to let
imagine if u were allowed to change the tag of a bot
^^
basically u cant bypass permissions with bots
the command that does something that needs a permission wont even work if you don't have one
People who hate var is kinda wrong, because as much as i hated var, now i understand that, after i define something inside blocks and try to use it somewhere else, vars are really useful
my message is not defined
People who hate
varis kinda wrong, because as much as ihatedvar, now i understand that, after i define something inside blocks and try to use it somewhere else, vars are really useful
@earnest phoenix tried using them in diffrent blocks, returns undefined
Use ctx.message
Because ctx is an instance of Context class, and it has a .message property
okay
which will give you the Message object
got it
var AbcDef = Math.floor(Math.random() * 100);```
tried using in other blocks, undefined
@cinder sandal
if (3 > 1) {
let something = "Bruh";
}
something; // undefined```
<=>
```js
if (3 > 1) {
var something = "Bruh";
}
something; // "Bruh"```
@earnest phoenix it does have it uses, but if you dont know how to use it, it'll cause unintended bugs, as the value changed and it wont be good code wise
if you were to have same named variables that are scoped block, those values might overflow to when you call it again because it wont respect the scopes. For people who dont know better, always tell them to not use vars, regardless. 99% of the time, they are just declaring a variable, not that they need the fuction that var provide
I know lol
Uhh, While using use strict, I think they are the only way to reassign values.
almost all cases you'd much better using let to get you a good hang of local scopes
I always use let or const, just var when only needed
Uhh, I never use let or var. Const is needed for some shit. but As a person who doesn't use "use strict", = works just fine for me.
thats indeed the correct way of doing it
vars are just basically for embeds or other things if you want to put the embed or something again in another command.
varsare just basically for embeds or other things if you want to put the embed or something again in another command.
@cinder sandal Let and=also work for that case.
even if its just meme'ing at this point, just point out that using vars is bad unless you know what you doing. Will save you and them a headache
iiirc, You can overwrite let.
if not ctx.message.guild:
await ctx.author.send("Command(s) cannot be used in dm, please use the command in the server")
``` for some reason the bot works great right now, but it still doesn't send the desired message?
What is ctx?
context?
@pallid igloo let and var can be overrided again
Because
ctxis an instance ofContextclass, and it has a.messageproperty
what is the use of shards?
uhhm the ionstance of context class
But not const
someone thinks that discord.py is official
Const => shorten for constant, not mutable, constantly(unchangeable)
what is the use of shards?
@carmine summit It divides the guilds into (arrays) some properties. Thus making the bot faster.
i explained him that discord cant even make a client

if not ctx.message.guild:
await ctx.author.send("Command(s) cannot be used in dm, please use the command in the server")
``` for some reason the bot works great right now, but it still doesn't send the desired message?
@eternal osprey Does the command work in DMs still?
though i think i know what you meant
@pallid igloo Not arrays, it just makes it run different instances of the bot
we are techinically bots but we can type anything
Yeah, I didn't have a solid idea.
it doesn;t anymore
Therefore you can't access all guilds of a client easily unless you broadcast an eval
but i'd love to send a message that they have to try it in the server
im 100% becoming a sex offender and idk if its a good thing or not
heroku can't save fs files ?
client.guilds.cache.size gives specific shard count in an array iirc?
im 100% becoming a sex offender and idk if its a good thing or not
@opal plank Just dont ask their gender.
becoming a dataphile
@pallid igloo It gives the amount of guilds that specific shard is handling
heroku can't save fs files ?
@viral iris i host on herokuand they don't even work
set this up yesterday
@viral iris Heroku doesn't save overwritten files
Like maybe redhat if you need a free one.
@viral iris Heroku doesn't save overwritten files
@earnest phoenix thats why when the bot restarts send the embed again
Yes
imagine if we could send embeds
You can
imagine if we could send embeds
@cinder sandal before 2019 november, yes.
If you were a self bot
easy way to trigger internal flags
any1 can change the fs to mongd.db ?
self bots bannable
Yes
you CAN do it without selfbotting
Can I ask a general question? My native language aint English, so I am always struggling to fully understand documentations. Pepeg. Can someone expalin to me what exactly Map does in javascript? I managed yesterday to use Map to save message.guild.id so more than one users can use my music bot :> But how exactly does it work?
Yes
@earnest phoenix can u ?
You can't send rich embeds unless a self bot is used, you can only send plain embeds showcasing links
or maybe a link that u posted which is displaying an image
if you get your token(which isnt modding client) and send it via axios or postman or anything really, TEACHNICALLY you arent modifying the client in any way shape or form while still sending an embed payload via a user account
though good luck explaining them that
if you get your token(which isnt modding client) and send it via axios or postman or anything really, TEACHNICALLY you arent modifying the client in any way shape or form while still sending an embed payload via a user account
@opal plank Iamma ring them up to confirm that.
any1 can change the fs to mongd.db ?
@viral iris Mongo.db would work but still changing from keroku to a vps is a better idea
reminder that im not a discord emplyee, i dont judge whats ToS or not
ยฏ_(ใ)_/ยฏ
im going by the book
@earnest phoenix can u come dm ?
K
danbot?
your own vps
danbot hosting
danbot?
@opal plank what
is it free
been recommended quite a few places
yeah
i dont have a link, but it was recommended quite a few times here and some other places
DanBot xyz or something
He said danbot.xyz
like i said, i dont have the link to it since i self host, never had the need to check it
though yes, quite a few people recommended it
there was a discord iirc
danbot is a malware name lmao
He said danbot.xyz
@pallid igloo it's a website for a discord bot
bruh
danbot.host
the name is a malware name
this one
not that one
they have a discord where you sign up
but i cant find the invite
You could go with something like DanBot but I wouldn't recommend it
Yes.
if you dont trust that, go for f1 Micro or AWS
f1 micro is free forever
aws is 1 year free
f1 micro too
I can't find one
you ARE in one
So, That's why I asked

weirdesthostingwebsitehost.com
@cinder sandal I'm pretending to be a Nub who desperately needs free hosting
SCAAAAAAAAMMMMMM!
not related to dev either way
prob better off asking in #general @sick fable
what you are looking for is bot recommendations, not on topic here, we offer development support
Kk
Cannot read property 'on' of undefined
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
const centa = new Discord.WebhookClient('xx', 'xx');
centa.send(`User with ID ${vote.user} just voted!`)
});
yes
dbl.webhook?.on
if you want the tl;dr
not going to force es6+ syntax onto someone
i think conditional chaining is es11
or if your node version doesnt support it, just do
if(dbl.webhook) => {//continue code here}
Why did I google it?
Oh, I understood by that example, I was just looking for more info on it (Like other uses)
anyone who is into react here? Have you guys see this :/ Kinda scary
i made a new text for people who ask to ask
There are 3 easy steps to getting help!
- Post your code
- Post your errors
- Send a short description of what you are trying to make
NEVER ask โwill anybody help me?โ or โHello is anybody willing to help me outโ as it wastes and makes helping you out slower, simply post your issue and a helper will get to you as soon as possible.
This is a serious issue and you need to work on this
Visit https://dontasktoask.com/ for more info about this issue.
I hope you understand !
Regards ,
A well wisher
Against popular belief "does not work" is not sufficient information to provide to receive help.
What's the expected (wanted) behaviour, what's the actual (unwanted) behaviour? Do you get any errors? What's your relevant code that might be causing the issue?
- Discord.js official bot.
'how bot go online?'
haha discordjs.guide go brrr
im not gonna lie, im impressed
i thought my code was going to get 2 or 3 stars
was not expecting this
Ohh
You haven't seen my tic tac toe code yet..
also
seriously, do you not use a command handler?
that was 5 days into learning JS dude
Do I report him?
@opal plank one more question

