#development

1 messages ยท Page 1539 of 1

lyric mountain
#

Well, it's actually called shield but whatever

normal sage
#

I know this isn't the right channel to ask, but does any dpy dev wanna work together?

#

I have a good bot idea.

lyric mountain
#

You started good, but ended catastrophically

stuck pike
#

guys i have wage problem

#

i cant login in the bot

#

when i use other bot to login eith same code it works

#

but the main bot stucks

#

terminal only shows nothing after node .

#

no errors as well

#

plus my bot is under verification on discord

#

Help plz yx_cry

mellow kelp
#

must be something wrong with your code

stuck pike
#

i used it

lyric mountain
#

Don't exclude the possibility of CF ratelimit

#

Don't u really get anything on the console?

#

Like, anything

stuck pike
#

blank

#

from 20 mins

mellow kelp
#

freakin windows powershell

lyric mountain
#

Why are you localhosting it tho

mellow kelp
#

this is why i use cmd KEKW

stuck pike
mellow kelp
#

try using the terminal instead of powershell

stuck pike
#

having same issue

stuck pike
lyric mountain
#

Cloudflare, but it's definitely not ur case

stuck pike
#

that bot was under verification

#

is that a factor?

lyric mountain
#

No

stuck pike
#

ufff how to fix

mellow kelp
lyric mountain
#

ignored.exe lul

mellow kelp
#

pretty sure that removes the giant red error thing on your console

stuck pike
#

yea the red thing went

mellow kelp
#

o

#

guess that wasn't the main problem

stuck pike
#

;=

#

:+:

earnest phoenix
#

imma go kms my bot just crashed cuz files are missing that MADE THE BOT FUNCTION cuz after the reboot some files were corrupted and i dint notice the bot was fine but it was starting to fall apart and i just spent 24hours up from coffee and now this will take 3 hours to reprogram them brb

stuck pike
#

Wot

stuck pike
lyric mountain
#

Also, use git, it's a must for every project

earnest phoenix
earnest phoenix
pearl trail
#

tacow

#

oops

lyric mountain
#

From inside the code?

#

You could open the class file as text

#

Then use regex to retrieve docs

#

Afaik comments are ignored during runtime, which includes javadocs

#

Open the class file directly

#

I don't mean the compiled one

#

I mean the original

#

Unless it's a standalone executable

#

If you use github, u can also retrieve the classfile content through direct link

#

You can fetch the javadoc from the official site can't u?

#

Iirc they do have an api

#

If not, you can just download the javadoc files

sacred aurora
#

does discord.js dispatcher have an end event?

#

or just finish

lyric mountain
#

No, i mean, javadocs are actual files stored in the official site

#

All IDEs download/fetch them

#

Idk exactly how it's done, but all ides gotta download the javadocs for ctrl + space usage

#

I'm pretty sure all vanilla java packages have their javadoc files

shrewd creek
#

guys i hv a problem with 429 ratelimit error

i am not able to acces the discords api
till last night it was fyn ...

is there any fix?

lyric mountain
#

No, just wait

#

Which 429 is it? Cloudflare?

shrewd creek
sullen olive
earnest phoenix
#

Guys

#

how to fix this Unicode error in logged = json.load(open('Logged.txt'))

#

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

#

what are you trying to do

#

Opening the file

#

what's in the file

#

Dict

#

Working in VS Code but not in Python IDLE

tribal siren
#
message.member.voice.channel.join()
  .then(connected => {
    connected.play(ytdl(args[0]))
})```
#

why doesn't it work?

earnest phoenix
#

Pls any good anime npm package?

#

I need a new anime command

lyric mountain
#

Not everything has a npm package

#

Anilist has an api, all you need is fetch it

rocky pulsar
#

cyclomatic complexity too high

old cliff
#

can anyone give me code of a reload command with sharding in js ?

rocky pulsar
#

@client.event
async def on_message(message):
if message.author == client.user:
return

slender thistle
#

What's the error?

rocky pulsar
#

cyclomatic complexity high

slender thistle
#

It's a warning, not an error

#

Did you Google the error message at least?

rocky pulsar
#

so wat do i do now

slender thistle
rocky pulsar
#

it just doesnt work

slender thistle
#

Jesus Christ, I know that's not all of your code

#

Show your full code

rocky pulsar
slender thistle
#

Nah I'm praying here don't mind me

rocky pulsar
#

lol

#

@slender thistle i sent in dm

languid garnet
#

yo, how do i whitelist channels on my server for gambling bot, so you cant post it iin all chats

old cliff
#

Hey this is my reload command code and has an error debug is not defined

try {
let file = path.join(__dirname,'..',`${command.config.category}`,`${command.config.name}.js`);
file = client.replaceAll(file,"\\","/");
console.log(file);
await client.shard.broadcastEval(`
delete require.cache[require.resolve('${file}')];
const newCommand = require('${file}');
newCommand.category = ${command.config.category};
this.commands.set(newCommand.name, newCommand);
`);
message.channel.send(`Command \`${command.config.name}\` was reloaded!`).then(msg => msg.delete({timeout:5000}));
} catch (error) {
console.log(error);
}```
#

the error comes from the djs sharding manager file

trim saddle
#

throw new Error(error)
i'm sorry, why are you wrapping an error in an error

old cliff
#

leave that --- I am doing something else too

trim saddle
#

i don't use d.js so i can't help you

old cliff
#

Fixed some things still the same issue

try {
    let file = path.join(__dirname,'..',`${command.config.category}`,`${command.config.name}.js`);
    file = client.replaceAll(file,"\\","/");
    console.log(file);
    await client.shard.broadcastEval(`
         delete require.cache[require.resolve('${file}')];
         const reqCommand = require('${file}');
         const newCommand = new reqCommand();
         newCommand.config.category = ${command.config.category};
         this.commands.set(newCommand.config.name, newCommand);
     `);
    message.channel.send(`Command \`${command.config.name}\` was reloaded!`).then(msg => msg.delete({timeout:5000})).catch();
} catch (error) {
    client.log.error(error);
}```
sacred trout
#

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "bal" is not found

#
  async def gstart(self,ctx):
    await ctx.send("Let's start with this Giveaway! Answer these questions within 25 seconds.")
    questions = ["Which channel should it be hosted in?",
                "What should be the duration of the Giveaway?",
                "What is the price of the Giveaway?"]
    answers = []```
#

please help

#

xD

old cliff
#

whats the error ?

sacred trout
#

wait

#

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "gstart" is not found

#

@old cliff

slender thistle
#

Literally what it says

#

Did you apply the command decorator to the command?

sacred trout
#

what how is it getting deleted?

#

bruh

old cliff
#

use hastebin

sacred trout
#

lol

#

ok

#

no circut bin

#

send link

old cliff
#

its offline

sacred trout
#

sad

#
  
  # @commands.has_permissions(administrator=True)
  async def gstart(self,ctx):
    await ctx.send("Let's start with this Giveaway! Answer these questions within 25 seconds.")
    questions = ["Which channel should it be hosted in?",
                "What should be the duration of the Giveaway?",
                "What is the price of the Giveaway?"]
    answers = []```
#

see this

slender thistle
#

Show code of another command the bot has

earnest phoenix
#

you're going to have a hard time parsing the response by the way

#

best to ask the questions one by one

old cliff
#

Bruh I am soo silly

#
newCommand.config.category = ${command.config.category};```
I forgot escaping
```js
newCommand.config.category = "${command.config.category}";
#

I AM SOOO DUMB

rocky hearth
#

Does this !?? exist for js?

old cliff
#

idk

earnest phoenix
#

it doesn't

#

what is that operator supposed to do

sacred trout
#
discord.ext.commands.errors.CommandNotFound: Command "gstar" is not found
Ignoring exception in command gstart:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/Bot/cogs/giveaway.py", line 43, in gstart
    msg = await self.client.wait_for('message', timeout=25.0, check=check)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 370, in dispatch
    result = condition(*args)
TypeError: check() missing 1 required positional argument: 'm'

The above exception was the direct cause of the following exception:```
old cliff
#

its gstart

#

not gstar

rocky hearth
sacred trout
#

lol

earnest phoenix
#

actually

#

i am not sure

sacred trout
#
Ignoring exception in command gstart:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/Bot/cogs/giveaway.py", line 43, in gstart
    msg = await self.client.wait_for('message', timeout=25.0, check=check)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 370, in dispatch
    result = condition(*args)
TypeError: check() missing 1 required positional argument: 'm'

The above exception was the direct cause of the following exception:
JAGUAR ๐ŸคดToday at 11:41```
earnest phoenix
#

i have to test but im on phone

old cliff
#

show full command code

sacred trout
pale vessel
#

bin it

sacred trout
#

ok

#

it is not saving

earnest phoenix
sacred trout
pale vessel
earnest phoenix
sacred trout
#

ok

#

well this worked

pale vessel
#

because it's not trash

sacred trout
#

makes sense

old cliff
#

@pale vessel btw do you know how to get shard id of a client ?

pale vessel
#

TypeError: check() missing 1 required positional argument: 'm'

sacred trout
#

yea

#

how tho lol

old cliff
#

without guild

#

to set status of individual shards

pale vessel
#

are you sharding?

sacred trout
#

tf?

old cliff
#

*experimental

sacred trout
#

is that

old cliff
#

I want to set individual statuses for individual shards with shard id

sacred trout
#

what is sharad?

old cliff
#

*shard

old cliff
pale vessel
#

isn't it check(m)? @sacred trout

#

without self

sacred trout
#

umm

#

yea?

pale vessel
sacred trout
slender thistle
#

NO SELF

sacred trout
#

no why is it like this?

#

green thin

#

g

slender thistle
#

Scroll up

sacred trout
#

did

#

it looks weird

#

ng exception:

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'convert' is not defined

slender thistle
#

ppq9q9w883uruhrb3bu2788w8w8w8ww888

sacred trout
#

wtf?

#

Ignoring exception in command gstart:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/Bot/cogs/giveaway.py", line 58, in gstart
time = convert(answers[1])
NameError: name 'convert' is not defined

slender thistle
#

what is convert

sacred trout
#

to secs

slender thistle
#

What is it

#

defined as

sacred trout
#
  def convert(self,time):
    pos = ['s','m','h','d']

    time_dict = {'s' :1, 'm' :60, 'h' : 3600 , 'd' : 3600*24}

    unit = time[-1]

    if unit not in pos:
      return -1
    try:
      val = int(time[:-1])
    except:
      return -2
    return val * time_dict[unit]
  @commands.command()```
slender thistle
#

Where did you define it

sacred trout
#

convert

pale vessel
#

convert.

sacred trout
#

?

slender thistle
#

Why is life so hard

sacred trout
#

cause it is?

slender thistle
#

Why are you using self there

old cliff
slender thistle
#

Are you making it a method and not just a function

sacred trout
#

oh yeah

#

makes sense

pale vessel
slender thistle
#

flaze I at least have hope because I GOT MY PAYPAL ACCOUNT BACK

#

But people here ๐Ÿ˜”

old cliff
#

do shard numbers start from 0 or 1 ?

slender thistle
#

0

#

afaik

old cliff
#

k thanks

#

time to start 100 shards for a testing bot in 2 servers

gleaming talon
#

How would i make this into a command, and if the user have the option for no dms for anyone it sends a message in chat, my friend made me this right before he went to bed lmao and i am so tried so i stopped trying after like 5 minutes

    const linkId = pool.createLink(member.id);
    const embed = new Discord.MessageEmbed()
        .setTitle('reCAPTCHA Verification')
        .setDescription(`Solve this captcha, and you wil get access to the server. \n\n\nhttp://${domain == '' ? 'localhost:8080' : domain}/verify/${linkId}`)
        .setColor('RED')
    member.send(embed)
})```
pale vessel
#

catch your send method

#

it will error if their DMs are closed

#

member.send(embed).catch(error => channel.send(embed)) for example

#

but you need to define a channel to send to first

gleaming talon
#

A reCaptcha bot

gleaming talon
#

oh i understand, i'll try, But i was asking how would i make it into a command?

old cliff
#

leave it to him

#

/her

gleaming talon
#

How would i fix message is not defined?

old cliff
#

did u define it ?

wanton knoll
#

Is it possible to make a command which can tell how many messages are there in server like 10,000 total messages

old cliff
#

10,000

#

counting messages ? make an array of messages and use array.length

earnest phoenix
#

Is soneone able to fix mu code because when I upload a new video or start a stream on YouTube or Twitch it is not posting it in my discord

#

lol

tight plinth
#

so my bot has an autorole feature that adds a role to members when they join. for some strange reason, it seems that, sometimes, the role is added according th audit log but the member does not have any or that the bot automatically removes the roles as soon as it is added. Any clue why?
give me a minute to get my code

#
MeyamaClient.on("guildMemberAdd", (member) => {
    MeyamaClient.stats.members.joined++;
    if (member.user.bot) return;
    let joinMessage = MeyamaClient.db.get(`${member.guild.id}.config.joinMessage`);
    if (joinMessage) MeyamaClient.AR(MeyamaClient, joinMessage, {
        type: "welcome",
        member
    });
    if (MeyamaClient.db.get(`${member.guild.id}.config.roleAtJoin`) && !member.roles.cache.has(MeyamaClient.db.get(`${member.guild.id}.config.roleAtJoin`))) {
        try {
            member.roles.add(MeyamaClient.db.get(`${member.guild.id}.config.roleAtJoin`));
            MeyamaClient.stats.roles.added++;
        } catch {
            "1";
        }
    }
    if (MeyamaClient.db.get(`${member.guild.id}.config.backupRoles`)) {
        let roles = MeyamaClient.db.get(`${member.guild.id}.${member.user.id}.backupRoles`) || [];
        try {
            member.roles.add(roles);
            MeyamaClient.stats.roles.restored += roles.length;
        } catch {
            "1";
        }
    }
});```
#

code sucks ik

compact scaffold
#

im not able to use iframes in my bot page

slender thistle
#

Are you sure you linked it properly?

compact scaffold
#

yes

#

this

#

shouldnt this be fine?

#

when i preview it its blank

#

@slender thistle

slender thistle
#

well shrug

eternal osprey
#

hey guys

#

TypeError: Cannot read property 'hasPermission' of null 2021-01-21T07:50:45.297121+00:00 app[worker.1]: at Object.module.exports.run (/app/commands/warn.js:7:23) 2021-01-21T07:50:45.297121+00:00 app[worker.1]: at Client.module.exports (/app/events/message.js:11:13) 2021-01-21T07:50:45.297122+00:00 app[worker.1]: at Client.emit (events.js:326:22) 2021-01-21T07:50:45.297125+00:00 app[worker.1]: at MessageCreateHandler.handle (/app/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) 2021-01-21T07:50:45.297133+00:00 app[worker.1]: at WebSocketPacketManager.handle (/app/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65) 2021-01-21T07:50:45.297134+00:00 app[worker.1]: at WebSocketConnection.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35) 2021-01-21T07:50:45.297134+00:00 app[worker.1]: at WebSocketConnection.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17) 2021-01-21T07:50:45.297135+00:00 app[worker.1]: at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:120:16) 2021-01-21T07:50:45.297135+00:00 app[worker.1]: at WebSocket.emit (events.js:314:20) 2021-01-21T07:50:45.297136+00:00 app[worker.1]: at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:789:20)

#

why am i getting this error?

pale vessel
#

the member is null

#

they are not cached

#

it could be a guild owner

eternal osprey
#

so the guild owners can't use the bot?

compact scaffold
#

๐Ÿ˜ฆ

pale vessel
#

the property before hasPermission()

eternal osprey
#
module.exports.run = async (bot, message, args) => {
  if (!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("You don't have `KICK_MEMBERS` permissions.");
  let wUser = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0])
  if (wUser === message.author) return message.channel.send("Are you retarted? Why do you wanna warn yourself?")
  if (!wUser) return message.reply("Couldn't find the user.");
  let reason = args.join(" ").slice(22);
  if (!reason) return message.channel.send("Please provide a reason!")
  if (!warns[wUser.id]) warns[wUser.id] = {
    warns: 0
  };```
pale vessel
#

message.member is null

eternal osprey
#

how

pale vessel
#

Either it's not cached or the message is from a DM

eternal osprey
#

it's a private server with the bot

#

idk if that's it

pale vessel
#

someone can still DM it

#

and it will error

eternal osprey
#

i am in a private server with the bot

#

who could possibly dm it?

pale vessel
#

only you?

eternal osprey
#

yeah

pale vessel
#

does this happen often

eternal osprey
#

yeah i cannot use the ban, warn, kick commands either

#

maybe because i use v12, but haspermission is v11?

#

@pale vessel

pale vessel
#

that method still exists

eternal osprey
#

hmm strangeg.

pale vessel
#

log the author and the member

eternal osprey
#

on vsc it works

#

but i put it on heroku

pale vessel
#

put console.log(message.author, message.member, message.guild.members.cache.get(message.author.id)) on the top of the function

gleaming talon
#

This is giving me aids, it gives me unexpected token ')' then i remove that token sends me expected token ')' client.on ('guildMemberAdd', member => { const linkId = pool.createLink(member.id); const embed = new Discord.MessageEmbed() .setTitle('reCAPTCHA Verification') .setDescription(`Please verify using this link! @${author.tag}\n\n\nhttp://${domain == '' ? 'localhost:8080' : domain}/verify/${linkId}`) .setColor('RED') member.send(embed).catch(error => client.channels.cache.get('800979412971290664').send(embed)) .then(msg => { msg.delete(900000)

#

i git stage 4 cancer from this

tight plinth
#
then(msg => {
    msg.delete(900000)
}) //to close the then
}) //to close the client.on```
#

just make sure every ( or { closes at some point

gleaming talon
#

Thank you omg

#

OMFG

tight plinth
#

np

gleaming talon
#

I WAS ON THAT FOR 7 YEARS

#

One more question, how would i mention the user in a embed?

tight plinth
#

you can do <@userid>

gleaming talon
#

pog

#

ill try that

tired panther
#

xD

#

Should I make a AI bot, which saves all questions here, then they can ask the question on a specific channel lol

gleaming talon
#

do it

tired panther
#

xD, but how would my ai learn without any content lol

#

let me ask a admin

gleaming talon
#

lmao ok

eternal osprey
#

hey

#

how many bots can i maximum host on the galaxygate 1gb lightning vps?

tight plinth
#

as many as you can, as long as they are optimized

eternal osprey
#

i mean how many bots can this hold?

pale vessel
#

at least one or two

eternal osprey
#

cuz right now i am hosting 2 bots and 1 website on it.

#

i need to add 1 more bot.

#

but will it hold?

pale vessel
#

check your memory usage

opal zealot
#

@tight plinth

the only thing you can do to make it faster is optimize your code and cache less
eh do you know if its possible to cache less?

tight plinth
opal zealot
#

ah damn it

tight plinth
#

just wait for someone like @slender thistle to help you

opal zealot
#

oh ok

#

ima paste the message here

devout cairn
#

how can i verify my bot

#

???

tight plinth
#

it needs to be in 75 servers

opal zealot
#

not exactly a discord.gg problem but its a problem that most likely came up a lot here, anyone knows how to reduce loading time when starting the bot?

devout cairn
#

I Ment how To get It into The Top.gg Bots

tight plinth
#

just wait one week

slender thistle
#

Well...

#

I'm not sure what you are even doing in the first place

#

or the size of your bot

split hazel
opal zealot
#

500

#

Thing is itโ€™s loading tons of stuff I donโ€™t even use in my bot so Iโ€™m trying to see if I can make it load only what I need

willow mirage
#

help my messageReactionAdd event is not working

#

no console, no error

#

nothing . . .

earnest phoenix
#
const ms = require("ms");

module.exports = { 
  //!tempmute @user 1s/m/h/d
  name: 'mute',
  args: true,

 run  (message, args) {
  let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  if(!tomute) return message.reply("Couldn't find user.");
  if(tomute.hasPermission("MANAGE_MESSAGES")) return message.reply("Can't mute them!");
let muterole = message.guild.roles.find(muterole => muterole.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
        });
      });
    }catch(e){
      console.log(e.stack);
    }
  }
  //end of create role
  let mutetime = args[1];
  if(!mutetime) return message.reply("You didn't specify a time!");

  await(tomute.addRole(muterole.id));
  message.reply(`<@${tomute.id}> has been muted for ${ms(ms(mutetime))}`);

  setTimeout(function(){
    tomute.removeRole(muterole.id);
    message.channel.send(`<@${tomute.id}> has been unmuted!`);
  }, ms(mutetime));


//end of module
}```
#

Itโ€™s showing error with await....

#

But I donโ€™t see anything wrong

zenith terrace
#

awaits can only be used inside async functions

willow mirage
#
module.exports = async(client, reaction, user) => {
    console.log("Someone reacted");
}

This fucking event is even not emitted, help me

#

I tried with client.on('messageReactionAdd') but still don't work (without event handler)

tired panther
earnest phoenix
tight plinth
#

does anyone have this issue? when i try to add a role to a member when they join, the bot adds it according to audit log but it's actually not added to the member

earnest phoenix
#

module.exports = {
  name: 'ban',
         /**
     * @param {Message} Message
     * @param {string[]} args
     */
  run: (message, args) => {
  const target = message.mentions.members.first();
  const reason = args.join(' ');
   if (!message.member.hasPermission("BAN_MEMBERS")) {
  return message.channel.send("You Don't Have Permission!")
  if (!target) return message.channel.send(`<@${message.author.id}> please mention a user to ban`);

  target
    .ban({ reason })
    .then(() => {
      const embed = new MessageEmbed()
        .setTitle('The ban hammer has spoken!')
        .setDescription(`<@${message.author.id}> banned <@${target.id}>`)
        .setTimestamp(new Date())
      message.channel.send(embed);
    })
    .catch(err => {
      console.log(err);
      message.channel.send(`<@${message.author.id}> error while banning <@${target.id})`)
    });
  }
}```
#

Why is it showing error with the last line

zenith terrace
tight plinth
#

idk

#

bc i can add the role to the member

eternal osprey
#

hey guys

#
const test = message.member
  console.log(test)
  if (message.author.bot) return;
  if (!message.guild) return;
  if (!test.hasPermission("BAN_MEMBERS") || message.author.id !== n.oID) {
    message.channel.send("You are missing the permission(s): Ban Members.");
  } else {```
#

i have a role assigned to myself that literally has all permissions

#

when i use a command it still returns me the error message

#

could anybody help me with this problem.

west agate
#

Is there a tutorial or documentation on how to allow multiple people to edit a discord bot? (Preferably on GitHub)

summer torrent
#

english

#

any errors?

#

yeah somon is Snowy

#

and you are using his bot template

#

anyways

iron gale
#

lol

#

Yes he is

misty sigil
#

you're doing if they don't have perm or they arent n.oID

#

so someone can have perm but be oID and still no and vice versa

#

if you use && you're checking if they don't have perms AND aren't oID

sick cloud
pure lion
#

how can i start pm2 with a node option like node --experimental-modules index.js

sick cloud
#

@pure lion pm2 start index.js -- --experimental-modules

#

add -- then any flags

#

iirc

pure lion
#

oh alright

#

doesn't wanna work

tight plinth
#

you can use the ecosystem.config.js file

#

example

#
module.exports = {
    apps: [
        {
            name: "Meyama",
            script: "index.js",
            autorestart: true,
            watch: false,
        },
    ],
};```just put the argument you wanna run ur program with in the script section
umbral zealot
pure lion
tight plinth
#

in the same folder as your index.js file

pure lion
#

also where do the node opts go

tight plinth
#

then you will have to do pm2 start to actually start the script

#

in script

pure lion
#

o

quartz kindle
#

pm2 --node-args

tight plinth
quartz kindle
#

it does

#

ie pm2 start bla.js --node-args="--max_old_space_size=500"

pure lion
#

oh shit

tight plinth
pure lion
#

tim here to save the day

tight plinth
#

ig imma belive u

quartz kindle
#

or in the ecosystem file: "node_args": "--max_old_space_size=500"

tight plinth
#

you can do "script": "index.js --max_old_space_size=500" tho

quartz kindle
#

i guess, although they dont mention it in the docs

#

so it would need to be tested

pure lion
#

pm2 start 0 --node-args="--experimental-modules"

#

doesnt work

quartz kindle
#

somethings in pm2 are confusing af if not blatantly bad design

pure lion
#

pain

quartz kindle
#

i had tons of issues getting logging to work the way i wanted

quartz kindle
#

without being in pm2 already

pure lion
#

o

#

ill delete it

quartz kindle
#

ye

severe cedar
#

So um I am making a discord.py bot and I wanted to make an economy system but whenever i run my beg and balance command it just gives the error Command raised an exception: TypeError: object method can't be used in 'await' expression. Some help would be gratly appreciated.
Code: https://srcb.in/N7QMJ3kD4H

quartz kindle
#

if its already in the pm2 list, it keeps using whatever options it was added to it with

pure lion
#

now it just doesnt start the server

quartz kindle
#

errors?

pure lion
#

nope

quartz kindle
#

then how does it not start?

pure lion
#

oh nvm its just throwing the same error as before

quartz kindle
#

which is?

pure lion
earnest phoenix
#

How do i show the name of the developer

#

in py

#

bc i think ctx.guild.owner is wrong

quartz kindle
quartz kindle
slender thistle
#

aeaaaaeeeeaaaeeeeeeaaaaaaeeeeeeaaaaa

zenith terrace
#

@quartz kindle hey, hey, hey

earnest phoenix
#

Yeah my name

quartz kindle
#

likely client.user.username, or something similar

slender thistle
#

Get application info, get ID of the owner, call get_user on it

pure lion
zenith terrace
#

@quartz kindle I got a question

slender thistle
quartz kindle
earnest phoenix
#

ok imma try.

quartz kindle
pure lion
severe cedar
#

i guess this chat is too active

pure lion
#

I'm tied I meant nvm

quartz kindle
#

ah

#

using ES modules in node is confusing af

split hazel
#

yeah

quartz kindle
#

do you have type:module in package.json?

split hazel
#

i only ever use them in ts

zenith terrace
#

@quartz kindle y'know how in d.js you can do message.channel.send({embed: {description: `and other things`}})

pure lion
#

I'll update to 14.X

slender thistle
quartz kindle
#

from what im reading in SO, most people recommend ditching node's native ES modules and use the esm package instead

#

lol

zenith terrace
# quartz kindle yas

whenever I do

message.channel.send({embed: {thumbnail: client.user.displayAvatarURL(), description: `bla bla`}})``` it returns this https://i.imgur.com/4zCNbxc.png

but whenever I make a normal `let embed = new discord.MessageEmbed()` it returns a normal looking ass embed
severe cedar
earnest phoenix
#

Hmm ctx.user.username doesnt work for me?

tribal siren
#
member.setNickname(nickname)
    .catch(err => {
      const b = new Discord.MessageEmbed()
        .setTitle('Error')
        .setDescription(err)
        .setColor('#bb1414')
      message.channel.send(b)
    })
  message.channel.send(embe)```
tribal siren
slender thistle
tribal siren
#

what shall i do?

earnest phoenix
#

But i use cog tho

slender thistle
severe cedar
#

@slender thistle THANK YOUUUU

earnest phoenix
#

ok

zenith terrace
#

oh

#

proxy url

quartz kindle
#

just do {thumbnail: {url: client.user...}}

zenith terrace
#

ah ok

tribal siren
#

uhm excuse me

quartz kindle
#

nani the fuck

zenith terrace
#

@split hazel

#

1

#

2

#

3

tribal siren
#

ip leak brotha

zenith terrace
#

speedy do be slow

#

@drowsy crag ur a better responder

#

someone did an ip leak

tribal siren
#

@green kestrel man?

drowsy crag
#

oop

split hazel
#

i always respond quickly i just don't say "got it" ๐Ÿ™‚

tribal siren
#

ah noice

drowsy crag
#

speedy is pog

tribal siren
#

so now

#

i got a problem

#
member.setNickname(nickname)
    .catch(err => {
      const b = new Discord.MessageEmbed()
        .setTitle('Error')
        .setDescription(err)
        .setColor('#bb1414')
      message.channel.send(b)
    })
  message.channel.send(embe)```
#

what's wrong?

quartz kindle
#

no permissions to set name?

split hazel
#

and just so you know you can't set the nickname of an owner

tribal siren
zenith terrace
tribal siren
#

it sends me both success and error

quartz kindle
#

either await or .then

tribal siren
#

and i just want it to send the error

#

where to put the await?

quartz kindle
#

await setNickanem

tribal siren
#

oh

#

let me try

zenith terrace
#

Nickanem

quartz kindle
#

yes nicknaem

zenith terrace
#

nice

tribal siren
#

nicknaem

quartz kindle
#

yes nickamen

zenith terrace
#

.setNickmane

tribal siren
#

still doesn't work :(

quartz kindle
#

remove the catch

#

or change it to return something

#
let result = await bla().catch(() => null)
if(!result) return sendError();
await sendSuccess()

or

try {
  await bla()
  await sendSuccess()
} catch(e) {
  await sendError()
}

or

bla().then(() => {
  sendSuccess()
}).catch(e => {
  sendError()
})
#

these are all different ways of doing the same thing

earnest phoenix
#

I tried using self.bot.user.name but it's what i want bc that just shows the name of the bot instead of my name

shell girder
#

sorry but what i have to type here in password

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
quartz kindle
shell girder
#

in Authorization ?

earnest phoenix
#

What do i have to do to show my name in the about command?

quartz kindle
#

then from the appinfo you get owner

quartz kindle
earnest phoenix
#

I mean this is my code:

em.add_field(name = 'Developer', value=ctx.owner.name, inline = True) 

but self.bot.user.name is wrong so what do i put instead? is it just owner?

quartz kindle
#

you need to fetch the application info

spiral crag
#

hey guys i have a question, if anyone here has used repl.it, does anyone know how to stop the automatic poetry package installation in repl.it?

earnest phoenix
#

Where do i put that?

#

This is my code:

 @commands.command(aliases = ['fawkes'])
    async def about(self, ctx):
        em = discord.Embed(title = "Bot Info",timestamp=ctx.message.created_at, colour = discord.Colour(0x1680E7))
        em.add_field(name = 'Bot name', value = 'Fawkes', inline = True) 
        em.add_field(name = 'Developer', value=ctx.owner.name, inline = True) 
        em.add_field(name = 'Library', value='dscord.py', inline = True)
quartz kindle
#

i already told you lol

earnest phoenix
#

I dont understand

opal plank
earnest phoenix
#

Guys, is there a permission called MANAGE_ROLES?

opal plank
shrewd creek
#

@bot.command()
@commands.is_owner()
async def guildinfo (ctx):
name = str(ctx.guild.name)
description = str(ctx.guild.description)

owner = str(ctx.guild.owner)
id = str(ctx.guild.id)
region = str(ctx.guild.region)
memberCount = str(ctx.guild.member_count)

icon = str(ctx.guild.icon_url)

embed = discord.Embed(
    title=name + " Server Information",
    description=description,
    color=discord.Color.blue()
)
embed.set_thumbnail(url=icon)
embed.add_field(name="Owner", value=owner, inline=True)
embed.add_field(name="Server ID", value=id, inline=True)
embed.add_field(name="Region", value=region, inline=True)
embed.add_field(name="Member Count", value=memberCount, inline=True)

await ctx.send(embed=embed)

** i put this code to get guild info but now i want to set a target guild with guild id how do i get it**
discord.py

earnest phoenix
#

@opal plank thanks

opal plank
#

๐Ÿ‘

shell girder
#

how can i get my bot webhook url

opal plank
#

depends where its hosted

shell girder
opal plank
#

i dont know the procedure for repl.it

#

since i dont use repl

shell girder
#

where i can find ?

opal plank
#

probably google

shell girder
#

thx

earnest phoenix
#

Why is it showing error with โ€œnameโ€:?

opal plank
#

you have an empty object there for no reason

#

i assume all that should be INSIDE

earnest phoenix
#

Oh yeah my bad

#

So

#

},
{?

#

@opal plank

opal plank
#

move that there

#

im really unsure where that last bracket belongs to though

crimson vapor
#

erwin

#

how long is your birthday?

opal plank
#

that whole thing looks like an array of object, so idk where this bracket belongs to

#

good question

#

probably already gone for a few hours

earnest phoenix
#

Do you want me to send you the code? @opal plank

opal plank
#

yeah its been 3 hours already that its gone

crimson vapor
#

lol

earnest phoenix
#

Alr

crimson vapor
#

have people use codeblocks lol

#

its so hard to read code when its just pasted raw

opal plank
#

better that than cellphone screenshots at 240p

crimson vapor
#

you make a good point

#

but its so easy to do code blocks

#

so no excuses

opal plank
#

some people dont even know about it

earnest phoenix
#

It got deleted...

opal plank
#

you posted links

#

prob server invite

earnest phoenix
#
const moment = require('moment')
var eco = require(`quick.db`);

module.exports = {
    name: "userinfo",
      aliases: ["Userinfo"],
    async run (message, args) {
        const people = message.guild.member(message.mentions.members.first() || message.author);
        let username = people.user.username
        let registered = moment.utc(people.user.createdAt).format('MMMM Do YYYY');
        let joined = moment.utc(people.joinedAt).format('MMMM Do YYYY');
        const embed = {
        "title": `${people.user.tag}'s userinfos`,
        "color": "#008000",
        "thumbnail": {
          "url": (people.user.avatarURL())
        },
        "fields": [
          {
            "name": "User ID",
            "value": `${people.user.id}`,
            "inline": true
          },
          {
            "name": "JOINED ON",
            "value": `*`+joined+`*`,
            "inline": true
          },
          {
            "name": "REGISTERED ON",
            "value": `*`+registered+`*`,
            "inline": true
          },
          {
            "name": "USERNAME",
            "value": `*`+username+`*`,
            "inline": true
          },
          {
            "name": 'USER ROLES ',
            "value": user.roles.cache.map(role => role.toString()).join(" ,"),
            "inline": true
          },
          {
          },
            "name": "Social Links",
            "value": "[Invite Bot](https://discord.com/oauth2/authorize?client_id=73453769569887&scope=bot&pe=2147483647) | [Support Server](https://discogg/)"
          }
        ]
      };
    message.reply({ embed });
    }
}```
opal plank
#

figured as much, its an array

#
const { Client, MessageEmbed, version } = require("discord.js");
const moment = require('moment')
var eco = require(`quick.db`);

module.exports = {
    name: "userinfo",
      aliases: ["Userinfo"],
    async run (message, args) {
        const people = message.guild.member(message.mentions.members.first() || message.author);
        let username = people.user.username
        let registered = moment.utc(people.user.createdAt).format('MMMM Do YYYY');
        let joined = moment.utc(people.joinedAt).format('MMMM Do YYYY');
        const embed = {
        "title": `${people.user.tag}'s userinfos`,
        "color": "#008000",
        "thumbnail": {
          "url": (people.user.avatarURL())
        },
        "fields": [
          {
            "name": "User ID",
            "value": `${people.user.id}`,
            "inline": true
          },
          {
            "name": "JOINED ON",
            "value": `*`+joined+`*`,
            "inline": true
          },
          {
            "name": "REGISTERED ON",
            "value": `*`+registered+`*`,
            "inline": true
          },
          {
            "name": "USERNAME",
            "value": `*`+username+`*`,
            "inline": true
          },
          {
            "name": 'USER ROLES ',
            "value": user.roles.cache.map(role => role.toString()).join(" ,"),
            "inline": true
          },
          {
"name": "Social Links",
            "value": "[Invite Bot](https://discord.com/oauth2/authorize?client_id=73453769569887&scope=bot&pe=2147483647) | [Support Server](https://discogg/)"
          },
        ]
      };
    message.reply({ embed });
    }
}
#

that should work

earnest phoenix
#

Alrighty

#

Lemme try

#

@opal plank the command dosent even reply anymore

opal plank
#

oh, cuz you missed ANOTHER brackets

earnest phoenix
#

Huh

#

Where? @opal plank

#

Did you or me?

opal plank
#

just reply() with the object

#

dont destructure it

#

reply({embed:embed})

tight plinth
#

I'm exporting a function and importing it in another file, but this errors happens when i try to call it. Any clue why? (ts)

crimson vapor
#

add language to them

tight plinth
earnest phoenix
#

@opal plank sill no respond

opal plank
#

it should be giving you an error message

#

check ur console

earnest phoenix
#

Nope nothing

opal plank
#

it should

earnest phoenix
#
const { Client, MessageEmbed, version } = require("discord.js");
const moment = require('moment')
var eco = require(`quick.db`);

module.exports = {
    name: "userinfo",
      aliases: ["Userinfo"],
    async run (message, args) {
        const people = message.guild.member(message.mentions.members.first() || message.author);
        let username = people.user.username
        let registered = moment.utc(people.user.createdAt).format('MMMM Do YYYY');
        let joined = moment.utc(people.joinedAt).format('MMMM Do YYYY');
        const embed = {
        "title": `${people.user.tag}'s userinfos`,
        "color": "#008000",
        "thumbnail": {
          "url": (people.user.avatarURL())
        },
        "fields": [
          {
            "name": "User ID",
            "value": `${people.user.id}`,
            "inline": true
          },
          {
            "name": "JOINED ON",
            "value": `*`+joined+`*`,
            "inline": true
          },
          {
            "name": "REGISTERED ON",
            "value": `*`+registered+`*`,
            "inline": true
          },
          {
            "name": "USERNAME",
            "value": `*`+username+`*`,
            "inline": true
          },
          {
            "name": 'USER ROLES ',
            "value": user.roles.cache.map(role => role.toString()).join(" ,"),
            "inline": true
          },
          {
          },
        ]
      };
    message.reply({embed:embed})
    }
}```
opal plank
#

why you sending the object still?

#

dont send empty objects

earnest phoenix
#

Wdym

opal plank
#

you know what an object is?

tight plinth
opal plank
#

48 servers in a day, holy shit

#

tim that sharding is coming sooner than i anticipated

grizzled raven
#

any faster way to do this? i'm trying to get the number of users who all their starred message's stars added up is greater than 729

quartz kindle
opal plank
#

you cant use import outside a module

#

you need to import()

tight plinth
#

mk

opal plank
#

if you exporting as default it needs to be import().then(a => a.default //do stuff)

quartz kindle
#

wut

opal plank
#

you cant use import inside it

#

he's doing dyanamically

#

prob using fs

#

you cant import mid code

#

but you can import()

quartz kindle
#

you mean you cant import ts files within your project if they are not modules?

opal plank
#

not that

#

this

#

actually, let me get a hands down example

#

1 min

quartz kindle
#

well i dont know the details of his project, but you should be able to do this no? ```ts
// file.ts
export default () => console.log(1)

// index.ts
import bla from "./file"
bla()

opal plank
#

not inside a module, no

quartz kindle
#

i dont get it

opal plank
#

red = good, yellow = bad

#

inside a module, you cannot use import

#

but you can use import() which does the same as require basically

quartz kindle
#

why would you mix module.exports with ts imports?

opal plank
#

here

#

see?

quartz kindle
#

ah so you cant do dynamic imports

#

like mixing import with code

opal plank
#

this is all using es6 so you dont get confused

#

no more mixing module.exports

#

look at top imports

#

and then dynamic

#

top imports are no issue at all, they are not a module, so its valid to import them

#

inside the module, aka the object, you cant use import statements

quartz kindle
#

i dont get async imports tho

opal plank
#

but import() is valid

quartz kindle
#

does the file wait until the async import finishes before exporting anything?

opal plank
#

same as require(), but promisified

#

thats why you neeed to await or .then() it

quartz kindle
#

i mean

opal plank
#

itsnot like require(),. but it works like require()

#

as you still need to access the .default property inside of it

#

exactly like require

#

its just async

quartz kindle
#

in the code you showed above, wont export default be executed before import.then() loads?

rustic nova
opal plank
#

possibly, though i do somethign similar on my client, dont see any errors, even with stuff im calling right after

#

that goes back to that whole async talk we had

quartz kindle
#

i mean, if ts somehow waits for the .then() before exporting, that sounds very against how promises work

opal plank
grizzled raven
#

just use eval and readFileSync smh

opal plank
#

maybe because of the for() loop?

#

not sure if that waits for each iteration

#

or just throws it until it eventually ends

#

i doubt it though

#

dont think for() loops affect any of this

#

just guessing cuz i dont have a concrete answer for it

quartz kindle
#

top level import().then() makes no sense

#

your code is being executed before the import finishes

#

im pretty sure

opal plank
#

some of those globals get called immediately after they been declared, such as my status, i dont see any of that erroring

quartz kindle
#

i googled a bit about ts dynamic imports

opal plank
#

the ready event is just below that

quartz kindle
#

import() is supposed to be used inside functions, not top level

#

to only load when needed

opal plank
#

then im doing it wrong

quartz kindle
#

like

opal plank
#

im using it in top level

grizzled raven
#

does it work when used top level

opal plank
#

in my case it does, supposedly

rich yarrow
#

hm

quartz kindle
#
import bla from "bla" // always imported
bla()


async function something() {
  let bla = await import("bla") // import only when called
  bla()
}
opal plank
#
client;
files = fs.readDir()
for(let f of files) import(f).then(client.commands.set(f.name, f));
client.on('ready', () => client.commands.get('status')());

this doesnt give me any problems

#

it might not be the right way to do it, but from what i played with, import() doesnt seem to fuck up much at all

cinder patio
#

I use require for things like this

opal plank
#

my point stands though

#

import cannot be used inside modules

#

import(), can

quartz kindle
opal plank
#

it may even be the time d.js takes to intiaite client

#

yeah, was about to mention that

#

so if you doing it topยดlevel you might need to wrap your whole index async, which seems a bit too much

#

or, at the very least, things that require import()

quartz kindle
#

so the correct way to do it would be ```js
(async () => {
for(f of files) await client.commands[f] = await import(./${f})
client.login()
})()

opal plank
#

looks about right, yes

#

of course you'd need to put stuff that requires that inside there as well

#

i just used one example on ready event

#

but if you have more, it might need to be put inside there

#

that would be very problematic for my gauges for example

#

as every event relies on them for metrics

#

so every client event i'd need to be put inside

quartz kindle
#

so like

opal plank
#

thats what composes my events

quartz kindle
#

there is no way to load static imports in a loop

opal plank
#

in my case it'd be at least 2/3rds of the bot inside async

quartz kindle
#

like this

#
for(...) {
  import x from y
}
#

at the top of the file

#

that doesnt work right?

opal plank
#

dont think so, no

quartz kindle
#

and import() is always async?

opal plank
quartz kindle
#

so you cant automate static imports at all?

opal plank
#

i think so, yes, i dont get intellisence from import() for some reason, so i cant tell what its doing

quartz kindle
#

like if you needed to import 50 files

opal plank
quartz kindle
#

you'd have to manually type them all

opal plank
#

you'd need to push it into a variable outside

quartz kindle
#

or convert everything to async to use dynamic

opal plank
#

not necessarily

quartz kindle
#

there is no static sync

opal plank
#

you could do hacky shit like i do

#

fs.write()

cinder patio
#

you can still use require if you are writing the code for node.js

opal plank
#

thats what i do for my dynamic database types

#

i literally use fs.write to write every type in a ts file

#

and the ts is always imported

#

imagine this

#
import test from 'test.ts'
writeFile() {
let num = 1;
for(let f of fs.readDir()) {fs.write(`export ${num} = {${f}}`, 'test.ts'); num++};
}

someFunction() {
const a = test.1;
}
#

you could have test always be imported

#

and then simply add the code itself, or a require() inside of it with write()

#

then anything inside test is callable

quartz kindle
#

lets say i have 50 files i want to import
option 1: manually write all 50 imports at the top of the file
option 2: put 50 names in array, make everything async and await import() in a loop
is there any other option?
something like put 50 names in array, loop with import name = require()?

opal plank
#

or you could do what i did up there

#

and only have 1 import

cinder patio
#

you can still use require in an node.js environment

opal plank
#

and set the file that you are importing with what you want

#

why bother mixing?

cinder patio
#

It's better than using fs

opal plank
#

es6 with es6, es5 with es5

#

you'd need fs either way

tight plinth
#

trying to connect to my vps with vscode, but i get this error despite it being fully functional. any reason?

opal plank
#

its about dynamicism, not how to import it or not

quartz kindle
opal plank
#

in order to dyanmic require() stuff you'd still need fs

opal plank
#

map all the stuff you want to import

#

thats why i put it in map and not like that

quartz kindle
#

thats some weird shit right there lmao

opal plank
#

though when the code is already running, you would need to delete cache

opal plank
#

this is the same shit as you setting properties inside functions

#

its hacky code

tight plinth
#

my ssh config file?

opal plank
#

let me see if i can find the gif

#

one second

tight plinth
agile lance
#

Should I start sharding?

agile lance
#

my bot is in only like 240 servers but is growing

opal plank
#

i did have a better gif somewhere, let me see if i can find it

undone smelt
#

Hello I am developing a bot for my server and looking for a way to get votes for my server on top.gg show up in a channel using the webhook. How should I approach this?

opal plank
#

actually, this one is better Tim

#

this is the improved one

tight plinth
opal plank
#

if i cant use ts to make it dyanmic, i'll simply use fs to write it for me

summer torrent
#

thonk

cinder patio
#

wait why do you have a different interface for each character or whatever

#

when they are literally the same ytho

opal plank
#

cuz i sometimes need to import all characters there are

#

i need to use in keyword

#

if i have all charcters and then try characterA in characters it'll pickup if that character exists in those types

#

there are various reasons why this would be handy

cinder patio
#

That's very hacky

opal plank
#

indeed, but it works flawlessly

#

this is basically dynamic types in a nutshell

#

i update database and the code updates itself with the types

#

and it also knows a new char as added

#

since i have TRIGGERS set

#

it runs that function sinde code with eval

undone smelt
#

rip I guess I can't get help here

opal plank
#

TRIGGER on INSERT http=> expresser server => check token/whitelist => eval genTypes(tablename/primary)

#

from postgres to code

cinder patio
#

I don't think that's how interfaces are supposed to be used

opal plank
#

they arent, thats why i had to do this

#

types are mostly needed when you're coding, unless you type checking, types makes no difference whatsoever inside

opal plank
#

but i want types on it too

#

so i did this whole thing

#

intellisense

cinder patio
#

Wait can you tell me again what are you using all those interfaces that are practically the same for?

opal plank
#

type checking in code

#

in usable code its being used with require() and Object.keys()

#

in types im using in keyword to check it when im manually using a character or something

cinder patio
#

Are you sure in works for interfaces?? An interface is just a type

opal plank
#

correct

#

its valid

cinder patio
#

but still, 'Something' only refers to a type, but is being used as a value here.

opal plank
#

lemme dig the code one second

#

fuck where was it

quartz kindle
#

can you even use in for entire objects? isnt it only for props?

#

like "a" in Something or "a" in obj

opal plank
#

im tryhing to find the code, this is some really fucky code

cinder patio
#

yea in accepts only strings, numbers or symbols

opal plank
#

fuck im not finding it

#

i know i used it in one of my files

#

dont think i'll be able to find it

#

i need to wait for my friend to come, he's the one who taught me about it

#

i really do not remember how i did it, but it does have a special keyword for using types in types

#

AH

cinder patio
#

anyways, why not just have one interface instead of a separate interface for all character? That's the point of em

opal plank
#

found it

#

keyof in

#

its not in interfaces its in advanced types

#

this allows me to use them individually

#

and check if a charcter is inside the interface

#

it'll error when i try to assign a character index that doesnt exist in the types

#

and since their index is their names, it works out fine

#

this is all pure types

restive furnace
#

as gang

opal plank
#

but if i recall correctly..

#

there

#

jesus christ that took a while to find

#

@cinder patio

#

this whole mess here

past needle
#

Is it possible to know if a channel is a news channel ? (discord.js)

opal plank
#

aight, enough playing around, gotta get to code

quartz kindle
#

in keyof typeof

#

lmao

opal plank
#

i warned you is was hacky and complicated af

#

a sane person would just make an array and change it

#

not me though

#

that requires changing arrays and maintaining code

#

no manual labour in my case

#

yeet data in db, auto types, boom

quartz kindle
#

no wonder, you're an aquarius xD

opal plank
#

lmao

#

idk what being aquarius have to do with me being stupid, but is the astros says so

quartz kindle
#

yup

sterile lantern
#

i have multiple codes (saved as code_codehere) and rn it only gets 1 code even though i have 3 in the db

#
 let codes = db.fetch(`code`)```
#

sqlite ^

quartz kindle
#

fetch("code") doesnt mean fetch everything that starts with "code"

#

fetch("code") means fetch exactly "code" and nothing else

misty sigil
#

code_*?

#

i doubt it

quartz kindle
#

which db is it?

#

quick.db?

misty sigil
#

or if all codes start with a defined letter couldn't you use one of sql's patterns

sterile lantern
#

o

jovial nexus
#

how can i log when an user joins/leaves a guild without gateway intents?

sterile lantern
#

and yea ^^^^

#

you cant

#

you need the intent

jovial nexus
#

u sure? there is not other way?

sterile lantern
#

yes... you cannot get that info without the intent

sterile lantern
#

all codes r defined with code_

#

then the random code

solemn latch
#

I wonder what data is even available with zero intents enabled ๐Ÿค”

sterile lantern
#

channels

#

servers too i think

jovial nexus
#

i was saying privileged gateway intents

solemn latch
#

Honestly might make a bot just to have a play around with it.

sterile lantern
#

what

#

privileged gateway?

jovial nexus
#

yes?

quartz kindle
jovial nexus
#

how can i log when an user joins/leaves a guild without privileged gateway intents?

sterile lantern
sterile lantern
quartz kindle
#

yes

sterile lantern
#

you iirc

#

cant*

#

im not too sure

sterile lantern
#

but i had a welcome msg

#

and it stopepd working

#

stopped*

#

after intents were turned off

jovial nexus
sterile lantern
#

is it the same way?

#

db.fetch

#

or is there a diff function

quartz kindle
#

better-sqlite3 is the database itself and works with SQL queries

#

there are no helper functions that do it for you like quick.db does

#

you have to code them yourself

sterile lantern
#

o

#

oof

#

does keyv have that function

quartz kindle
#

to do that in sqlite you would do something like db.prepare("SELECT * FROM table WHERE id LIKE 'codes_%'").all()

#

but then again, in sqlite you should structure your tables in a better way than that

#

for example SELECT * FROM codes WHERE id = 'id here'

#

and ditch the a_b_c thing altogether

sterile lantern
#

oh

#

i see

#

is there any other DB that has a easier way

#

like keyv or enmap

quartz kindle
#

SQL is a fully featured query language to interact with SQL-compatible databases (sqlite, mysql, mariadb, postgresql, etc)

#

if you learn SQL you can use any database that supports SQL

#

and it gives you a lot of power to do anything you want with the data

sterile lantern
#

o

quartz kindle
#

but you have to learn it

#

its like a second language

sterile lantern
#

ah

#

alright

fringe pendant
#

for basic data store/retrieval it'll be pretty easy to learn

#

assuming you're not doing any crazy joins or whatever

quartz kindle
#

yes, basic usage is very easy

#

for example

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

lmao

#
// save data
db.prepare("INSERT INTO users (name, date, age) VALUES (?,?,?)").run("tim", Date.now(), 30);

// get data
let timsAge = db.prepare("SELECT age FROM users WHERE name = ?").get("tim");
fringe pendant
#

Another option if you're feeling saucy is to put a simple express.js API in between, so you can input/retrieve data in JSON. Doesn't really matter if you're only doing a few transactions but if you're planning to add quite a few tables and functions then it could clean your code up a lot

#

I've gone that route

earnest phoenix
#

C:\Users\pcs\Desktop\Natsumi>npm i discord.js
npm WARN tar EPERM: operation not permitted, open 'C:\Users\pcs\Desktop\Natsumi\node_modules.staging\discord.js-3f9e79e5\webpack\discord.js.LICENSE.txt'
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community/

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pcs\AppData\Roaming\npm-cache_logs\2021-01-21T15_56_47_061Z-debug.log

C:\Users\pcs\Desktop\Natsumi>

#

because I get this error when I put

#

npm i discord.js

quartz kindle
#

do you have any other program open in your project? like a code editor?

misty sigil
#

tim's 30

#

what

quartz kindle
#

well, not yet

#

in 2 months

#

xd

misty sigil
#

i will wait

quartz kindle
#

to say that again?

#

lmao

misty sigil
#

and to wish you a happy birthday

#

lmao

quartz kindle
#

xDD

pure lion
#

How can I make the opengraphics image larger?

#

Also Tim, Matt and I will fax you a cake

tribal siren
#

bot.roles.highest.comparePositionTo(member.roles.highest)

#

bot indeed has a highest role

drowsy grail
#

happy early birthday

tribal siren
#

wait tim has birthday soon?

#

wow happy birthday tim sorry for not knowing

drowsy grail
#

@tribal siren does the member have a role?

tribal siren
#

yes

pure lion
#

Is bot your client?

tribal siren
#

yes..

pure lion
#

Bots don't have roles

tribal siren
#

should i do message.guild.me then?

pure lion
#

You're gonna do <message>.guild.me.roles

#

Yeah

tribal siren
#

oh

#

im dumb

#

aight thanks

distant cobalt
#
dropMsg.react('๐ŸŽ‰').then(() => dropMsg.react(''));``` how do i make this only 1 reaction added?
quartz kindle
#

wut?

quartz kindle
distant cobalt
#

how come right after it reacts, it sends the message?

dropMsg.react('๐ŸŽ‰').then(() => dropMsg.react('๐ŸŽ‰'));
            const filter = (reaction, user) => {
                return ['๐ŸŽ‰'].includes(reaction.emoji.name);
            };
            
            dropMsg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
                .then(collected => {
                    const reaction = collected.first();
            
                    if (reaction.emoji.name === '๐ŸŽ‰') {
                        let winner = dropMsg.reactions.cache.get("๐ŸŽ‰").users.cache.filter((u) => !u.bot).random();
                        channel.send(`Congrats ${winner}! You win!`)
                    } else {
                        return
                    }
                })
                .catch(collected => {
                    channel.reply('**Drop exceeded the giveaway time limit! Ending...**');
                });```
#

i think i need to filter the bot's reaction out tho right?

#

how do i do that

earnest phoenix
#

@quartz kindle BRO HAPPY BIRTHDAY

earnest phoenix
#

U happy too?

mellow kelp
#

wait its tims birthday

earnest phoenix
#

Lol

#

Yes someone said that

mellow kelp
#

HAPPY BIRTHDAY DUDE

earnest phoenix
#

YE MAN

distant cobalt
#

HAPPY B DAY

rustic nova
#

Make sure the user who reacted to it is not the bot

distant cobalt
rustic nova
#

Not sure

distant cobalt
distant cobalt
#

but how do i filter the bot's reaction?

rustic nova
#

Isn't there a function to get who reacted?

distant cobalt
earnest phoenix
#

Hello