#development
1 messages · Page 842 of 1
hi
my bot has passed 190 server's
on discord
but it's starting cause a problem
since it's a giveaway bot
it's not handling to much server's
?
wdym it has passed 190 servers and not handling "to much server's"
@narrow kettle iterate over range(0, len(your_list)), access an element under index x and compare it to element x + 1
@slender thistle iterate over zip(list, list[1:])
smarter 😛
also after u sort it ofc
thanks
if (url.includes("list=")) {
const playlist = await ytpl(url.split("list=")[1])
const videos = playlist.items;
if(!playlist) return message.channel.send("Playlist not found")
for (const video of videos) await handleVideo(video, msg, voiceChannel)
const embed = new Discord.MessageEmbed()
.setTitle("Playlist Added to Queue")
.setDescription(`${playlist.title} has been added to the queue. It has ${playlist.videoCount} songs`)
.setColor("#00aaff")
msg.channel.send(embed);
}``` Having errors with this code and
```js
let song;
song = {
id: video.id || video.videoId,
title: video.title,
url: video.url || `https://www.youtube.com/watch?v=${video.videoId}`,
author: video.author.name,
request: msg.author.toString(),
thumbnail: video.thumbnail,
duration: video.duration || video.duration.timestamp
}``` With the error:
```js
Cannot read videoId of undefined //basically tha video is undefined
``` I have no idea how to fix. Please help. Thanks in advance
undefined
generally that's a typo
or something you haven't set
also oof that indentation
or video is undefined
I literally put that
where is the variable video set
u don't set video there
for(const video of videos)
The handleVideo function
ok right makes a lot more sense now
whats the signature like
function handleVideo(/* what's here? */)
My messagess aren't sending
show ur handleVideo function
its discord being whack, separate the code
this is the "blocked in dm" errro
Ye ik
discord is trash
its usually cuz your message too longum
retry
if message is too long discord automaticly create a txt with your message content
normally
1|pichu | 12:27:10 PM worker.1 | Error: input stream: This video contains content from UMG, who has blocked it on copyright grounds.
1|pichu | 12:27:10 PM worker.1 | at /home/lumap/PichuRewrite/node_modules/ytdl-core/lib/info.js:47:25
1|pichu | 12:27:10 PM worker.1 | at PassThrough.<anonymous> (/home/lumap/PichuRewrite/node_modules/miniget/dist/index.js:196:32)
1|pichu | 12:27:10 PM worker.1 | at PassThrough.emit (events.js:316:20)
1|pichu | 12:27:10 PM worker.1 | at endReadableNT (_stream_readable.js:1201:12)
1|pichu | 12:27:10 PM worker.1 | at processTicksAndRejections (internal/process/task_queues.js:84:21)
1|pichu | 12:47:32 PM worker.1 | Error: input stream: This video is no longer available because the YouTube account associated with this video has been terminated.
1|pichu | 12:47:32 PM worker.1 | at /home/lumap/PichuRewrite/node_modules/ytdl-core/lib/info.js:47:25
1|pichu | 12:47:32 PM worker.1 | at PassThrough.<anonymous> (/home/lumap/PichuRewrite/node_modules/miniget/dist/index.js:196:32)
1|pichu | 12:47:32 PM worker.1 | at PassThrough.emit (events.js:316:20)
1|pichu | 12:47:32 PM worker.1 | at endReadableNT (_stream_readable.js:1201:12)
1|pichu | 12:47:32 PM worker.1 | at processTicksAndRejections (internal/process/task_queues.js:84:21)```how can I handle these errors with ytdl
@tight plinth did you see if there is any errors with my handle video?
What is the problem with that
Umm, does anyone know how to make a specific command usable by only the owner of a bot?
I have config.ownerId
I tried
if (message.author.id !== config.ownerID)
I didn't think it worked
Should work
it should work
This is mine for the eval command
if it doesnt and no errors
if (message.author.id != "536949735299219467") return;
hmm....
console log message.author.id and config.ownerID
This is what I'm using it for
if (command === "restart") {
const embed = new Discord.RichEmbed().setDescription(
`Restarted in: **${Math.round(client.ping)}**ms`
);
if (message.author.id !== config.ownerID) {
const NotAllowedEmbed = new Discord.RichEmbed().setDescription(
`Not enough permission, you cannot Restart ${client.user.tag}!`
);
message.channel.send(NotAllowedEmbed);
}
message.channel
.send(embed)
.then(() => client.destroy())
.then(() => client.login(config.token));
}
cx is ur videoID defined
Yes
check using console
probably coz playlist is an array
https://hastebin.com/igigipupuy.js This is my handleVideo event
But look at the loop
I've tested with eval
@high bough have u tried the code?
@finite bough I'll give another line of my code, cuz IDK if it really works or not, but this one practically doesn't work.
if (command === "suc") {
if (message.author.id !== config.ownerID) {
const NLembed = new Discord.RichEmbed()
.setAuthor(
"Mineko",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
)
.setColor([173, 216, 230])
.setDesription("Cannot show `Dev-Special` Commands")
.setFooter(
"©Mineko | v1.5.2 Beta | 12 Total Commands",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
);
message.channel.send({ NLembed });
} else {
const embed = new Discord.RichEmbed()
.setAuthor(
"Mineko",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
)
.setColor([173, 216, 230])
.addField("**Unlisted Commands**", "`restart`, `botping`, `listservers`")
.setFooter(
"©Mineko | v1.5.2 Beta | 12 Total Commands",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
);
message.channel.send({ embed });
}
}
if (message.author.id != config.ownerid) return message.channel.send("You cannot use this!");
That's what I got
What is your config.ownerId defined as in config.json
Yes
It's
683577627948351512
But even with my friend's acc, I can still use the command
With the one i specified above, I can't use the command, but it doesn't show anything, even though i set it to embed
@high bough have u logged config.ownerID?
Yes
@woven sundial you have defined invites twice, once in your loop so the code is confused
Try this
invites.forEach(function(invite) {
possibleinvites.push(`${invite.inviter.username} || ${invite.uses}`)
})```
@high bough what are u trying to do
this part is when the message author is not the config.owener
@woven sundial I get it
invites.forEach(function(invite) {
possibleinvites.push(`${invite.inviter.user.username} || ${invite.uses}`)
})```
I just checked the docs
That's what you are supposed to do
I think
inviter is a user type
^
You could get their id and find the user via the guild
Log invite
console.log(invite)
Entire error?
12v?
waits
@high bough what are u trying to do
@finite bough Sorrt, I was eating, anyway, I was trying to make the command
const embed = new Discord.RichEmbed()
.setAuthor(
"Mineko",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
)
.setColor([173, 216, 230])
.addField("**Unlisted Commands**", "`restart`, `botping`, `listservers`")
.setFooter(
"©Mineko | v1.5.2 Beta | 12 Total Commands",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
);
message.channel.send({ embed });
```run if i was the owner, and
```js
const NLembed = new Discord.RichEmbed()
.setAuthor(
"Mineko",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
)
.setColor([173, 216, 230])
.setDesription("Cannot show `Dev-Special` Commands")
.setFooter(
"©Mineko | v1.5.2 Beta | 12 Total Commands",
"https://cdn.discordapp.com/avatars/683597011693469698/d9733c732d874e5137a9738b21d54acd.png"
);
message.channel.send({ NLembed });
```run if otherwise.
Log invite.inviter
Log invite.inviter
d.js
Fuck
how can i get attachment url from collector?
Can someone help me with ```js
if (message.author.id !== config.ownerID)
@woven sundial one of the invites has no user
this means the field is nullable, which means it doesnt always return a user
there are invites without users
so you need to check if the invite has a user before trying to get his username
so ytdl stops playing 90% of my songs when they hit 2-3 min, forced to skip. why
If I'm using ```js
if (message.author.id !== config.ownerID)
```js
{
"ownerID": "683577627948351512", "4324234234242342", "2342342423424234243"
}
```?
how...
Yes
[python] I got an error in this code(a bot that checks it tells me) but i have no idea what is the problem?
def who_is_missing(file_name):
fille = open(file_name, 'r')
my_list = [line.split(',') for line in fille.readlines()]
my_list.sort()
count = 0
for x in my_list:
if (count - x) != 1:
x = len(my_list)
count += 1
my_list.append(count)
my_list.sort()
return count
path = input("Please Enter a File Path: ")
hey so, i have a list, how an i take that list and write it into a new text file? (python)
they dont have \n in each one
but i can just add it in a loop i guess
for x in my_list:
if x == x:
break
ops
does that break the for loop?
oki thanks
so ytdl stops playing 90% of my songs when they hit 2-3 min, forced to skip. why @tight plinth is that bug?
yes
could someone pls help me make a ping command with latency and api with d.js ?
Cause it's also happened to me 🤮
oof
someone pls help me
@fresh hatch with discord.js you said?
making it to reply with pong is as easy as shit
client.on('message', message => {
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send("Pong~")
}
})
yes
@fresh hatch lemme show ya
thx
U mean "internet speed test" or something?
@fresh hatch you can do this
thx
Np
[DISCORD.JS V12] My playlist handler will not work, been tryna fix all day. Please help if you can. Thanks in advance
https://hastebin.com/alubojoham.js
Lemme take a look at that for a second
@fresh hatch doesn't matter add an await before:
message.channel.send('🏓 Pinging...')
And you see that there's a line called (bot.ws.ping)?
Change the bot to Client
Also you should listen to the message event only once
it gets stuck at 🏓 pinging...
yes
yes
Change it to client without a capitalized C
shit im so dumb
Lmao
c-p Balance ton porc chilla
Wait it says NaN?
It's createdTimestamp
@fresh hatch change the pmsg.createTimestamp - message.createTimestamp
create to created
thx
Np
[DISCORD.JS V12] My playlist handler will not work, been tryna fix all day. Please help if you can. Thanks in advance
https://hastebin.com/alubojoham.js
Imma bout to lose my mind here
could someone pls help me debug the 8ball cmd
someone pls help
how do i define it?
you create it
const args = "what the value should be?"
yes
what the value should be?
i learned from yt
are you sure you learnt
watch again the part on how to create args
@fresh hatch so ur trying to do the args?
@fresh hatch if you need args you can use this
"let args = message.content.substring(Prefix.length).split(" ");"
hes showing you how to use it as a exported command
on which his args are created before being passed to it
still not working
you cant copy paste code and expect it to work
lol
you actually jump into somthing which is quite advanced
i started from yt too but now i do all myself
(too if sometimes i ask to you guys : D)
programming is extremely strict, you have to make your own code, because other people's code was made specifically to fit their exact use case and it will not work for you if you dont at least adapt it to fit your code
i just read the docs :P
lol
me too sometimes
But the most of the times i just know what im doing
@fresh hatch did you do "const Prefix = '(your prefix)'" ?
if you dont do that my let args will not work
cuz he doesnt recognize "Prefix"
i declared the prefix in config.json
@fresh hatch umm Prefix to prefix maybe?
Can u send me a screen of how you writed "Prefix"?
Cuz if you writed "PREFIX" for exapmple, it will not work
you will see my token
Cover that
ok..
variable names are case sensitive. if you declared a variable called prefix you cannot use it as Prefix
Yea
@fresh hatch did you write Prefix or prefix?
exapmple
Lel
bruh
i declared the prefix right now
@fresh hatch =>
discord.MessageEmbed()
@solemn quartz it says in the console.error => discord.RichEmbed() is not a constructor
So it should be discord.MessageEmbed()
What...
maybe he did "const Discord = bla bla bla"
i get this monstrosity when i do discord.MessageEmbed()
and he did "new discord.RichEmbed()"
@fresh hatch could you show us the code of the command 8ball?
i dont think it is the best youtuber ever but ok
RichEmbed does not exist in discord.js v12
@fresh hatch the reason you're messing up is because his tutorials are old
which version of discord.js are you using?
@solemn quartz we didn't meant the node module's version
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Wait 12.1.1? I've never seen that before
Hmm mine is 12.0.2
12.1.1 was released a couple days ago
@fresh hatch show us the code of the command 8ball
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
wait what
@fresh hatch the reason your bot is spamming is because you dont do any check for what the message should start with
your bot is gonna reply to ALL messages
is your pc's name "Web"?
i dont know if i took this right
i forgot to move it
@fresh hatch wait a second... Why do you have (( in the Math code line?
fixed it
Hmm... Is it working now?
where the fuck is the Math.floor code line?
@fresh hatch do you have a code called:
if (message.user.bot) return;
In the message event?
And that should be =>
Math.floor(Math.random()*replies.length)
@fresh hatch wait
it is "const result = replies[Math.floor(Math.random() * replies.length)]"
i do that like this ^
Why are you Creating hundreds of message events?
@fresh hatch try this const result = replies[Math.floor(Math.random() * replies.length)]
i messed it up last time
cuz i copied from my code and i forgot to edit a thing
so it didnt worked
did he at least add a check for command name? otherwise his bot is gonna reply to ALL messages, regardless of commands
how do i add check
(node:6380) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null
at Object.run (C:\Users\t\Documents\app\commands\skip.js:23:35)
i did "const bot = new Discord.Client()" and this
@fresh hatch i did this and if you create message with just the if statement it works... You don't need to create hundreds of message events
so u could do "Client.login(token)"
self-hosting
Self-hosting is a pro gamer move
@fresh hatch you can use if staments
if (condition) //action after condition is met
@karmic viper you mean your bot's id?
@karmic viper id = ur bots client id xD
@fresh hatch do Client.login(token) insetad of
@fresh hatch and make sure to add:
if (message.author.bot) return;
Under the message event
Lol because the bot responds to itself
It's ok lol
(node:1963) UnhandledPromiseRejectionWarning: Error: 404 Not Found
at IncomingMessage.res.on (/rbd/pnpm-volume/1199ff33-6e23-4fde-89e5-eeb204fa56f1/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:118:25)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
(node:1963) 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: 4)
What is Problem bros
@fresh hatch you need to use:
if (message.author.bot) return;
Instead of that
(node:6380) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null
what
hep
thx
serverQueue.connection.dispatcher.end('Skip command has been used!');``` Skip command causes error
Have tested with the search commn
and it works
It is only there with the play command
@fresh hatch np
that's not the file
https://hastebin.com/amadaxajaq.js - play command
https://hastebin.com/viyacehava.js - skip command
https://hastebin.com/pipuxovire.js - search command
search works with skip but play doesn't
Error - (node:6380) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null at Object.run (C:\Users\t\Documents\app\commands\skip.js:23:35)
there's no dispatcher.end in that file smh
As skip works
@fresh hatch type in node .
thx
Np
it din't run my 8ball.js
help me pls
Huh does the console.log say anything? @fresh hatch
only Ready from index.js
When you use 8ball command it doesn't work?
yes
tf is that indentation
@fresh hatch that yes means it doesn't work or it does lol?
i doesn't
Wait lemme check that brb
do I have something wrong with this
console.log(`${bot.user.tag} is online in ${bot.guilds.size}`);
it says KnightBot#3056 is online in undefined
@heavy anchor bot.guilds.size needs to be =>
bot.guilds.cache.size
is it in 0 guilds ( ͡° ͜ʖ ͡°) @heavy anchor
no lol its in Several
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)
@fresh hatch i have no idea why it doesn't work... I searched for that but no solution
https://hastebin.com/amadaxajaq.js - play command
https://hastebin.com/viyacehava.js - skip command
https://hastebin.com/pipuxovire.js - search command
search works with skip but play doesn't
Error - (node:6380) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null at Object.run (C:\Users\t\Documents\app\commands\skip.js:23:35)
ok that worked thx @earnest phoenix discord.js v12 must be different
It is
@heavy anchor np
( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)
( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)( ͡° ͜ʖ ͡°)
shitposts in off topic bruh
|c
.urban lenny
When I mention someone, I want to write a command waiting for that person to reply. But I couldn't figure out how to wait for the second message. While doing this, I cannot mark the same person with this command twice. (discordjs)
Is there a short sample code?
MessageCollectors
but i wont spoonfeed code
you need to have 2 messagecollectors
not just 1
and a filter to make sure it's the same user that responded the first time
one should be enough no? unless i didnt understand what he wants
It looks a bit complicated. hmm
just needs a global state
but I use v11
hold on
message collectors should be the same in v11
just change the v12 to v11 :p
mhm
the options are different though
https://hastebin.com/amadaxajaq.js - play command
https://hastebin.com/viyacehava.js - skip command
https://hastebin.com/pipuxovire.js - search command
search works with skip but play doesn't
Error - (node:6380) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null (skip.js) Pls help
Does this look right?
looks fine
looks fine
var ping_time = Date.now()
msg.channel.send('Pong!').then(m => {
m.edit('Pong! ' + (Date.now() - ping_time) + `ms 🏓`);
});
lol
anything wrong with it when sending the msg, errors?
no
then why are you asking-
bc idk if the time is Accurate
template literals
omg thats so hot
im using this all the time
var ping_time = Date.now()
msg.channel.send('Pong!').then(m => {
m.edit(`Pong! ${(Date.now() - ping_time)}ms 🏓`);
});
@heavy anchor
as i said it might return NaN if you do it the way you did
(or just put it in an embed but yknow thats l a z y)
it returns a number i just don't know if thats the most accurate way to do it
anyway no big deal
koolio
lul
babel is one of the most annoying tools I've ever used
does anyone know how do i run all the files in the same time with nodejs?
because node . doesn't work for me, it only executes index.js
thats not what you want to achieve
if you run multiple files independently, they cannot talk to each other, it will be completely separate programs
what you probably want is load other files from your main file
you can achieve that using require and module.exports
how do i do that?
// main file
let something = require("./otherfile.js")
// otherfile.js
module.exports = something```
how can i do that when i write a command the bot joins my voice chanel and reproduces an specific song?
It doesn't have one answer and takes time
But I think it has something to do with an NPM install
I need help on how to show the servers the bot is in on dbl
@hearty jetty
client.user.setPresence({
status: "online",
game: {
name: `${client.guilds.size} Servers | /help`,
type: "WATCHING"
}
});
});```
you can change the online to idle
and the name: is the custom status so for @gilded plank the name is Discord Bots
on top.gg
OHHH
i know this.
bruh
are u know?
ok
excuse me but for top.gg it should just import what your bot has
so if your bot is online it says online and if your bot's status is idle it should say idle
on top.gg
That's what it does
but this is not updated for a long time.
If something on your bot page is not updating, try force editing
Ah
Because your bot has not been accepted yet
Your bot's is not in this server
well then you must wait
the web mods are reviewing applications everyday
@raven urchin do not take my word for this but it's either you must type the server id in or it automatically shows the DSL servers
What's your bot's library, ZeroNation?
@earnest phoenix for bots they need the api
You can use dblapi.js
I need help
When I go to the terminal in visual studio to see if i can turn on my bot
then say what you need help with
@slender thistle Like this?
@raven urchin Did you pass your client to DBL constructor?
(node:16) UnhandledPromiseRejectionWarning: RangeError: Invalid permission string or number.
at Function.resolve (/home/container/node_modules/discord.js/src/util/Permissions.js:195:65)
at Permissions.has (/home/container/node_modules/discord.js/src/util/Permissions.js:62:35)
at Role.hasPermission (/home/container/node_modules/discord.js/src/structures/Role.js:171:46)
at /home/container/node_modules/discord.js/src/structures/GuildMember.js:321:35
at Map.some (/home/container/node_modules/discord.js/src/util/Collection.js:357:11)
at GuildMember.hasPermission (/home/container/node_modules/discord.js/src/structures/GuildMember.js:321:23)
at Object.execute (/home/container/commands/Moderation/tmute.js:12:19)
at Client.<anonymous> (/home/container/index.js:143:13)
at Client.emit (events.js:311:20)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
(node:16) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16) [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.
I tried understanding this error but i cant; can somebody tell me what line this is on?
and a bot just DM'd me
im scared
@slender thistle how do I do that?
@earnest phoenix node.js isn't installed it seems
i did
@earnest phoenix show the bot who dms u
@raven urchin
@zinc sluice
i didnt ping em either
sec
@zinc sluice
I did that @slender thistle
i did XL
Is client in DBL arguments?
"hi"
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, 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:2
+ node .
+ ~~~~
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
``` What did I do wrong?
going to repost ur message to saa
@earnest phoenix node is not installed
@slender thistle yeah
Then you're good
@earnest phoenix the node command doesnt exist for ur cmd
can somebody still tell me what line the error is on-
It just says NA
tx
how do i install node into visual studio?
did hasPermission() change in v11
if(person.hasPermission("MANGAGE_MESSAGES")) return message.reply("I can't mute that user!")
thats the error
hmm
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, 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:2
+ node .
+ ~~~~
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException``` I have Node installed, but it says it cant find it
@raven urchin wait for a update
@earnest phoenix well no
?
Yikes
its not installed
why did you censor the bot name?
launch ur bot from this cmd
Don't wanna promote the bot :/
if its not meant to be ad u can show bot name
here have a vote
2 votes actually
@tight plinth I have it setup like this
wait
umm
damn hosting from a phone
no glitch
Don't bully....
u have to post dbl code into ur index.js
^
@tight plinth ah okay, didn't know
not another file
or use a module.exports like I do
index.js better
I use module.exports = { @crimson vapor
I put it in my message event
Oh my, where in the index.js do I put it?
where you want, outside of a event
normally add it to just under the declaration of client or at the bottom
I think it needs to be under login
im not too sure since I use a modified client
try to put it before client.login
So on top of it?
Hi guys, i want to create a Question-Answer bot for my channel. But, idk how can it possible ? So any1 can help me ?
you could use an API like wolfram or something
isn't wolfram minecraft hack?
umm
well yes but no
@tight plinth like this?
this should work,ye
It works! Thank you very much
np
Sorry if I was being too much
you arent nearly as bad as some people
I'm just trying to learn you know
let some_people = ["message.author.displayName", "x", "y"]
don't put it in quotes lol
whats the simplest way to do cooldowns?
depends what the cooldown is for
server/user cooldown between commands
can someone tell me how to intergrate a image search api into my bot?
can someone tell me how to intergrate a image search api into my bot?
@lucid pasture google
read api docs
make an object with servers maybe
k
@tight plinth set timeout i suppose
i found a code a long time ago
this might help u out
setinterval?
const talkedRecently = new Set();
// -- This part of the code is covered up by the notepad window --
var prefix = config.prefix;
client.on("message", (message) => {
if (talkedRecently.has(message.author.id)) {
message.channel.send("Cooldown 20 sec");
message.delete();
return;
}
talkedRecently.add(message.author.id);
setTimeout(() => {
talkedRecently.delete(message.author.id);
}, 20000);
if (message.content.startsWith("-help")) {
message.channel.send("-r33 (Nissan Skyline) [[Add the rest of the line here]]");
}
})
kinda like array I think
^
it will
set is basically a list but no ordering
u can order a set right?
(node:16) DeprecationWarning: Collection#find: pass a function instead
returns this error and it wont go forward or even mute the user if that makes sense
it seems possible i mean
is that a fatal error
a set does not keep track of the items orders
@earnest phoenix show the code of your mute command
[python] so i need to make a function that gets a text file with a name of a song, the name of the guy/band who made the song and the length of the song, and between each one there is a ;(there is a few lines, each one is a different song and different length(song writer can be the same). the function takes that file and makes a tuple which contains the longest song, number of songs and the band/singer who have the most songs on the file(its graunted there is one). i know how to do the number of songs, but no idea about the rest, ill send examples of the file and the function, srry for the long message
ok
const ms = require('ms')
module.exports = {
name: "tempmute",
desc: "Temporarily mute someone.",
usage: "<mention> <time>",
cooldown: 5,
execute: async (message, args) => {
//.tempmute @user 1s/1m/1h/1d
let person = message.mentions.members.first()
if(!person) return message.reply("Couldn't find that user.")
if(person.hasPermission("MANAGE_MESSAGES")) return message.reply("I can't mute that user!")
let muterole = message.guild.roles.find(`name`, "muted")
if(!muterole){
//start of creating the role
try{
muterole = await message.guild.createRole({
name: "muted",
permissions: []
})
message.guild.channels.forEach(async (channel,id) =>{
await channel.overwritePermission(muterole,{
"SEND_MESSAGES": false,
"ADD_REACTIONS": false
})
})
}catch(e){
console.log(e.stack)
}
//end of creating the role
let mutetime = args[1];
if(!mutetime) return message.reply("You didn't specify a time!")
await person.addRole(muterole.id)
message.reply(`<@${person.id}> has been muted for ${ms(mutetime)}`)
setTimeout(function(){
person.removeRole(muterole.id)
message.channel.send(`<@${person.id}> has been unmuted after ${ms(mutetime)}.`)
},ms(mutetime))
}
}
}
@crimson vapor
that was way longer than i expected
ye
@earnest phoenix I see what you did, change let muterole = message.guild.roles.find("name", "muted") to `let muterole = message.guild.roles.find(m => m.name == "muted")
guess what
oh oki thanks
it work
you dont have nitro, you can send animated emojies and server emojies in different servers, set animated profile pictures and custom tags and more, try out now!
WHY SAME LINE REEEEEEEEEE
coz
https://lumap.is-inside.me/7obq7xtW.png I use a command mod ONLY for GW (it hides emojis who require nitro)
@crimson vapor
ye
it just wont add the role
send the verification message
or send the unmuted verification message
no errors
and the muted role gets created
are you sure you have perms to add the role
mhm
and that you're respecting the hierarchy
^
not ur rank, bot rank*
ik
bot rank is under mine
a person with no roles
i can't tell you anything else but to debug
a bot can add roles to anyone even the owner
yes
if a role has permission to send messages differently
it will overwrite the mute role's perms
but
if all roles are set to /
(the person has no rolez)
instead of guessing literally debug
go through your code
hey guys i need help.
i want this string hello. world splitted into array like this ['hello', '.', 'world'] what regex do i need in split function?
put the muted role at the top of the hierarchy
well split at spaces is average so idk
hey guys i need help.
i want this stringhello. worldsplitted into array like this['hello', '.', 'world']what regex do i need in split function?
@restive night can you?
u can do .split(' ') to get ['hello.','world']
putting it at top didnt work
but i want that . also include in array
why do you keep avoiding the fact that i'm telling you to DEBUG, which if you had done, you would've identified your problem already
because im doing it
while doing other things
hmm
ikikikiiik
it's quite literally putting a try catch on methods that can throw and logging through your closures
@gritty frost https://lumap.is-inside.me/ETW4wD5X.png install vsc
read the errors 
if aleready installed, uninstall & reinstall
^
k
i have a try catch
re
only on role creation
i said to try catch on any method that can throw
or simply try catch the entire command
i did the whole command
no errors
just doesnt work
var person = message.mentions.members.first()
let mutetime = args[1];
if(!mutetime) return message.reply("You didn't specify a time!")
await person.addRole(muterole.id)
but i think its this part
does nothing
but it awaits the added role then sends the verification message
and it isn't adding the role
How can I encode "Open Date" in the mute command
I HATE ytdl stopping songs after 1-3 minutes, is there any fix?
iirc it's got to do something on youtube's side and them closing the connection if you hang for too long
and sometimes I got this error in the log https://lumap.is-inside.me/3f4hYaqV.png
i went around that problem by buffering the content from the video into memory and then allowing my code to slowly consume the buffer and send it to discord
the first index of a list in python is 0 right?
its not starting from one or something
All indexing starts from 0 in Python, yeah
let mutetime = args[1];
if(!mutetime) return message.reply("You didn't specify a time!")
await person.addRole(muterole.id)
@earnest phoenix
c s s
weird question but i'm back on discord.js to create a bot for someone else and basically i'm literally trying to send a message to a single channel after somebody joins on v12 but apparently there's no straightforward way to do it since apparently .get() no longer exists on Guild.channels
.fetch()?
nope .fetch() is out of the question as well
why not?
hpnestly don't know if that's because v12 is broken right now or some other reason
because it's not a function of Guild.channels
try resolve
yeah did that
okay well i'll take a look into it more
the thing about .resolve() gives GuildChannel or null, so it should have a .send() function
ah well turns out it does, never mind lmao
nice
<Guild>.channels.cache
god fucking dammit i hate discord.js for this one reason
@earnest phoenix wouldnt buffer it from memory take a decent amount of time?
no turtle
no it's ok i got it thanks yall
or he will keep on typing for 2 years
@earnest phoenix wouldnt buffer it from memory takes a decent amount of time?
yes if you do it sequentially, however i'm doing it in parallel, both downloading into buffer and sending from buffer to discord are simultaneous
but if there is 1 error in buffering
oh turns out .send only exists on TextChannel now
so i casted GuildChannel to TextChannel and it worked
ah
it's handled by zero byte filling the buffer, shiemi
galaxy brain
so yeah this is how v12 is these days ig
this.client.on("guildMemberAdd", async(m: GuildMember) => {
if (m.guild.id === process.env.SERVER_ID) {
const channel = await m.guild.channels.resolve(process.env.SERVER_ID) as TextChannel;
await channel.send(`hello`);
}
});
for me I didn't need to convert it to a textchannel
btw you don't need async for resolve afaik
yep
i put it there out of habit lmao
also just run npm update unless you're already on the latest version of djs because it is what it is
Yo I'm just starting out with discord.js
Wtf is a Cache?
Like it says it works like an array yet guild.members.length returns "undefined"
Instead of the length of the array
In computing, a cache is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere.
That's not what a Cache is in discord.js @topaz fjord
that's what cache is in general
wtf is that docs
That's what popped up when I looked up "discord js docs"
cry would not like that
Is that the wrong docs?
cry wouldn't like anything
yes
Thx @pale vessel
I use discord.js. I have 2 versions of the bot. One developer version and one non-developer version. How do I make sure that the developer version doesn’t interfere with the stats of the public version?
Yhea I was wondering why it said "server"
"/en/latest/"
@sullen patrol please don't copy paste your message into other channels
is it mini mod time
I mean
it makes sense for him to repost here?
@pale vessel yes
yes
Hi, I'm jsut asking with what .addrole is replaced in V12? Thanks.
roles.add
when you don't know how to use the docs
(i still use v11)
just check docs first and if you still dont understand THEN you ask here
i mean like even the domain is readthedocs.io
thats how I would do it
reposting the question isn't gonna get people to help
debug
give an error and we can help
also I recognize that code from crawl's d.js music bot series 
not
bot
bart
ever seen someone not github fork
me
[python] so i got this function i did and all whats left is to make the list into the file(rewrite with the new list) how do i do it?
def my_mp4_playlist(file_path, new_song):
fille = open(file_path, 'r')
my_list = [line.split(';') for line in fille.readlines()]
if len(my_list) >= 9:
my_list[6] = new_song
else:
while(my_list.count('\n') < 2)
my_list += '\n'
my_list += new_song
print
no because I don't have an error to go off of
I'm not gonna run the code myself to see what's wrong
hey so
if you understand what you've coded, you'd immediately know the issue by debugging
hey blox
if I want a command like !help and i say something after it like @royal portal then how do i make it so it will still work
so it ignores whats after the message
a command handler
and it sitll works
ah
yes. startsWith
fair
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("ewadwarfawr2133213dawd");
you didn't have to post the code
xd
fair
so they can scroll up
its obviously video, msg, voiceChannel
