#development
1 messages · Page 783 of 1
ok
instead you should check it first, and then do the rest
//Cooldown
if(cooldown.has(message.author.id)) return dbl.hasVoted(message.author.id).then(voted => {
if(voted) {
let cdEmbed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle(":exclamation:**Cooldown**")
.setDescription(`You're using this command too frequently! \n Please wait 1500 ms to use any command again.`)
.setTimestamp();
message.channel.send(cdEmbed)
setTimeout(() => {
cooldown.delete(message.author.id)
}, 1500);
} else {
let cdEmbed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle(":exclamation:**Cooldown**")
.setDescription(`You're using this command too frequently! \n Please wait 3000 ms to use any command again. \n For voters, cooldown time is 1500 ms! \n \n While you wait why not to vote for this bot to unlock special features and less cooldown time, it's free!`)
.setTimestamp();
message.channel.send(cdEmbed)
setTimeout(() => {
cooldown.delete(message.author.id)
}, 3000);
}});
cooldown.add(message.author.id);```
better?
no
i don't get it
dbl.hasVoted(id).then(voted => {
if(cooldown.has()) {
if(voted) {
send embed
} else {
send other embed
}
} else {
cooldown.add()
if(voted) {
timeout(1500)
} else {
timeout(3000)
}
}
})```
ok
@earnest phoenix you cannot add attachment to description
description is only for text
use attachFile and setImage instead
@quartz kindle still does not work
Did you use setImage with the file
what doesnt work
i still sends the command and does not add an cooldown
//Cooldown
dbl.hasVoted(message.author.id).then(voted => {
if(cooldown.has(message.author.id)) {
if(voted) {
let cdEmbed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle(":exclamation:**Cooldown**")
.setDescription(`You're using this command too frequently! \n Please wait 1500 ms to use any command again.`)
.setTimestamp();
message.channel.send(cdEmbed)
} else {
let cdEmbed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle(":exclamation:**Cooldown**")
.setDescription(`You're using this command too frequently! \n Please wait 3000 ms to use any command again. \n For voters, cooldown time is 1500 ms! \n \n While you wait why not to vote for this bot to unlock special features and less cooldown time, it's free!`)
.setTimestamp();
message.channel.send(cdEmbed)
};
} else {
cooldown.add(message.author.id);
if(voted) {
setTimeout(() => {
cooldown.delete(message.author.id)
}, 1500);
} else {
setTimeout(() => {
cooldown.delete(message.author.id)
}, 3000);
} ;
};
});```
What is the mongo function equal to the add function in quick.db?
as i thought, you cant use it like that
using .then() is the same as using callbacks, the code inside it becomes independent from the rest of the code, it does not stop it nor interfere with it
if you want it to stop the rest of the code, you have to use async await instead
let voted = await dbl.hasVoted()
if(voted) { etc.. }
also your code in general should be reviewed. you are running database calls on every single message, the performance will likely be terrible
bad = terrible performance and lots of future problems if your bot gets any big, but you do you
so instead of that i should add that stuff to guildCreate
the guild config should be in the ready event
yes, but not ALL guilds
just one guild
so dont use client.guilds.keyArray().forEach
so i should only use client.guilds.keyArray() and for ready event i should use client.guilds.keyArray().forEach?
ok so client.guild.keyArray() and for ready event client.guilds.keyArray().forEach?
wat
client.guilds is a map. so it already inherits .forEach and .map
are you using discord.js stable or master
stable?
client.guilds is a Collection (which extends map)
ok.
every function you see on the docs for collection you can use with client.guilds
yeah, but should i use those collections for ready event and for guildCreate event i should use guilds.keyArray(id)...
you dont need to use
keyArray?
and the guildCreate passed the guild object
client.on('guildCreate', guild) {
// do stuff with the guild object
console.log(guild)
}```
ok
//Cooldown
let voted = await dbl.hasVoted(message.author.id)
if(cooldown.has(message.author.id)) {
if(voted) {
let cdEmbed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle(":exclamation:**Cooldown**")
.setDescription(`You're using this command too frequently! \n Please wait 1500 ms to use any command again.`)
.setTimestamp();
message.channel.send(cdEmbed);
} else {
let cdEmbed = new Discord.RichEmbed()
.setColor("#ff0000")
.setTitle(":exclamation:**Cooldown**")
.setDescription(`You're using this command too frequently! \n Please wait 3000 ms to use any command again. \n For voters, cooldown time is 1500 ms! \n \n While you wait why not to vote for this bot to unlock special features and less cooldown time, it's free!`)
.setTimestamp();
message.channel.send(cdEmbed);
}
} else {
cooldown.add(message.author.id);
if(voted) {
setTimeout(() => {
cooldown.delete(message.author.id)
}, 1500);
} else {
setTimeout(() => {
cooldown.delete(message.author.id)
}, 3000);
};
};``` again no errors and no cooldowns given
you should return after message.channel.send
i tried that
then theres still something wrong elsewhere
How do I check if a channel has Send Messages permissions?
Anyone know how to code this into a bot?
to basically detect if someone has left the discord/kicked/banned, and to also kick them from other discords
( Example is a main server with sub-servers for other reasons like departments etc )
get each guild, see if member exists, if it does kick/ban from there too
but what would the code be to detect if they leave ? i know how i could see if they are in each guild and run the kick command against them, but idk how to detect if they leave
there is an event
whats it called?
what library are you using
thanks
any idea how to use that in code? ( this is my first attempt at the kick command and now this xDDD )
i have this s ofar
})
so far so good
member is a GuildMember object, which has a kick method
loop through the guilds, check if the user is in it, if yes kick
help meeee 😭
Yeh i get the kick part, but what about if the user leaves manually? how to detect if left then put that into a loop etc etc
db.prepare(`CREATE TABLE IF NOT EXISTS ${options.table} (ID TEXT, json TEXT)`).run();
^
SqliteError: file is not a database```
let nesne = args[0]
if (!nesne) return message.channel.send('Give ID.')
db.set(`prem_${nesne}`, 'pre')```
Please helppp
i how to fix?
pls help
@pure gust if the user leaves the event is emitted anyways
ill figure something out after dinner @mossy vine but thanks though! sent me in the right directio nanyway
Could someone help me? My !mute command won't work
const Discord = require("discord.js");
const ms = require("ms");
module.exports.run = async (bot, message, args) => {
//!tempmute @user 1s/m/h/d
let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!tomute) return message.reply("Bu kullanıcıyı bulamadım. Etiketlediğine emin misin?");
if(tomute.hasPermission("MANAGE_MESSAGES")) return message.reply("Bu kullanıcıyı muteliyemem. Bu kişide **(Mesajları Yönet)** yetkisi bulunuyor.");
let muterole = message.guild.roles.find(`name`, "muted");
//start of create role
if(!muterole){
try{
muterole = await message.guild.createRole({
name: "muted",
color: "#000000",
permissions:[]
})
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
SPEAK: false
});
});
}catch(e){
console.log(e.stack);
}
}
//end of create role
let mutetime = args[1]
.replace(`sn`, `s`)
.replace(`dk`, `m`)
.replace(`sa`, `h`)
.replace(`g`, `d`)
if(!mutetime) return message.reply(`:warning: Lütfen bir zaman giriniz! \n**Doğru Kullanım;** \`!!mute <@kullanıcı> <1sn/1dk/1sa/1g>\``)
await(tomute.addRole(muterole.id));
message.reply(`<@${tomute.id}> kullanıcısı mutelendi. Süre: ${ms(ms(mutetime))}`);
setTimeout(function(){
tomute.removeRole(muterole.id);
message.channel.send(`<@${tomute.id}> kullanıcısının mutelenme süresi sona erdi!`);
}, ms(mutetime));
};
exports.conf = {
enabled: true,
guildOnly: true,
aliases: ['Mute', 'mutee', 'MUTE', 'mte', 'mute', 'sustur', 'sus', 'Sus', 'SUS', 'SUSTUR', 'Sustur'],
permLevel: 2
};
module.exports.help = {
name: "mute",
description: "Etiketlenen Kişiye Mute Atar",
usage: "mute [kullanıcı] [sebep]"
}```
its my mute command.
its working
@main aurora
guys please helppp
Ok, thank you
lol sick spoonfeeding
@mossy vine can you help mee?
Did you put that after the bot.on('ready'),() =>{
can you stop spamming your problem
lmao
yikes
@toxic jolt read the channel topic
cry pls leave you dont want to see this stupidity
Do not mention people randomly.

@main aurora you have a few spelling mistakes in your code first of all
also, dont copy and paste his code, it will not work
I didn't
what do you need help with
the whole thing xD, i tried researching and nothing really helps / makes sense
with js nope xD
i know forEach may not technically be a loop but close enough
Please enlighten me cyber
enlighten about what
Refer to the message about the forEach loops
like what forEach is?
Why they're technically not loops
because it would be like for ( something = something: loads more shit )?
here is generally what you want to do
on event
<some loop over guild objects>
find member in this guild
if member found in that guild, kick
okay ill try type that in something that makes sense to me xD
forEach is a loop, just a loop that fires functions and is about 95% slower than other loops lol
yeh dont make sense xD
is it really that slow
})```
anyone able to add a loop into that to detect if a user has left/kicked, and to then run a kick command in other guilds?
coz i literally have no idea what im doing xD
the event doesnt differentiate between leaves and kicks iirc
is that what you want? if they leave also kick from others?
yeh
then its easy
so if they leave Guild#1 or they get kicked from Guild#1, to also kick them from Guild#2, Guild#3 and so on
guildMemberRemove is an event that is fired every time a member is kicked or leaves, from any guild your bot is in
guildMemberRemove gives you the relevant member
you can use member.guild to see which guild it was
then you can use client.guilds.filter() to find guilds where the member exists
and get the member from each of the other guilds, and kick them
@earnest phoenix
"widht" vs width
width instead of width
incorrecting spelling
@quartz kindle soz for the ping, but how do i add that into my code? ( just want to add i have literally 0 proper experience with discord bots lol )
do you have any js experience?
not really, just in school but what we code is a load of horse shit xD
do you know of at least some basics, like data types? (strings, numbers, arrays, objects)
yeh ofc
i use livecode in school which is some weird programming language with like 1% being js
How popular are Delphi and PascalABC in production? 
ok, so, member is a GuildMember object, as described here https://discord.js.org/#/docs/main/stable/class/GuildMember (assuming you're using d.js v11)
and you should be able to access client from everywhere, which is described here https://discord.js.org/#/docs/main/stable/class/Client
as you can see in the link above, client has a guilds property
which contains ALL guilds your bot is in
so you can access them by typing client.guilds
now, they are contained in a Collection which is a special object, similar to Maps, where each guild is indexed by its guild id
and you can use methods from arrays and objects on it
for example, you can use client.guilds.get(guildid) to get a specific guild
or client.guilds.find(some function) to find a specific guild based on some conditions
or client.guilds.filter(some function) to filter the guilds and return a list of guilds based on some condition
some better examples of what tim is on about
the condition you want is that the member that just left exists in the guild
client.guilds.find(guild => guild.name === 'ooga booga')
client.guilds.filter(guild => guild.name === 'ooga booga')
okay so i dont need the guild id then?
its better to use ids than names
okay
but hes showing an example of how the function should be used
yeh coz its lot less longer than the one im wanting to use
in the above example, guild is each guild that the find/filter functions will compare
so essentially it means from each guild in guilds, see if guild.name equals "ooga booga"
the same way you can use from each guild in guilds, see if guild.id equals some id
client.guilds.filter(guild => guild.id === someID)
because its not a single case
var testServer2 = bot.guilds.find(guild2 => guild.id === `397740638491377675`);```
Guild ids are unique
he wants to kick the member from all other guilds the member is in
Oh
if your trying to find a server using an ID, use Collection#get
would that be the right thing to put each guildId into a variable identified for that specific guild
so essentially you're going to want something a tad more complex
client.guilds.filter(guild => guild.members.has(memberID))
Nah fam xD
my situation is - if someone leaves or gets kicked from Guild#1, i want them to be kicked from Guild#2, Guild#3 and so on
wouldn't it be guild.members.has() ?
^true
async with ctx.typing():
player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True)
ctx.voice_client.play(
player, after=lambda e: print("Player error: %s" % e) if e else None
)
await ctx.send("Now playing: {}".format(player.title))
```how to add queue in this script (script i get from GitHub for example (discord.py))
by not copy pasting Just have a List of of queued song objects
d
@modest maple
bot.py
# some stuff
class MyQueue:
def __init__(self):
return bot.queue
some_cog.py
import mybot
# inside a cog
myqueue = mybot.MyQueue()
bot.myqueue = myqueue


So I've rewrote the whole code and my mute command still won't work. Can someone help?
Send the error.
It just won't work
What happens when you run the mute command?
Nothing happens at all
Anything in console.
No
try log it into console then
Oh, one second
TypeError: Cannot read property 'first' of undefined
at Client.<anonymous> (C:\Users\sadsp\Desktop\Discord Bots\index.js:18:61)
at Client.emit (events.js:223:5)
at MessageCreateHandler.handle (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:223:5)
at Receiver.receiverOnMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:223:5)
what did you do?
I didn't change it yet
then thats why
there is no mentions.user
its either mentions.users or mentions.members
im literally been stuck at the same thing for like 2 hours now XDDDDDDD
reading the discord.js doc and nothing explains / gives me an explanation on my problem XD
@pure gust that's because it requires logic.
Assuming your question was about removing a member from other guilds (Guild #2, Guild #3, etc.) if they leave or get kicked from Guild #1, you just need to get each guild you want to check has the member, like said in docs: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/674338553974489098
So, iterate over each guild and check. If the member is in the guild, get the member object and kick them.
So would I remove the guild in message.guild.member
@everyone How to set bot game ?? Discord.js

not everyone here is a JS developer, at least do @plain talonDevs
?
oops sorry js 😛
Rip my boy js
you did ping me and I don't know anything about discord.js
Nah I'm good
ok
Rip, now my bot won't do anything 
but no one is gonna give you the code of it
ok
But use this to set the game https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setPresence
ok
ok
i wish to remove a bot from a host how would i
Hello how can create the weebhook to now how vote the bot ?
C:\Users\caine\Desktop\EVM\index.js:86
await member.kick(reason)
^^^^^
SyntaxError: await is only valid in async function
at wrapSafe (internal/modules/cjs/loader.js:1067:16)
at Module._compile (internal/modules/cjs/loader.js:1115:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
PS C:\Users\caine\Desktop\EVM> what does this mean
only valid in async function
TypeError: message.guild.members is not a function
at Client.<anonymous> (C:\Users\sadsp\Desktop\Discord Bots\index.js:17:34)
at Client.emit (events.js:223:5)
at MessageCreateHandler.handle (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:223:5)
at Receiver.receiverOnMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:223:5)
That's what happens when I type !mute and it goes from node back to powershell
message.guild.members is not a function
It said message.members isn't one either
@grim aspen how shall i do async
message.members is never a function what are you talking about 
message.guild is basically an object (what these parentheses said earlier was wrong mb)
So what should I put so it works?
Ah
Like started yesterday new
one sec
you dont need message.guild.member because both mentions.members.first() and members.get() already give you a member
you dont need to get a member from a member by doing guild.member(member)
that is what i said in the image
But I deleted it and got another error
what did you write?
I deleted the message.guild.member
how to do async function
Was I supposed to put something in its place?
did you also remove the parenthesis? show that part how it looks now
@tawny lantern async function
function() {
await something() // error
}
something => {
await something() // error
}
async function() {
await something() // works
}
async something => {
await something() // works
}``` @tawny lantern
the parenthesis part was not for you
what About that tim
Remove the parenthesis around message.mentions.members.first?
just showed you how to use async
@main aurora just show your code, i dont know how it looks like right now
make a new thing and put that in it
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case 'mute':
let person = (message.mentions.members.first() || message.guild.members.get(args[1]))
if(!person) return message.reply("I couldn't find that user");
let mainrole = message.guild.roles.find(role => role.name === "Visitor");
let muterole = message.guild.roles.find(rolee => role.name === "Muted");
if(!muterole) return message.reply ("I couldn't find that role");
let time = args[2];
if(!time){
return message.reply("You didn't specify a time!")
}
person.removeRole(mainrole.id);
person.addRole(muteRole);
message.channel.send(`@${person.tag.user} Has now been muted for ${ms(ms(time))}`);
setTimeout(function(){
person.addRole(mainerole.id);
person.removeRole(muterole.id);
message.channel.send(`@${person.user.tag} Has now been unmuted!`)
}, ms(time));
break;
no, go back to the start of whatever function you have and add async to it
where the let args are
Crap im so confused
¯_(ツ)_/¯
ie: `client.on("event", something => {
})`
just add async to it
async something =>
mb
"message", async something =>
client.on("message", async something => {
})
dont change any thing
just
add
async
on the right place
like above
gib me money
gets buried in debt
Or more I will be broke when I get my car and pay server costs
Watch DBL hire Tim for being very helpful 2020 must watch
Lol
Speaking of
hire me as a js teacher for noobs
I fixed the spelling mistake and got another error
@slender thistle wHeN yOU gUnNa FIx DbL pyThuM
what is the error this time
ReferenceError: muteRole is not defined
at Client.<anonymous> (C:\Users\sadsp\Desktop\Discord Bots\index.js:32:22)
at Client.emit (events.js:223:5)
at MessageCreateHandler.handle (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:223:5)
at Receiver.receiverOnMessage (C:\Users\sadsp\Desktop\Discord Bots\node_modules\ws\lib\websocket.js:789:20)
at Receiver.emit (events.js:223:5)
Sigh
@modest maple install from source for now, I'm too sick to use my laptop
@quartz kindle
Sorry for all the questions
aka I'm lazy but I'm still sick
@main aurora
But like
check index.js on line 32, see if you can find what is wrong there (tip: muteRole is wrong)
I really cannot be arsed
If you handle your webhooks and requests fine, I don't see why you should use dblpy
Like idc if it's vote locked or not the websites give the bot enough publicity for a steady gain
tim its still not working i even put it in
It's just an API wrapper 
Yh
@tawny lantern show your code, including the event part
Tbf I might run it in a seperate thread on server side
if(command === "kick"){
if(!message.member.roles.some(r=>["Administrator", "Moderator"].includes(r.name)) )
return message.reply("Sorry, you don't have permissions to use this!");
let member = message.mentions.members.first() || get(args[0]);
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.kickable)
return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
await member.kick(reason)
.catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
"message", async something =>
client.on("message", async something => {
})
}
}
})
@tawny lantern including the event part (client.on)
So that way everything like dB, API calls, webdrivers etc... Are all on the same system
And then the bot takes seconds to load
Cuz all it does it send requests and send response

@quartz kindle how long u gonna keep trying lmao
all the way before
Hi
until you reach a client.on
Here use Bot designer for Discord? In phone?
just like down load that and it has my script
Tim can set an example for us helpers with his patience I'm ngl
@queen sierra Discord bot designer is not supported or allowed here
const PREFIX = '*';
var version = "0.0.1"
const usedCommandRecently = new Set();
bot.on('ready', () =>{
console.log('This bot is online!');
bot.user.setActivity('Currently in Being worked on', { type: 'Listening to *'}).catch(console.error);
})
bot.on('guildMemberAdd', member =>{
const channel = member.guild.channels.find(channel => channel.name === 'front-door')
if(!channel) return
channel.send(`Welcome to Assist bot development, ${member}. dm cool for questions.`)
});
bot.on('message', message=>{
let args = message.content.substring(PREFIX.length).split(" ");
switch(args[0]){
where the arows are
I recon I could probably make a discord.js bot with the basics pretty easily without even knowing js properoy
d.js doesn't look too hard
everywhere where you want to use await you need to start it with an async there
@modest maple for what?
yes
should work
DBL does not support DBD bots
nope
How do u even run js scripts xD
await member.kick(reason)
^^^^^
SyntaxError: await is only valid in async function
at wrapSafe (internal/modules/cjs/loader.js:1067:16)
at Module._compile (internal/modules/cjs/loader.js:1115:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
d.js is node so npm I would assume
afk
But like straight up js without node I haven't ever seen someone do that
you do that in websites lol
straight up as in just a clean OS, no browsers, no node
Ik clojure and python and combined they cover just about every base
well js cant run without an interpreter/engine
Ik a bit of c and cpp
Which I should learn more
But meh
Master one language at a time
why learn C in this day and age lul
Might try rust maybe
oS dEvULoOpMaNT
Seems to be quite a popular one
So basically "You shall suffer"
sufferrrrrr
I shall use python for os dev
Python is a compiled language
It's compiled into binary so it's alright
does it really compile to machine code?
like, does it run without python installed or packaged?
I doubt that on more levels than the unknowing of this server has been by far
anyone know why i'm getting this error( TypeError: Cannot read property 'setMaxListeners' of undefined) with a messageCollector?
code?
const collect = new Discord.MessageCollector(message.channel {time: 20000})
collect.on('collect', mes => {
console.log(mes)
})
}
and he leaves the conversation to help
yea
missing comma in there, and second argument should be the filter function, not options
ah
anyway why dont you use the channel method version?
o
@slender thistle im addicted, send help
atModerators ban Tim
lmao
hey tim one thing
dont ban, just mute, dont wanna lose cert
does createCollector work with dm channel?
should work yes
But then you'll just DM people who ask for help here :p
i wont, i dont help via dms (only rarely), unless i get paid
Oh alright atOliy mute this guy right here
what if you don't have a filter?
Lol
like if i'm just accepting any message?
just put true
ok thanks
or if it complains that it wants a function, () => true
yeah i just get its not a func
await member.kick(reason)
^^^^^
SyntaxError: await is only valid in async function
at wrapSafe (internal/modules/cjs/loader.js:1067:16)
at Module._compile (internal/modules/cjs/loader.js:1115:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
is there a message.channel equivalent for a dmchannel
its the same
message.channel
if the message came from a dm
@tawny lantern you will need to show ALL your code, else there is no way to find whats wrong with it. put it in pastebin or something
const usermes = message.author.send("test")
console.log(message.channel)
console.log(await usermes.channel)
const collect = usermes.createMessageCollector(true, {time: 20000})
collect.on('collect', mes => {
console.log(mes)
})
}
yeah not really sure what i'm doing wrong
.channel returns as a undefined
message.author doesn't have those properties
.send returns a promise of a message
You're just missing a keyword somewhere
oooooo
@quartz kindle hi
?
@lean palm you're really trying to await the channel, rather than the message. You should use await in the variable assignment instead, so you can access it.
yeah i rewrote that anyway i was just testing
the only thing i can't get to work is not using a filter it keeps saying Function.prototype.apply was called on null, which is a object and not a function
did you put () => true as the filter?
ahh thanks it works
How do you parse a URL? like from js { prefix: 'f%21', mod_log: '%23test' } the % signs to ! and #
is it normal when booting a bot on a vps takes a long time to emit the ready event?
or
How would I find a number that
doesnt go over the maximum money for a bank
and is equal or lower than the current balance?
Currently, Im using bankMax - bankCurrent to get the amount of money that can be put into the bank
The noob, what library (and possible framework)
I think my IP is getting temp banned from discord because all of a sudden my bot reached like 8k tcp connections and a higher than normal amount of bytes sent and it can’t log in
How can I tell if my bot is temp-banned or something?
@near ether just make a request to Discord api and it will probably show the cloudflare banned headers and ratelimit status https://discordapp.com/api
Those bans only usually last about an hour unless this is something else
Gotcha
Is there any reason why discord would be temp-banning my IP?
It probably means your bot is breaking the rate limits
open('prefixes.json', 'r') as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]``` ```bot=commands.Bot(command_prefix=commands.when_mentioned_or('get_prefix'))
bot.remove_command('help')
@bot.event
async def on_guild_join(guild):
def get_prefix(bot, message):
open('prefixes.json', 'r') as f:
prefixes = json.load(f)
prefixes[str(guild.id)] = '!'
with open('prefixes.json', 'w' as f:
I'm going to advise against what you're doing here
That file is going to potentially be opened hundreds or thousands of times a second
Do you have a better way to do it
Cache them
I have no idea how to do that so I'm going to stick with this

Why do people do that
"I don't know how to do something you said so I'm not gonna put any effort into figuring it out"

[LavalinkMusic] Running discord.js-lavalink-musicbot v0.0.9
[LavalinkMusic] Running NodeJS v10.15.3
[LavalinkMusic] Running Discord.JS v11.5.1
[LavalinkMusic] Logged in as Tuney Pro#7764 (ID 538711686010503168)
[LavalinkMusic] Listening to REST node host https://lavalink-discordbot.glitch.me/ and port 3000
[LavalinkMusic] Prefix: !
[discord.js-lavalink-musicbot] Uncaught Exception - Error: getaddrinfo ENOTFOUND https https:80
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
facing error while setting up lavalink on glitch.com
hmm
Will anyone be available tomorrow to do a one on one and help me with my bot?
I am having a funny issue with a bot I'm writing
I want the bot to send '>>daily' to a channel which should trigger another bot to do its thing
the other bot works fine when I send the message as myself
when the bot sends the same message it does nothing...
any ideas?
@earnest phoenix many bots on discord mean more than 80% bots do not reply to a bot that's bcuz people can get millions of money
Lol
That's tooo ridiculous
You were trying to get money
it's standard design to make your bot ignore other bots
Does the same apply to webhooks? Most bots wont reply to them?
Someone have a code for music ?
github does
Thanks
Will anyone be available tomorrow to do a one on one and help me with my bot?
The author object from messages sent by webhooks will have the bot field set to true so yes, those would be ignored too.
woot woot, sql admin command done :D
technically one big sql injection, kinda.
hacks it
gl hacking sporks
Oof that's kinda cool
how does the table look in mobile tho?
i would be able to read it if i turn my phone into landscape
like not even syntax highlighting works in mobile
but i have to limit the number of columns in my query so it doesnt wrap lines
yeah 😦
Vertical table sounds good
unless it's huge
Add an alias for --vertical under --mobile
hmm
i could
but im the only one who uses these admin commands, so i know its limitations 🙂
probably wasted time putting the ascii box around it
i could have just run the mysql client or something instead and let it do all the formatting 😄
is there any faster way of communication between 2 programs (posibbly hosted in different places) than websockets? (considering ease of usage/implementation)
well, its probably either that or REST
but good luck doing udp ipc via javascript
it baaically boils down to protocol, TCP for consistency, UDP for performance
i just saw different places
websockets is an implementaition of TCP
games generally use udp, with a combination of reliable and unrealiable delivery of their packets
yup
reliable delivery means it has a sequence number and the software queues and retries
basically TCP deals with packet loss, while UDP doesnt
yup
and tcp has methods to prevent saturation of the pipe too iirc
if you want speed, you steer clear of anything built on top of http(s)
even a raw tcp socket is faster than http
@mossy vine if you have two programs on the same machine, you can use unix sockets, or shared memory
yeah except proper http/1.1 has stuff on top that means its constantly opening and closing connections, websocket not so much
and http/2 well... thats just awful 😛
How efficient are websockets compared to REST or, rather, is there any difference in performance between both?
yeah i was thinking of eithet a rest api or websocket api thing
@slender thistle when i last tested there was an about 10-50 ms difference in my case
and did websockets win? :¬)
yes
I use websockets for my stuff
yehee I have an excuse to use websockets in my crap
how to edit background color in bot long desc
@tight plinth find the class via inspect and overwrite it in your desc
@mossy vine websocket would be a ton faster than REST if we could send our commands through it
rather than the current state of receiving our inbound messages through websocket and our commands through REST
each REST call must open a new HTTP connection, make the request, wait for the reply and close it
if they were sent through the websocket as outbound data, you could send them on an existing connection and then not have to keep a separate connection open while you wait
but then the whole API would need to be re-engineered so that whenever you send a request you could attach an arbitary library-assigned ID to it, and get the same ID back in your response so you can attach them together
right now the REST port number pair is that ID
what sort of ids are you talking about? i was simply thinking of sending an instruction through a websocket like "find <user>" and then recieve a response
oh wait i think i understand what you mean
send "<id> find <user>" then forget about it, and do something with the result that comes back with the id?
@lucid pewter #commands #265156322012561408 bots dont work elsewhere
@earnest phoenix thanks
yw
hmm... I wanna see if somebody would like this bot. Though this bot will violate terms of service, it will send a person in dms a scheduled message. How do ya think people, should I create this bot?
bruh
oh wait
if the scheduled message has a large timespan and it's opt in, it's allowed
but if a lot of people will have a lot of scheduled messages? It's like then every sec gonna send a message.
what's your intention here
But by
Though this bot will violate terms of service
I meant logging into users account and sending by their acc
If they accepted that
that is not allowed
i know
we won't help you break the tos
I know that. Just wanted to make sure
There was consent since they registered the oauth app ofc /s
How can I show the Percentage in Symbols?
for example:
10% = ⬛ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️
I'm using Js
in emojis?
yeah
repeat the emoji n amount of times where n is your percentage
though that'll get spammy and result in 100 emojis for 100%
you probably want something like 10% is one emoji
divide your percentage by 10 and repeat the emoji the amount of times the division returned
well
it's a static loop with no actual dynamic variable; so it's rather useless you could just use a string with the emoji repeated 10 times
though yes you'd use a for loop
I currently have a system where if a user reacts to a specific message, a new message gets sent in the same channel. What would be the best way to rate limit that, as the user can just react and un-react again and again
Don't have it loop
add their id to some list
then remove it after n amount of seconds
in the reaction handler check if the id is in the list
if you're using a multithreaded language consider using concurrent lists/maps
(node:1014) UnhandledPromiseRejectionWarning: ReferenceError: clientUser is not defined
``` Help
Discord.js v12
Client status and Activity
what do u expect clientUser to do?
there is no such thing as clientUser, so u need to make it do something & also seems like you need to learn a bit more of js
@earnest phoenix you can to use the client that you define yourself
client.setActivity('With my bot friends!')may work
client.user.setActivity(`Oya v0.0.2 | Beta`, { type: "STREAMING" })
```When I do this, the part of the toy is not visible
wut is the toy
I know what they want lost
Not necessary.
@earnest phoenix what do you mean by toy. Also streaming requires a url param
client.user.setActivity(`this is an example`, {
url:'https://twitch.tv/example',
type: "STREAMING"
})```
for example. Playing would be:
client.user.setActivity('Example', {type: 'PLAYING'})
message.guild is null
DMs don't have guilds, hence the conclusion that the command/whatever has been executed in bot's DMs
client.on('message', message => {
var antiraid = db.fetch(`sunucular.${message.guild.id}.spamkoruma`)
if(!antiraid) return;
if(message.author.bot) return;
message.guild.fetchMember(message.author).then(member => {
if(member.hasPermission('BAN_MEMBERS')) return;
var b = []
var aut = []
setTimeout(() => {
message.channel.fetchMessages({ limit: 10 }).then(m => {
m.forEach(a => {
if(m.filter(v => v.content === a.content).size > m.size / 2) {
message.guild.fetchMember(m.author).then(member2 => {
if(member2.hasPermission('BAN_MEMBERS')) return;
b.push(a)
aut.push(a.author)
})}})
if(!b.includes(":warning: | `Self` botlar susturulacak.")) { işlem() }
else {}
function işlem() {
if(b.length > 5) {
message.channel.send(':warning: | `Self` botlar susturulacak.')
aut.forEach(a => {
message.channel.overwritePermissions(a, {
"SEND_MESSAGES": false
})
})
message.channel.send(client.emojiler.evet + ' | `Self` botlar susturuldu.')
} else return;
}
})})})})```
this command.
Am I missing something or are you creating a function in an event
@toxic jolt kod tanıdık geldi falan işte.
@earnest phoenix asdğlsaldakd
@toxic jolt you need to check if the channel is a DM or not
kanka ayarlı değil işte o sunucuda o yüzden öyle diyor
english only @toxic jolt @earnest phoenix
@toxic jolt message.guild is undefined
@summer torrent he knows
also if someone is helping with turkish here i think its fine if they dont understand english fine
@earnest phoenix reckon you could translate for me
@delicate zephyr I'm so tired
You need to check for message.channel.type === 'DM' with an if statement, or make sure message.guild exists
thats all I need you to say
google translate doesnt work that well with programming crap
let a = "";
for (var i = 1; i < 10; i++) {
a += "◻️";
console.log(a, i / 10, "%");
}
somehow this gives me the numbers from 0,1% to 0,9%
I'm tried that code recently and, my bot down
Error? @earnest phoenix
it doesnt
@earnest phoenix try message.channel.type === "dm"
if (!message.guild) return;```
- 100 if you want it as a percentage..
Oh
@delicate zephyr
let a = "";
for (var i = 1; i < 10; i++) {
a += "◻️";
console.log(a, a.length / 10, "%");
}```
well what is it supposed to be
the \ is dividing it

so thats why youre getting .9
what can I do
just so console.log(a, a.length, "%")
o
which probably isn't what they are looking for
returns me 20% to 180%
Maybe you should tell us what you're trying to do
Instead of having us guess solutions for something
Will the value you're calculating in the log have a use
Or do you simply need the string
Pretty sure you're just looking for a progressbar
Which doesn't require a for loop
Strings have a repeat() method that you can use
Which means the only thing you still have to figure out, is how to calculate how many boxes there should be
but why is it showing 1-9%?
Because that's how you've set up the for loop
what can I do
It'll stop once the condition you've supplied no longer resolves to true
You've put i < 10
so if i is 10, it won't continue
But as mentioned up above, you probably don't need the for loop
replace x with your "box"
replace 3 with the right amount
all it takes 👀
@late hill xxx lmao

how would I get the Percentage from that? @late hill
well if there is no profile picture there is no url so no source
@late hill progress bar
Well then
In the process of calculating the amount of boxes
You'll run into the percentage..
no
shimano
oh wait
yes
@earnest phoenix
return if there is no profile picture
if(user.avatarURL === null) return
Over do {}
Np
I am tryna do a command
With tickets
And everytime the channel is renamed
It goes back to it's original name
Can I have some help
This is the code
message.channel.setParent('CATEGORY ID')
message.channel.lockPermissions()
message.channel.setName(`closed-ticket`)```
What
like im wanting to have two commands
with each being an embed
the first command works but the second one doesnt because embed has already been declared?
use a different var
SyntaxError: Identifier 'embed' has already been declared
like the embed/
common sense
the const embed
name to like const example
is that what u mean to change that
so its like const embed = new Discord.RichEmbed() and const embedtwo = new Discord.RichEmbed()
whats that xD
🤦
or something understandable like bot_embed and status_embed

what
"setauthor is not a function"
Not you lol
just appeared out of nowhere
".setAuthor" right?
yeh
you do getServerInfo().setAuthor
i need to remove getserverinfo
then do it
embed.setAuthor
nah its fine now but literally
@summer torrent pls look dm.
i stop the code and re run and now it says richembed field values may not be empty
yeh i had one and it worked, made it two and stoppped workoing xDDDDDDDD
anyone notice anything wrong with that? worked before perfectly, i change 0 of it, and not it wont work and i get that (node:1100) UnhandledPromiseRejectionWarning: RangeError: RichEmbed field values may not be empty.
can timestamp be empty?
i mean yeh, like it worked before and it works on the other embed
one of the embed values is empty
what lib are you using?
discord.js ofc
line 166
show 166th line in your code
why ofc? I don't use discord.js
i dont have 166th line xD
yall blind af
166 comes from d.js source code
index.js line 120 is where the error is
ah yes
see, i dont use discord.js
Else I would have known that 😛
nah thats just basic js tho 
the way it was for like 2 weeks now working perfectly xD
your players list is empty
^
always good to have a fallback on fields
esp when you don't have control over the source data
coz usually i dont see that error when the server is empty and yeh
any idea how i can work around that and still show the embed?
just add a fallback in case the player list is empty
nvm fixed it xD
hello i have error pleae help me
Error: Cannot find module 'm3u8stream/lib/parse-time'11:44 PM
at Function.Module._resolveFilename (module.js:548:15)11:44 PM
at Function.Module._load (module.js:475:25)11:44 PM
at Module.require (module.js:597:17)11:44 PM
at require (internal/module.js:11:18)11:44 PM
at Object.<anonymous> (/rbd/pnpm-volume/f07d4f0b-efd5-4960-8093-830593bb8280/node_modules/.registry.npmjs.org/ytdl-core/0.29.7/node_modules/ytdl-core/lib/info-extras.js:5:21)11:44 PM
at Module._compile (module.js:653:30)11:44 PM
at Object.Module._extensions..js (module.js:664:10)11:44 PM
at Module.load (module.js:566:32)11:44 PM
at tryModuleLoad (module.js:506:12)11:44 PM
at Function.Module._load (module.js:498:3)
How did you add the module
package.json
update ytdl-core package
^
i create to bot glitch
add parse time
im turkish i dont understand :(
Update ytdl-core
no add parse-time
async def school(ctx, self):
await ctx.send("do you like school")
Would this work in a cog
did you try it?
ok so i have a question for you guys who use typescript and ES modules,import from and yadayada
im trying to use a package that was just updated to ES Module, now i cant use it in any way in node 12 lol
require("package") says i cant require ES modules. import("package") says error not supported. import x from "package" says cannot use import outside an ES module
adding type:module to my package.json says i have to change all my files to .cjs
@_@
fuck this i dont wanna rewrite my entire project for this shit
Ye old cjs files
Tbf
yeah but like, i dont wanna have to install an entire module just to read this specific module lol
can't you set "type": "module" in package.json
@quartz kindle
according to quick google
i did, it tells me i need to rewrite my files from .js to .cjs
you'll need to run with --experimental-modules when using node 12
13 got rid of that requirement
rip
Instead rename package.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from package/package.json.
welp i just renamed the module file to .cjs and changed it in the module package.json
and it worked lul
but it sucks having to modify a dependency and having to redo-it on every update
write a script to do it for you
When I try to go and paste something into my python file and I use control v It just closes my file then when I use right click to paste it does not work
Sounds like you need a decent editor
I don't understand because it's never happened before
I was gonna try to run with --experimental-modules but I ended up just using babel because turns out when you have it set to modules you can't use require at all which breaks my current command handler
how would i send hyperlinked text on discord
anyone know how i can use epoch for timers
thx
Can't you use datetime-like module
Uh...
Just piped a video file, I think there might be an error in FS. Anything I can do about it?
and i know its possible
And no, I don't THINK you can make timers out of epoch.
you can
did it
take 1 timestamp
your target time ig thats what you call it
and current time
take away and divide result by 1000
i wanted to do more of a how much time has passed since x thing
i did a timer of 10s
timestamp at the beginning and timestamp when the timer said 10s after

this is gonna be useful for making cooldowns in my bots
that i know this info
yea the time is 9.8 whatever its almost 10s anyway 
The .2 seconds of typing the commands 
const Ids = ["535579900955066392", "535579820088754178", "662724365095403577"]
const Hasrole = oldMember.roles.find(role => Ids.includes(role.id))
if(!Hasrole && !oldMember.serverMute){
oldMember.setMute(true, "le membre n'a pas ces rôle")
oldMember.send(`Vous avez été mute en vocal sur ${oldMember.guild.name} parce que vous n'avez pas vos rôles choisissez vos rôle déconnectez vous du vocal et revenez et vous pourrez parler`)
let embedmuted = new discord.RichEmbed()
.setTitle("Un membre viens de ce faire mute en vocal")
.setDescription(`${oldMember.user} viens de se faire mute en vocal parce qu'il n'avais pas c'est rôle`)
.setColor('#0080FF')
.setTimestamp()
.setFooter(`Logs serveur ${guild.name}`)
bot.channels.get("657162338184724482").send(embedmuted)
}
if(Hasrole && oldMember.serverMute){
oldMember.setMute(false, "le membre a ces rôle")
}```
where is error
the message in private message and for logs is sent twice
does it send the message twice, or an infinite amount of times. is it a command?
twice
getting this error 4|alphabot | TypeError: Cannot convert "null" to int 4|alphabot | at Object.toWireType (/root/alpha123/node_modules/opusscript/build/opusscript_native_wasm.js:8:47113) 4|alphabot | at OpusScriptHandler$_encode [as _encode] (eval at new_ (/root/alpha123/node_modules/opusscript/build/opusscript_native_wasm.js:8:36904), <anonymous>:9:26) 4|alphabot | at OpusScript.encode (/root/alpha123/node_modules/opusscript/index.js:69:28) 4|alphabot | at Encoder._encode (/root/alpha123/node_modules/prism-media/src/opus/Opus.js:55:25) 4|alphabot | at Encoder._transform (/root/alpha123/node_modules/prism-media/src/opus/Opus.js:138:30) 4|alphabot | at Encoder.Transform._read (_stream_transform.js:191:10)4|alphabot | at Encoder.Transform._write (_stream_transform.js:179:12) 4|alphabot | at doWrite (_stream_writable.js:453:12) 4|alphabot | at writeOrBuffer (_stream_writable.js:435:5) 4|alphabot | at Encoder.Writable.write (_stream_writable.js:326:11) 4|alphabot | at VolumeTransformer.ondata (_stream_readable.js:727:22)4|alphabot | at VolumeTransformer.emit (events.js:321:20) 4|alphabot | at addChunk (_stream_readable.js:305:12) 4|alphabot | at readableAddChunk (_stream_readable.js:280:11) 4|alphabot | at VolumeTransformer.Readable.push (_stream_readable.js:214:10) 4|alphabot | at VolumeTransformer.Transform.push (_stream_transform.js:152:32) 4|alphabot | at VolumeTransformer._transform (/root/alpha123/node_modules/prism-media/src/core/VolumeTransformer.js:60:12) 4|alphabot | at VolumeTransformer.Transform._read (_stream_transform.js:191:10) 4|alphabot | at VolumeTransformer.Transform._write (_stream_transform.js:179:12) 4|alphabot | at doWrite (_stream_writable.js:453:12) 4|alphabot | at writeOrBuffer (_stream_writable.js:435:5) 4|alphabot | at VolumeTransformer.Writable.write (_stream_writable.js:326:11)
@wicked pivot Could it be that you are executing the command 2 times?
can i not make this black
did you try it?
yee
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'Colour' has no attribute 'black'
It is giving me this for every color besides orange and green
Maybe check the documentation on how to do it


