#development

1 messages · Page 783 of 1

quartz kindle
#

using it multiple times will send multiple requests

#

which is not good

earnest phoenix
#

ok

quartz kindle
#

instead you should check it first, and then do the rest

earnest phoenix
#
//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?

quartz kindle
#

no

earnest phoenix
#

i don't get it

quartz kindle
#
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)
    }
  }
})```
earnest phoenix
#

ok

quartz kindle
#

@earnest phoenix you cannot add attachment to description

#

description is only for text

#

use attachFile and setImage instead

earnest phoenix
#

@quartz kindle still does not work

late hill
#

Did you use setImage with the file

quartz kindle
#

what doesnt work

earnest phoenix
#

i still sends the command and does not add an cooldown

quartz kindle
#

@earnest phoenix attachFile and setImage

#

@earnest phoenix show full code

earnest phoenix
#
//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);
        } ;
      };
      });```
zenith orchid
#

What is the mongo function equal to the add function in quick.db?

quartz kindle
#

@earnest phoenix how are you using this?

#

show the command or message event

quartz kindle
#

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

earnest phoenix
#

why is that bad if i wont get banned

#

its fine

quartz kindle
#

bad = terrible performance and lots of future problems if your bot gets any big, but you do you

earnest phoenix
#

so instead of that i should add that stuff to guildCreate

quartz kindle
#

the guild config should be in the ready event

earnest phoenix
#

ok

#

but if it gets a new guild

#

it needs it right?

quartz kindle
#

yes, but not ALL guilds

#

just one guild

#

so dont use client.guilds.keyArray().forEach

earnest phoenix
#

so i should only use client.guilds.keyArray() and for ready event i should use client.guilds.keyArray().forEach?

quartz kindle
#

no..

#

client.guilds is ALL guilds

#

why do you need ALL guilds in guildCreate?

earnest phoenix
#

ok so client.guild.keyArray() and for ready event client.guilds.keyArray().forEach?

quartz kindle
#

wat

delicate zephyr
#

client.guilds is a map. so it already inherits .forEach and .map

quartz kindle
#

no

#

there is no client.guild

delicate zephyr
#

are you using discord.js stable or master

earnest phoenix
#

stable?

delicate zephyr
#

client.guilds is a Collection (which extends map)

earnest phoenix
#

ok.

delicate zephyr
#

every function you see on the docs for collection you can use with client.guilds

earnest phoenix
#

yeah, but should i use those collections for ready event and for guildCreate event i should use guilds.keyArray(id)...

delicate zephyr
#

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)
}```
earnest phoenix
#

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
quartz kindle
#

you should return after message.channel.send

earnest phoenix
#

i tried that

quartz kindle
#

then theres still something wrong elsewhere

glacial mango
#

How do I check if a channel has Send Messages permissions?

pure gust
#

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 )

quartz kindle
#

get each guild, see if member exists, if it does kick/ban from there too

pure gust
#

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

mossy vine
#

there is an event

pure gust
#

whats it called?

mossy vine
#

what library are you using

pure gust
#

like discord.js / node.js

#

if thats what u mean

mossy vine
#

d.js yeah

#

one sec

pure gust
#

thanks

mossy vine
#

guildMemberRemove iirc

#

yep

#

its that

pure gust
#

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

#
    
})
mossy vine
#

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

toxic jolt
mossy vine
#

dont call kick on the original member object tho

#

get the member from the guild

pure gust
#

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

toxic jolt
#
  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

mossy vine
#

@pure gust if the user leaves the event is emitted anyways

pure gust
#

ill figure something out after dinner @mossy vine but thanks though! sent me in the right directio nanyway

main aurora
toxic jolt
#
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

main aurora
#

Ok, thank you

toxic jolt
#

no problem

#

😦

#

why error

#

😦

mossy vine
#

lol sick spoonfeeding

toxic jolt
#

@mossy vine can you help mee?

main aurora
#

Did you put that after the bot.on('ready'),() =>{

mossy vine
#

can you stop spamming your problem

quartz kindle
#

lmao

earnest phoenix
#

yikes

summer torrent
#

@toxic jolt read the channel topic

mossy vine
#

cry pls leave you dont want to see this stupidity

summer torrent
#

Do not mention people randomly.

earnest phoenix
quartz kindle
#

@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

main aurora
#

I didn't

pure gust
#

Im back xD

#

So anyone able to help me with guildMemberRemove?

mossy vine
#

what do you need help with

pure gust
#

the whole thing xD, i tried researching and nothing really helps / makes sense

mossy vine
#

okay so

#

do you know the basics of loops

#

such as forEach loops, etc.

pure gust
#

with js nope xD

mossy vine
#

i know forEach may not technically be a loop but close enough

slender thistle
#

Please enlighten me cyber

mossy vine
#

enlighten about what

slender thistle
#

Refer to the message about the forEach loops

mossy vine
#

like what forEach is?

slender thistle
#

Why they're technically not loops

mossy vine
#

see thats a good question

#

i dont know if it is or isnt

#

probably is

pure gust
#

because it would be like for ( something = something: loads more shit )?

mossy vine
#

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
pure gust
#

okay ill try type that in something that makes sense to me xD

quartz kindle
#

forEach is a loop, just a loop that fires functions and is about 95% slower than other loops lol

pure gust
#

yeh dont make sense xD

mossy vine
#

is it really that slow

pure gust
#
    
})```

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

quartz kindle
#

the event doesnt differentiate between leaves and kicks iirc

#

is that what you want? if they leave also kick from others?

pure gust
#

yeh

quartz kindle
#

then its easy

pure gust
#

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

quartz kindle
#

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

pure gust
#

"widht" vs width

mossy vine
#

width instead of width

pure gust
#

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 )

quartz kindle
#

do you have any js experience?

pure gust
#

not really, just in school but what we code is a load of horse shit xD

quartz kindle
#

do you know of at least some basics, like data types? (strings, numbers, arrays, objects)

pure gust
#

yeh ofc

#

i use livecode in school which is some weird programming language with like 1% being js

slender thistle
#

How popular are Delphi and PascalABC in production? nekohmm

quartz kindle
pure gust
#

like a loop is literally repeat loop with = 1 to 5

#

yeh

quartz kindle
#

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

delicate zephyr
#

some better examples of what tim is on about

quartz kindle
#

the condition you want is that the member that just left exists in the guild

delicate zephyr
#
client.guilds.find(guild => guild.name === 'ooga booga')
client.guilds.filter(guild => guild.name === 'ooga booga')
pure gust
#

okay so i dont need the guild id then?

quartz kindle
#

its better to use ids than names

pure gust
#

okay

quartz kindle
#

but hes showing an example of how the function should be used

pure gust
#

yeh coz its lot less longer than the one im wanting to use

quartz kindle
#

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)

pure gust
#

```testServer1 = bot.guilds.find(guild => guild.id === '663793124233052171');````

amber fractal
#

Why would you filter to a single case?

#

Isnt find better?

quartz kindle
#

because its not a single case

pure gust
#
var testServer2 = bot.guilds.find(guild2 => guild.id === `397740638491377675`);```
amber fractal
#

Guild ids are unique

quartz kindle
#

he wants to kick the member from all other guilds the member is in

amber fractal
#

Oh

earnest phoenix
#

if your trying to find a server using an ID, use Collection#get

pure gust
#

would that be the right thing to put each guildId into a variable identified for that specific guild

quartz kindle
#

so essentially you're going to want something a tad more complex

#

client.guilds.filter(guild => guild.members.has(memberID))

modest maple
#

why df would you want to mass kick someone

#

#dickmove

pure gust
#

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

earnest phoenix
#

wouldn't it be guild.members.has() ?

quartz kindle
#

^true

pure gust
#

idk xD

#

idek what im doing rn xD i just know the var thing coz ive done that be fore

iron scroll
#
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))
modest maple
#

by not copy pasting Just have a List of of queued song objects

earnest phoenix
#

d

slender thistle
#

@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
modest maple
slender thistle
main aurora
#

So I've rewrote the whole code and my mute command still won't work. Can someone help?

short siren
#

Send the error.

main aurora
#

It just won't work

short siren
#

What happens when you run the mute command?

#

Nothing happens at all

#

Anything in console.

main aurora
#

No

pure gust
#

try log it into console then

main aurora
#

Oh, one second

quartz kindle
main aurora
#

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)

quartz kindle
#

what did you do?

main aurora
#

I didn't change it yet

quartz kindle
#

then thats why

#

there is no mentions.user

#

its either mentions.users or mentions.members

pure gust
#

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

sudden geyser
main aurora
#

So would I remove the guild in message.guild.member

mint storm
#

@everyone How to set bot game ?? Discord.js

topaz fjord
blissful scaffold
#

not everyone here is a JS developer, at least do @plain talonDevs

mint storm
#

?

blissful scaffold
#

oops sorry js 😛

topaz fjord
#

Rip my boy js

mint storm
#

ok

#

done of trolling?

blissful scaffold
#

you did ping me and I don't know anything about discord.js

topaz fjord
#

Nah I'm good

mint storm
#

ok

main aurora
#

Rip, now my bot won't do anything DaveCrying

topaz fjord
#

but no one is gonna give you the code of it

mint storm
#

ok

topaz fjord
mint storm
#

ok

topaz fjord
#

ok

tawny lantern
#

i wish to remove a bot from a host how would i

light drift
#

Hello how can create the weebhook to now how vote the bot ?

quartz kindle
tawny lantern
#

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

prime cliff
#

only valid in async function

grim aspen
#

so in your command handler you can have an async

#

well you didn't do that

main aurora
#

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

blissful scaffold
#

message.guild.members is not a function

main aurora
#

It said message.members isn't one either

tawny lantern
#

@grim aspen how shall i do async

prime cliff
#

message.members is never a function what are you talking about Blob_Sweat

amber fractal
#

message.guild.members isnt a method

#

it's a property

main aurora
amber fractal
#

message.guild is basically an object (what these parentheses said earlier was wrong mb)

main aurora
#

So what should I put so it works?

amber fractal
#

Do you know what an object is?

#

or how to obtain its properties

main aurora
#

Honestly, no

#

I'm new to this

amber fractal
#

Ah

main aurora
#

Like started yesterday new

amber fractal
#

one sec

quartz kindle
#

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

main aurora
#

But I deleted it and got another error

quartz kindle
#

what did you write?

main aurora
#

I deleted the message.guild.member

tawny lantern
#

how to do async function

main aurora
#

Was I supposed to put something in its place?

quartz kindle
#

did you also remove the parenthesis? show that part how it looks now

#

@tawny lantern async function

tawny lantern
#

what parenthesis

quartz kindle
#
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

tawny lantern
#

what About that tim

main aurora
#

Remove the parenthesis around message.mentions.members.first?

quartz kindle
#

just showed you how to use async

#

@main aurora just show your code, i dont know how it looks like right now

tawny lantern
#

make a new thing and put that in it

main aurora
#

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;
quartz kindle
#

no, go back to the start of whatever function you have and add async to it

tawny lantern
#

where the let args are

quartz kindle
#

@main aurora you still have spelling mistakes lol

main aurora
#

Oops

#

Thanks

tawny lantern
#

Crap im so confused

quartz kindle
#

your code is inside a function

#

most likely fired by an event

modest maple
#

¯_(ツ)_/¯

quartz kindle
#

ie: `client.on("event", something => {

})`

#

just add async to it

#

async something =>

tawny lantern
quartz kindle
#

🤦

#

i literally told you

#

async something =>

tawny lantern
#

mb

quartz kindle
#

"message", async something =>

#

client.on("message", async something => {
})

#

dont change any thing

#

just

#

add

#

async

#

on the right place

#

like above

modest maple
#

Tim

#

You try

#

So hard

#

And I love you for that

quartz kindle
#

gib me money

modest maple
#

Nu

#

I'm broke sad

quartz kindle
#

gets buried in debt

modest maple
#

Or more I will be broke when I get my car and pay server costs

slender thistle
#

Watch DBL hire Tim for being very helpful 2020 must watch

quartz kindle
#

Lol

modest maple
#

Speaking of

quartz kindle
#

hire me as a js teacher for noobs

main aurora
#

I fixed the spelling mistake and got another error

modest maple
#

@slender thistle wHeN yOU gUnNa FIx DbL pyThuM

quartz kindle
#

what is the error this time

main aurora
#

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)

modest maple
#

Sigh

tawny lantern
slender thistle
#

@modest maple install from source for now, I'm too sick to use my laptop

tawny lantern
#

@quartz kindle

main aurora
#

Sorry for all the questions

modest maple
#

Oof

#

Tbf

slender thistle
#

aka I'm lazy but I'm still sick

modest maple
#

I don't use the module

#

I should

quartz kindle
modest maple
#

But like

quartz kindle
#

check index.js on line 32, see if you can find what is wrong there (tip: muteRole is wrong)

modest maple
#

I really cannot be arsed

slender thistle
#

If you handle your webhooks and requests fine, I don't see why you should use dblpy

modest maple
#

Like idc if it's vote locked or not the websites give the bot enough publicity for a steady gain

tawny lantern
#

tim its still not working i even put it in

slender thistle
#

It's just an API wrapper nekohmm

modest maple
#

Yh

quartz kindle
#

@tawny lantern show your code, including the event part

modest maple
#

Tbf I might run it in a seperate thread on server side

tawny lantern
#

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 => {
                        })
                        
                      }            
                    }

})

quartz kindle
#

@tawny lantern including the event part (client.on)

modest maple
#

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

tawny lantern
slender thistle
quartz kindle
#

jesus christ

#

@tawny lantern what do you have BEFORE if(command === "kick"){?

modest maple
#

@quartz kindle how long u gonna keep trying lmao

quartz kindle
#

all the way before

queen sierra
#

Hi

quartz kindle
#

until you reach a client.on

tawny lantern
#

omg hold up

queen sierra
#

Here use Bot designer for Discord? In phone?

tawny lantern
#

just like down load that and it has my script

slender thistle
#

Tim can set an example for us helpers with his patience I'm ngl

quartz kindle
#

@tawny lantern that is still not the full script

#

what comes before case 'Help':?

modest maple
#

@queen sierra Discord bot designer is not supported or allowed here

tawny lantern
#

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]){
quartz kindle
#

finally

#

async

tawny lantern
#

where the arows are

modest maple
#

I recon I could probably make a discord.js bot with the basics pretty easily without even knowing js properoy

quartz kindle
#

yes

#

async message

#

async member

slender thistle
#

d.js doesn't look too hard

quartz kindle
#

everywhere where you want to use await you need to start it with an async there

tawny lantern
queen sierra
#

@modest maple for what?

quartz kindle
#

yes

tawny lantern
#

should work

modest maple
#

DBL does not support DBD bots

tawny lantern
#

nope

modest maple
#

How do u even run js scripts xD

tawny lantern
#

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

modest maple
#

It's been ages since I've attempted to run a file

#

TIM you tried to tell them

slender thistle
#

d.js is node so npm I would assume

tawny lantern
#

afk

slender thistle
#

But like straight up js without node I haven't ever seen someone do that

quartz kindle
#

you do that in websites lol

modest maple
#

I should probably learn js

#

But like

slender thistle
#

straight up as in just a clean OS, no browsers, no node

modest maple
#

Ik clojure and python and combined they cover just about every base

quartz kindle
#

well js cant run without an interpreter/engine

modest maple
#

Ik a bit of c and cpp

#

Which I should learn more

#

But meh

#

Master one language at a time

quartz kindle
#

why learn C in this day and age lul

modest maple
#

Might try rust maybe

slender thistle
#

oS dEvULoOpMaNT

modest maple
#

Seems to be quite a popular one

quartz kindle
#

if you want OS dev, use asm

#

huehuehue

slender thistle
#

So basically "You shall suffer"

quartz kindle
#

sufferrrrrr

slender thistle
#

I shall use python for os dev

modest maple
#

Python is a compiled languageskyReverse

slender thistle
#

It's compiled into binary so it's alright

quartz kindle
#

does it really compile to machine code?

#

like, does it run without python installed or packaged?

slender thistle
#

I doubt that on more levels than the unknowing of this server has been by far

lean palm
#

anyone know why i'm getting this error( TypeError: Cannot read property 'setMaxListeners' of undefined) with a messageCollector?

quartz kindle
#

code?

lean palm
#

const collect = new Discord.MessageCollector(message.channel {time: 20000})

collect.on('collect', mes => {
console.log(mes)
})
}

slender thistle
#

and he leaves the conversation to help

lean palm
#

yea

quartz kindle
#

missing comma in there, and second argument should be the filter function, not options

lean palm
#

ah

quartz kindle
#

anyway why dont you use the channel method version?

lean palm
#

o

quartz kindle
#

@slender thistle im addicted, send help

slender thistle
#

atModerators ban Tim

quartz kindle
#

lmao

lean palm
#

hey tim one thing

quartz kindle
#

dont ban, just mute, dont wanna lose cert

lean palm
#

does createCollector work with dm channel?

quartz kindle
#

should work yes

slender thistle
#

But then you'll just DM people who ask for help here :p

lean palm
#

huh

#

werid

quartz kindle
#

i wont, i dont help via dms (only rarely), unless i get paid

slender thistle
#

Oh alright atOliy mute this guy right here

lean palm
#

what if you don't have a filter?

quartz kindle
#

Lol

lean palm
#

like if i'm just accepting any message?

quartz kindle
#

just put true

lean palm
#

ok thanks

quartz kindle
#

or if it complains that it wants a function, () => true

lean palm
#

yeah i just get its not a func

tawny lantern
#

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

dusky marsh
#

Exactly as the error says

#

You're using await in a non-async scope

lean palm
#

is there a message.channel equivalent for a dmchannel

quartz kindle
#

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

lean palm
#

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

dusky marsh
#

message.author doesn't have those properties

quartz kindle
#

.send returns a promise of a message

tawny lantern
#

nvm

#

screw it

#

ill

#

ugh

#

its

#

UGH

#

its hard

dusky marsh
#

You're just missing a keyword somewhere

lean palm
#

oooooo

junior vapor
#

@quartz kindle hi

quartz kindle
#

?

sudden geyser
#

@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.

lean palm
#

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

quartz kindle
#

did you put () => true as the filter?

lean palm
#

ahh thanks it works

mystic violet
#

How do you parse a URL? like from js { prefix: 'f%21', mod_log: '%23test' } the % signs to ! and #

grizzled raven
#

is it normal when booting a bot on a vps takes a long time to emit the ready event?

#

or

quartz kindle
#

how long?

#

how many shards/guilds?

empty owl
#

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

sudden geyser
#

The noob, what library (and possible framework)

grizzled raven
#

nah nvm, it was an error or something

#

it never started

near ether
#

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?

prime cliff
#

@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

near ether
#

Gotcha

near ether
#

Is there any reason why discord would be temp-banning my IP?

blissful scaffold
#

It probably means your bot is breaking the rate limits

near ether
#

Hmm

#

Is that it?

outer niche
slender thistle
#

Show the rest of the code

#

with X as Y: however

outer niche
#
    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:

slender thistle
#

You are only doing X as Y:

#

Why are you declaring get_prefix twice

stable horizon
#

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

outer niche
#

Do you have a better way to do it

stable horizon
#

Cache them

outer niche
#

I have no idea how to do that so I'm going to stick with this

stable horizon
#

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"

earnest phoenix
earnest phoenix
#
[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

sinful lotus
#

do you even run your lavalink

#

nor do even glitch allow that

earnest phoenix
#

hmm

main aurora
#

Will anyone be available tomorrow to do a one on one and help me with my bot?

earnest phoenix
#

First I need to know how to setup it

#

hi

#

hello

earnest phoenix
#

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?

violet nimbus
#

@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

earnest phoenix
#

it's standard design to make your bot ignore other bots

violet nimbus
#

Yep

#

if (message.author.bot) return; LOL

earnest phoenix
#

easy enough

#

sorry, first day using bots

violet nimbus
#

Oooh

earnest phoenix
#

Does the same apply to webhooks? Most bots wont reply to them?

zealous burrow
#

Someone have a code for music ?

stray wasp
#

github does

zealous burrow
#

Thanks

main aurora
#

Will anyone be available tomorrow to do a one on one and help me with my bot?

late hill
#

The author object from messages sent by webhooks will have the bot field set to true so yes, those would be ignored too.

green kestrel
#

woot woot, sql admin command done :D
technically one big sql injection, kinda.

quartz kindle
#

hacks it

tight plinth
#

gl hacking sporks

slender thistle
#

Oof that's kinda cool

quartz kindle
#

how does the table look in mobile tho?

green kestrel
#

like arse, probably

#

😄

quartz kindle
#

xD

#

i hate that discord doesnt have any way to make something look good in both

green kestrel
#

i would be able to read it if i turn my phone into landscape

quartz kindle
#

like not even syntax highlighting works in mobile

green kestrel
#

but i have to limit the number of columns in my query so it doesnt wrap lines

#

yeah 😦

quartz kindle
#

what about a vertical table? lmao

#

columns from left to right

slender thistle
#

Vertical table sounds good
unless it's huge

quartz kindle
#

maybe make it an option

#

--vertical

slender thistle
#

Add an alias for --vertical under --mobile

green kestrel
#

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 😄

mossy vine
#

is there any faster way of communication between 2 programs (posibbly hosted in different places) than websockets? (considering ease of usage/implementation)

quartz kindle
#

well, its probably either that or REST

green kestrel
#

there are tons of good ways

#

you can establish a udp conversation between the two

earnest phoenix
#

ipc

#

oh

#

nvm

green kestrel
#

but good luck doing udp ipc via javascript

quartz kindle
#

it baaically boils down to protocol, TCP for consistency, UDP for performance

earnest phoenix
#

i just saw different places

quartz kindle
#

websockets is an implementaition of TCP

green kestrel
#

games generally use udp, with a combination of reliable and unrealiable delivery of their packets

quartz kindle
#

yup

green kestrel
#

reliable delivery means it has a sequence number and the software queues and retries

quartz kindle
#

basically TCP deals with packet loss, while UDP doesnt

green kestrel
#

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

quartz kindle
#

well http is one layer above, it can be built on top of tcp or not

green kestrel
#

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 😛

slender thistle
#

How efficient are websockets compared to REST or, rather, is there any difference in performance between both?

mossy vine
#

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

slender thistle
#

and did websockets win? :¬)

mossy vine
#

yes

modest maple
#

I use websockets for my stuff

slender thistle
#

yehee I have an excuse to use websockets in my crap

tight plinth
#

how to edit background color in bot long desc

modest maple
#

They're pretty cooo

#

But with python can be a pain at times

earnest phoenix
#

@tight plinth find the class via inspect and overwrite it in your desc

green kestrel
#

@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

mossy vine
#

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
#

e*binfo

#

Wot

#

*binfo

earnest phoenix
lucid pewter
#

@earnest phoenix thanks

earnest phoenix
#

yw

grim aspen
iron scroll
#

oh

#

i idiot

earnest phoenix
#

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

slender thistle
#

There was consent since they registered the oauth app ofc /s

uneven wyvern
#

How can I show the Percentage in Symbols?

for example:
10% = ⬛ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️ ◻️

#

I'm using Js

earnest phoenix
#

in emojis?

uneven wyvern
#

yeah

earnest phoenix
#

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

uneven wyvern
#

yeah

#

I need to use for loops ig

earnest phoenix
#

divide your percentage by 10 and repeat the emoji the amount of times the division returned

uneven wyvern
#

let text = "" for(var i = 1; 1<10; i++) { text += "◻️ " }

#

would that work?

earnest phoenix
#

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

cinder patio
#

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

modest maple
#

Don't have it loop

earnest phoenix
#

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

earnest phoenix
#
(node:1014) UnhandledPromiseRejectionWarning: ReferenceError: clientUser is not defined
``` Help  
Discord.js v12
digital ibex
#

it is fairly obvious but ok

#

what r u trying to do?

earnest phoenix
#

Client status and Activity

digital ibex
#

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
digital ibex
#

🤦‍♂️

#

ok

#

i am sure it will be client, not clientUser

#

so

delicate zephyr
#

@earnest phoenix you can to use the client that you define yourself

digital ibex
#

client.setActivity('With my bot friends!')may work

earnest phoenix
#
    client.user.setActivity(`Oya v0.0.2 | Beta`, { type: "STREAMING" })
```When I do this, the part of the toy is not visible
digital ibex
#

wut is the toy

delicate zephyr
#

I know what they want lost

digital ibex
#

ok

#

u deal with it

earnest phoenix
#

Not necessary.

delicate zephyr
#

@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'})
toxic jolt
#

i how to fix id error?

delicate zephyr
#

id is undefined

#

try logging what message.guild is

#

and see what it outputs

slender thistle
#

message.guild is null

delicate zephyr
#

oh

#

oof

slender thistle
#

DMs don't have guilds, hence the conclusion that the command/whatever has been executed in bot's DMs

toxic jolt
#
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 {}

    functionlem() {

    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.

slender thistle
#

Am I missing something or are you creating a function in an event

delicate zephyr
#

javascript

#

@slender thistle that how it works with js

earnest phoenix
#

@toxic jolt kod tanıdık geldi falan işte.

toxic jolt
#

@earnest phoenix asdğlsaldakd

delicate zephyr
#

@toxic jolt you need to check if the channel is a DM or not

toxic jolt
#

yardımcı olsana

#

hmm

earnest phoenix
#

kanka ayarlı değil işte o sunucuda o yüzden öyle diyor

summer torrent
#

english only @toxic jolt @earnest phoenix

toxic jolt
#

okay

#

@earnest phoenix dm

summer torrent
#

@toxic jolt message.guild is undefined

delicate zephyr
#

@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

earnest phoenix
#

@delicate zephyr I'm so tired

delicate zephyr
#

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

uneven wyvern
#
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%

earnest phoenix
#

I'm tried that code recently and, my bot down

uneven wyvern
#

Error? @earnest phoenix

earnest phoenix
#

No error.

#

Directly down

uneven wyvern
#

Tf

#

@delicate zephyr the channel type needs to be in lowercase

delicate zephyr
#

it doesnt

uneven wyvern
#

@earnest phoenix try message.channel.type === "dm"

delicate zephyr
#

actually

#

if that works

summer torrent
#
if (!message.guild) return;```
delicate zephyr
#

then yea

#

or that

#

what NMW03 said

uneven wyvern
#

yeah

#

any1 can help me?

delicate zephyr
#

whats up

#

@uneven wyvern

late hill
#
  • 100 if you want it as a percentage..
uneven wyvern
#

bruh

#

that don't solves the 1-9 Problem

late hill
#

Oh

uneven wyvern
#

@delicate zephyr

let a = "";

for (var i = 1; i < 10; i++) {
  a += "◻️";
  console.log(a, a.length / 10, "%");
}```
late hill
#

well what is it supposed to be

delicate zephyr
#

the \ is dividing it

late hill
delicate zephyr
#

so thats why youre getting .9

uneven wyvern
#

what can I do

delicate zephyr
#

just so console.log(a, a.length, "%")

uneven wyvern
#

o

late hill
#

which probably isn't what they are looking for

uneven wyvern
#

returns me 20% to 180%

late hill
#

Maybe you should tell us what you're trying to do

#

Instead of having us guess solutions for something

uneven wyvern
#

try to show the Percentage of 10 white boxes

#

bad explained ik

late hill
#

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

uneven wyvern
#

but why is it showing 1-9%?

late hill
#

Because that's how you've set up the for loop

uneven wyvern
#

what can I do

late hill
#

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 👀

uneven wyvern
#

@late hill xxx lmao

late hill
uneven wyvern
#

how would I get the Percentage from that? @late hill

late hill
#

What percentage do you need

#

Be specific in what you're trying to do

uneven wyvern
#

well if there is no profile picture there is no url so no source

#

@late hill progress bar

late hill
#

Well then

#

In the process of calculating the amount of boxes

#

You'll run into the percentage..

uneven wyvern
#

no

late hill
#

shimano

uneven wyvern
#

oh wait

#

yes

#

@earnest phoenix

#

return if there is no profile picture

#

if(user.avatarURL === null) return

#

Over do {}

#

Np

golden condor
#

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`)```
earnest phoenix
#

What

pure gust
#

quesiton

#

how tf do i have two embed commands?

stray wasp
#

Did you send it twice?

#

Show code pls

#

Alright gtg

pure gust
#

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?

knotty steeple
#

use a different var

pure gust
#

SyntaxError: Identifier 'embed' has already been declared

knotty steeple
#

yea

#

rename it

pure gust
#

like the embed/

knotty steeple
#

common sense

pure gust
#

the const embed

knotty steeple
#

rename

#

the variable

pure gust
#

name to like const example

knotty steeple
#

to something else

#

idk do what u want

pure gust
#

is that what u mean to change that

#

so its like const embed = new Discord.RichEmbed() and const embedtwo = new Discord.RichEmbed()

knotty steeple
#

y e s

#

and pls use a damn command handler

pure gust
#

whats that xD

earnest phoenix
#

🤦

blissful scaffold
#

or something understandable like bot_embed and status_embed

clear burrow
knotty steeple
#

what

pure gust
#

"setauthor is not a function"

clear burrow
#

Not you lol

pure gust
#

just appeared out of nowhere

earnest phoenix
#

".setAuthor" right?

blissful scaffold
pure gust
#

yeh

blissful scaffold
#

you do getServerInfo().setAuthor

knotty steeple
#

remove the second line

#

or move it

pure gust
#

i need to remove getserverinfo

knotty steeple
#

then do it

summer torrent
#

embed.setAuthor

pure gust
#

nah its fine now but literally

earnest phoenix
#

@summer torrent pls look dm.

pure gust
#

i stop the code and re run and now it says richembed field values may not be empty

blissful scaffold
#

addField needs 2 or 3 values

#

and those values can't be empty

pure gust
#

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.

blissful scaffold
#

can timestamp be empty?

pure gust
#

i mean yeh, like it worked before and it works on the other embed

mossy vine
#

timestamp should be empty shouldnt it

#

what line are you getting that error on

pure gust
#

idk it doesnt say

#

unlesss it does and i dont see it xD

summer torrent
#

one of the embed values is empty

pure gust
blissful scaffold
#

what lib are you using?

pure gust
#

discord.js ofc

blissful scaffold
#

line 166

summer torrent
#

show 166th line in your code

blissful scaffold
#

why ofc? I don't use discord.js

pure gust
#

i dont have 166th line xD

mossy vine
#

yall blind af

#

166 comes from d.js source code

#

index.js line 120 is where the error is

summer torrent
#

ah yes

blissful scaffold
#

see, i dont use discord.js
Else I would have known that 😛

pure gust
#

thats line 120

mossy vine
#

nah thats just basic js tho mmLol

pure gust
#

the way it was for like 2 weeks now working perfectly xD

blissful scaffold
#

your players list is empty

summer torrent
#

^

neat flower
#

always good to have a fallback on fields

pure gust
#

oh yes

#

i have just realised that

neat flower
#

esp when you don't have control over the source data

pure gust
#

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?

neat flower
#

just add a fallback in case the player list is empty

pure gust
#

nvm fixed it xD

radiant sparrow
#

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)

summer torrent
radiant sparrow
#

i add to module

#

but

#

low wasp
#

How did you add the module

radiant sparrow
#

package.json

summer torrent
#

update ytdl-core package

low wasp
#

^

radiant sparrow
#

i create to bot glitch

grim aspen
#

add parse time

radiant sparrow
#

im turkish i dont understand :(

summer torrent
#

Update ytdl-core

grim aspen
#

no add parse-time

summer torrent
grim aspen
outer niche
#
async def school(ctx, self):
  await ctx.send("do you like school")

Would this work in a cog

blissful scaffold
#

did you try it?

quartz kindle
#

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

#

@_@

modest maple
#

Oh boy are you gonna have

#

Sooo sooo much fun

quartz kindle
#

fuck this i dont wanna rewrite my entire project for this shit

modest maple
#

Ye old cjs files

#

Tbf

topaz fjord
#

I use babel for that

#

for the import shit

quartz kindle
#

yeah but like, i dont wanna have to install an entire module just to read this specific module lol

topaz fjord
#

can't you set "type": "module" in package.json

#

@quartz kindle

#

according to quick google

quartz kindle
#

i did, it tells me i need to rewrite my files from .js to .cjs

topaz fjord
#

you'll need to run with --experimental-modules when using node 12

#

13 got rid of that requirement

quartz kindle
#

also tried

#

same shit

topaz fjord
#

rip

quartz kindle
#

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

topaz fjord
#

write a script to do it for you

outer niche
#

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

amber fractal
#

Sounds like you need a decent editor

outer niche
#

I don't understand because it's never happened before

scenic kelp
#

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

visual sandal
#

how would i send hyperlinked text on discord

summer torrent
#

Works on only embed

knotty steeple
#

anyone know how i can use epoch for timers

visual sandal
#

thx

knotty steeple
#

cuz i wanna make cooldowns

#

what kinda math i gotta do

slender thistle
#

Can't you use datetime-like module

shell obsidian
#

Uh...

knotty steeple
#

i dont want no modules just

#

m a t h

shell obsidian
#

Just piped a video file, I think there might be an error in FS. Anything I can do about it?

knotty steeple
#

and i know its possible

shell obsidian
#

And no, I don't THINK you can make timers out of epoch.

knotty steeple
#

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 crylaugh

hollow saddle
#

The .2 seconds of typing the commands bloblul

wicked pivot
#
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")
      }```
summer torrent
#

where is error

wicked pivot
#

the message in private message and for logs is sent twice

sudden geyser
#

does it send the message twice, or an infinite amount of times. is it a command?

wicked pivot
#

twice

earnest phoenix
#

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)

blissful scaffold
#

@wicked pivot Could it be that you are executing the command 2 times?

wicked pivot
#

no

#

the event is "voiceStateUpdate"

outer niche
blissful scaffold
#

yes

#

set the color of your embed

outer niche
#
        colour = discord.Colour.black()
        )``` this right
#

??????

blissful scaffold
#

did you try it?

outer niche
#

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

blissful scaffold
#

Maybe check the documentation on how to do it