#development
1 messages · Page 475 of 1
tutorial on what?
There are some good programming tutorials on YouTube, but not really any discord bot making ones
you need to find some written ones for these
yeah i found a website that teaches you how to use and understand code and java
i recommend codecademy (that's where i started)
thats what im using haha
oh ok lol
python is best for building simple AI programs
discord.py isn't bad also, but if you are learning a language just for making discord bots, then learn javascript
and discord.py actually has a lot of examples where beginners can learn from
ah ok
can anyone help me fix this error while install discord.py
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 19, in <module>
sys.exit(pip.main())
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python3.5/locale.py", line 594, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting```
How to purge tagged message only?
you're going to need to explain
Here's the code sorry for trouble
module.exports.purge = async(msg,args)=>{
msg.delete();
const fetched = await msg.channel.fetchMessages({limit: args[0]});
msg.channel.bulkDelete(fetched).catch(e => msg.channel.send(`Error : ${e}`));
}
it purge all message lol
message.channel.fetchMessages({limit: 100}).then(msgs=> msgs.filter(m => m.mentions.channels.size >= 1 || m.mentions.roles.size >= 1 || message.mentions.members.size >= 1 ))```
👀
@grizzled isle let me guess,
delete 100 messages
filter by user tagged? can more than one user
or filter by roles tagged
Step 1: Get messages
Step 2: Filter Messages
Step 3: bulk delete messages
i understand the step but i dont understand how to filter them 0-0?
lowkey just did
i cant do it

i'm worse one
Anyone else having issues with keeping their bot online today, it's probably some strange bug that only happens to those who have their bots hosted on glitch.com...
i wonder if glitch fixed the uptime hack
Just saw an ad flashing
can anyone good at javascript? plz dm me
@high tinsel Mines fine
hello everyone i trying to send image from embed but it failed please tell me the reason
the reason that i found is it cant use local image, if the reason is this then i wont try embed anymore.
here 's the code.
module.exports.tarot = async (msg,args)=>{
let tarot = Math.floor(Math.random() * 3);
let embed = new Discord.RichEmbed()
.setTitle(`Mayor Arcana`)
.setDescription(`Description:`)
.setColor(`#00AAFF`)
.setImage(`./data/tarot/${tarot}.png`);
msg.channel.send({embed}); // Embeded not work
msg.channel.send(``,{files: [`./data/tarot/${tarot}.png`]}); // normal message work
}```
@night bridge Try loading it to an image hosting site.
it works
reason1 === reason1.length <1 ? reason1: "No reason was provided"
can't get this to work
always says "No reason was provided"
do your reason have data?
it's args.slice(1).join(' ')
on reason1
it works if i remove the === and nothing like reason1 only
but this way it always returns "no reason was provided"
how do you make a message collector in discord.js
i coded my discord bot in Malbolge
I am making a create channel command and I only want the person that used the command, the staff of that server, and the owner to see the channel, but I don't know how to do that part
Can someone please help ;p
I @knotty steeple https://discord.js.org/#/docs/main/stable/class/MessageCollector
how do i let the bot change the embed color from white to black every time?
what
i wanna make an embed !help
Randomize it
what language?
discord.js
is it supposed to do it only once
is there a module in js that can choose from a random sequence
yes but i wanna have it what and black
not purple pink blue green red cyan
uh
? discord.js is new for me
I thought you meant like that lmfao
oof I don't think setTimeout will work will it?
Cause it will have to be every time the command is used
or am I just dumb ;p
no
i rlly need it
no
Google is good place to look
no servers but i added bot
if you want to be given code so easily then you shouldn't call yourself a bot developer 
?

They spoon feed
no
why are you telling him that 
they do
"made" is a hard word to use when you used an easy-to-use software to make that bot while actual bot developers "write" their codes manually
I think it's kinda dumb to be honest, no one will learn to actually write code
learn to code
where i can put my image that discord can call?
dont use dbm
Discord Bot Maker
discord bot maker
Oh ah
a program with code BLOCKS
its for people that cant code
Yes My friend got that
and want to waste their money
She made a bot in lua or something
inb4 he cracked it
it's something you pay $10 to make a completely useless shitty bot
but i think it is not possible to make the help one time white and the other time black
I know how but I prefer not to say
okjzfdnhvolkhzjdbfkjvhbzfdvhbzfdjhvbkfzjhvbofzijkbv frhzrdshrhzrh
cracked it
What are we even doing?
couse i am bad in discord.js and you guys are pro you guys made bots with it
okjzfdnhvolkhzjdbfkjvhbzfdvhbzfdjhvbkfzjhvbofzijkbv dhnrdhzrh
@inner jewel
it is completely impossible to make something easy-to-use that doesn't have any limitations, so you should do it manually by knowing a programming language
plug
how do i get the github
what
what
how do i come there
you open the site?
Umm
ur making no sense
🤦
tf are these questions
idk
When you speak nearly perfect english
people like this
then you sound like you don't know it
their problem is not
programming
their problem is
like
how do they funciton
in day to day life
nice, and I wasnt talking 
I am making a create channel command and I only want the person that used the command, the staff of that server, and the owner to see the channel, but I don't know how to do that part.
Can someone please help ;p
owners and admins will be able to see it by default, as for staff you could check if their roles have manage server or manage channel permissions
ive been in servers
where the staff couldnt create channels
you'd probably have to have it be defined by the server
OOF
I forgot about that
damn
Ok
How can I make it so that the person that used the command can see it and no other members
send it via pms
no..
what do you mean then
oh
Yea
you could make an unverified role
and when they use the command
well
used on them
they obtain a verified role
remove unverified role
and modify the server channel settings
accordingly
No...
That is not what I mean :/
It is for a NSFW server
So I need it so people can verify to get into nsfw section
instead of doing it in the DMs were only one person can do it
it will be in a channel were mods/admins/owner can do it if one or more person is busy someone else is there that can do it
How could I make this regex work with "+-=!@ and spaces"? const regex = "/\w+/gm"
oof
boye
the regex works
I just need you to tell me how to use spaces and stuffs with it
can someone send me changing bot activity ? (PM) discord.js
👍
@lusty dew we cant help much without the code
but it looks like you're using commandfile.run() when you can't
bot.on("message", async message => {
if(message.author.bot) return;
if(message.content.startsWith(`@brisk fern `)){
var command = message.content.slice(`@brisk fern `.length).toLowerCase();
var cmd = command.split(" ")[0];
var args = command.replace(cmd+" ", "");
var commandfile = commands.get(cmd);
if(commandfile) commandfile.run(bot, message, args).catch((e)=>console.error(e));
}
});
@bright spear
Lmfao
Ignore the convo
It was something I was talking about with one of my dev members XD
well, looks like commandfile.run() isnt valid
what is commands
^
console log it to see if its getting the command properly
ok
also, your commands wont work if your bot has a custom nickname in a server
because custom nicknames change the mention from <@id> to <@!id>
well fuck
Oops I flipped them
Ah ok
same on the slice part
you can do some shenanigans to avoid repeated code
i'd do something like js array = ["<@id>","<@!id>"]; result = array.indexOf(msg.content); // 0 if no nickname, 1 if nickname, -1 if not found if(result > -1) { msg.content.slice(`${array[result]} `.length) }
of course to use that you need to split the entire string before, instead of using startswith
shit you love indexOf @quartz kindle
finds which one, if any
if you use includes, you wouldnt know if there is a nickname or not
the ! version isn't always used even with nicknames afaik
yeah its a bit weird, even so its good to be prepared for it
mobile doesn't add it for example
oh
btw why did they add it in the first place?
afaik it's for notifications
also it might be different on ios and android
Whats some good libs like discord.js?
Eris if you want a js lib
@tulip snow the lib list is at https://discordapp.com/developers/docs/topics/community-resources#libraries
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
I tried
Console logging commandfile.run, commands, and commandfile
I just kept getting the same error
console log is not to remove the error
is to see the contents of commandfile
to see if it contains the expected value
No
I mean
I console logged it
I just get the same error
and nothing more
So whatever I console log
is not showing up
you have to console log before the command.run line
because errors stop the code execution
so the code never reaches the console log
always console log before the line thats causing errors
oh?
so I have to do
module.exprts = {
run,
names: ['feet', 'f']
exports*
Oh wait no
@knotty steeple What do you mean?
run would be undefined since it isnt in here { names: [ 'feet', 'f' ] }
oh
Define the run function in module.exports
var Discord = require("discord.js");
const config = require("../config");
const superagent = require("superagent");
const send = require("quick.hook");
const talkedRecently = new Set();
module.exports.run = async (bot, message, args) => {
if (talkedRecently.has(message.author.id)) {
message.channel.send("Wait 5 seconds before getting typing this again. - " + message.author);
} else {
let {body} = await superagent
.get(`https://nekos.life/api/v2/img/feet`);
if(!message.channel.nsfw) return message.channel.send("Comand can only be used in nsfw channels!")
let hentaiEmbed = new Discord.RichEmbed()
.setColor("#ff9900")
.setDescription(`<@${message.author.id}> I heard you like feet? :heart:`)
.setImage(body.url);
message.channel.send(hentaiEmbed);
message.delete().catch();
talkedRecently.add(message.author.id);
setTimeout(() => {
talkedRecently.delete(message.author.id);
}, 5000);
}
}
module.exports = {
names: ["feet","f"]
}
this is my code
module.exports.run
Then it should work
It doesn't though
Hm?
Hmm
maybe
My friend used a thing called
JSdoc
or whatever
in Vscode to utilize VsCodes thing
or whatever
and he did that
🤔
jsdoc is nice
here let me show you what I mean
I know what JSdoc is
Okie ;p
I was just trying to be noice
:3
Anyway
He used the array thing
So you could use either feet
or f
Hm
That didn't work
It just brought up new errors
this is what me and my friend did
for another bot
using JSdoc
I tried using JSdoc
but I faild :/
Failed*
JSDoc doesn’t change actual execution of code.
hmm
I don't know I just want to fix this
I didn't have this problem before
I am remaking one of my old bots
JSDoc is just comments
When I login to my account it shows the latest changes, but if I logout It shows the previous description
plz help
let amount;
if(amount < 1 || amount > 100) return msg.channel.send(Donner moi un montant entre 1 et 100);
WHAT !!!!!!
GraphityBOTBOTAujourd'hui à 01:49
J'ai réglé le volume sur : 500
let args = msg.content.split(/\s+/);
if (!args[1]) return msg.channel.send(`Le volume actuel est : **${serverQueue.volume}**`);
**
let amount;
if(amount < 1 || amount > 100) return msg.channel.send(`Donner moi un montant entre 1 et 100`);**
if (isNaN(args[1])) return msg.channel.send("Entre une valeur correcte");
if (!msg.member.voiceChannel) return msg.channel.send(`Vous n'êtes pas dans un channel vocal !`);
if (!serverQueue) return msg.channel.send(`Il n'y a rien à jouer.`);
if (args.length > 1) {
amount = parseInt(args[1])
};```
what is the problem
the sound can up to 10000000
0_0
ok
its repared
i have moved
the lock sound up 100
} else if (command === 'volume') {
let args = msg.content.split(/\s+/);
if (!args[1]) return msg.channel.send(`Le volume actuel est : **${serverQueue.volume}**`);
if (isNaN(args[1])) return msg.channel.send("Entre une valeur correcte");
if (!msg.member.voiceChannel) return msg.channel.send(`Vous n'êtes pas dans un channel vocal !`);
if (!serverQueue) return msg.channel.send(`Il n'y a rien à jouer.`);
if (args.length > 1) {
let amount;
amount = parseInt(args[1])
if(amount < 1 || amount > 100) return msg.channel.send(`Donner moi un montant entre 1 et 100`);
};```
ok
i have a second probleme
i cant modifie that to
const channel = member.guild.channels.find('name', 'join_leave');
let join_leave = await db.fetch(`jlch_${member.guild.id}`);
const channel = member.guild.channels.find('name', `${join_leave}`);```
that not work
no error and not working
are you trying to make the bot find a channel named jlch_264445053596991498
yes
yes you are
that is exactly what your doing
jlch = join leave channel
no
for me its that
you have it set for
i am coding a join leave
h
let active = await db.fetch(`active_${member.guild.id}`);
if(active == true) {
const channel = member.guild.channels.find('name', 'join_leave');
if (!channel) return;
const canvas = Canvas.createCanvas(700, 250);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage('/home/graphity/fondnoir.jpg');```
ok
and i cant place this code
let join_leave = await db.fetch(`jlch_${member.guild.id}`);
const channel = member.guild.channels.find('name', `${join_leave}`);```
do you know what the code you just sent do?
what do you think it does
look
No FOR mal attention
you are trying to find a channel called jlch_264445053596991498 (saying the guild id was here)
I cant send all code
and when i said why i didn't work
what
i use quick.db
the fuck
he's searching in the database for an entry with that name and the result is what he's trying to operate on
the problem is
but without knowing the result not much can be helped
Juste for join leave
"it won't work" is likely because join_leave isn't set to anything useful
and when i add the code that doesent work
let join_leave = await db.fetch(`jlch_${member.guild.id}`);
const channel = member.guild.channels.find('name', `${join_leave}`);```
module.exports.run = async (bot, message) => {
if (message.author.bot) return undefined;
if(message.channel.type === "dm") return undefined;
let fetchedl13 = await db.fetch(jlch_${message.guild.id});
if(fetchedl13 === null);
const args = message.content.split(" ").slice(1);
var saytext = args.join(" ");
if (!message.member.hasPermission("ADMINISTRATOR")) return message.reply("Vous n'avez pas accès à cette commande.").then(msg => {msg.delete(4000)});;
message.channel.send(Le nouveaux channel de join/leave et : ${saytext})
message.delete(message.author);
db.set(jlch__${message.guild.id}, saytext).then(i => {
});
}
ok
ok
its egal
- copy code yes
it should be fine. if it's null it just won't do anything
basically a no-op
let active = await db.fetch(`active_${member.guild.id}`);
if(active == true) {
const channel = member.guild.channels.find('name', 'join_leave');
if (!channel) return;
const canvas = Canvas.createCanvas(700, 250);
const ctx = canvas.getContext('2d');
are you uploading a picture when someone joins and leaves
yes
no wonder discord has multiple hundreds of TB of images stored
const background = await Canvas.loadImage('/home/graphity/fondnoir.jpg');
its = at koya
and its not finish just
ok
its repared
In discord.js, does TextChannel#messages return all messages sent?
Like, can I do msg.channel.messages.size to see how many messages have been sent?
It's a collection of all cached messages, it doesnt contain every message ever sent
although in the case of discord.js it may aswell have every single message in it 
Bleh, I don't think so ._.
yeah it's only cached messages
was just poking fun at discord.js for their memory usage lmao
if you wanted to fetch a certain amount of messages you can do that, but certainly not every single message
especially for larger servers
I have this function:
const searchVideos = (API, terms, user) => {
API.searchVideos(terms, 2)
.then(async res => {
API.getVideoByID(res[0].id)
.then(async results => {
let songObj = new Object({
title: results.title,
id: results.id,
url: `https://www.youtube.com/watch?v=${results.id}`,
addedBy: user,
length: results.durationSeconds,
thumbnail: results.thumbnails.high.url,
});
console.log(songObj);
return songObj;
}).catch(err => {
console.error(err);
return err;
});
}).catch(err => {
console.error(err);
return err;
});
}
When I console.log the songObj there, i get the correct song. But if I try using it:
const song = await searchVideos(YouTube, args.join(' '), msg.author);
it always returns undefined. Why is this? 👀
because the result is returned inside the promise
Which means..?
Which means a few things:
- you dont understand async
- you dont understand how to do promise chaining
- you should probably use an async function and
awaitto make the code readable
i mean you are awaiting searchVideos and its not even async. thats not necessarily bad but its pointless
searchVideos should be ```js
async(...) { /do something/ }
if you wanna be lazy you can just return a promise and resolve the songObj and reject on the errors
Errrrm, alright.
API.searchVideos and API.getVideoByID both return a promise, you're doing a few things inside each .then callback which is called after each promise is successfully finished (async). you are awaiting your custom searchVideos function but the code inside it its not awaited, probably your way to go about it is to make the func itself async and await its contents
const res = await API.searchVideos(...) etc
here lemme 🥄 1 sec
const searchVideos = async(API, terms, user) => {
return new Promise((resolve, reject) => {
API.searchVideos(terms, 2)
.then(async res => {
API.getVideoByID(res[0].id)
.then(async results => {
let songObj = new Object({
title: results.title,
id: results.id,
url: `https://www.youtube.com/watch?v=${results.id}`,
addedBy: user,
length: results.durationSeconds,
thumbnail: results.thumbnails.high.url,
});
console.log(songObj);
resolve(songObj);
}).catch(err => {
console.error(err);
reject(err);
});
}).catch(err => {
console.error(err);
reject(err);
});
});
}
then inside an async function
const result = await searchVideos(...)
Alright, thanks.
actually i dont think the first one needs to be async in this case
Holy hell I'm finally stumped on something.
whats p @wintry quest
why'd you make everything async but still use promises
const searchVideos = async (API, terms, user) => {
const res = await API.searchVideos(terms, 2);
const results = await API.getVideoByID(res[0].id);
const songObj = {
title: results.title,
id: results.id,
url: `https://www.youtube.com/watch?v=${results.id}`,
addedBy: user,
length: results.durationSeconds,
thumbnail: results.thumbnails.high.url,
}
console.log(songObj);
return songObj;
}
@karmic blaze You should take a look at that ^
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
guild.createChannel(`${message.author} verification`, 'text')
.then(console.log)
.catch(console.error);
}
module.exports.help = {
name: "verify"
}
I want to make it so that the person that used it can see the channel and a certain role can but I still can't figure it out
the next argument is channel overwrites
what you want to set is READ_MESSAGES for the user and the role, right?
Well
actually VIEW_CHANNEL
Wouldn't that make it so
everyone with READ_MESSAGES can see the channel then
I only want the person that used command and a certain role
to be able to see it
ofc the owner can automatically see it
owner of serevr*
server*
you'd be disallowing view channel for @ everyone
Oh
So if I use
VIEW_CHANNEL only the person can see it and not regular members?
I am trying to make understanding of this
Deny READ_MESSAGES for @everyone and enable it for the person using the command
Only that person and people with ADMIN perms will be able to see the channel then
so
you disable @ everyone the view channel permissions, now no one can see it
then you allow the user view channel permissions, now only that person can see it
and finally you allow view channel for the role and they can also see it
Hmm
yeah and of course admin will always be able to see them
Yea
You basically disallow everyone to see the channel but add an exception to one person
You should try this in a private server to better understand what's actually going on
I meant tweaking with the permissions manually
and a little tip: the id for the everyone role is the same as the guild id
TIL
Thinking of moving from python to js
So Kinda like this
Got help in another server
But I didn't want to bug them too much
I got the @ everyone down
I hope
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
guild.createChannel(`${message.author} verification`, 'text', [{
id: guild.id,
deny: "VIEW_CHANNELS"
}, {
id: message.author.id,
allow: "VIEW_CHANNELS"
}])
.then(console.log)
.catch(console.error);
}
module.exports.help = {
name: "verify"
}
is this how I do it for both @ everyone and the user?
looks good
allow and deny are deprecated tho, you should use allowed and denied and put the view channels in an array
Ah ok
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
guild.createChannel(`${message.author} verification`, 'text', [{
id: guild.id,
denied: [VIEW_CHANNELS]
}, {
id: message.author.id,
allowed: [VIEW_CHANNELS]
}])
.then(console.log)
.catch(console.error);
}
module.exports.help = {
name: "verify"
}
so like this?
you still need the quotes
OOF I forgot the ""
yea
lol
Also
Tonkku
One other thing
I am trying to do
!male approve
or !approve male
and it gives them the role
but after 60% people have the male verified role
the command stops working
but if some people leave with the male verified role
it works again
is that a bug or something you want to implement
A bug?
does what you just described happen to your bot or is this what you want your bot to do?
ok so just check <Role>.members.size against <Guild>.members.size
Ah ok
you might have to fetch members first to have all of them to count
Yea
Erm
Tonkku
it is saying guild is not defined at guild.id
id: guild.id,
that
I thought I defined guild o.O
well, you need to find the guild you want to add channels to
show code again
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
message.guild.createChannel(`${message.author} verification`, 'text', [{
id: guild.id,
denied: ["VIEW_CHANNELS"]
}, {
id: message.author.id,
allowed: ["VIEW_CHANNELS"]
}])
.then(console.log)
.catch(console.error);
}
module.exports.help = {
name: "verify"
}
It is a private bot.
use message.guild.id in your createchannel
^
OOF
I did the same with
guild.createChannel xD
I really need to stop ccoding at 3am
I'd say go sleep yeah XD
"sleep is for the weak"
I don't know how discord.js passes around permissions so i can't help you with that, i don't use discord.js for my bot
ah found it
your createChannel call is wrong
Eh, Invalid Access and Invalid Permissions I believe are a new thing in the API, because they never appeared before, but now they are all of a sudden
if you don't wanna see them just catch them and replace with null
[Discord.js]
Hi,
how can I edit a role to allow everyone to mention it
^^
they are in no way new at all
pls help, is there a way to send a message in a specific server, in a specific channel, d.js
what lib?
discord.js
oh right
so how?
@lusty dew now that I look at your code agian that should be fine too
pineapple fan, its says on your youtube that you are sacoma
there should be methods to get guild/channel objects in a client class
Hey guys, I've been trying to make a custom bot for my server, and I can't seem to find any good tutorials
I've been trying to find one for a day now
did you do any coding before making a bot?
you need a programming language, not tutorials
I'm planning to get into batch
gotcha
uugh
So what language should I learn before I actually make a bot?
choose one you are comfortable with
What are some of the most used?
so how do you send a message in a channel in a certain server?
drom a different server
from*
if you like python go with python, there are actually libraries for discord in lots of programming languages
ok
i dont know any stats unfortunately, nor do i know if they even have stats for that
I'll try python and see how I do with that
the mods are offline
can i have help now pls
discord.js yes

there should be a client object you have, you can get a channel from the client provided you have an id of that channel
?
code?
i just dint get what you mean
dont*
how can i send a message to <#272764566411149314 >
message.logchannel.send()
const logchannel = ?
const client = new Discord.Client();
how?
const logchannel = client.channels.find(272764566411149314);
assuming the id is correct
just use that id then
you wont even be able to
it says #bot-commands
but how can i get the server name?
Help used
By:
Pineapplefan1234YT#9295
At:
Sun Sep 02 2018 10:10:49 GMT+0000 (UTC)
In:
#bot-commands
thats the current help log
Help used By: Pineapplefan1234YT#9295 At: Sun Sep 02 2018 10:10:49 GMT+0000 (UTC) In: #bot-commands In: Discord Bot List
is the goal
log for every command that is executed?
yes
well not every command
but how do i get discord bot list to appear at the bottom?
@toxic forum
ok thanks
agian, guild can be null if the message was send from a DM for instance
it doesnt respond to dms
aight
error?
well i don't know either 😅
wait
you need to be able to debug your own code at least
that was it
really!?
That doesn't even tell anything
are you sure
yes
wait
no
this is part of the same error
`at Object.module.exports.run (/app/commands/purge.js:29:44)
at Client.client.on (/app/server.js:22:31)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (/rbd/pnpm-volume/e833a0de-7dc5-4e4f-82a8-7de26ebb0fdd/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/rbd/pnpm-volume/e833a0de-7dc5-4e4f-82a8-7de26ebb0fdd/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/rbd/pnpm-volume/e833a0de-7dc5-4e4f-82a8-7de26ebb0fdd/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/rbd/pnpm-volume/e833a0de-7dc5-4e4f-82a8-7de26ebb0fdd/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/rbd/pnpm-volume/e833a0de-7dc5-4e4f-82a8-7de26ebb0fdd/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/event-target.js:120:16)
(node:8370) 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:8370) [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.`
@toxic forum
@wide ruin you are not catching errors in your code
no
or
you need...
message.author.tag
show me your code
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
message.guild.createChannel(`${message.author.tag} verification`, 'text', [{
id: message.guild.id,
denied: ["VIEW_CHANNEL"]
}, {
id: message.author.id,
allowed: ["VIEW_CHANNEL"]
},
{
id: "485758387263504391",
allowed: ["VIEW_CHANNEL"]
}])
.then(console.log)
.catch(console.error);
}
module.exports.help = {
name: "verify"
}
only for a vc
Still going to keep message.author.tag though
without it just displasy the ID
displays*
if you invite me in a dm, i can help with it
the 60% thing
Yepo
I know how to do it kinda
Ah yes
With the create channel thing
I want to also send a message in that newly created channel
How would I make it do that?
woudl i do
oof wait
Hey guys ! I've a question, how do you get your bot demute ?
demuted where
in what channel
if there's a problem with it you should have a mention in #mod-logs
@toxic forum hey can I ask you something
sure
How do I make my bot send a message in the channel when it is created
Like after the verification channel is created
it will send a message
Ah
So like
message.guild.createChannel(`${message.author.tag} verification`, 'text', [{
id: message.guild.id,
denied: ["VIEW_CHANNEL"]
}, {
id: message.author.id,
allowed: ["VIEW_CHANNEL"]
},
{
id: "485758387263504391",
allowed: ["VIEW_CHANNEL"]
}]).then(message.channel.send("messagehere"))
.then(console.log)
.catch(console.error);
like that
?
nope
@toxic forum Like from everywhere, it gets mute due to a bad command
the general idea is correct though
Oh
you,re just using the wrong channel
oh?
lets see if my js knowledge is still on point
@wicked latch either write code that disables the command on this guild or remove the command
@toxic forum Ok I just changed the command, ty 😃
.then((channel) => {
channel.send("message here");
});
the channel passed to then should now be the newly created one @lusty dew
nope
messagecontains the info about the channel where the command where sent
So message.channeldoesn't contains the channel created
Ah
I see
Also
Could I do a like
setTimeout
so after a certain ammount of time
the channel deletes automatically
amount*
you could use that yes
Ok
I will try and implement that
It would be good to have it
instead of an admin having to delete it
if someone decided not to verify after all
Hmm
How would I get the channel to delete?
I know embed can be done by
embed: null
can channel be done the same way?
don't think so
OOF ok
I will have to figure out how to delete the channel then
after the timeout is done
channel.delete()
think you really need sleep 🤣
NU
no sleep >:)
I am almost done
All I need after that
is Male approval command
which will be hard...
for one reason
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
message.guild.createChannel(`${message.author.tag} verification`, 'text', [{
id: message.guild.id,
denied: ["VIEW_CHANNEL"]
}, {
id: message.author.id,
allowed: ["VIEW_CHANNEL"]
},
{
id: "485758387263504391",
allowed: ["VIEW_CHANNEL"]
}]).then((channel) => {
channel.send("");
});
.then(console.log)
.catch(console.error);
.setTimeout(() => {
channel.delete()
},300000);
would this work
mainly asking about
the timeout
or do I have to do
message.channel.delete
I know I had to do that in my !close command
settimeout woudnt work with the . in front
const { RichEmbed } = require('discord.js')
const replies1 = ['yes, ', 'no, ']
const replies2 = [' is, ', " isn't, "]
let outcome = ~~(replies1.length * Math.random())
module.exports.run = (client, message, args) => {
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!rUser) return message.channel.send("No user selected");
let q = args.join(" ").slice(22);
let first = item {outcome} of replies 1
let second = item {outcome} of replies 2
message.channel.send(first + rUser + second + q)
}
module.exports.help = {
name: "is"
}```
the section in the middle is what i need help with
@lusty dew see if you understand this https://stackoverflow.com/questions/34653095/how-to-delay-a-promise-in-when-function#34653257
@toxic forum can you help pls
I kinda understand it
just by looking at it
it is setting a delay
for the console log
Oh wait
It is delaying the promise
and console logging it
Right?
OOF when in a function
looks like you want to wait for messages after eachother that use those replies @wide ruin ?
wdym @toxic forum
@lusty dew its in milliseconds so 1sec = 1000
well
hmm
i don't think that fits inside a number in js
Well
You can use them in
cooldowns
like
let cooldown = 8.64e+7
I seen it done
it works
why ask then
Cause
I did not know if it would work with a setTimeout
ofc now that I think about it
nvm
just let me shut up XD
1 day is 86400000ms
in scientific notation yes
Yea
can i have help still tho pls
what do you need help for
const { RichEmbed } = require('discord.js')
const replies1 = ['yes, ', 'no, ']
const replies2 = [' is, ', " isn't, "]
let outcome = ~~(replies1.length * Math.random())
module.exports.run = (client, message, args) => {
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!rUser) return message.channel.send("No user selected");
let q = args.join(" ").slice(22);
let first = item {outcome} of replies 1
let second = item {outcome} of replies 2
message.channel.send(first + rUser + second + q)
}
module.exports.help = {
name: "is"
}
don't know how to do that in js though
idk what they meant
it is basically like o/is @wide ruin dense
and it either says yes, @wide ruin is dense or no, @wide ruin isn't dense
basically
he want's a user to fire off a command, his bot asks a question and awaits the response, then asks another question
is what is understood at least
¯_(ツ)_/¯
Hmm
So basically like CleverBot?
Yea
i dont want cleverbot
just commadns like that
so how can i get item {outcome} of a list
👌
thats basically 8ball
I don't know python, but you want to have an array of responses. When the bot detects user input, it will take a random one of those responses and send it
it's not 8ball
For example,
let responses = ["first response", "second response", "etc."];```
he want's to await the next message of a user inside his command
thats js
@wild tide i have the responses thing
and an outcome var, that picks a number from 1 to list length
but i need item outcome of responses
how do i do that?
replies1[outcome]
if i understand correctly, you want to pick one from the list using outcome as the index.
call the list replies1 and specify which item of the list [number]
Gm Tim
Guys, is there any way to pass 1 MySQL connection to 3 shards?
not afaik. each shard should have its own db connection, hence why you need a db that accepts multiple connections for sharding
Also I heard about pooling, maybe it could work, or no?
no idea
ok thx
bot.on("ready", async () => {
^
console.log(`${bot.user.username} is online`);
bot.user.setActivity(`over ${bot.guilds.size} guilds || !help`, {type: "WATCHING"});
console.log(`${bot.user.tag} is online with ${bot.guilds.size} guilds!`);
});
( Unexpected token
Meh
the ( after async is an unexpected token
Also
The bot was ran on a Linux idk if that has anything to do with it
node -v


