#development
1 messages · Page 803 of 1
recent windows versions have that enabled by default
no
no
no
dont
you are following a very old outdated tutorial
pls
discord.io is dead
has been dead for 2 years
where do i find new one
no where
is discord.io javascript library?
yes
npm install discord.js
i type npm install discord.js in power shell???
npm init in powershell????
yes
Lovely
ok then
Press enter
again????
Just keep doing it for a bit
spam enter right
You can stop now
ok what else
Looks like it
You need an index.js file where everything starts from
wat
You should be able to find a YouTube tutorial on it
Just search how to make a discord bot
You also need some prior programming experience
where can i find that
Programming experience?
yes
Codecademy.com is cool
But there are alternatives
You basically just need to understand how to code because otherwise your brain will explode
That's a slight obstacle then
I recommend you learn first
Ideally learn JavaScript if you're looking anywhere
do i learn "Give me a custom recommendation" or "I want to explore on my own"
the i want to explore thing
Yeah
i will learn javascript right
Yeah
Don't expect to be good at it very quickly
I've been programming for 7 years and I still think that making a bot is hard
But you gotta start somewhere
does codecademy work on games
What do you mean?
like people make their own servers and they code
programming is an entire world, there is endless things to learn
you can do literally anything with programming
aight
but at the same time, there is always "the right tool for the job"
so you need to learn a LOT
before you can start doing more complex things
Certain languages are more suited to a particular thing so it's all about learning the right language for what you want
aight
language, architecture, environment, target platform, etc...
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.login(TOKEN);```
Has anyone worked with Instagram Real Time API?
@quartz kindle you can create a girlfriend with coding
get a waifu for christmas
well, robot "girlfriends" are improving everyday
Sadly. Time for more antisocial people, let's go.
I mean
all that needs is AI training
however proper robotics needs a lot more training it is nowhere near
i'm confused, they said this will work but it did send a welcome message.
client.on('client.guilds.channels.get', member => {
member.guild.channels.get('660593478807322634').send("Hey there" + `${member.user.tag}` + "Welcome to She ra https://tenor.com/view/fighting-combat-duel-battle-sword-fight-gif-13471573");
});
this is strange
I think it's the link.
No.
there is no event called "client.guilds.channels.get"
i think you want use guildMemberAdd
MMM
client.on("guildMemberAdd"
Seems like a similar event.
That happened earlier
So what about this?
member.guild.channels.get
^^^^^^^^^^^^^^^^^^^^^^^^^
also the object you're calling member isn't a member object it's a guild object, the name doesn't matter but the properties you're trying to access don't exist the guild object has the channels property
so in your case it should be. member.channels.get(you know what to do here)
guildMemberAdd returns a member, not a guild
@pine bear whats your current code?
i need glasses as well, but no money to buy them =X
oof
client.on('guildMemberAdd', member => {
member.channels.get('660593478807322634').send("Hey there" + `${member.user.tag}` + "Welcome to She ra https://tenor.com/view/fighting-combat-duel-battle-sword-fight-gif-13471573");
});
@pine bear what version of djs?
yall out here mixing events and didnt bother to ask for more context smh
Lemme run the command to see
and read guildCreate

see
hes on v11
6.13.4
should be member.guild.channels.get
That was the old code
leave it as member.guild.channels.get, or use member.client.channels.get
@pine bear yeah and it was right, I read guildCreate, so the code I sent only works in the guildCreate event
Yea huh
so 
client.on('member.client.channels.get', member => {
member.channels.get('660593478807322634').send("Hey there" + `${member.user.tag}` + "Welcome to She ra https://tenor.com/view/fighting-combat-duel-battle-sword-fight-gif-13471573");
});
should work?
no
you changed the wrong thing
guildMemberAdd is correct
member.channels is not
Oh I see by what you mean.
if you go to the docs website
you can see all possible values you can put there
client.on("channelCreate")
client.on("guildMemberAdd")
etc...
all possible values are listed there
I forgot about that, must add it to my vocabulary.
It also appears that https is also in my browser.
tim ur still on light mode turn off the lights
@quartz kindle bruh
i literally just found out that topgg has dark mode, or i already knew and just forgot about it
You click this
For dark mode
Dang, You click the "SUN" icon on the top left of the screen
or suffer and scroll to the bottom of the page for the button
^thats what i did
Ahh! I can't really tell what's going on with command handlers, I'll try to understand it later, then make a module. because I don't want to start something if I don't know how to set it up.
can i get help
You might need to clarify what do you need help with, also. I might not be of any help anyway! 😔
error
Hey someone can help me i cant install diskusage package..
ok, so in python i have a global var set at line 23 using row_counter = 0 and on line 121 inside of a function im adding 1 to it using row_counter += 1. Im getting the error local variable 'row_counter' referenced before assignment. With global vars it just has to be defined before it is even used in a function as far as i am aware. So im wonder what on earth is causing this issue because i must be missing something.
whats the discord.js kick function
you mean the GuildMember kick method?
whats that lol
Oh that thing i tried it once and it gave me this error
(node:27358) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:27358) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Oh 🤔
hey guys im new is this were u get the code
No sorry this is my error i don't have put any icon for the guild....
that's not how programming works
@rain sail You learn programming language and get the necessary coding environment set up type the code yourself.
I'm working on modules and do I put the entire event block in the module js file? Because I want to put the entire roll command in that module file instead of my main js file.
Like then create a const value and set it to ('./modulename.js') etc in the main.js file
Hello. I'm attempting to make a seperate bot that's duty is to stare at my main bots status, when it goes offline, it detects it, then tells me.
Heres the error code.
if (dogbot.presence.status != "online") owner.send("DogBot has crashed or is offline."); // If DogBot is not online, send the owner this message
^
TypeError: Cannot read property 'presence' of undefined
at Timeout._onTimeout (C:\Users\Cools\Downloads\StatusBot\index.js:26:16)
at listOnTimeout (internal/timers.js:536:17)
at processTimers (internal/timers.js:480:7)
C:\Users\Cools\Downloads\StatusBot>```
Here is my code.
Index.js^
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");
client.on("ready", () => {
console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setActivity(`DogBots status!`);
});
const owner = client.users.get("279116778246766593");
const dogbot = client.users.get("679211740202008596");
setInterval(function(){
if (dogbot.presence.status != "online") owner.send("DogBot has crashed or is offline."); // If DogBot is not online, send the owner this message
}, 60000);
client.login(config.token);
dogbot is never defined
wait
oh
client.users.get is returning undefined
Probably an invalid id being passed
What would I be able to replace it with?
Hm.
Likes the owner id/dogbot id?
Let me recheck that.
Yeah, I believe you're right.
I'm going to check.
@earnest phoenix try iconURL()
@red hollow i'm not in v12(dev) i'm in stable(11.6.1) and this is iconURL but the server doesn't have icon sorry
oh
I have add an icon and this work
its null then
Yeah sorry
Weird
Do you think it would have to have to deal with adding " run: async (bot, message, args) => {}"?
Or would that be unrelated?
I don't see that line in the code
Anyways though, if that lambda has an empty body, it should do n
Wait that's not a lambda
Must be some code thing I don't know about
Oh hm, anyone else know?
Anyways though
If it has an empty body
the lambda should do nothing
Perhaps try moving all your code into the ready event handler?
I'm lazy
I did this
My actual function is intended to be used in a callback
But I'm too lazy to do all of that
So I instead just send "Localize this message"
Ok, I'ma test my new feature
I'm quite sure I forgot some code somewhere
But maybe I didn't
I'll ask again in a few hours
@pine bear You put the event in your main file, and then call your roll command that is in another file
At least, that's what I would do
Oh ok
Oof
I meant to save some data in a chatlink document
but I instead saved it in a channel document
so my command gave me a "no such chatlink" error
Will fix tomorrow
Goodnight
Hey!
So.
const { gblacklist } = await con.prepare('SELECT blacklist FROM config WHERE guildid = ?').get(args[1]);
if (gblacklist == 0) {
The command is suposed to run like this
pm!bl g <guildid>
how good are u
how good are you
?
@earnest phoenix where r u from
Yep, hit a road block.
how good are you at coding @pine aspen
client.fetchUser("547115752574943311").then(user => { const { createdAt } = user client.user.createdAt })
I’m just trying to eval and this isn’t working... (I’m trying to get my created date) I know I did something wrong but I can’t figure it out
@earnest phoenix I'm decent.
How do I set up this bot in my server
@earnest phoenix Did you make the bot account?
I invited it to my server
This isn’t a bot support server.
I know that
is he talking about his bot or a made bot?
Well no one’s gonna answer you. 
Lmao
@earnest phoenix no, it's called discord bot list not server list bot
Well I’m trying to find a bot that tells me what servers people are in
I never heard of a bot that does that
const bradley = require("rage") 
XD
Import Bradley as rage
Haha.
there's no such thing as a bot that "tells the servers ppl are in"
maybe common servers?
That’s odd I got a bot in my server That is names “discord server list”.
I don't even think you would be able to list said servers if there was unless the bot was in them
^
@earnest phoenix discord server list is a place to post and advertise your server
Same thing as the bot list but for servers
👍
I’ll just repeat what I said earlier lol.
client.fetchUser("547115752574943311").then(user => { const { createdAt } = user client.user.createdAt })
I’m just trying to eval and this isn’t working... (I’m trying to get my created date) I know I did something wrong but I can’t figure it out
The only reason you have that bot is that's how it gets your server info.
Well some of it
I need a little help with something, I need to add a module.export but I don't know where in here.
if (command === 'roll'); {
const value = parseInt(args.join(" "));
if (isNaN(value)) return message.channel.send('Not a valid number to roll!');
if (!isFinite(value)) return message.channel.send('Can\'t roll infinite!');
isFinite
const roll = Math.floor(Math.random() * value) +1;
const embed = new Discord.RichEmbed()
.addField("You rolled", roll)
.setColor(0x00A2E8)
message.channel.send({embed})
};
@forest mirage try const user = client.users.get('yourID') then use user.createdAt
Will do
Maybe it’s different since I’m on mobile haha.
Different as in visually different so I wrote it wrong.
For the eval to test it try something like
user.send("Hi")```
If that doesn't work then I honestly have no clue why it's blocking it 🤔
it's a promise
ok, so I need to find out where to put the module.export variable in the js code in the module file.
Yeah he should be able to just do user.createdAt
client is the bot
Oh hey toxic
Hey
and i think you can omit const { createdAt } = user too
Oh, really. Gimme a sec.
@pale vessel the only thing I couldn't remember helping him is if createdAt takes brackets after it
Like createdAt()
no
createdAt and createdTimestamp like that
Timestamp is easier to format
like using moment
Ahh okay
Hmm
dw me too
try await
instead of then?
still need then
I think he means await user.createdAt
Oh
Ohh
Wait whats async...
yep
Yeah I was gonna say I don't think await will run out of async
He wants to get the date his acct was created
Kinda but for him only
oh
I mean... yeah but I can do it with anyone after I figure it out lol
try
then(async (user) => {
await user.createdAt;
});```
Also wouldn't it show the date if he added a message.channel.send(user.createdAt) ?
sure
Doesn’t work. It’s 1 AM and my brain is fried. Probably why I can’t figure it out
thanks for all your help
i'll try it on my bot for you
Thanks!!
const { gblacklist } = await con.prepare('SELECT blacklist FROM config WHERE guildid = ?').get(args[1]);
if (gblacklist == 0) {
The command is supposed to run like this pm!bl g id
The resault of ID is gblacklist is undefined.
@forest mirage you there
Yeah
it's because user.createdAt does not exist
...
only user.createdTimestamp
So you can only get the bots creation date?
You can get user's too
createdTimestamp
createdAt is just formatted createdTimestamp
you can format it yourself
let s = bot.users.get('266432078222983169');
s.createdTimestamp;```
client.fetchUser(id).then(user => { console.log(user); });```
that id is just my id
no problem
You as well Toxic
Np :)
Hi I have an error in my dashboard
This
If anyone can help me please dm me
Pretty sure that's a discord invite
@flat pelican ?
Seeing as it redirects to discordapp.com
Hmh
I mean. Also. The subdomain
Bruh
i saw that
So I'm just a dumbass then and it wasn't an inv?
It was not
Invite
Btw what is that
Assuming you're missing a )
You’re missing a parantheses
*parentheses
} brace
] bracket
ik
O
at Function.render (/rbd/pnpm-volume/5fa57373-af26-4845-a77c-ff17ff4ff69a/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:580:17)12:41 PM
at ServerResponse.render (/rbd/pnpm-volume/5fa57373-af26-4845-a77c-ff17ff4ff69a/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/response.js:1012:7)12:41 PM
Jump To
What about this
idk
read the error
jump to the code
Would hosting on a pi4 2gb ram be better than on glitch
sure
Is it possible to make a roblox connection to a game and be able to execute a command in game from discord
@surreal sage yes
everything is possible.
everything is possible.
True
How do I fix this?
add the module
Im new to coding
discord.js right?
yeah
wdym
it says the system cannot find the path specified
this one?
idk
it's the only module used in the code
show ur package.json @earnest phoenix and the file whats it says its missing module.
oh. just type npm i then
or show error above
throw error in terminal
it is index.js
you're right, outside the folder
it says index.js in the screenshot
What is that
open package.json and scroll further down
Put index.js file outside of ur node_modules folder
the whole bot is in the node_modules folder
GG
config = discord 
What have you done...
idk you tell me
Normally u don't need to put anything inside node_modules folder
i can tell you got the code from github
are you sure
I got it from yt lol
This guide is better
wayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy better
don't follow some dude with a notepad on youtube
so do I restart the whole script?
Yes
delete everything and follow the guide
Delete everything and follow this guide
so delete my bot folder?
trust me it's important
i feel old
how do I clear out VSC?
u can create new folder instead deleting
no, d e l e t e
Delete folder manually
..
And close vsc
So do I create a new folder through VSC?
and am i the only one who use classic notepad++ to code my whole bot?
@pale vessel yes
k
@earnest phoenix u delete ur workspace and everything on vsc
And start from nothing
yeah did that
Just follow the guide
"you are now on the right path!"
ok now that I am here what do I do?
let it be
where do I put my code in?
yes. create a new file called index.js
where?
in the root folder (streamnotifier)
add the bot code in there
ight thx for the help
no problem good luck with the journey
lol
bruh
can we see the error
@earnest phoenix
nice ping
show ur package.json
that's normal
.
you're not finished with the code yet
^
sorry new to coding
it's ok
its ok
cool, i'm learning 🎉
how do I add a prefix like for example sn!
if (!msg.content.startsWith("sn!")) return;```
thx
}
yes
you need to close the brackets, do })
});
alr
or you just do https://anidiots.guide
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
console.log("I am ready!");
});
client.on("message", (message) => {
if (message.content.startsWith("ping")) {
message.channel.send("pong!");
}
});
client.login("SuperSecretBotTokenHere");```
delete everything and paste that and try to understand the code

I remember
it's from the guide
same
ok, not that serious
When i started java, the entire screen was like a mix of red and yellow
i understood nothing lul
Im stuck on this
type
});
also delete that code (if (message.con...) it's useless
@earnest phoenix ya need to close the open brackets so node.js knows when you want the function to end
means })
more like javascript in general
i use it even if it's optional
remove that line of code
add const prefix = "sn!";
Not existant
XD
if (msg.content == prefix + "kick") {
code
}```
if it's too basic add args don't do it yet
i think we are just confusing him atm
hmm
...
nice copy paste
yeah
LMAO
you like it?
ok what
delete it
how did u even learn that .then
deleted
add message.channel.send("Kick command here") to test it out
i was going there
throw the test in the dustbin
let him do one thing first
after you're done, you need to log in to the bot. you can do that by adding client.login("TOKEN") on the bottom
Token is the bot's token
I know that
I do the following in my code to get when the bot is voted, do I need to set the webhook url also in the bot's page on DBL?
bot.dbl_client = dbl.DBLClient(bot, bot.dbl_token, webhook_port=5000)
@bot.event
async def on_dbl_vote(data):
uid = data["user"]
print("Vote received")
await increment_ticket(bot, uid)
will get error from Package.json file 
yeet did you install the modules yet?
or
node index.js
ok done
now type node index.js
ok worked
the kick one?
yeah
change msg to message
that's what i do to save space
message is more nice
arguable
everyone had their own preference
yep
and i cant speak english yeet
too blurry to see
regenerated anyway
thats why you usually store the token in annother file
it worked
ok
How do I create a custom status for my bot like "Watching _"
is this right?
client.user.setPresence({
game: {
name: `[text]`,
type: "Watching"
}
});
use logic
that code doesn't make sense
if the message content equals exactly to "sn!kick"
then kick the first member mentioned
but there aren't any members mentioned because the content matches exactly to "sn!kick"
so how do I made it make sense?
lol
yikes
:/
im new to coding...
@earnest phoenix its ok continue learning
Use .startsWith() instead of ==
You want to check if the message starts with the prefix and the ban command, not if the message is exactly that
Google js startswith to see how to use it
is this right?
how do I fix?
save and test ?
That will make the command run with any prefix
It only checks for prefix length, not what the actual prefix is
Also you have one else blocks too many
I cant even start the bot...
yt :/
You only have one IF, and yoi have two ELSE
use guide or websites
Remove the second ELSE part
I did
oh nvm
client.on("message", (message) => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case 'kick':
if(!args[1]) message.channel.send('You need to specify a person!')
const user = message.mentions.users.first();
if(member){
member.kick('You were kicked from Stokeleys Streaming Den')() =>{
message.reply('Successfully kicked ${user.tag}');
}).catch(err =>{
message.reply('I was unable to kick the member');
console.log(err);
});
}else{
message.reply("That user isn\' in the server")
}
thats the code
rn
Code blocks please
ima fix it 2 min
``` code here ```
Also, its member.kick().then().catch() and not member.kick()().catch()
wait
that cmd has so many errors
@earnest phoenix
client.on("message", (message) => {
const PREFIX = "sn!"
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case 'kick':
if(!args[1]) message.channel.send('You need to specify a person!')
const user = message.mentions.users.first();
let member =message.guild.member(user);
if(member){
member.kick('You were kicked from Stokeleys Streaming Den').then(() =>{
message.reply(` Successfully kicked ${user.tag}`);
}).catch(err =>{
message.reply('I was unable to kick the member');
console.log(err);
});
}else{
message.reply("That user isn' in the server")
}
}
});
spoonfeeding arent we
welp
delicious
thats still not checking for prefix lmao
It will accept the command with any 3 character prefix
make it so that it ignores commands that don't start with the prefix
Can you set a bot status to idle?
sure
clientPresence#setStatus
@earnest phoenix
Nothing happened
then you did it wrong
put it on onready
Ok
on glitch
yea
coz
if u dont set up a watch.json
everytime it resets
the status goes online
why
sad
precisely
then you messed something up
I didn’t edit the bot but the bot is on glitch so
why do you want your bot to be idle anyway
Idk
Whatever I will not set the status to idle
I use idle mode
okay, go on....
#lazygang
good talk
mhm
Anyone know cheap vps for discord bot
Contabo
check pinned messages
client.once('ready', ready => {
console.log('Ready');
client.user.setPresence({
game: {
name: `prefix is ${config.prefix}`,
type: "Watching",
url: 'https://youtu.be/kt-j6Gwzx84',
},
status: "idle",
});
});
Yeah
Jacob u can use that as reference
setActivity()
Do I need to add watch.json or something
lol
Just wondering do I put the help command on my bot website or respond with the help command ?
Do both.
Hey, this is kind of related to Development. How could I do if my node index.js is running if my program is running. If it stops it sends a webhook saying the bot stopped.
@pine aspen to where
A discord webhook.
An external process manager
@pine aspen what lib you using
Ehh just a simple script that tracks your processes, not familiar with node.js stuff
How to send output of a code as a command in discord.py?
Discord.JS
@earnest phoenix Do you mean send a response to a command in Discord channel or
So like bot.on(disconnect) => {
}
discord.js also has a webhook interface
Yes
<client>.on('disconnect', () => {
...
});```
then you can use that to send the message
since when the bot disconnects the code in the event fires
Thanks.
@slender thistle Yes i meant this, so how?
i'd help you with webhooks too but it's 10pm here so gl with the rest
But that won't work if the process just exits
but the process won't exit when the bot disconnects
and if there's a fatal code error other monitoring wouldn't help
The question was
process stops
I’ll figure out the Webhook part.
well then ignore what i said if that's what your goal is, to rubbish any help i try to give
Wasn't
@earnest phoenix Are you using the commands extension or on_message event for commands?
Just making the person aware that your suggestion is likely not what they were looking for
I am using commands extension
So you should have Context object that you can use .send coroutine on
It says None
What does
@bot.command()
async def eval(ctx, *, code):
func = f"async def func():\n{textwrap.indent(code, ' ')}"
await ctx.send(f"{exec(func)}")```
Well duh
exec doesn't return anything
eval does
Also you are overwriting reserved keywords
Rename your command function to _eval and use name='eval' in the decorator
Do you know the difference between eval and exec?
exec runs the code and prints it to the output, it doesn’t eval it
But i don’t know eval
eval(func)?
First search result for exec vs eval python
eval and exec have these two differences: ... eval returns the value of the given expression, whereas exec ignores the return value from its code, and always returns None (in Python 2 it is a statement and cannot be used as an expression, so it really does not return anything).
So what returned value are you trying to use with exec when it doesn't return ANYTHING
where as eval does return what is returned
eval(func)?
same arg as exec accepts
Ok
expressions inside a string
@bot.command(name="eval")
async def _eval(ctx, *, code):
func = f"async def func():\n{textwrap.indent(code, ' ')}"
await ctx.send(f"{eval(func)}")
It raised SyntaxError in async def func():
What's the full traceback
Ignoring exception in command eval:
Traceback (most recent call last):
File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "<string>", line 192, in _eval
File "<string>", line 1
async def func():
^
SyntaxError: invalid syntax
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 892, in invoke
await ctx.command.invoke(ctx)
File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/core.py", line 797, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/data/data/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.7/site-packages/discord/ext/commands/core.py", line 92, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: SyntaxError: invalid syntax (<string>, line 1)```
So?
what's undefined
might also be helpful to know what promptMessage is
and using meaningful variable names would make your code read better
please do this:
```js
code
```
Does anyone know what this error means?
I can't find anything on the internet, I thought it was something with slowdown mode, but I heard that channel doesn't have a slowdown mode.
name: 'DiscordAPIError',
message: 'Missing Access',
path: '/api/v7/channels/'a channel id'/messages?limit=1',
code: 50001,
method: 'GET' }```
doesnt look like it is hmm
are u using d.js? @nocturne grove
yes
message: 'Missing Access', make sure your bot has access to the channel maybe?
sry, forgot to mention
ive never seen this before tbh
did you hide that before posting, or does the original error show like that?
no that's my edit
ah ok lol
and yeah, missing access means the channel is not accessible
but that 'messages?limit=1' is a weird thing, I tried to google it
no, thats normal, you're trying to get/fetch a message right?
it's just an endpoint to get messages out of a channel
channel s not acccessible
check for perms before trying to interact with it; discord sends you all of the channels regardless if you're able to access them or not
either it was deleted, or its from a guild where your bot is not part of, or the bot cant see the channel because it has no view channel permissions
oh wait I now see that error came 1 sec after the bot joined the guild, and my bot is grabbing last message of each channel when it joins
why are you doing that?
my bot is sending a welcome message in the first channel it encounters where the last message was sent less than a minute ago
and these channels are apparently not filtered well
what if it doesnt find one lol
will test that in a moment, good question 😉
const channels = guild.channels.filter(c => c.type == 'text' && c.permissionsFor(guild.me).has('SEND_MESSAGES')).array();```
that's what it does
but it couldn't read, so maybe it doesn't have read perms but does have send perms
maybe yeah
a guild without text channels wasn't the problem, it was the 'read messages' permission
thank you all for your help
client.on(`messageReactionAdd`, reaction => {
console.log(reaction);
if (reaction.author.id === `${config.client_id}`) {
return;
}
if (reaction.channel.name === `server-roles`) {
if (reaction === `💻`) {
reaction.author.addRole(`Programmer`);
} else {
return;
}
}
});
It doesn't even console.log any information
did you add a reaction? is the message cached (not sure if this is required)?
yea.. i tried adding a reaction
once I was doing some things with reactions, with some reaction events (idk which) you had to react to a message that was sent after the bot was turned on for the event to be triggered
pretty sure it is
pretty sure it is
@visual sandal was that a reaction to my message?
hm
I tested it, the event only triggers with messages that are sent after the bot was turned on (it's an assumption though, that that is the reason)
so.. i guess i'll have to go back to the raw event
what do you mean?
think you have to use the reaction collector, but I don't know everything about reactions
oh wow never seen that
How to make custom prefix for a guild?
ok
provide a correct token
i have
check again

