#development

1 messages · Page 607 of 1

vagrant bison
#

tries in dbm

strange trout
vagrant bison
#

he has now switched on, but he does not answer all commands

strange trout
#

Can you show me your code

grim aspen
#

which one of you are having problems

#

i can't tell who needs help

strange trout
#

Taki

vagrant bison
#

I have

grim aspen
#

which library?

strange trout
#

Your bot is online but not responding to commands. Did you check if it has proper perms?

vagrant bison
#

d.js

#

yes

grim aspen
#

try showing your code

vagrant bison
#

no command has been running since 12 and it was working before

#

my bot is createt on dbm

#

when I run a bot from my computer everything is ok, only when I turn on the bot with vps is not ok

strange trout
#

Discord Bot Maker?

vagrant bison
#

ye

#

...

#

help me

strange trout
#

I highly recommend you learn how to use one of Discord's many libraries

#

Or join the dbm support server

vagrant bison
#

...

strange trout
#

I don't think anyone here uses DBM to make bots unfortunately. You'll be better off joining their support server

west spoke
#

Yeh

sullen elm
#

help

#

in c#

mossy vine
#

Console.ReadLine() returns a string afaik

#

or a buffer

#

either one of those

#

yeah it returns a string

#

you need to convert it to an integer first

earnest phoenix
#

Is yç an int (number)? @sullen elm

#

Yup

#

Intiger ^

mossy vine
#

no, its not

#

as its coming from Console.ReadLine()

earnest phoenix
#

Ye? I see it

#

it's returned as a string

#

because the user can input other characters than numbers

#

you'd use int.TryParse to see if it's a valid number

mossy vine
#

does anyone here use pm2? how can i execute a command to an already running process?

#

so basically i did pm2 start "java -jar server.jar" --name something

#

and i wanna execute commands in that process

#

or are there any pm2 alternatives that let me do that?

inner jewel
#

screen/tmux should allow

#

if you mean writing to stdin

mossy vine
#

yes

#

does screen work just like pm2?

inner jewel
#

no

#

systemd should be able to do everything pm2 does

mossy vine
#

ah, and i just connect to the process with conspy 20?

inner jewel
#

you'd change 20 to the tty you're using

mossy vine
#

in pm2s case what would that be?

#

the pid?

real portal
#

wtf

#

-1200 ping

#

my bot is faster of me

strange trout
#

lul

inner jewel
#

that happens when you use ids to calculate ping

#

Clock drift refers to several related phenomena where a clock does not run at exactly the same rate as a reference clock. That is, after some time the clock "drifts apart" or gradually desynchronizes from the other clock i.e. the crystal-based clocks used in computers, like a...

earnest phoenix
#

*yardım

eternal mesa
#

Do people suggest pm2 or systemd

spring ember
#

For what

#

They can be used together as well

#

Usually I would recommend using Kubernetes or other orchestration tools and Docker to manage production bcode

vernal rivet
#

I suggest standard node. But that's me. Pm2 is nice and let's you to interact with the application through a website. But the problem I have had, and I have a feeling others had is that sometimes your bot will crash when added to pm2, this has happened to me every time. I never really worked with systemd, so cant tell you much about that one

#

Node.js is going to be alot easier to deal with. Nodemon is also another good one to choose, but if your ide autosaves, then I wouldn't recommend nodemon since it restarts Everytime it senses that a file has saved.

fossil scaffold
#

anyone else having issues with node.js?

heady anvil
#

an issue with node.js could be extremely broad

#

i'm not sure what you're trying to do

fossil scaffold
#

well more npm

#

i get this everytime i try to npm install discord.js

vernal rivet
#

Well read the errors

fossil scaffold
#

i have.... i have tried to look those up and they still do not work...

#

no matter what i try i get the same errers

vernal rivet
#

Discord.js needs to have one of those dependencies to be installed I believe

fossil scaffold
#

i just tryed to install npm install bufferutil --save-optional and i got the same error

vernal rivet
#

Do opusscript and node-opus

fossil scaffold
#

nope same errors for both

vernal rivet
#

What does the errors look like when trying to install opusscript?

fossil scaffold
#

same as the discord.js

#

no matter what i try it's the samething

inner jewel
#

there aren't any errors there

#

those are optional dependencies

fossil scaffold
#

hmm it says npm ERR code 1

vernal rivet
#

It won't let him install d.js cause he doesn't have one of the listed dependencies installed, something like that

inner jewel
#

those are optional

#

you dont need then

#

discord.js is already installed

fossil scaffold
#

thebeat@1.0.0 /home/TheBeat/thebeat
├── UNMET PEER DEPENDENCY bufferutil@4.0.1
├── UNMET PEER DEPENDENCY erlpack@earnest phoenixapp/erlpack
├── UNMET PEER DEPENDENCY libsodium-wrappers@^0.7.3
├─┬ UNMET PEER DEPENDENCY node-opus@0.3.1
│ ├── bindings@1.2.1
│ ├── commander@2.20.0
│ ├── nan@2.13.2
│ └─┬ ogg-packet@1.0.1
│ └─┬ ref-struct@1.1.0
│ └── ref@1.3.5
├── UNMET PEER DEPENDENCY opusscript@^0.0.6
├── UNMET PEER DEPENDENCY sodium@^2.0.3
└── UNMET PEER DEPENDENCY uws@^9.14.0

vernal rivet
#

So he is trying to install it when it's already installed?

inner jewel
#

you can ignore those

#

it installed d.js, then listed those optional dependencies that aren't installed

fossil scaffold
#

so i don't actually need those?

#

i'm working on making a bot right now so i just want to make sure

fiery birch
#

u dont need them prolly

#

opus is for audio and music bot stuff, idk the others

fossil scaffold
#

ya i was trying to get opus

#

because i'm making a music bot

fiery birch
#

oh

fossil scaffold
#

but it don't install

#

lol

vernal rivet
#

Do you ffmpeg installed?

fossil scaffold
#

yes

#

that's install

#

ed

vernal rivet
#

Ok

fossil scaffold
#

thebeat@1.0.0 /home/TheBeat/thebeat
├── UNMET PEER DEPENDENCY bufferutil@4.0.1
├── UNMET PEER DEPENDENCY erlpack@earnest phoenixapp/erlpack
├─┬ ffmpeg@0.0.4
│ └── when@3.7.8
├── UNMET PEER DEPENDENCY libsodium-wrappers@^0.7.3
├── UNMET PEER DEPENDENCY node-opus@0.3.1 extraneous
├── UNMET PEER DEPENDENCY opusscript@^0.0.6
├── UNMET PEER DEPENDENCY sodium@^2.0.3
└── UNMET PEER DEPENDENCY uws@^9.14.0

#

i just tried to install node-opus but its saying it's still not in stalled

#

ok i got opusscript to go

vernal rivet
#

Have you checked in your node_modules if you have opus there?

fossil scaffold
#

but node-opus won't install

#

yes i have it's not there

vernal rivet
#

Ok

fossil scaffold
#

npm says it installed it but it don't show up that its installed

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vernal rivet
#

What does your json files look like?

sage bobcat
#

One message removed from a suspended account.

fossil scaffold
#

oh there we go it installed now

#

weird

vernal rivet
#

There should be a file already made for you calledpackage.json it will be lower case, look at that file

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

vernal rivet
#

Yes

#

When it comes to program, a and A are two different things.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

vernal rivet
#

From my understanding of the package.json file is that it is used to store all of your packages and dependencies. Not where you put stuff for your bot. I believe it's complaining about that the keys you have in it is not what is supposed to be there. It's talking about the beginning

#

What ide are you using?

#

I wouldn't use notepad at all, notepad++ is a different story

kind nexus
#

@bold oxide help

vernal rivet
#

Can't use bots here

fossil scaffold
#

ok so i've fixed my npm... apparently it wasn't updated to the right npm and i had to update it

#

now all is working

#

everything is installed 😃

slender thistle
#

Could you post a summary of what express is?

#

Flask probably Thonk

fossil scaffold
#

ok i have installed discord-irc but everytime i go to use it i get -bash: discord-irc: command not found

#

Linker@1.0.0 /home/Weldon/Bots
└── discord-irc@2.7.0

npm WARN Linker@1.0.0 No repository field.
npm WARN Linker@1.0.0 No license field.
[Weldon@thunder Bots]$ discord-irc --config linker.json
-bash: discord-irc: command not found

#

ok nevermind got hat

#

lol

#

that

coral trellis
#

Code it yourself, we don't spoonfeed here

earnest phoenix
#

Hello, I would like to know how to add a widget on my bot with (.setImage("LINK HERE")I did this, do its not work.

quartz kindle
#

please tell us which language you're using, which library you're using and show us the code you tried

errant nebula
#

Uh, I am using discord.py and for some reason my bot is REALLY lagging nowadays, with below 1% server resource usage. Like, I get a response 10 seconds after typing the command. It used to be fine earlier. My bot is in 770 guilds now tho.

#

Logs show nothing, testing bot works fine on my laptop

#

also this lag does not occur all the time, only 70% of the time

earnest phoenix
#

Hello, I created a command create prompt but it tell me: createInvite is not defined. How do I define it??

#

js ?

#

yes

#

@earnest phoenix

#

yes

#
  console.log(inv.url)
})``` i think is that
#

edit ^

#

My coding is not the same wait

#
guild.defaultChannel.createInvite({
        maxAge: 0
    }).then(invite => {
        message.channel.send(`**Lien permanent :** \n http:\//discord.gg/${invite.code}`);
    }).catch(e => logger.error(e))
};
#

uh defaultChannel has been deleted

#

From discord.js

#

I withdraw it

#

My codage :

#
const Discord = require ("discord.js")

exports.run = (client, message) => {

    let guild = message.guild;
    message.delete();
    
    if (!message.guild.member(message.author).hasPermission('CREATE_INSTANT_INVITE')) {
        return message.reply('<![alertking](https://cdn.discordapp.com/emojis/565822552815960064.webp?size=128 "alertking")565822552815960064> | Vous devez avoir la permission `CREATE_INVITE` pour effectuer cette commande.').catch(e => logger.error(e))
    }
   
      
    guild.defaultChannel.createInvite({
        maxAge: 0
    }).then(invite => {
        message.channel.send(`**Lien permanent :** \n http:\//discord.gg/${invite.code}`);
    }).catch(e => logger.error(e))
};

module.exports.help = {
    name: 'createinvite'
};
#

use guild.channels.random.createInvite({ maxAge: 0 }).then(invite => { message.channel.send(`**Lien permanent :** \n http:\//discord.gg/${invite.code}`); }).catch(e => logger.error(e)) };

#

ok

#

ah mais attend

#

t'es fr

#

Je viens de remarquer en envoyant le code

#

ah bah oui

#

mdrr

#

toi aussi ?

#

oui

#

pareil

#

je reviens dans 5 minutes

#

euh 30

#

ok

late hill
#

Or create the invite for the channel the command was used in?

#

Would make more sense, no?

real portal
#

I'm hosting my bot on my old phone with 2gb of RAM and it works great and is almost free xd

gleaming tulip
#

random is a function too

#

so channels.random().createInvite()

lofty hamlet
#

Hello, how can I send a private message to the person who adds my bot I put this: guild.owner.send
But whoever adds it is not necessarily the owner

late hill
#

You can't know who added the bot unless you're using OAuth to have users authorize afaik

lofty hamlet
#

Ok thx

#

And the use of richpresence to put a thing that is done like: Develop your bot with a large image etc is it allowed?

late hill
#

If you're talking about your own account yes

#

Bots can't

lofty hamlet
#

I speak it's allowed exemple :

#

?

fair minnow
#

Anyone know how I can represent 18446744073709551616 as 18446744073709551616 in javascript?

late hill
#

Yes but if you'll have links and stuff on it, some servers might ban you as they could see it as advertising @lofty hamlet

#

@fair minnow use strings?

fair minnow
#

I need to do maths on it :/

late hill
#

oof

fair minnow
#

var result = minimum + (number / 18446744073709551616) * (maximum - minimum + 1)

late hill
#

What even is that

#

👀

fair minnow
#

It's part of an algorithm for provably random number generation

#

18446744073709551616 = 16^16

#

The only 2 solutions I can see is use a smaller number (which I'd rather not do) or use a js library like math.js

fathom mesa
earnest phoenix
#

Are you waiting more than 6 hours? @fathom mesa

fathom mesa
#

@earnest phoenix i add the server on website on match 10th

earnest phoenix
#

Yes

fathom mesa
#

i checked today the member count didnt update

earnest phoenix
#

But when the server had 217500 members?

fathom mesa
#

yes

earnest phoenix
#

More than 6h aho?

fathom mesa
#

wait should i give to powers to the @pliant gorge in order to work that member count?

lofty hamlet
#

@late hill by discord this is allowed ?

late hill
#

Yes

errant nebula
#

anyone pinged?

lofty hamlet
#

Ok thanks you

late hill
#

Just don't spam change it

lofty hamlet
#

@late hill me ?

late hill
#

Yes

lofty hamlet
#

Of ?

#

I do not have to spam what?

#

@late hill 🤔

#

I think I understand, I have to change often if I understood correctly

errant nebula
#
Apr 22 18:20:48 megumin run.sh[26256]: INFO:discord.voice_client:Starting voice handshake...
Apr 22 18:20:49 megumin run.sh[26256]: INFO:discord.voice_client:Voice handshake complete. Endpoint found singapore456.discord.gg (IP: 103.126.138.58)
Apr 22 18:21:54 megumin run.sh[26256]: WARNING:discord.state:VOICE_STATE_UPDATE referencing an unknown member ID: 508156862328340490. Discarding.
...
Apr 22 18:23:43 megumin run.sh[26256]:   File "/usr/lib/python3.7/asyncio/selector_events.py", line 494, in _sock_connect_cb
Apr 22 18:23:43 megumin run.sh[26256]:     raise OSError(err, f'Connect call failed {address}')
Apr 22 18:23:43 megumin run.sh[26256]: TimeoutError: [Errno 110] Connect call failed ('103.126.138.58', 443)

Anyone else facing this?

sage bobcat
#

One message removed from a suspended account.

unique nimbus
#

It depends if you know how to code and how well

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

unique nimbus
#

Practise makes perfect

#

Try and ask for help if needed

errant nebula
#

ye

#

but python is better

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

No language is better than other

errant nebula
#

look at php.

#

some languages are indeed better than others

earnest phoenix
#

Php its not java or javascript

mossy vine
#

@sage bobcat you would need to handle user input, and a database to save progress

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

grim aspen
#

why not learn and read the docs

errant nebula
#

just create a simple bot

#

look at other open source bots on GH

earnest phoenix
#

1+1=2

fair minnow
#

@sage bobcat You could see if there's a tutorial online on how to make a bot. Then, when you feel ready, you can embellish it with your own stuff. That's how I learned.

earnest phoenix
#

public class Main {


    public static void main(String[] args) throws LoginException {

        String token = "TOKEN";


        JDABuilder builder = new JDABuilder(AccountType.BOT);
        builder.setToken(token);
        builder.addEventListeners(new Citation());
        builder.build();
    }


}```
```Java
public class Citation extends ListenerAdapter {


    public void onCitation(MessageReceivedEvent event){


        event.getChannel().sendMessage("hello").queue();


    }

}``` It won't say hello :(
inner jewel
#

add @Override

#

the compiler will show you what's wrong

earnest phoenix
#

@inner jewel it won't Override

inner jewel
#

exactly

#

jda isn't bukkit

#

it won't magically call your method

earnest phoenix
#

bukkit x')

inner jewel
#

you need to override the right method for it to be called

earnest phoenix
#

ok i'll try it

inner jewel
#

onX(XEvent)

earnest phoenix
#

wtf duuuuuudeeeee

sage bobcat
#

One message removed from a suspended account.

vernal rivet
#

Just like making an other bot, expect you tell to do invites

earnest phoenix
#
  if (message.guild) {
    
    score = client.getScore.get(message.author.id, message.guild.id);
    if (!score) {
      score = { id: `${message.guild.id}-${message.author.id}`, user: message.author.id, guild: message.guild.id, points: 0, level: 1 }
    }
    score.points++;
    const curLevel = Math.floor(0.07 * Math.sqrt(score.points));
    if(score.level < curLevel) {
      score.level++;
      if(message.guild.id === "264445053596991498") return; // ------------------- Is this correct way to block level message here?
      message.reply(`Your level is now! **${curLevel}**!`);
    }
    client.setScore.run(score);
  }
``` Check the comment!
#

put that under if (message.guild) {

#

but that will block every message in the server

#

soo i'm kinda stuck

steel heath
#

if (message.guild && message.guild.id != "264445053596991498") { }

earnest phoenix
#

whaat?

#

remplace if (message.guild) { by ^

#

why tho

#
lient.on('message', message => {
        if (message.author.bot) return;
 /*client.channels.get('568027128470437888').send(
    message.author.username.toString()
    + " :: " +
    message.content.toString()
  + " :: Userid ::" +
   "<@" + message.author.id + ">"
  )
*/
  
let score;
  if (message.guild) {
    
    score = client.getScore.get(message.author.id, message.guild.id);
    if (!score) {
      score = { id: `${message.guild.id}-${message.author.id}`, user: message.author.id, guild: message.guild.id, points: 0, level: 1 }
    }
    score.points++;
    const curLevel = Math.floor(0.07 * Math.sqrt(score.points));
    if(score.level < curLevel) {
      score.level++;
      if(message.guild.id === "264445053596991498") return;
    message.reply(`Your level is now! **${curLevel}**!`);
    }
    client.setScore.run(score);
  }
#

idk if i should

green swan
#

@earnest phoenix, What are you trying to do?

earnest phoenix
#

i shouln't

#

trying to block the server in my code

green swan
#

well

vernal rivet
#

What's up?

green swan
#

here one sec

earnest phoenix
#

for only this server

#
    
    score = client.getScore.get(message.author.id, message.guild.id);
    if (!score) {
      score = { id: `${message.guild.id}-${message.author.id}`, user: message.author.id, guild: message.guild.id, points: 0, level: 1 }
    }
    score.points++;
    const curLevel = Math.floor(0.07 * Math.sqrt(score.points));
    if(score.level < curLevel) {
      score.level++;
      if(message.guild.id === "264445053596991498") return; // ------------------- Is this correct way to block level message here?
      message.reply(`Your level is now! **${curLevel}**!`);
    }
    client.setScore.run(score);
  }```
#

and so it doesn't block every other server

#

;)

steel heath
#

the one i sent will work

earnest phoenix
#

wtff

green swan
#

one sec @earnest phoenix

earnest phoenix
#

It will only run on this server

#

The code in that

#

it will only run on this server

#

EXACTLY what I don't want

#

idk

steel heath
#

there's != so it'll work when server id is not "264445053596991498"

green swan
#
if (message.guild {
    if (message.guild.id === 'ID') return;
}```
steel heath
#

thats pretty unnecessary tho

earnest phoenix
#

OOOOOOOH

#

I have literaalys autism

green swan
#

😇

earnest phoenix
#

thanks

#

i used if (message.guild && message.guild.id != "264445053596991498") { in the end

vernal rivet
#

You don't need to check for message.guild, you know it's in a guild

earnest phoenix
#

maybe in a dm?

#

@vernal rivet

green swan
earnest phoenix
#

that's why the check was there in the first place

vernal rivet
#

Dms is different story

#

You usually don't to be a dm bot

earnest phoenix
#

I do use dm's to make a special verify system for only my friend's server

vernal rivet
#

But that's for one command

#

You specifically told it to be in dms for the command, every other command is default which is by the server

pallid zinc
earnest phoenix
#

read

pallid zinc
#

trying to create a loop

grim aspen
#

the error's told on the console

pallid zinc
#

Client.on('ready', async () => {

earnest phoenix
#

function

pallid zinc
#

my code

vernal rivet
#

Await is an asynchronous function, it is only valid in asynchronous methods/functions

#

You have to give more than one line my friend

pallid zinc
#
    function sleep(ms) {
        bot.user.setActivity(`you everyday.`, {type : 'WATCHING'});
         await sleep(1000);
        bot.user.setActivity(`22 everyday.`, {type : 'WATCHING'});
         await sleep(1000);
        bot.user.setActivity(`232131232 everyday.`, {type : 'WATCHING'});
        return new Promise(resolve => setTimeout(resolve(), ms));
    }
  
})```
earnest phoenix
#

async function sleep(ms) {

vernal rivet
#

^^^^^^

pallid zinc
#

it worked

#

but no activity is showing

steel heath
#

what do you think

pallid zinc
#

it should be Client

#

i think

grim aspen
#

bot.user is not the same as client

#

it would be client.user

steel heath
#

unless he defined that

grim aspen
#

Client*

steel heath
#
Client.on('ready', async () => {
    async function sleep(ms) {
        Client.user.setActivity(`you everyday.`, {type : 'WATCHING'});
        await sleep(1000);
        Client.user.setActivity(`22 everyday.`, {type : 'WATCHING'});
        await sleep(1000);
        Client.user.setActivity(`232131232 everyday.`, {type : 'WATCHING'});
        return new Promise(resolve => setTimeout(resolve(), ms));
    }
})```
undone dune
#

türk varmı türk

pallid zinc
#

still

grim aspen
#

hold on

late hill
#

xd

pallid zinc
#

checked before you send my friend

late hill
#

You don't call the function

#

And if you did

#

It would be fucked

#

Because it endlessly keeps calling itself

grim aspen
#

what name did you define new Discord.Client(); as

pallid zinc
#

Client

steel heath
#

ew

vernal rivet
#

Yes

#

So you did const Client = new Discord.Client?

pallid zinc
#

still no activity showing

earnest phoenix
#

wait

late hill
#

gamer please

#

Fix the infinite loop

#

and then actually call the function

earnest phoenix
#
   Client.user.setActivity()
    setTimeout(game2, 10000);
};

function game2(){
       Client.user.setActivity()
    setTimeout(game1, 10000);
};


Client.on("ready", () => {

    setTimeout(game1, 10000);
});```
#

edit ^

pallid zinc
#

edited bro

earnest phoenix
#

i'm french

vernal rivet
#

||cough cough prefect time to plug my botcough cough||

pallid zinc
#

Ok

mossy vine
#

how would i remove focus from an input field with javascript?
i have a regular <input type="text" autofocus> field

#

i tried document.getElementById('inputfieldid').blur() but that doenst do anything

idle basalt
#

but .blur() is the answer

earnest phoenix
#

hi

mossy vine
#

but it doesnt work

vernal rivet
mossy vine
#

mate i know

#

let me get the file

#

upon pressing escape it should unfocus the input field

#

but it doesnt

vernal rivet
#

whats your id?

mossy vine
#

putting a console.log() in the Mousetrap callback works tho, so thats not the problem

#

i sent the file

vernal rivet
#

i can't look at it cause i am on a chromebook right now

mossy vine
#

ow in the version i sent im still using jquery

vernal rivet
#

but from what you sent about the .blur, what is the id of the field?

mossy vine
#

the id is not the problem

vernal rivet
#

but it is

#

.getElementById() is going to search by the element ID, in this case your id is searchfield

mossy vine
#

yes

#

and thats what i have in the code

#

actually, hold up

#

oh wiat

#

i just realized what the issue is

#

i used Mousetrap.bind instead of Mousetrap.bindGlobal

#

ok now its working

vernal rivet
#

oofers

earnest phoenix
#

Hello, I coded a music bot but when I made the play command with a YouTube link, the. BOT joins the vocal salon and leaves immediately. The worries come from the:

const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
          .on('end', reason => {
        message.channel.send('``La musique est terminée.``');
              if (reason === 'Stream is not generating quickly enough.') console.log('Fin de la musique.');
              else console.log(reason);
              serverQueue.songs.shift();
              play(guild, serverQueue.songs[0]);
          })
          .on('error', error => console.error(error));
      dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
  
      serverQueue.textChannel.send(`?? Début de la musique : **${song.title}**`);
  }
  
  });
lofty hamlet
#

How i can pick a random personn with the reactions of a message ?

earnest phoenix
#

.random()

lofty hamlet
#

?

earnest phoenix
#

Si jamais tu es Francais. Dit le

#

ah ok

#

Il est francais ahhh

#

Plus simple d'un coup

lofty hamlet
earnest phoenix
#

demasquage lel

#

@lofty hamlet bah tu a juste a fetch les reactions

lofty hamlet
#

This is a english channel

earnest phoenix
#

ah oui

#

Et a faire un .random()

#

Nah

lofty hamlet
#

Speak in english :/

earnest phoenix
#

Fr

#

bah développement

#

channel

#

Toute les langues

#

Tkt

#

donc tu peut

#

Ya que dans general que tu peux pas

#

Jparle h24 fr ici

lofty hamlet
#

I'm not french dude

earnest phoenix
#

AH

#

mdrr

#

Il troll ? @earnest phoenix

#

Chelou lui nan ?

west spoke
earnest phoenix
#

Je crois

west spoke
#

You too @earnest phoenix

earnest phoenix
#

Yep ne se dit pas en anglais

lofty hamlet
#

You can speak english ?

earnest phoenix
#

Yes

west spoke
#

dats not english

earnest phoenix
#

@west spoke french are allowed here

#

What's your problem?

west spoke
#

Ok

#

Now it is

#

No

earnest phoenix
#

Yes

west spoke
earnest phoenix
#

@west spoke If the French are not allowed to speak French. How do they do it? Open-minded in term of language ! not just English.

#

Yes but i speak french because the people are french

west spoke
earnest phoenix
#

Dude its general

#

French are allowed in development

#

Ask to a mod

#

@west spoke Leave now.

lofty hamlet
#

Stop and speak english dude

west spoke
#

^

earnest phoenix
#

We know what they say.

#

If i want to speak french i speak french

west spoke
#

Some people dont

earnest phoenix
#

Stopped lazy now

#

@lofty hamlet What are you worried about?

west spoke
#

Hm?

#

No someone was just asking me a question in general

quartz kindle
west spoke
#

Thank you.

quartz kindle
#

everything else is mostly english-only, aside from some small tips here and there

mossy vine
#

rule 6

pallid zinc
#
   Client.user.setActivity()
    setTimeout(game2, 10000);
};

function game2(){
       Client.user.setActivity()
    setTimeout(game1, 10000);
};


Client.on("ready", () => {

    setTimeout(game1, 10000);
});```
#

Still can't fix

mossy vine
#

ok but you could just use recursion

earnest phoenix
#

@pallid zinc dude

mossy vine
#

also what the fuck

pallid zinc
#

What

earnest phoenix
#

your () are empty

pallid zinc
#

I filled

#

Bro

earnest phoenix
#

And what is the problem?

pallid zinc
#

No console err

grim aspen
pallid zinc
#

But not showing the activity

west spoke
grim aspen
#

active?

pallid zinc
grim aspen
#

elaborate

west spoke
#

Ok let's not spam haha

earnest phoenix
#

@pallid zinc bot takes time to show activity

pallid zinc
#

1 hour it take

earnest phoenix
#

Do you have restart your bot?

mossy vine
#

tbf you are changing status every 10 seconds

#

thats borderline api abuse

#

change it to something like a minute

earnest phoenix
#

The max is 5 times per minutes

vernal rivet
#

Oofers

earnest phoenix
#

30000 ms are good

#

@pallid zinc remplace 10000 by 30000 or higher

dusky marsh
#

Max is 5 times a minute

earnest phoenix
#

And put off your bot for 3m and restart it after

opaque eagle
#

New Error:
CustomClient.js: https://hasteb.in/lexewori.js
ready.js: https://hasteb.in/pilufevi.js ```sh
yarn run v1.15.2
$ node dist/index.js
/Users/sinistercyborg/Workspace/Bot/dist/structures/CustomClient.js:33
this.on(name, (...args) => event.exec(args));
^

TypeError: event.exec is not a function
at FeliciaClient.on.args (/Users/sinistercyborg/Workspace/Bot/dist/structures/CustomClient.js:33:46)
at FeliciaClient.emit (events.js:193:13)
at WebSocketManager.triggerReady (/Users/sinistercyborg/Workspace/Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:442:17)
at WebSocketManager.checkReady (/Users/sinistercyborg/Workspace/Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:411:61)
at Object.module.exports [as READY] (/Users/sinistercyborg/Workspace/Bot/node_modules/discord.js/src/client/websocket/handlers/READY.js:17:13)
at WebSocketManager.handlePacket (/Users/sinistercyborg/Workspace/Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:390:31)
at WebSocketShard.onPacket (/Users/sinistercyborg/Workspace/Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:398:22)
at WebSocketShard.onMessage (/Users/sinistercyborg/Workspace/Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:264:10)
at WebSocket.onMessage (/Users/sinistercyborg/Workspace/Bot/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:193:13)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```

sinful lotus
#

the event you are calling doesnt have exec as function

#

double check how you load and your event files

opaque eagle
#

That's what I need help with

sinful lotus
#

thats your problem I answered it

#

Im not sure what "event" cause your stacktrace just says there

inner jewel
#

static exec() might work

#

actually

#

nvm it won't

#

you need to call new on the events

#

new (require(theevent))(client)

sinful lotus
#

wait

#

lemme check your file

opaque eagle
#

CustomClient.js line 40 @inner jewel

sinful lotus
#

oh

#

a sec

inner jewel
#

.then(i => new i.default()) it should be passing the client

opaque eagle
sinful lotus
#

do something like this
fs.readdir your files
require it then call new on it

#

after calling new on it put it on function

opaque eagle
#

That's what I think I'm doing

sinful lotus
#

thats what you need to do since its class based

inner jewel
#

what's ready.ts

sinful lotus
#

if its a function, you can get away without doing new

opaque eagle
#
// ready.ts
import { Event, FeliciaClient } from "..";
export default class extends Event {

    constructor(client: FeliciaClient) {
        super(client);
    }

    exec() {
        console.log(`${this.client.user!.username} has logged in, serving ${this.client.guilds.size} guilds.`);
    }

};```
idle basalt
#

just do the same thing for events as you do for commands except bind your client

sinful lotus
#

like
const event = require('./ready.js')
client.on(eventname, event.exec)

then on your event
exports.exec = async function () {}

#

where this is your client on event

opaque eagle
#

ok

idle basalt
#

and do that dynamically for all files in your event folder with fs

sinful lotus
#
functions like 
async function stuff() {}
can inherit this without doing bind()

while
const stuff = async () => {}
needs .bind() so you can make your this as client on that function
inner jewel
#

async () => {} doens't have a this

sinful lotus
#

you can bind this there

#

since bind creates a new function

#

but you woud be better of async function stuff () {}

#

less overhead

inner jewel
sinful lotus
#

then thats sad

inner jewel
sinful lotus
#

normal function has this

inner jewel
#

arrow functions have the this from the enclosing scope

sinful lotus
#

arrow functions dont override this if for exampe its inside a class

inner jewel
#

class C { something() { return () => console.log(this); } }

new C().something()() would print the C instance

#

which is the this value for the arrow function's enclosing scope

idle basalt
#

this is big overcomplicated in js tbh

#

i recommend the video series on egghead.io explaining this

sinful lotus
#

this is confusing at first

#

but u get used to it

inner jewel
#

just don't use this inside normal functions and you can avoid most problems

#

biggest issue is getting references to class instance functions (eg class C { callback() { ... } stuff() { setTimeout(this.callback, 10); } })

sinful lotus
#

if you do use this just dont overcomplicate it

#

LOL

idle basalt
#

i just avoid this

real portal
#

how to allow to do-release-upgrade in command to not must send Y after 2 minutes?

#

^linux

quartz kindle
dusky bear
#

Can you install canvas without using npm.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

Idk in py

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

slender thistle
#

Why the hell is Python mentioned on that screenshot

earnest phoenix
#

Idk

mossy vine
#

because of node-opus

slender thistle
#

I can not read, thank you

idle basalt
#

node-opus depends on node-gyp which requires windows build tools and python in path

#

Run npm i windows-build-tools --production --vs2015 --add-python-to-PATH --global as admin, and restart terminal.
Restarting machine can also be required.

#

copied from d.js discord ^

lofty hamlet
#

How i can pick a random personn with the reactions of a message ?

spring ember
#

the reaction has an array of participants

#

just choose one of them

lofty hamlet
#

Hum 🤔

spring ember
#

what language do you use?

lofty hamlet
#

JS

mossy vine
#

array[Math.round(Math.random() * array.length)] should work

spring ember
#

yes

mossy vine
#

spoonfeeding because i have no idea how to explain it

#

it just works

#

ok

#

dont ask me why

lofty hamlet
#

Hum what the name of the array ?

spring ember
#

it's pretty basic

#

just use Math.floor

mossy vine
#

whatever you name your array

#

oh yeah Math.floor is what you need

spring ember
#

and not Math.round

mossy vine
#

otherwise small chance of out of range error

spring ember
#

yes

#

it might be a really huge chance

lofty hamlet
#

What wait

spring ember
#

it depends on the array

lofty hamlet
#

I want a random reaction of this message

#

How i can PICK a user ?

#

array[Math.round(Math.random() * array.length)] ?

spring ember
#

@lofty hamlet it's simple Math.random() is a random number from 0 to 1
if you multiply it by the array length it's a random number from 0 to the array.length

lofty hamlet
#

What the name of the array reaction of a message

#

Lmao

spring ember
#

oh

lofty hamlet
spring ember
#

you use master or stable version of d.js?

lofty hamlet
#

I think master 🤔

#

I d'ont know

spring ember
#

it should be ```js
message.reactions[reactionId].users

lofty hamlet
#

?-?

#

And the message ?

#

Where i place the id of the message

spring ember
#

the message is the message the reactions are on

west spoke
#

So

spring ember
#

you first fetch the message

west spoke
#

569983515693809719.reactions[reactionId].users

#

?

spring ember
#

NO

#

message is not the id

west spoke
#

hey I dont know s about java

spring ember
#

it's the message object

#

its

#

JavaScript

west spoke
#

K I am just gonna go

#

Since I am not welcome at all

lofty hamlet
#

Oof

spring ember
#

I didn't say that

#

you are free to get help

lofty hamlet
#

message.fetch("ID").reactions[reactionId].users ?

spring ember
#

what is message.fetch("ID")

lofty hamlet
#

How i can fetch a message ?

#

I don't understand

#

What is it fetch

spring ember
#

can you store the message object?

#

it will really make everything easier

slim heart
#

is there a way to do discord footers with OG?

lofty hamlet
#

But I just want to take a random person who has put a reaction to a message

spring ember
#

@lofty hamlet you can also create a reaction collector

lofty hamlet
#

The message is already posted...

spring ember
slim heart
#

get the reaction collection then do .random()

#

@lofty hamlet

lofty hamlet
#

The message is already posted

slim heart
#

then do it

#

what're you havin trouble with bud

lofty hamlet
#

What ?

slim heart
#

what're you havin trouble with

#

what's stoppin you from doin these things?

lofty hamlet
#

I don't understand i want just want to take a random person who has put a reaction to a message (message already posted)

slim heart
#

will this only be used once?

frail anchor
#

wqew,

lofty hamlet
#

Yes

slim heart
#

if so then fetch the message, > .reactions.get("emoji id of the reaction") > .users > .random()

lofty hamlet
#

Basically the same thing as the giveaway bot reroll command

#

Ok thanks you

#

I go test and i recall you if he don't work

slim heart
#

kk

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

Have you read the error?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

slim heart
#

reactions isnt a part of channel, its a part of the message

#

do var message = await client.channels.get(channel).fetchMessage("messageid")
message. etc what you had after channel

#

no

#

.fetchMessage is asynchronous

#

because it fetches from the api

#

client doesn't store messages

frail anchor
#

hello I was going to ask something was my boat but when I click invite an empty page I can do what I can do

grim aspen
#

i'm not sure i understood that sentence

mystic shell
#

my bot is showing up as online on discord but not online on the discord bot list

grim aspen
#

what is your bot?

mystic shell
#

Dragon Bot

amber fractal
#

It isnt here

mystic shell
#

i have the bot in a server that i made to test it

#

its showing up as online there

#

and the commands are working and stuff

#

its probably not that big a deal if its not showing up as online on discordbots.org but i just want to know why

west spoke
#

It's not herem

#

Ita fine.

slim heart
#

@lofty hamlet whats wrong with it?

lofty hamlet
#

Scroll up

#

case "end": fonction.channellogs(message) var Fetchingchannel = args.slice(1).join(" "); var messagefetch = await bot.channels.get("493049997651345438").fetchMessage(Fetchingchannel) var Fetchvar = messagefetch.reactions.get("🙏").users.random() Fetchvar message.channel.send(Fetchvar) break;

slim heart
#

ik but whats wrong

#

is there an error?

lofty hamlet
#

Fetchvar is empty

slim heart
#

can u console.log(messagefetch.reactions.get("emoji")

lofty hamlet
#

Yep

#

Hum

#

Nothing @slim heart

#

Ho no wait

slim heart
#

yea then do .users.random()

lofty hamlet
#

?

slim heart
#

.users.random()

lofty hamlet
#

Yep

slim heart
#

do it

lofty hamlet
#

random of undefined lmao

#

console.log(messagefetch.reactions.get("🙏".users.random()))

slim heart
#

ur missing a )

lofty hamlet
#

My bad

#

random of undefined

#

No

#

console.log(messagefetch.reactions.get("🙏".users.random()))

slim heart
#

ur still missing a )

lofty hamlet
#

I'm fucking !

inner jewel
#

a string has no users property

late hill
#

Not missing, just missplaced

#

xd

lofty hamlet
#

Ups 😂

slim heart
#

no really

#

String.protoype.users = "gotchu yasmin"

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

lofty hamlet
#

undefined @slim heart

slim heart
#

@sage bobcat user.tag}

sage bobcat
#

One message removed from a suspended account.

slim heart
#

@lofty hamlet copy paste it again please

#

@sage bobcat before, you're closing off the template like this ${thing}

lofty hamlet
#

console.log(messagefetch.reactions.get("🙏").users.random())

slim heart
#

console.log( just the .users

lofty hamlet
#

Ok

#

It's strange

#

Collection {}

#

Lmao

slim heart
#

then whatever message ur fetching has nobody whos reacted with that

lofty hamlet
#

count: 69,

#

Look

slim heart
#

hm

lofty hamlet
#

It's strange

slim heart
#

dont know what to tell ya

#

ur broken idk

lofty hamlet
#

@late hill you can we help ?

slim heart
sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

It's so strange

strong peak
#

fonction?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

lofty hamlet
#

Not look this

#

It's my function name

mossy vine
#

@sage bobcat that function is not asynchronous, you can try .send('blah').then(_ => {})

sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

@slim heart

#

Look up

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

Just an example

#

Put in whatever you want

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

Uh no

sage bobcat
#

One message removed from a suspended account.

late hill
#

use an ide

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

What i send here are just examples. Youre not going to get far by just copypasting
It should be message.channel.send()

frail anchor
#

wad

sage bobcat
#

One message removed from a suspended account.

slim heart
#

u dont need await

#

if u use await u need to make the function async

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

slim heart
#

put async before ur function

mossy vine
#

client.ping

slim heart
#

no hes talking about bot latency not gateway latency

mossy vine
#

Oh

#

Right

slim heart
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

slim heart
#

or just do .then

mossy vine
#

Fireship made a great video on async/await

sage bobcat
#

One message removed from a suspended account.

slim heart
#

message.channel.send().then(msg=>do with message etc.)

#

yea

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

No

slim heart
#

but then do what u need in {}

mossy vine
#

Your bot is going to send "client.ping" instead of its value

slim heart
#

u need to send a message first ding dong

#

:p

sage bobcat
#

One message removed from a suspended account.

slim heart
#

@mossy vine

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

slim heart
#

dv dont look at what he said, that's the right idea but then put ur code in the {}

#

lol

mossy vine
#

Ok im probably waaay too tired to be able to help sorry

slim heart
#

es oki

sage bobcat
#

One message removed from a suspended account.

slim heart
#

no

#

do the first message send, but now u have the new msg so u can interact with the <Message>.createdAt

#

and do math and what not, then edit the message or do whatever u want, and u have the ping

earnest phoenix
#

@slim heart
i love your brawlhalla Mirage Montage 🙂 its so good

slim heart
#

oh wow, hi lol. i didnt think people would attach my discord to it but ty <3

earnest phoenix
#

np <3

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

strange trout
#

Wot

slim heart
#

what the

#

h u h

sage bobcat
#

One message removed from a suspended account.

strange trout
#

LOL

slim heart
#

u know what

#

just use client.ping

#

````${client.ping}ms`

sage bobcat
#

One message removed from a suspended account.

slim heart
#

lookup some javascript tutorials while ur at it please.

sage bobcat
#

One message removed from a suspended account.

slim heart
#

clearly not

#

and some djs tutorials

sage bobcat
#

One message removed from a suspended account.

slim heart
#

dont copy, actually learn it

sage bobcat
#

One message removed from a suspended account.

hushed berry
#

its hard to learn how to swim if you jump off the deep end

slim heart
#

^^^^^^^

#

couldnt agree with a statement more

sage bobcat
#

One message removed from a suspended account.

slim heart
#

this isnt hands on

#

quite the opposite if anything

unique nimbus
#

The main point for the example is to give you a guildline on what you are meant to do

grim aspen
#

think of this: i can't just jump into a battlefield game and expect to be one hell of a sniper like ravic

#

i have to learn to be a hell of a sniper like him

dusky marsh
#

Start with some simple tutorials , learn the verbiage, try to get the syntax down

mystic shell
#

ok this isnt really an issue im expecting to be able to fix on my own but on discordbots.org my bot isnt showing up as online even tho the bot itself is online and working like normal

#

just saying, maybe someone should look into that?

slim heart
#

it happens sometimes

#

dw about it

fleet glen
#

is this js only?

grim aspen
#

python too

slim heart
#

no

#

all of them

#

anything bot/discord dev related

dusky bear
#

What are some popular servces for hosting a bot?

fleet glen
#

an old pc in ur basement

slim heart
#

fax

fleet glen
#

is it free?

#

because I'm broke

west spoke
#

a fax would be free

dusky marsh
#

Look at the pins

slim heart
#

no im saying facts

#

like the basement pc

fleet glen
#

ok, I was a little confused

#

its good until ur internet goes wack

sage bobcat
#

One message removed from a suspended account.

fleet glen
#

so like, idk how to implement DBL Api stuff

#

the given code is... odd

spring ember
#

@sage bobcat I recommend resetting the token

#

Even if you delete people can still see it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mystic ravine
#

r

fleet glen
#
IDblSelfBot me = await DblApi.GetMeAsync();``` keeps giving me ``` Could not load type 'Miki.Net.Http.HttpResponse`1' from assembly 'Miki.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null'.```
sage bobcat
#

One message removed from a suspended account.

hushed berry
#

@sage bobcat theres likely something else wrong with your code

#

a missing brace or quote or smth

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Hi

#

Are you know how to Run a bot?

grim aspen
#

not sure what you meant there^

earnest phoenix
#

I mean make a bot online

grim aspen
#

code a bot

west spoke
#

@earnest phoenix easiest would likely be Python and/or javascript

#

just google "python rewrite bot" since async is literally almost dead

earnest phoenix
#

ok

slender thistle
#

Let's not make Discord bots without knowing the basics of programming language

west spoke
#

yeah

#

exactly

#

honestly, make a simple text-based game in python. So easy i could likely do it in my sleep xd

fleet glen
#

is anyone else here not doing java script?

#

or python

sonic pivot
#

(node:20277) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 guildMemberUpdate listeners added. Use emitter.setMaxListeners() to increase limit

#

I'm using discord.js

grim aspen
#

i usually ignore the warning

#

i use the same library as you

sonic pivot
#

I dont want to ignore it

#

would like to set max listeners to a known safe number

#

but process.setMaxListeners() doesn't do it for some reason

#

Is there a specific emitter that I have to call this method on?

grim aspen
#

try putting a number in the parenthesis

#

unless you already did that

idle basalt
#

why do you have 11 guildMemberUpdate listeners

#

if you only have one guildMemberUpdate event you should only have one listener

dusky marsh
#

^ you should only have one listener per event

mystic shell
#

im trying to use attachments but its not working

mystic shell
#

oh wait nope got it

obtuse thistle
#

Any idea why I am getting this sometimes in my bot logs? My bot has nothing to do with voice chat and has no commands using voice channels.
Unknown User (VOICE_STATE_UPDATE User=********************** Gui ld=**********************).

slender thistle
#

That's another user the bot sees

#

I would bet

vivid mortar
#

can i change how my bot page looks like?

vivid mortar
#

i did edit it

#

but it wont change anything

real portal
#

^ this isn't ad, I just share it

mossy vine
#

"i did small linux tool" "this isnt an ad, i just share it"

real portal
#

?

amber fractal
#

Do you know what an ad is?

sage bobcat
#

One message removed from a suspended account.

pallid zinc
#
          var member= message.mentions.members.first();
          let embed = new Discord.RichEmbed()
        .setImage(message.member.avatarURL)
        .setColor('#275BF0')
          message.channel.send(embed)
        }```
#

why

latent willow
#

Assuming you are on stable - - > users have the avatarURL property members don't

buoyant wagon
#

how can you tell if a user is offline and not invisible

slender thistle
#

Standing next to them

ruby dust
#

that's like the point of the invisible status, people just don't want to be known that they are online

earnest phoenix
#

How long does it take to approve a bot?

grim aspen
earnest phoenix
#

thanks

west raptor
#

@mossy vine what's the error in the config

mossy vine
west raptor
#

tsconfig should something like ```json
{
"compilerOptions": {
/* Basic Options /
"target": "es6", /
Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. /
"module": "commonjs", /
Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. /
"outDir": "dist", /
Redirect output structure to the directory. */

/* Strict Type-Checking Options */
"strict": true,                           /* Enable all strict type-checking options. */

"esModuleInterop": true,                   /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"resolveJsonModule": true

},
"include": [
"src"
]
}

mossy vine
#

yeah its exactly that minus the outDir

west raptor
#

npm install @types/node

mossy vine
#

i did

west raptor
#

what

#

oh

mossy vine
#

i did

west raptor
#

update typescript

mossy vine
#

oh

#

i did

#

still ass

west raptor
#

what's the error now lmao

mossy vine
#

same

west raptor
#

hmm

mossy vine
#

index.ts cant find module ./config.json even tho its literally right next to it

#
import * as config from './config.json'

console.log(config.token)```
west raptor
#

can you like send tsconfig.json

fervent oyster
#

I thought json wasn't considered a module in ts, or am I wrong

mossy vine
#
{
  "compilerOptions": {
    /* Basic Options */
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
    "module": "es6",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "strict": true,                           /* Enable all strict type-checking options. */
    "esModuleInterop": true,                   /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    "resolveJsonModule": true
  }
}
#

dont mind the comments im too lazy to remove

west raptor
#

why is module es6

#

that's supposed to be target

#

module i just leave as commonjs

mossy vine
#

idk it was default when i ran tsc --init

west raptor
mossy vine
#

es6 is valid according to intellisense anyways

west raptor
#

weird

mossy vine
#

its still complaining about resolveJsonModule and that it cant import the ./config.json module

west raptor
#

mega weird

#

never had this issue

slim heart
#

Restart pc

#

Don’t actually that’s a joke

#

Well it might work—

#

But don’t

pallid zinc
#

auto changing status not working

#
  let status = [
     
      `DG.help`,
      `over users can use me!`
  ]

  setInterval(function() {
      let status = status[Math.floor(Math.random() = status.lenght)];
      Client.user.setActivity(status, {type: "WATCHING"});

      
  }, 10000 )
})```
#

no err

mossy vine
#

ok there are so many issues with that

pallid zinc
#

first

hushed berry
#

You spelled length wrong

mossy vine
#

and typed = instead of *

pallid zinc
#

lol

mossy vine
#

and also, 10 seconds

#

make it AT LEAST 30

pallid zinc
#

what i have spelled worng

mossy vine
#

we told you lmao

pallid zinc
#

what

#

poor english as indian

mossy vine
pallid zinc
#

hmm

#

saying status not defiened

inner jewel
#

first one is ignored

#

status[...] is reading from the second let status

pallid zinc
#

hmm

#

now also status not defiened

late hill
#

Show updated code

pallid zinc
#

wait trying new think

#
  let statuses = [
     
      `DG.help`,
      `over users can use me!`
  ]

  setInterval(function() {
      let status = statuses[Math.floor(Math.random() = statuses.length)];
      Client.user.setActivity(status, {type: "WATCHING"});

      
  }, 30000 )
})```
#

fixed that status err

#

but new err

mossy vine
#

aaaand whats the error?

#

oh yeah

#

i see

#

you still have = instead of *

pallid zinc
mossy vine
#

mate thats what im saying

pallid zinc
#

i have to put *

#

but where

mossy vine
#

instead of the =

#

on the line it shows the error on

pallid zinc
#

my english sloow

#

i have = two

mossy vine
#

boi im literally fucking telling you what to do it couldnt be simpler

strange trout
#

I'm trying to load profile picture onto canvas but it returns image type is unsupported

#

I'm using the code off discord.js guide

pallid zinc
#

done

lament meteor
#

did u put the image data into a canvas image @strange trout ?

pallid zinc
#

c sorry i dint get you

#

and now its working

strange trout
#
    const { body: buffer } = await snekfetch.get(message.author.displayAvatarURL());
    const avatar = await Canvas.loadImage(buffer);
    ctx.drawImage(avatar, 25, 0, 200, canvas.height);
#

`(node:1384) UnhandledPromiseRejectionWarning: Error: Unsupported image type

`

pallid zinc
#

c thanks

lament meteor
#
  1. u should not use snekfetch cause its depriciated
strange trout
#
async fetchAvatar(url) {
    const result = await fetch(url);
    if (result.ok) return result.buffer();
    throw new Error('Failed to retrieve avatar.');
}
#

Used this aswell

#

Same error

lament meteor
#

what avatar type did u fetch?

strange trout
#

message.author.displayAvatarURL()

lament meteor
#

:/ well try to do message.author.displayAvatarURL({format: "png"})

#

add the {format} thing

strange trout
#

Works thanks

lament meteor
#

probs cause u been sending a webp format

mossy vine
#

@west raptor okay so i managed to fix the issue but now typescript compiles the import as import * as config from './config.json'; which isnt valid javascript according to node