#development

1 messages · Page 908 of 1

opaque seal
#

I have a problem, is there someone to help?
@lofty grove Don't ask to ask, just ask

slender mountain
#

@opaque seal what do you mean instantly goes away?

opaque seal
#

It like sets the limit and then after a split second it removes it

#

and set the channel to unlimited userLimit

#

I can't understand why

quartz kindle
#

either you have some other code overwriting this one, or this one is overwriting itself

#

you are executing multiple requests concurrently, which is never a good idea anyway

#

you should await each request

opaque seal
#

either you have some other code overwriting this one, or this one is overwriting itself
Yeah that's what I thought, but I'm 99.9999% sure it isn't

#

I've checked

#

you should await each request
ok

slender mountain
#

Yeah I was about to say something about the async function not having any awaits

opaque seal
#

No I have some other code in there

#

nothing relevant for the problem

sterile minnow
#

Hey,

My Code has an Error:

ReferenceError: Cannot access 'voiceConnection' before initialization ReferenceError: Cannot access 'voiceConnection' before initialization /rbd/pnpm-volume/433a83ca-f352-490e-9316-c380057bb4b2/node_modules/.registry.npmjs.org/opusscript/0.0.7/node_modules/opusscript/build/opusscript_native_wasm.js:8 var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMEN abort(ReferenceError: Cannot access 'voiceConnection' before initialization). Build with -s ASSERTIONS=1 for more info.

Does anyone know whats wrong with it?

since i have v12

#

My Code:

    var outofrange = new Discord.MessageEmbed()
      .setTitle("Out of range")
      .setAuthor(message.author.username)
      .setColor("RED");
    var nomu = new Discord.MessageEmbed()
      .setTitle("❌ | No Music is being Played")
      .setColor("RED")
      .setAuthor(message.author.username);
    var nomy = new Discord.MessageEmbed()
      .setTitle("❌ | You're not in my Channel")
      .setColor("RED")
      .setAuthor(message.author.username);
    var nonu = new Discord.MessageEmbed()
      .setTitle("❌ | This is not a Valid Number")
      .setColor("RED")
      .setAuthor(message.author.username);

    let vol = args.join(" ");
    if (!Number(vol)) return message.reply(nonu);
    const voiceConnection = voiceConnection.find(
      val => val.channel.guild.id == message.guild.id
    );
    if (voiceConnection === null) return message.channel.send(nomu);
    if (!message.member.voice.channel) return message.channel.send(nomy);
    const dispatcher = voiceConnection.player.dispatcher;
    const currentvol = dispatcher.volume * 100;
    if (!vol) {
      let embed = new Discord.MessageEmbed()
        .setDescription(`**Current Volume:** ${currentvol}%`)
        .setColor("ORANGE")
        .setAuthor(message.author.username);
      return message.channel.send(embed);
    }
    if (vol > 200 || vol < 0)
      return message.channel.send(outofrange).then(response => {
        response.delete(5000);
      });

    let embed = new Discord.MessageEmbed()
      .setDescription("Volume set to " + vol)
      .setColor("GREEN")
      .setAuthor(message.author.username);
    dispatcher.setVolume(vol / 100);
    message.channel.send(embed);
  }

quartz kindle
#

you're using .find() on something that doesnt exists yet

sterile minnow
#

what do i have to set there?

quartz kindle
#

i dont know what you want to do

#

but you're trying to access something from the very thing you're defining

#

which is invalid

sterile minnow
#

find the Voice Connection on the Server that the message camer from

pale vessel
#

i would suggest reading the docs

#

it really helps

sterile minnow
#

i did

pale vessel
#

well something is wrong

quartz kindle
#

you mean the voice connection that the bot has in that server?

sterile minnow
#

And they say sth with voice connection. yes

opaque seal
#

Tim I'm trying to send the code with hastebin but it seems to not work

pale vessel
#

what doesn't work? tell us

opaque seal
#

hastebin

pale vessel
#

oh my goodness

quartz kindle
#

in v12 its guild.voice.connection

#

@sterile minnow

opaque seal
#

How can I send you my code guys?

sterile minnow
#

i'm scared of my own code

pale vessel
opaque seal
#

Any methods other than hastebin?

quartz kindle
#

there are a bunch of different bins

pale vessel
sterile minnow
#

pastebin

opaque seal
#

Indentation got messed up at the end

sick cloud
#

embarrassing that a cert's asking it but does anybody here want to share how they handle custom prefixes

earnest phoenix
#

hello my bot 79 commad

opaque seal
#

embarrassing that a cert's asking it but does anybody here want to share how they handle custom prefixes
I store it in my database

pale vessel
#

well duh lol

knotty steeple
#

quick.json 😎

opaque seal
#

https://hasteb.in/zotadaje.js
btw this worked a couple days ago, then I've made some changes, not to the limit part, and now it isn't workin properly

sterile minnow
#

@quartz kindle ty works now

quartz kindle
#

@sick cloud ```js
// message event
let prefix = message.guild ? client.app.getPrefix(message.guild.id) : client.defaultPrefix;

// app class
getPrefix(id) {
if(!this.client.guilds.cache.get(id).AppData) {
let guild = this.db.prepare("SELECT * FROM guilds WHERE id = ?").get(id);
if(guild) {
this.client.guilds.cache.get(id).AppData = JSON.parse(guild.data);
} else {
this.client.guilds.cache.get(id).AppData = {};
}
}
return this.client.guilds.cache.get(id).AppData.prefix || this.client.defaultPrefix;
}

pale vessel
#

same

#

nice

#

i use mysql2/promise

quartz kindle
#

i use better-sqlite3

sick cloud
#

hm ok

#

do you inject any mention prefix in tim

#

or not

lofty grove
#

@lofty grove Don't ask to ask, just ask
@opaque seal ```const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
console.log("7/24 online");
response.sendStatus(200);
});
app.listen(8000);
setInterval(() => {
http.get(http://trexdash.glitch.me/);//Enter your glitch link correctly!
}, 280000)

#

should i add this to bot.js?

pale vessel
#

7/24 online lol

sick cloud
#

great english

quartz kindle
#

@opaque seal what is halls?

knotty steeple
#

better-sqlite3 best

opaque seal
#

uhm it's an object variable that I define earlier in the code

sick cloud
#

i'm making an oss bot and using enmap which is better-sqlite3 behind it so /s

knotty steeple
#

also u use a function

#

smart

#

i should do that

lofty grove
#

console.log("7/24 online"); Could there be a typo?

opaque seal
#

24/7

pale vessel
#

maybe

knotty steeple
#

i just always make it check on message event

quartz kindle
#

@sick cloud not at the moment. i will add a single hardcoded mention command to obtain the current prefix

#

because right now, if people forget the prefix, there is no way to get it lmao

sick cloud
#

cool

knotty steeple
#

lul what

sick cloud
#

i like my bot being usable by mention regardless so

#

complex system

pale vessel
#

i make it defaults to the prefix command if it detects a mention (without content/command)

quartz kindle
#

yeah, my bot mention used to have a function on its own, where it would talk to people and ask random questions

#

but i removed it in my latest update

knotty steeple
#

i just made it send the current prefix on mention

pale vessel
#

ye same

knotty steeple
#

and the mention prefix would also work

quartz kindle
#

yeah thats what im gonna do probably

pale vessel
#

it's the most simple way

quartz kindle
#

but not the mention itself, it has to be with a command

knotty steeple
#

i always add mention prefixes anyway

quartz kindle
#

because i had a stupid problem once

#

where a guild got raided

#

by accounts spamming mentions

knotty steeple
#

omegalul

quartz kindle
#

and my bot started queuing responses due to rate limits

pale vessel
#

do you have a cooldown system?

quartz kindle
#

and after the raid ended, my bot kept spamming them with responses

#

i do now lmao

#

for a while there was a rumor that my bot had been hacked and aided in the raid lmao

knotty steeple
#

i actually made myself cooldowns that store time in a db

#

wow me

pale vessel
#

wow effort

knotty steeple
#

and its based on something i made for a cli

quartz kindle
#

my cooldown system is weird af

knotty steeple
#

so i copied that

sick cloud
#

my bot's got a very very simple handler/cooldowns because it's an open source bot i'm publishing, so i'm not putting anything fancy in it

#

my actual bot has an auto blacklist system and all

knotty steeple
#

normal command cooldowns i would use a set

#

cuz y not

quartz kindle
#

i dont have per user nor per command cooldowns, i just have a global cooldown per channel

knotty steeple
#

good idea

sick cloud
#

that's a decent idea

knotty steeple
#

but also multiple users cant use at the same time

sick cloud
#

this oss bot just has per cmd/per channel non-persistent

quartz kindle
#

if they send more than 5 commands per 5 seconds, they get a "too many commands" response and ignore future commands for 5 seconds

#
          if(ratelimit[message.channel.id] === undefined) { ratelimit[message.channel.id] = 0; }
            ratelimit[message.channel.id]++;
            if(ratelimit[message.channel.id] > 5) { ratelimit[message.channel.id]--; return; }
            if(ratelimit[message.channel.id] === 5) {
                ratelimit[message.channel.id] += 99;
                setTimeout(() => { ratelimit[message.channel.id] -= 100; }, 6000);
                return message.reply("Too many commands").catch(console.log);
            }
            setTimeout(() => { ratelimit[message.channel.id]--; }, 5000);
``` lmao
knotty steeple
#

=== undefined

#

sir

quartz kindle
#

because it can be 0

knotty steeple
#

wew

opaque seal
#

Just copied it from the guide xD

knotty steeple
#

bad

opaque seal
#

why?

sick cloud
#

i did that for this oss bot

#

it's a half decent cooldown

unique nimbus
#

Copying without knowing what it does is a bad idea

opaque seal
#

oh yeah

sick cloud
#

not persistent though

opaque seal
#

had to focus more on other stuff

knotty steeple
#

a set isnt persistent of course

sick cloud
#

tim, mine is crap compared to yours:

each command has some type of cooldown (usually 60s for api cmds, 120s for high use api cmds)
you can use it with 3-5 second gaps while on cooldown
if you spam the command 5 times while on cooldown you get blacklisted for 1 hour (all cmds/msgs ignored)
after that, if you repeat again and keep spamming, you'll get permanently blacklisted

opaque seal
#

Guys when I use this code I can see the voice channel get's a user limit but then it instantly goes away:

guy.guild.channels.create(roomName, { type: 'voice' })
    .then(async nChannel =>{
        let limit = newState.channel.userLimit;
        let br = newState.channel.bitrate;
                guy.voice.setChannel(nChannel);
            nChannel.overwritePermissions([
          {
            id: every,
            deny: ['CONNECT'],
          },
        ]);
        if(limit !== 0){
             nChannel.setUserLimit(limit)
        }
        nChannel.setBitrate(br);
```Do you know why?

Anyway, can someone figure out why this happens?

knotty steeple
#

dont quote codeblocks smh

#

they dont work it seems

sick cloud
#

works for me?

pale vessel
#

desktop

knotty steeple
#

thanks mobile

opaque seal
#

works for me?
@sick cloud it does?

pale vessel
#

smh

opaque seal
#

sry for the ping

sick cloud
#

i'm talking about the codeblock showing

opaque seal
#

oh

sick cloud
#

your code is a little confusing because you're using functions instead of just providing it all on creation

quartz kindle
#

@opaque seal the reason i asked about halls before is that you're executing everything in a for loop, looping over halls

earnest phoenix
#

anyone else sometimes get backend failed for top.gg

quartz kindle
#

so if for any reason two items of halls lead up to the same channel, it could be overwriting it

knotty steeple
#

reload

#

the site

earnest phoenix
#

i mean via webhook

knotty steeple
#

api problem then

#

shrug

earnest phoenix
#

yeah guess so lol

opaque seal
#

so if for any reason two items of halls lead up to the same channel, it could be overwriting it
good point but this shouldn't at 99.9% happen

#

let me check thought

#

Also it would create 2 channels and not just one

#

Omg

#

I found out why

#

I'm stupid

#

No nvm

quartz kindle
#

lmao

#

another thought would be reordering the functions

earnest phoenix
#

yes this is what im getting lol (node:25) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized

opaque seal
#

another thought would be reordering the functions
what do you mean with that? Like put everything in the 'create'?

quartz kindle
#

first check for the category channel, if it doesnt exist create it, then create the channel and specify the category in the channel creation options, so you dont need to make another call to set the category, as the channel will already be created inside the category

opaque seal
#

Yeah I should do that

pale vessel
#

tim should i make a caching system or just fetch the data live from the server every time a command is executed?

quartz kindle
#

also, cant bit rate and user limit also be defined in the channel creation options?

#

and after all that, move the user

#

@pale vessel depends

#

if its on a command, you should be safe fetching it

pale vessel
#

for example, prefixes

quartz kindle
#

if its on every single message, cache

pale vessel
#

currently doing that

#

thanks

opaque seal
#

and after all that, move the user
Yeah thanks, anyway something really weird is happening inside my code

pale vessel
#

because it's hard to manage, i have to delete the cache and stuff

quartz kindle
#

yes, if the prefix changes, you have to update both cache and db

pale vessel
#

yep

quartz kindle
#

or delete cache to force refresh

sick cloud
#
    let prefix = message.guild ? client.config.ensure(message.guild.id, defaultConfig).prefix : defaultPrefixes;
    let prefixArray = [`<@${client.user.id}>`, `<@!${client.user.id}>`, prefix];

    if (!prefixArray.find((i) => message.content.toLowerCase().startsWith(i))) return;

this is what i come up with

#

think it should work?

pale vessel
#

i do the latter

earnest phoenix
#

i keep geting this lol

#

raw: '{"error":"Unauthorized"}', body: { error: 'Unauthorized' }, status: 401,

quartz kindle
#

sure should work

pale vessel
#

read the error

sick cloud
#

sweet

earnest phoenix
#

yeah i know what its saying

quartz kindle
#

maybe instead of .find, you can use .some not sure if it has any performance benefit tho

earnest phoenix
#

i just dont know why its saying im not authorised lol

pale vessel
#

can you trace where it came from

#

because we can't do much here

earnest phoenix
#

your talking to me right lol

pale vessel
#

no

quartz kindle
#

lol

earnest phoenix
#

oh lol

quartz kindle
#

yes hes talking to you

earnest phoenix
#

my bad

pale vessel
#

thanks tim

quartz kindle
#

do you know where the error is coming from?

earnest phoenix
#

stop messing with my head hahahah

quartz kindle
#

what are you doing when the error shows up?

#

like, are you making a request to top.gg?

pale vessel
#

sounds cliche

earnest phoenix
#

i just start my bot up

#

ive checked webhook details with my bot files etc and everything is good

quartz kindle
#

did you make any code changes recently?

#

is the error coming from a webhook?

earnest phoenix
#

yes

quartz kindle
#

show the relevant code

earnest phoenix
#

oh no worry i didnt make any changes all i did was upgrade my vps

#

which shouldnt effect it

sick cloud
#

will .some return a boolean?

earnest phoenix
#

raw: '{"error":"Unauthorized"}', body: { error: 'Unauthorized' }, status: 401, headers: { date: 'Mon, 04 May 2020 22:16:06 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '24', connection: 'close',

pale vessel
#

yes

#

it will

quartz kindle
#

yes, .some returns a boolean

pale vessel
#

some and every

quartz kindle
#

@earnest phoenix does the error not show any url? it doesnt really help if we dont know what code is generating that error

pale vessel
#

does it not have a stack trace

sick cloud
#

cool

earnest phoenix
#

'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload', 'x-content-type-options': 'nosniff',

#

might help

pale vessel
#

cloudflare lmao

earnest phoenix
#

why would cloudflare deny me access tho hahaha

pale vessel
#

might be because you changed vps?

#

or upgrade

#

just a speculation

earnest phoenix
#

yeah could of been that

#

guess i just need to wait it out right?

quartz kindle
#

but we still need to know what is being unauthorized

#

which request

clever garnet
#

if (member.hasPermission('KICK_MEMBERS')) {

TypeError: member.hasPermission is not a function
cann someone help

sick cloud
#

it changed to permissions.has

opaque seal
#

Ok thank you Tim, idk how, but just by reordering my functions and putting everything into the create one, it works fine now

grizzled raven
#

yikes

#

i should change that lol

#

wait

clever garnet
#

like this?if (member.permissions.has('KICK_MEMBERS')) {

grizzled raven
#

d.js?

pale vessel
#

yes

#

why wouldn't it be

clever garnet
#

yes

opaque seal
grizzled raven
#

then hasPermission shoudl work

opaque seal
#

maybe member is wrong?

pale vessel
#

yeah

clever garnet
#

theres an error

pale vessel
#

that

clever garnet
#

i defined member

opaque seal
#

where did you get member from?

pale vessel
#

as?

opaque seal
#

Share the code

clever garnet
#

const member = message.author

#

ok

pale vessel
#

it's message.member

quartz kindle
#

message.author is not a member

opaque seal
#

that's not a member

pale vessel
#

author is a user

knotty steeple
#

thats not how it works

grizzled raven
opaque seal
#

message.member

pale vessel
#

yikes

opaque seal
#

message.member works

pale vessel
#

you can delete it

opaque seal
#

If the message is sent in a guild

knotty steeple
#

yea uh

#

delete that

#

and make a new webhook

clever garnet
#

why

neat ingot
#

im working on a redesign for my bots battle system. would here be an appropriate place to ask for feedback on the layout i've chosen?

knotty steeple
#

well

grizzled raven
#

oh yeah

knotty steeple
#

unless u want a webhook token sniped

clever garnet
#

ok

grizzled raven
#

would i just add whatever i need to into my /home/user folder?

clever garnet
#

ill setup a const

knotty steeple
#

also any lurker here couldve gotten it

#

yes

grizzled raven
#

okokok

knotty steeple
#

home is ur home

#

stay at home

#

stay at ~

grizzled raven
#

in a vps

#

ok

clever garnet
#
  const webhook = webhookid
  const reason = message.content.split(" ").slice(2).join(" ");
  const member = message.author
    
  let args = message.content.substring(PREFIX.length).split(" ");
  switch (args[0]){
    case 'kick':

      if (member.permissions.has('KICK_MEMBERS')) {
        if(!args[1]) message.channel.send('Please put a members username.')

        const user = message.mentions.users.first();
  
        if(user){
          const memberr = message.guild.member(user)
  
  
          const embed = new Discord.MessageEmbed().setColor('#099ff').setTitle('Kick command').setDescription(`Looks like someone made a bad choice!\n\n${message.author} kicked ${memberr} from the server!`)
  
          if(memberr){
            memberr.send(`You have been kicked from the server.\n\n**Reason:**\n${reason}`)
            memberr.kick(`Kicked from the server for reason: ${reason}`).then(() =>{
              message.channel.send(embed)
              webhook.send(`${user} was kicked by ${message.author.tag}\n\n**Reason:**\n${reason}`)
            })
  
          }
          if(!memberr){
            message.channel.send(`That isn\'t a member!`)
          }
        }
      break;
        }

    

  }
})```
#

there

pale vessel
#

ok stop

neat ingot
#

ok, you got your contabo vps noob?

grizzled raven
#

yeah

clever garnet
#

now what do i do

grizzled raven
#

accidentally got a german vps but eh

pale vessel
#

member.permissions?

knotty steeple
#

what linux distro

pale vessel
#

is that a thing in djs

clever garnet
#

thats what i was told

grizzled raven
#

ubuntu

neat ingot
#

i just use 'putty' on windows to ssl into the host, then i have a custom 'bot' folder in the root folder

grizzled raven
#

same as last vps

neat ingot
#

you can also use filezilla

opaque seal
#

member.permissions?
yeah

knotty steeple
#

dont use root

neat ingot
#

to just mass transfer files

knotty steeple
#

ok its a vps who cares

neat ingot
#

lol

knotty steeple
#

but i still wouldnt use root

neat ingot
#

root is default folder it puts you in when ssl, which is why i chose there

#

it would be best to have a different directory, but for my ease in testing...

clever garnet
#

what do i do

knotty steeple
#

u know u can just login to a different user

pale vessel
#

make a new user

neat ingot
#

yea after you make one 😄

knotty steeple
#

ok

#

so

pale vessel
#

yeah

neat ingot
#

which tbf, is best practice

clever garnet
#

what do i do

pale vessel
#

chill

knotty steeple
#

a user with sudo > root

pale vessel
#

you could fuck a lot of things with root

#

like perms

neat ingot
#

yea for sure

clever garnet
#

im being ignored

neat ingot
#

you are yes

#

😄

clever garnet
#

yes

pale vessel
#

and we know too lol

grizzled raven
#

i wasnt in root but i made my own folder, /Starboard lmao

neat ingot
#

whats your issue mr quick?

pale vessel
#

they sent a code

clever garnet
#
  const webhook = webhookid
  const reason = message.content.split(" ").slice(2).join(" ");
  const member = message.author
    
  let args = message.content.substring(PREFIX.length).split(" ");
  switch (args[0]){
    case 'kick':

      if (member.permissions.has('KICK_MEMBERS')) {
        if(!args[1]) message.channel.send('Please put a members username.')

        const user = message.mentions.users.first();
  
        if(user){
          const memberr = message.guild.member(user)
  
  
          const embed = new Discord.MessageEmbed().setColor('#099ff').setTitle('Kick command').setDescription(`Looks like someone made a bad choice!\n\n${message.author} kicked ${memberr} from the server!`)
  
          if(memberr){
            memberr.send(`You have been kicked from the server.\n\n**Reason:**\n${reason}`)
            memberr.kick(`Kicked from the server for reason: ${reason}`).then(() =>{
              message.channel.send(embed)
              webhook.send(`${user} was kicked by ${message.author.tag}\n\n**Reason:**\n${reason}`)
            })
  
          }
          if(!memberr){
            message.channel.send(`That isn\'t a member!`)
          }
        }
      break;
        }

    

  }
})```
```TypeError: Cannot read property 'has' of undefined```
pale vessel
#

permissions probably

knotty steeple
#

what user are u on then @grizzled raven

opaque seal
#

Just look up the doc you'll find all your answers on there https://discord.js.org/#/docs/main/stable/general/welcome

clever garnet
#

i need help

neat ingot
opaque seal
#

The doc is there for you

neat ingot
#

thats some sample code i use for permissions

smoky spire
#

@clever garnet users don't have perms, members do

clever garnet
#

what do i do

pale vessel
#

read docs

knotty steeple
#

message.member

#

im sure they already told u that

clever garnet
#

where

pale vessel
#

whatdoidowhatdoido

opaque seal
#

read docs
yeah man, someone could code that for you but you wouldn't learn anything

pale vessel
#

poor developers generated a well-designed docs but no one uses it

knotty steeple
#

u know in the actual kick they are trying to get the member right

#

i guess

neat ingot
#

yea, tbf, i had coded it, bbut they are right, you should read over the docs

knotty steeple
#

so why wont they use that same thin

#

thing

pale vessel
#

because pepega

grizzled raven
#

oh that was last time

#

also

#

i hate setting stuff up

pale vessel
#

you have to

neat ingot
#

same

grizzled raven
#

because i use better sqlite the process is 600x longer/harder

pale vessel
#

i have apache2+PHP, mysql and vsftpd

#

for my stuff

#

and screen

neat ingot
#

i use nginx, and docker containers

grizzled raven
#

i could ask my old provider

#

but

pale vessel
#

please continue

#

don't leave me hanging

knotty steeple
#

tmux over screen

grizzled raven
#

how on earth do i fix this i forgot

neat ingot
#

lol

pale vessel
#

install python and stuff

#

and then gyp

neat ingot
#

yea, do updates and install any tools you might use

grizzled raven
#

ik its something to do with python and gyp but like

quartz kindle
#

sudo apt-get install build-essential

neat ingot
#

tim to the rescue again lol

grizzled raven
#

thank you, you are a kind man

#

wait

pale vessel
#

command spoonfeed

grizzled raven
#

is it "you are a kind man, thank you"?

pale vessel
#

or something

pale vessel
#

both works

grizzled raven
#

nah its not spoonfeed im writing it word for word so im not copying

neat ingot
#

lmao

pale vessel
#

fair enough

neat ingot
#

best logic

quartz kindle
#

lmao

grizzled raven
#

xd

pale vessel
#

kind good

neat ingot
#

anyone have any idea how one would implement sharding into a bot that runs within a docker container? is it possible to have my shards run in different containers? and on different servers entirely?

quartz kindle
#

possible yes

#

but not that easy

delicate zephyr
#

thats called clustering and yes it is possible, but you can find Libraries to help you do so

quartz kindle
#

you can configure each shard with a specific shard id or array of shard ids

#

and set them all to the same total shard count

neat ingot
#

oh, i can? i thought discord js forced the shard id with its manager thing.

quartz kindle
#

but you need to manually control their connections, because they cannot connect concurrently

neat ingot
#

so im guessing then i wouldnt use the default manager and would have to implement my own?

grizzled raven
#

yes

#

big brain code time

#

my bot will die in 18 mins i need to setup this vps fast

delicate zephyr
#

so for example you would have to do (for simplest solution)

Cluster 1:

  • Shard 1
  • Shard 2
  • Send ready to spawn to cluster 2
    Cluster 2:
  • Shard 3
  • Shard 4
quartz kindle
#

you'd need a centralized process that the shards connect to, in order to coordinate logins

delicate zephyr
#

^

neat ingot
#

yea, thats no issue really

quartz kindle
#

or keep hitting discord's identify rate limits until it lets you connect lmao

neat ingot
#

my intent was them to connect to website to pass data on user count etc to website anyway

#

i can easily have some website api endpoint that handles some extra stuff

quartz kindle
#

sure

neat ingot
#

sweet, as long as possible i'll figure it out when that time comes 😄

quartz kindle
#

another thing is that rest rate limits are global

knotty steeple
#

how tf are u missin make

quartz kindle
#

so your shards wont be aware of how much the other shards are using the rest api

knotty steeple
#

also do u have base-devel installed

quartz kindle
#

but that would only be a problem if you use cross-shard rest requests

neat ingot
#

ahhh, thats a fair point

#

nah i shouldnt need to be doing that tbh

quartz kindle
#

like requesting data for guilds that are in other shards

neat ingot
#

at most it'd be sending a report embed to my own server

#

but can easily change that to send to website and save in file or some junk

grizzled raven
#

feel like my db is growing too fast

#

@quartz kindle how big is ur db again?

quartz kindle
#

let me check

grizzled raven
#

oh great it worked

#

ok now

quartz kindle
#

14mb in the main file, 4mb in the wal file

#

possibly more in memory, the file size doesnt necessarily reflect the true database size while its running

neat ingot
#

what kind of db do you use? sql?

quartz kindle
#

sqlite

neat ingot
#

i dont like sql query syntax 😄

quartz kindle
#

i kinda do lmao

#

i like it that its consistent across a multitude of sql libraries, drivers, databases and implementations

neat ingot
#

tbf its not that bad, and is pretty explicit, but i like how mongoose gives me better readabilities

quartz kindle
#

i find mongoose schemas confusing lmao

#

but i never really tried learning them anyway

neat ingot
#

nah i lub them ❤️

#

i made a custom loader thing to make managing my models easier 😄

quartz kindle
#

xD

neat ingot
#

super easy to define properties, and very explicit in what it allows 🙂

delicate zephyr
#

gotta love mongoose

neat ingot
#

^

quartz kindle
#

im too used to js's dynamic typing

#

anything that is typed confuses me

onyx hare
#

Ok so how would I fix discord-giveaway/src/master.js cuz my bot decided to pack in and “Master.js is not formatted properly”

neat ingot
#

step 1 - find issue
step 2 - fix

onyx hare
#

I uninstalled and reinstalled it hoping it’d fix

#

But nothing I could be on an outdated npm ¯_(ツ)_/¯

neat ingot
#

might help us to know what master.js is or does?

onyx hare
#

I’ll grab it ina sec just need to reboot laptop

quartz kindle
#

i cant even find that repo

#

i found discord-giveaways and discord-giveawaybot but not discord-giveaway

knotty steeple
#

mongoose confused

onyx hare
#

It’s the giveaways one

neat ingot
#

there is no file called 'master' within the src directory of discord-givaways

#

there is a 'manager'

onyx hare
#

Ya that I got it confused with another file

quartz kindle
#

so what is the actual error and the actual file?

onyx hare
#

Now loading into discord on my browser to post error

quartz kindle
#

and stack trace if possible

onyx hare
#
    at GiveawaysManager._initStorage (C:\Users\name\Desktop\Giveawaybot\giveaways-bot-master\node_modules\discord-giveaways\src\Manager.js:325:27)
(node:10156) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10156) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Logged in as Giveaway Bot#5363!
Ready to serve in 75 channels on 3 servers, for a total of 44 users.
(node:10156) UnhandledPromiseRejectionWarning: The manager is not ready yet.
(node:10156) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)```
#

i dunno as im new to compexed bots ¯_(ツ)_/¯

#

complexed*

neat ingot
#

when did you download the code for this bot?

onyx hare
#

about 3 days ago

neat ingot
#

_initStorage is not a function within the current version uploaded

#

and 2 days ago a fix for storage was uploaded

#

i'd redownload it and see how you get on 🙂

earnest phoenix
#

How Can I Record Data on My Bots

onyx hare
#

oh i got an older then

neat ingot
#

lol yea yours is out of date 😄

quartz kindle
#

that means the file is either corrupted or wrongly formatted

#

if you have an existing file, delete it and let the package remake it
the default file is giveaways.json

earnest phoenix
#

How Can I Record Data on My Bots

neat ingot
#

thats a very vague question. what kind of data?

#

i mean, i could answer 'in a database', but im guessing you want more info than that?

tardy estuary
#

db would probably be most flexible

onyx hare
#

I updated the files but still get the same error 😫

quartz kindle
#

did you do what i said?

#

delete your giveaways.json file

clever garnet
#

if (member.permissions.has('KICK_MEMBERS')) {
TypeError: Cannot read property 'has' of undefined
im using discord.js

#

how do i fix dat

quartz kindle
#

did you fix your member like people said before?

#

message.author is not a member

clever garnet
#

what do i do

#

i didnt understand what they meant to do

quartz kindle
#

discord.js has two different things: User and Member

clever garnet
#

so what do i do

quartz kindle
#

User has things like username, profile picture, etc
Member has things like nickname, roles and permissions

#

message.author = User
message.member = Member

clever garnet
#

alright

#

testing it rq

#

alright it works now imma quickly make it say that u dont have permission

#

thanks

lyric mountain
#

So, I've solved my issue

neat ingot
#

🥳

lyric mountain
#

For those reading: The expected payload for the oAuth2 token endpoint IS NOT A JSON, but an url encoded string

#

This could be useful if someone else faces this issue (oAuth2 call returning invalid_grant)

neat ingot
#

'a url' is grammatically correct as 'url' when said has a 'y' sound as the first sound which is not a vowel sound. ~ at least, thats the logic i got taught with

#

'you-are-ell'

quartz kindle
#

what the fuck

#

lmao

lyric mountain
#

I still correct myself whenever I write a word with a vowel as the first letter

neat ingot
#

he correct a to an 😛

quartz kindle
#

i also say an url

sudden geyser
#

english is wack

neat ingot
#

lol, maybe im the wrong one 😄

quartz kindle
#

doesnt written grammar have priority over spoken sound?

neat ingot
#

what self respecting programmer prioritizes spoken over typed? 😄

lyric mountain
#

The way I was taught was "don't let A stay near other vowels, they'll fight one another"

neat ingot
#

lmao

lyric mountain
#

So put a N between them to make them friends

quartz kindle
#

lmao

lyric mountain
#

Little things like this really help memoing things, just like bodmas

neat ingot
#

woot, english level +1

#

'an hour' is a great example

heavy marsh
#
//Check If User Was Kicked!
const fetchedLogs = await member.guild.fetchAuditLogs({
    limit: 1,
    type: 'MEMBER_KICK',
});

const kickLog = fetchedLogs.entries.first();
if (!kickLog) return;
const { executor, reason, target } = kickLog;
  
var embed = new discord.RichEmbed()
    embed.setAuthor(`Member Kicked | ${member.user.tag}`, member.user.displayAvatarURL);
    embed.setColor(`#ffff00`);
    embed.setDescription(`**Member ${member.user} Kicked by ${executor}**`);
    embed.addField('User', `${member.user.tag} \`[${member.user.id}]\``, true);
    embed.addField('Moderator', `${executor.tag} \`[${executor.id}]\``, true);
    embed.addField('Reason', reason || `No reason given`);
    embed.setThumbnail(member.user.displayAvatarURL);
    embed.setTimestamp();
    embed.setFooter(`Member ID: ${member.user.id}`);

member.guild.channels.get(`707008340126859314`).send(embed);

I am trying to get the audit logs to see if a user is kicked.
But even if the user is not kicked it goes as the user is kicked. How can I fix this?

#

Using discord.js (v 11.4.2)

topaz fjord
#

wait

#

shit

heavy marsh
#

👀

topaz fjord
#

wait

#

no im right

heavy marsh
#

Like this

topaz fjord
#

ye

#

if it isn't

#

return

#

if it is, continue

heavy marsh
#
//Check If User Was Kicked!
const fetchedLogs = await member.guild.fetchAuditLogs({
    limit: 1,
    type: 'MEMBER_KICK',
});

const kickLog = fetchedLogs.entries.first();
if (!kickLog) return;
const { executor, reason, target } = kickLog;

if (target.id === member.id) {
var embed = new discord.RichEmbed()
    embed.setAuthor(`Member Kicked | ${member.user.tag}`, member.user.displayAvatarURL);
    embed.setColor(`#ffff00`);
    embed.setDescription(`**Member ${member.user} Kicked by ${executor}**`);
    embed.addField('User', `${member.user.tag} \`[${member.user.id}]\``, true);
    embed.addField('Moderator', `${executor.tag} \`[${executor.id}]\``, true);
    embed.addField('Reason', reason || `No reason given`);
    embed.setThumbnail(member.user.displayAvatarURL);
    embed.setTimestamp();
    embed.setFooter(`Member ID: ${member.user.id}`);

member.guild.channels.get(`707008340126859314`).send(embed);
} else {
return;
}
#

Like this?

pale vessel
#

what a mess

topaz fjord
#

you could just do

neat ingot
#

id single line it

#

if (target.id !== member.id) return;

topaz fjord
#
if (target.id != member.id) return;
heavy marsh
#

!==

#

or !=

neat ingot
#

!==

#

!== is explicit with type checking, != is not and can lead to false positives

heavy marsh
#

OOh ok

neat ingot
#

tbf for this occasion either would be fine

topaz fjord
#

it can't be type converted anyways

#

well it can

neat ingot
#

String->Number<->

topaz fjord
#

but it wont give false positives

#

turning the string into the number would break it

#

node can't handle bigints

neat ingot
#

ahhh fair

heavy marsh
#
bot.on('guildBanAdd', async (guild, user) => {
const fetchedLogs = await guild.fetchAuditLogs({
    limit: 1,
    type: 'MEMBER_BAN_ADD',
});

const banLog = fetchedLogs.entries.first();
if (!banLog) return;

const { executor, reason, target } = banLog;
if (target.id !== user.id) return;

var embed = new discord.RichEmbed()
    embed.setAuthor(`Member Banned | ${user.tag}`, user.displayAvatarURL);
    embed.setColor(`#ff7e5f`);
    embed.setDescription(`**Member ${user} Banned by ${executor}**`);
    embed.addField('User', `${user.tag} \`[${user.id}]\``, true);
    embed.addField('Moderator', `${executor.tag} \`[${executor.id}]\``, true);
    embed.addField('Reason', reason || `No reason given`);
    embed.setThumbnail(user.displayAvatarURL);
    embed.setTimestamp();
    embed.setFooter(`Member ID: ${user.id}`);

bot.channels.get(`707008340126859314`).send(embed);

});
neat ingot
#

i'd still do the !== 😄

heavy marsh
#

So this will also be correct right?

topaz fjord
#

ye

quartz kindle
#

if both are strings, it doesnt matter which one you use

heavy marsh
#

Both are strings

#

Also is guildBanRemove correct?

pale vessel
#

please read the docs if you're unsure

#

you're making yourself look silly by asking simple things jere

#

jere

neat ingot
#

gj

pale vessel
#

i had one job

heavy marsh
#

gj*

topaz fjord
heavy marsh
#

gj?

pale vessel
#

good job

topaz fjord
#

good job

neat ingot
#

^

topaz fjord
#

haha

#

too slow

earnest phoenix
#

how long would lavalink setup take

#

because I need to get the play feature working

pale vessel
#

10 seconds

earnest phoenix
#

how long would coding the play command take

pale vessel
#

just play? probably 8 minutes

earnest phoenix
#

do you know the pros vs the cons of using lavalink over ytdl-core

#

wanna know how much I'm sacraficing

smoky spire
#

They're completely different things

earnest phoenix
#

it's performance vs availability

neat ingot
#

whats lavalink?

#

googles

earnest phoenix
#

want good performance? use your own audio streaming
want easy setup and code that can be written in 3 minutes? use lavalink

#

I'll give lavalink a shot, I'm hosting this in the clouds anyway

icy crane
#

im so confused, whats the difference between .position and .rawPosition in djs, I just evaled a role in my server but they came out with the same number

#

and which one is better to use for role position?

earnest phoenix
#

position is the position of the role in the cache

#

rawPosition is what's returned by discord

icy crane
#

would there ever be a difference in the two? like when using them for role position?

#

well, obviously there would

#

but like, I dont know which one to use lol

earnest phoenix
#

no idea, i don't use d.js

smoky spire
#

Use position

#

It exists for a reason

icy crane
#

well they both exist for a reason

sick cloud
#

what sort of things should be configurable for a music bot

#

ie on a guild conf level

icy crane
#

channels it responds in for sure, at least i would recommend that

neat ingot
#

yea, the rooms its allowed to play music in, and be controlled in

sick cloud
#

blacklisted/whitelisted channels?

pale vessel
#

vote skip

sick cloud
#

can do

#

yep

icy crane
#

dj if you havent yet

neat ingot
#

maybe saving playlists? 😄

sick cloud
#

dj?

#

yep playlists is planned

pale vessel
#

when you want maximum customization

neat ingot
#

>play mycustomplaylist

icy crane
#

people that can bypass vote locked actions

#

like

#

vote skips

sick cloud
icy crane
#

the dj can bypass that

sick cloud
#

oh i see

#

yep

#

like a bot admin role of sorts

icy crane
#

yeah kinda

sick cloud
#

i also have queue shuffling and sc/spotify support planned

#

any others?

neat ingot
#

>play guildthememusic

pale vessel
#

what

neat ingot
#

let guilds set a specific music as theme

#

😄

#

pointless i know, but lets face it, most commands are...

astral yoke
#

wait i got an easy question that people probably find me retarded for asking, but if you mention someone like !hi @astral yoke how would you make it so it sends it back as the id like what message.author.id does

oak cliff
#

you would have to get the user from the mentions

#

i assume youre using discord.js ?

astral yoke
#

discord.js 11

astral yoke
#

ty

oak cliff
#

yw :)

astral yoke
#

Congrats on Moderation!

oak cliff
#

ty :)

astral yoke
#

❤️

amber fractal
#

Cache

#

Almost surely anyways

mystic violet
#

My bot hasn't been booting for a day now, i have no idea why, its not giving me the ready event

#

It worked all before

#

I restarted my pc, reinstalled d.js, re-ran console, reset the db

#

I've tried everything ablobsweats

earnest phoenix
#

Welp

mystic violet
#

my internet speeds and everything are okay too

earnest phoenix
#

No errors?

mystic violet
#

Im so confused

#

no errors

#

just not loading ready lol

#

or any events

#

in that case

#

no sharding or anything

earnest phoenix
#

Maybe firewall issues?

#

Idk if that could affect the bot tho

mystic violet
#

Ill reinstall node

#

see if it works

#

lol

#

reinstalled node

#

no progress

#

smh

#

wow

#

now none of my dms are working

#

thats great

#

I was fukin right

#

lol

#

they're having connection issues

#

bad discord

neat ingot
#

did you try refreshing your bot token?

#

i had an issue before where i was rebooting my bot too fast (thanks nodemon) and discord invalidated my bot token, had to renew

mystic violet
#

@neat ingot yeah I did

#

thanks for asking though, still not booting

lyric mountain
#

What error does the console throw?

magic jackal
#

What am I doing wrong here, I'm trying to return the error that the Missing permissions is mentioning in console.

#
msg.channel.send(new Discord.MessageEmbed()
        .setTitle('Respect Found')
        .setDescription(`<@${msg.author.id}> has paid their respects. :pray: :regional_indicator_f:`)
        .setColor('#003cff')
        .setTimestamp()
        //.setFooter(msg.author.tag)
        .addField('Server Respects', `\`${fcount}\``, true)
        .addField('Total Respects', `\`${total}\``, true)
        //msg.reply(`has paid their Respects. :regional_indicator_f: :pray:\nTotal Respects: \`${total}\`\nRespects Paid on this guild: \`${fcount}\``)
        ).catch(console.error + "tadjklfaklsdjhfklajsdhfjklhfd")```
#

.catch() does nothing

pliant urchin
#

try .catch(e => console.error(e + "ysissgsish"))

magic jackal
#

mk

lyric mountain
#

Yeah, that catch is not a valid callback

magic jackal
#

ah i see

pliant urchin
#

Wut what are the conditions to make a say cmd

lyric mountain
#

Errrr...make the bot say?

pliant urchin
#

hmm yes

#

Surprisedpikachu many bots are getting denied due to say cmd

lyric mountain
#

I don't think so

#

Bots get denied for anonymous PM messenger

#

Not for say commands

undone carbon
#

Is it possible to get the hex color of a role? If so how? Djs

pliant urchin
#

GWcmeisterPeepoShrug hmm ok

lyric mountain
#

@undone carbon transform the integer to rgb values, then convert to hex

undone carbon
#

I'm newly coding, no idea about that sorry

pliant urchin
#

@undone carbon <Role>.hexColor

pale vessel
lyric mountain
#

Yeah, there's always a pre-made function

pale vessel
#

oh ye

#

fast boi

pliant urchin
#

lol

lyric mountain
#

But byte shifting is fun

pale vessel
#

you're a masochist then

lyric mountain
#

But it feels soooo good to directly manipulate bytes or have chained conditionals to the fifth level

neat ingot
#

member.displayHexColor gets you the color the member has in the member list

#

i use it in my embeds

#

^

lyric mountain
#

Excuse me messieur, are you by chance using iexplorer?

tardy estuary
#

ew

queen needle
#

whats iexplorer

lyric mountain
#

A miserable little pile of timeouts

tardy estuary
#

trash

neat ingot
#

ie is removed everywhere but our memory 😄

tardy estuary
#

except US government and US healthcare computers

neat ingot
#

HA

#

claps

lyric mountain
#

It's actually still present in windows 10, just write iexplorer in the search bar

#

They keep it together with edge

neat ingot
#

lol yea, its still there, its so ingrained into windows microsoft literally cant get rid of it without breaking things

tardy estuary
#

MS went ahead and upgraded edge (or is currently doing that) on Win10 machines to be chromium based

pale vessel
#

at least it's better

neat ingot
#

edge is already chromium based

tardy estuary
#

but idk why they wont just remove IE tbh. or have IE actually launch edge chromium

#

it is now

#

it wasnt prior

neat ingot
#

they did it cause google slowed down youtube on browsers that werent chromium

#

which made edge seem slower, even though it was faster by a long while

tardy estuary
#

to like, a few weeks ago tbh. it only went into stable this year I believe

neat ingot
#

quite a political affair tbh

lyric mountain
#

Edge is a bit better, but I still can't believe it's not butter

tardy estuary
#

bleh at work I am supposed to do my web dev with IE11 in mind, to make sure that handful of users can still use the application. but I totally dont. fuck em

neat ingot
#

nice

#

tbf, yea, anyone whos trying to run ie over edge, chrome, firefox, opera even, doesnt deserve compatibility

pale vessel
#

unless they're forced to

tardy estuary
#

boomers gonna boom

neat ingot
#

whomever is forcing them should be sent to prison

#

thats a form of serious assault

uncut river
#

what's something that can use a lot of disk, but almost no ram. or does disk usage = ram usage

tardy estuary
#

reading/writing to a harddrive(disk)

#

ram usage = running application or something stored in memory. disk usage (im assuming you mean something like high % usage from windows task manager) could be something reading or writing from/to disk

magic jackal
#

I need a git master, can someone assist me with this damn repo, I need to remove a branch and it might be easier to explain in Voice.

clear wraith
#

Hey...

#

Is there a way I can make this allowed to myself or a certain role?

#

Code: ```const db = require('quick.db')
const discord = require('discord.js')

exports.run = async (client, message, args, config) => {

if (!message.member.hasPermission('MANAGE_GUILD')) { // if message.author / member does not have the permission MANAGE_GUILD, return.
    return message.channels.send('You\'re missing the permission `MANAGE_GUILD` to use this command.').then(msg => {
        setTimeout(() => {
            msg.delete()
        }, 2500); // delete after 2.5 seconds.
    })
}

let user = message.mentions.members.first() || message.author

if (isNaN(args[0])) return message.channel.send(`${message.author}, you need to input a valid number to remove.`) // if args[0] (first input) is not a number, return.
db.add(`money_${user.id}`, args[0])
let bal = await db.fetch(`money_${user.id}`)

 let embed = new discord.MessageEmbed()
.setAuthor(`Added Money!`, message.author.displayAvatarURL)
.addField(`Amount`, `${args[0]}$`)
.addField(`Balance Updated`, `${bal}$`)
.setColor("GREEN") 
.setTimestamp()


message.channel.send(embed)

}```

sudden geyser
#

Check the first arg to see if it's your user ID, or if the member has a role (<GuildMember>.roles), or your final check of if the member has MANAGE_SERVER. By the way, I think it's MANAGE_GUILD.

#

You also don't need to do setTimeout(() => msg.delete(), 2500), as there's an option to delete a message with a timer.

#

or even author.displayAvatarURL as it's a function in v12.

clear wraith
#

ok

#

If i want it to be my userid that can access this command would i do...

sudden geyser
#

You'd check the if condition and have it check if the message author has the same ID as you.

clear wraith
#

if (!message.member.hasUserID('userid'))

sudden geyser
#

hasUserID is not a function.

clear wraith
#

oh

sudden geyser
#

There's a property for the ID.

#

It's in the docs.

clear wraith
#

ok

#

Thx

earnest phoenix
#

im gonna use Andesite for my music funtion

small prairie
#

How do we fetch all presences of a guild in d.js v12?

earnest phoenix
small prairie
#

arent these just cached ones?

#

or these are all?

earnest phoenix
#

GWhurpyShrug i just checked the docs

#

should be all

small prairie
#

these are just cached ;-;

#

but thanks for trying to help ^_^

sudden geyser
#

Would it make sense to say, "Joined At", or, "Joined On"?

earnest phoenix
#

Depends on if its a time like 7pm or just the date

#

i'd say if its both, do "joined on 2/2/2022 at 2:22PM"

neat ingot
#

i dont bother with on or at, theya re both 'filler'

earnest phoenix
#

i wen't the extra step and just even make a custom timestamp resolver because i'm stupid GWhurpySip

neat ingot
#

u know moment.js is a thing? 😄

#

(assuming your using js)

jade shadow
#

Hey everyone

#

@client.command()
async def start(ctx):
await ctx.send('Hi! How can I help you? choice 1 choice 2')
async def check(m):
return m.content == 'choice 1'

msg = await client.wait_for('message', check=check)
await ctx.send('dc info test')
#

When you do .start

#

it doesnt matter what your response is after it says Hi! How can I help you? choice 1 choice 2

#

but I want it to respond with: 'please specify a valid option' if you dont put in an actual choice

#

help pls

sudden geyser
#

Hope, I have it as a field title like this:

Joined At
January 6th, 2020

It really doesn't mean anything but I'm interested if it's "At" or "On". I already have the "Joined Discord" in the footer timestamp and "Joined Server" would be weird imo (Dekita).

neat ingot
#

fair enough i guess 😄

#

for just the date i'd use 'on'

ornate wagon
#

Kiss your self man

earnest phoenix
#

please help

#

how do i turn this string to an epoch miliseconds since 1 jan 1970?

#

Tue May 05 2020 01:24:44 GMT-0500

hoary elm
summer torrent
#

epochtimestamp * 1000

icy crane
#

So I am trying to make a function that gets exported into other commands so I dont have to rewrite the same code over and over, and it involves dbl.hasVoted() which isnt the problem at all, that works fine. I'm just having a problem getting the function to actually return the right values. If the user has voted, return true, if they havent, return false. If I console log INSIDE of the function, the correct values are being recorded, but if I console log the function itself in a command, it returns undefined.

Here is the code for the vote function thing

    voted: function(dbl, message) {
        dbl.hasVoted(message.author.id).then(v => {
            if (v) return true;
            if (!v) return false;
        })
    }

again, I am having a problem with the function returning the correct values, not the dbl api

#

and this is how I am calling the function.

const voted = require('../../functions').voted;

console.log(voted(client.dbl, message))
shut inlet
#

hey so im getting

-----economy-----
Error: coins.js => TypeError: cmd is not a constructor

And this is my code, ive looked on stack and found nothing can anyone help?

const {Command} = require("../../lib");
const {MessageAttachment} = require("discord.js");
const fetch = require("node-fetch");
const randomPuppy = require("random-puppy");
const Money = require("./models/money.js")

module.exports = class Money extends Command {
    constructor() {
        super("coins", {
            description: "coins system",
            usage: "!coins",
            aliases: ["coins"],
            cooldown: 5000
        });
    }

    async run(message, args) {
        let coinstoadd = Math.ceil(Math.random() * 50);
        console.log(coinstoadd + "coins");
        Money.findOne({userID: message.author.id, serverID: message.guild.id}, (err, money) => {
            if(err) console.log(err);
            if(!money){
                const newMoney = new Money({
                    userID: message.author.id,
                    serverID: message.guild.id,
                    money: coinstoadd,
                })

                newMoney.save().catch(err => console.log(err));
            }else{
                money.money = money.money + coinstoadd;
                money.save().catch(err => console.log(err));
            }
        })


    }
};
cinder patio
#

You aren't returning anything in the function, you can do return dbl... @icy crane

icy crane
#

uh well, I figured out my problem, the way i solved it didnt make a lot of sense, but thanks for reading

cinder patio
#

There is a better way of doing this but ok

shut inlet
#

Google, any advice mate?

#

wait

#

fuck my life ik

#

it should be in events folder not cmd folder

#

oof

#

disregard that

cinder patio
#

are you sure the error is coming from there? cmd isn't mentioned once

#

oh ok

bright oar
#

How have you setup your webhook to use on_dbl_vote? I tried portforwarding, but now the port doesn't open. Is there a way to do it online?

queen needle
#
if (message.content.startsWith(prefix + "nick")) {
    if(!args[0]) return message.reply("Please include a nick name")
    client.user
      .setNickname(args)[0]
      .then(user => message.reply(`My new nickname is ${user.nickname}!`))
      .catch(console.error);
  }```
#

why doesn't my nick name command work

cinder patio
#

You are passing an array of args instead of the first argument to .setNickname

queen needle
#

oh

cinder patio
#

And also you are trying to access a property with the name 0 on a promise

queen needle
#

how>

#

?*

#

cause i know i had to change .setNickname(args[0])

cinder patio
#

.setNickname(args)[0]

#

yeah

#

that's correct

queen needle
#

it doesnt work

cinder patio
#

well do you get any errors?

queen needle
#

client.user.setNickname is not a function

cinder patio
#

client.useris a User object, and users are not related to guilds

#

To change your bot's nickname you can do message.guild.me.setNickname(...

#

guild.me returns the bot as a GuildMember of the guild

queen needle
#

is there a way i could make it change my nickname not the bots?

cinder patio
#

specifically yours, or the person who is doing the command?

queen needle
#

the person doing the command

cinder patio
#

message.member returns the GuildMember who does the command (It will be undefined if the command is done in DMs, so make sure to check for that)

queen needle
#

for that can i just use

#

if(message.author.bot) return;

cinder patio
#

well no

#

That checks if a bot sent the message

queen needle
#

oh

nocturne grove
#

a new statement was found but no delimiter was found between it and the previous one How to solve this MySQL error? It's really annoying. We are just using

UPDATE settings SET desc = '${desc}' WHERE guildid = ${msg.guild.id}```
nocturne grove
#

nvm, never call a column desc 😂

queen needle
#

how could i create a command with canvas like a triggered command

#

so it takes their profile picture and puts it on a image of the triggered gif

restive furnace
#

why everyone uses 1 cmd per file, even on js i have made succesfull command handler what supports even 50 cmds per one file

delicate zephyr
#

Because it's easier to manage when it's done correctly

queen needle
#

yeah

delicate zephyr
#

Like for me, I have command folder -> category folders -> commands in relative categories

#

And it's all automated etc

queen needle
#

for me i have index.js

next remnant
#

why everyone uses 1 cmd per file, even on js i have made succesfull command handler what supports even 50 cmds per one file
I don't
I have a cogs directory with each cog in a separate file loaded as dpy extention

#

Cogs are based on category so it makes it easier to categorize the help command

queen needle
#

its easier for me to have all commands in one ile

#

file

modest maple
#

no

#

thats bad practice

next remnant
#

How many commands?

queen needle
#

i have about 45

next remnant
#

That's bad

#

You probably should separate it in files

queen needle
#

im using glitch for it because im a disappointment and the way glitch works idk how to switch to a command handler

wide ruin
#

how do i run a .js file?

#

i tried npm start and it just does that

earnest phoenix
#

Syntax error, show us the file

wide ruin
#

line 1 char 1

#

const { app, BrowserWindow } = require('electron')

#

thats the first line

earnest phoenix
#

well afaik that only shows up when you run it with double clicking on it

wide ruin
#

i didnt though

#

i did npm start

earnest phoenix
cinder patio
#

You run an electron project with electron file.js

#

afaik

wide ruin
#

thats just the example from their docs though

cinder patio
#

well their start script is probably electron file.js, while yours may be the default node index.js

earnest phoenix
#

People's of top.gg are checking my bot now already 2 days

#

Do u guys love scripting

#

It's a little bit hard but it's cool!

#

wait 1 weeks, and yeah coding is nice GWloopyGok

gilded plankBOT
quartz kindle
#

@wide ruin you're trying to use electron?

#

thats not how it works

#

you code the js file, then you make it your main file in your package.json, then you double-click the electron.exe to run it

#

you have to download the electron prebuilt demo package for your system

#

or you can run it with npm start, after you configured your package.json to use electron instead of node

mossy vine
#

so im trying to apply this in flask but just some pointers for a general implementation would be nice too
how could i return 2 pieces of data, png and text with 1 http response from a (flask) webserver? just return the png data as regular and text in header?

modest maple
#

how are you sending / planning to send the png data

#

byte array?

earnest phoenix
lofty cedar
#

Why my bot doesn’t write in testing and it isn’t off because on my server it work

honest perch
#

what prefix?

lofty cedar
#

!

shut inlet
#

ok i need help, my bot when i mute someone adds / removes the role fine. however they can still talk and shit

honest perch
#

thats why

summer torrent
#

! is common prefix

lofty cedar
#

And

honest perch
#

mulzy that means the role has perms

shut inlet
lofty cedar
#

K

shut inlet
#

no but i overide it

#

look

shut inlet
pure totem
#

hiii I’m new hereee how do I make a bot .w. star2

copper fog
mossy vine
#

@modest maple i have no idea, how should i? omegalul

copper fog
#

I tried margin but nothing

hasty sparrow
#

Could be padding

modest maple
#

@mossy vine i mean you could a byte array, or just serve the static file as url with the text both in the data

mossy vine
#

ok wait so i have a python package that will generate me an svg, but i need to send that as png

#

and along with that png i also need to send some text data

modest maple
#

btye array ig then

pure totem
#

oop can anyone answer my question-

modest maple
pure totem
#

oop-

#

ty

copper fog
#

Padding still nothing

hasty sparrow
#

Inspect element and find out what's causing the spacing

copper fog
#

Ohk

#

But my HTML editor doesn't allow me to inspect the built in browser in my HTML Editor

shut inlet
#

someone pls help me

hasty sparrow
#

Then stop using the built-in browser and use a proper one

copper fog
#

:/

#

What if I told you

#

That I'm coding

#

on mobile?

mossy vine
#

what if we told you not to

#

because its a bad idea in general

copper fog
#

my computer broke

earnest phoenix
#

F

#

coding on phone is really a bad idea tho

wet dove
#

yeah

copper fog
#

What do I use then :(

earnest phoenix
#

a pc

#

or atleast something better than a phone

#

xD

#

or laptop

#

you would even be able to code on a raspberry pi

copper fog
#

I only have a phone and currently broke asfpepowot

earnest phoenix
#

maybe ipad will work ??

#

@copper fog R.I.P

#

F

copper fog
#

okeh i have no other choice but to code in phone

earnest phoenix
#

rip then

#

ye

#

good luck bro

copper fog
#

Is my problem I'm having.. gonna be solved..?

slender thistle
#

Remove margin/padding catshrug

#

or move the elements

copper fog
#

Removing margin/padding doesn't do anything

#

It just made my website messy

pulsar bloom
#
    if str(ctx.guild.id) == "264445053596991498":
        pass  ```
#

Still responds

slender thistle
#

Maybe you meant return

pulsar bloom
#

Let me try

turbid apex
honest perch
#

it should post automatically

#

tbh all you need are the first two lines

earnest phoenix
#

"Incorrect string value: '\xF0\x9F\x91\xAF\xE2\x80...' for column s3389_database.settings.description at row 6", sqlState: '22007',
im getting this
i know its to do with the Collation
ive set it to utf8mb4_unicode_ci
is that not correct?

#

how do i add my bot to DBL?

knotty steeple
earnest phoenix
#

i just read the faq

#

thanks

knotty steeple
#

np

sacred mountain
#

I’m trying to await any message and then use that message content later. I have looked at some docs but can’t seem to get it to work

#

Does anyone know how I can do this?

pale vessel
#

how did you try to do it

sacred mountain
#
            message.channel.awaitMessages(filter, {max: 1, time: 5000}).then(collected => {

                console.log(message.content)

            }).catch(err =>{
                console.log("err")
            })```
#

After 5 seconds it logs the message

#

And there is never an error

cinder patio
#

you aren't logging the collected message

sacred mountain
#

Ik

#

I haven’t worked on that bit yet

#

It’s just actually getting it to log anything when it receives a message

#

Instead it just waits until the time is up and then logs

cinder patio
#

something should get logged when you send another message after the command one

sacred mountain
#

Nope

#

It only logs when the time runs out

cinder patio
#

well show your filter function

sacred mountain
#

Wdum

cinder patio
#

What's filter

sacred mountain
#

Oh

#

One sec

#
const filter = require('filter');```
#

might have done it wrong

cinder patio
#

yeah.. that's probably not right

sacred mountain
#

I used filter on my other bot

#

But I never defined filter

#

Wait

#

Found it

cinder patio
#

filter must be a function that either returns true or false

#

I have no clue what require('filter') is but it's definitely a module for doing something completely different

sacred mountain
#

Yup

cinder patio
#

If you don't want a filter, put () => true as the first parameter for the awaitMessages function

#

(maybe putting null/undefined also works, not sure)

sacred mountain
#

I tried just removing mention of filter and now I got a different error

cinder patio
#

and that error is...

sacred mountain
#
                                             ^

TypeError: Function.prototype.apply was called on #<Object>, which is a object and not a function```