#development

1 messages · Page 605 of 1

late hill
#

If your bot is in the server that has that emoji

#

Yes

green dome
#

Cool, didn't know that! 😃

earnest phoenix
#

If the bot say gets invited to someone's server and they don't have the emojis will it still display?

#

Or will just the ID print?

#

That's the only thing that is confusing me ATM, because I have the emojis on my support server, but if I add them to the bot in say a help/shop Embed near said item, I'm worried it won't display the emoji and will only display the <ID>

late hill
#

If that server allows the bot to use external emojis it will work

earnest phoenix
#

Understood!

#

So I can put just a little disclaimer then saying allow it for full effect

#

Thanks Wesley and advaith

oblique edge
#

huh

#

interesting

blazing crypt
#

Uhhh, how do you make rich embed not spew out an error?

#

Answers would be greatly appreciated

west skiff
#

spewing out errors isn't the default state. Try reading them they'll tell you what's wrong.

dusty cipher
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);

// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})
#

so this shows how many servers is the bot on if im correct?

earnest phoenix
#

Yes

#

But remember to set your token

dusty cipher
#

jep thanks

real portal
#

is some external portal where I can check somebody user is online? ;-;

quartz kindle
#

no

real portal
#

:C

quartz kindle
#

why do you need that?

real portal
#

I want make badge on my page which would show my status.

quartz kindle
#

that is possible yes

real portal
#

hm?

#

how?

quartz kindle
#

you can use the oauth2 api to get user information with your own account

#

or have a bot report your status for you

molten yarrow
#

user.presence.status
Returns online, idle or offline

earnest phoenix
#

Yes

quartz kindle
#

the problem is, the api doesnt support unnatended access unless you're using websockets afaik

real portal
#

but for bot I want the same if it crashed

quartz kindle
#

so you have to either have your website maintain a websocket connection, or use a bot to relay information

#

or maybe its possible to use the rest api with your bot token, idk, i havent used the rest api before

real portal
#

I thought it was an easier way, eg. badge as GitHub readmes

quartz kindle
#

i looked at the discord docs, and it should be possible to use your bot token

#

try sending a request to https://discordapp.com/api/v6 using your bot token as the authorization header

real portal
#

I try it later

split lantern
#

@real portal well the badge as GitHub Readme is just a website that has the image on it

real portal
#

I know how it works 😂

tiny prawn
#

how can ı add my bot here

grim aspen
inner jewel
#

@quartz kindle @real portal you need a websocket connection to get online status

#

only presence update events give that information

earnest phoenix
#

Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\alanw\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 255, in _run_event
await coro(*args, **kwargs)
File "C:\DiscordBotExport\snow.py", line 17, in on_ready
await client.change_presence(game=Game(name='CS:GO'))
TypeError: change_presence() got an unexpected keyword argument 'game'

#

can you guys help me

#

how to fix

grim aspen
#

first

unique nimbus
#

have you looked in docs

grim aspen
#

code blocks

#

second

#

show us code

#

third

#

please learn to code

unique nimbus
#

dont give us your token also

earnest phoenix
#

okay

#

look

#

please help

#

are.... are you using notepad

#

yes then it is copied and run in python

unique nimbus
#

wat

earnest phoenix
#

WHAT

#

👏 use 👏 visual 👏 studio 👏 code 👏

#

-__

mossy vine
#

this guy is coding in 3019 while we are stuck in 1960

earnest phoenix
#

lol

unique nimbus
#

its not game=Game

earnest phoenix
#

then what

unique nimbus
#

activity=discord.Game

#

google is a thing

earnest phoenix
#

ok

unique nimbus
#

also I will dm you the official discord.py discord server

#

you can ask help there also

sinful lotus
#

another thing, dont be a help vampire

#

learn before you code

unique nimbus
#

yes

earnest phoenix
#

whats this

unique nimbus
#

NN2 please stop swapping servers

earnest phoenix
#

okay

unique nimbus
#

have you read docs

#

@earnest phoenix

earnest phoenix
#

i cant understand lol

unique nimbus
#

read

cold harness
#

Yes please red the docs first

loud salmon
#

this was posted in 2006

#

it still is very relevant

cold harness
#

Lol thanks spooder

loud salmon
#

its in the pins lol

earnest phoenix
#

dude

#

still dont understand

unique nimbus
#

LEARN PYTHON

#

PLEASE

earnest phoenix
#

just read that

#

bro please tell me codes that i want to change

unique nimbus
#

No

earnest phoenix
#

no, read that

unique nimbus
#

You won't learn that way

#

You need to understand what you did

#

what the error means

#

and how to fix

earnest phoenix
#

can you tell me whats my error

#

i ddint got it

loud salmon
#

your error says your error

earnest phoenix
#

+_+

idle basalt
earnest phoenix
#

i'm pretty sure there's a rule that you can't spoodfeed people, @crude bane

unique nimbus
#

He left

earnest phoenix
#

They can give you pointers, but not the actual code

#

Oh

#

lmao

unique nimbus
#

oof

earnest phoenix
#

Probably is going to ask for the entire code because they don't want to learn

#

That is Pure Laziness

unique nimbus
#

I looked there

earnest phoenix
#

like me using Discord Bot Maker for my first few bots

unique nimbus
#

He asked how to fix

#

they gave fix

#

he ignored fix

#

asking to get fix

#

which was already given

#

then got it fixed

earnest phoenix
#

some people smh

unique nimbus
#

Ye

earnest phoenix
#

wait got it fixed by someone else?

#

or did they do it

unique nimbus
#

they legit gave the code

#

as it was a breaking feature

#

oof

earnest phoenix
#

why would they do that

#

they don't learn that way

unique nimbus
#

they got annoyed

#

and gave up

unreal rampart
#

hey, i recently made a crash game for my bot, but if someone were to bet 50 and cashout at 4, they would for some reason quadruple their balance or only lose 50

#

and idk why

unique nimbus
#

Can you show the part of the code

#

yes

unreal rampart
#

yea

earnest phoenix
#

like i had to read the documentation for discord.js just to understand it, and i asked minor questions along the way

unreal rampart
#

where should i send it

unique nimbus
#

here

unreal rampart
#

its to long for discord though

unique nimbus
#

just that part

earnest phoenix
#

Put it in a hastebin

unreal rampart
#

maybe a screenshot

unique nimbus
#

yes

earnest phoenix
#

throwbin is better

#

if your code includes your token censor it out

unique nimbus
#

that was a test

#

is it work

#

never used hastebin

#

oof

mossy vine
#

yes

#

it does

unique nimbus
#

ok

idle basalt
unreal rampart
unique nimbus
#

stupid question is it stored externally

#

@unreal rampart I think its this

#

mal = [author, float(oldCoins) * float(stop)]

#

you are times it

mossy vine
#

its called multiplying

#

but yes

unique nimbus
#

however idk

#

sorry

unreal rampart
#

well, lets say i go "-crash 50 1.6" if the bot chooses a number lower than 1.6 i lose, and if the bot chooses higher than 1.6 i win and what i bet is multiplied by when i cashed out (1.6 in this case)

magic smelt
blazing crypt
#

Hello! How do you make the bots game status to "Watching (how many guilds the bot is in)"??

mossy vine
#

read the docs

blazing crypt
#

Cant find it

#

wait is it client.guilds.size

#

or client.guilds

slender thistle
#

The latter will output all guilds your bot is in

#

The former will just output the amount

blazing crypt
#

thanks

#

so

mossy vine
#

its unrelated to the question anyways

#

@blazing crypt discord.js?

blazing crypt
#

ye

slender thistle
#

You could separate that question into 2, actually

blazing crypt
#

client.on("ready", () => { client.user.setGame(client.guilds.size) });

mossy vine
slender thistle
#

But whatever

blazing crypt
#

Is that right?

#

client.on("ready", () => { client.user.setGame(client.guilds.size) }); @mossy vine

#

is that right?

mossy vine
#

yeah

blazing crypt
#

thanks

mossy vine
#

if you want it to display "watching x" then continue reading the docs

#

actually no

#

dont use setGame

#

use setPresence

blazing crypt
#

it works

mossy vine
#

setGame is deprecated

blazing crypt
#

wait so

mossy vine
#

setGame works now, but will be removed any day

blazing crypt
#

client.user.setPresence({ game: { name: client.guilds.size}, status: 'online' })

mossy vine
#

yeah

blazing crypt
#

k thx

#

@mossy vine

#

doesnt know setpresence

mossy vine
#

how do you define client?

blazing crypt
#

var Discord = require("discord.js");

#

no

#

var client = new Discord.Client();

#

@mossy vine

mossy vine
#

are you sure its in your ready event?

blazing crypt
#

ye

mossy vine
#

send code

blazing crypt
#

k

#

wait its not ready

#

event

#

🤦

#

wait it is

#

@mossy vine sent in dms

molten yarrow
#

client.user.setActivity(`${client.guilds.size} servers|${client.users.size} users`);
Works fine for me

mossy vine
#

but he is not even doing that

molten yarrow
#

setPresence is Status like online, idle or offline

mossy vine
#

no lol

#

they almost the same

#

almost

#
client.user.setPresence({ game: { name: 'with discord.js' }, status: 'idle' })
 client.user.setActivity('YouTube', { type: 'WATCHING' })```
lethal sun
#

what is wrong here? I know it's a syntax error, but what is wrong with it?

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE ON CONFLICT REPLACE,
    money     INTEGER DEFAULT 0,
    bank      INTEG' at line 2```

my SQL:

CREATE TABLE currency (
id UNIQUE ON CONFLICT REPLACE,
money INTEGER DEFAULT 0,
bank INTEGER DEFAULT (0),
bankmax INTEGER DEFAULT (1000),
inventory,
itemcount INTEGER DEFAULT (0)
);```

real portal
#

@magic smelt witam pana

magic smelt
#

@real portal witam

unique nimbus
#

Mespi did you save your files externally

#

into a json for example

earnest phoenix
#

anyone can help me with my bot's website i have some trouble
i uploaded my html website file to wordpress and i can't make it the homepage
i have wp file manager plugin

quartz kindle
#

why wordpress if you're using plain html?

#

wp is great to use with themes, plugins and all the crap they have

earnest phoenix
#

so what can i do to use html only

quartz kindle
#

a normal webhosting service

earnest phoenix
#

i use infinity free

quartz kindle
#

anyway, idk your wp setup so i cant help with the configuration, but one of the things you can do is automatically redirect the base url to /bot

#

many websites do that

real portal
#

try it netlify

earnest phoenix
#

@quartz kindle can i show you the website and tell me if it's good

quartz kindle
#

also, if you have a vps for hosting your bot, you can host your website there as well

#

just install a webserver like nginx and link the ip address to a domain name

#

there are services that offer you free domain names with custom dns

earnest phoenix
#

yes i know

quartz kindle
#

you want to show me the website for a design evaluation?

earnest phoenix
#

yes

quartz kindle
#

well, i dont mind

#

you can dm me

magic smelt
#

@unique nimbus i use mongodb for levels

copper cradle
#

hm

late hill
#

@magic smelt why do you make it start at index 1

#

And not 0

#

I'm guessing you have 2 documents saved in your database

#

And you're skipping the one that actually has xp

#

You should also add a limit to the query as if your bot grows you probably don't want hundreds of users displayed on it

#

You can do this using .limit()

#

Just put it after your sort

slim heart
#
class mouseSetup {
  constructor(ctx, shape) {
    this.canvas = ctx.canvas;
    this.ctx = ctx;
    this.shape = shape;
    this.canvas.addEventListener("mousedown", this.mouseDownReaction.bind(this))
  }
  mouseDownReaction() {
    this.canvas.addEventListener("mousemove", this.mouseMoveReaction.bind(this));
    this.canvas.addEventListener("mouseup", this.mouseUpReaction.bind(this));
    this.canvas.removeEventListener("mousedown", this.mouseDownReaction, false);
  }
  mouseUpReaction() {
    this.canvas.removeEventListener("mousemove", this.mouseMoveReaction, false);
    this.canvas.removeEventListener("mouseup", this.mouseUpReaction, false);
    this.canvas.addEventListener("mousedown", this.mouseDownReaction.bind(this));
  }
  mouseMoveReaction(evt) {
    var bcr = this.canvas.getBoundingClientRect();
        this.shape.newX = (evt.clientX - bcr.left)*(this.canvas.width/bcr.width);
        this.shape.newY = (evt.clientY - bcr.top)*(this.canvas.height/bcr.height);
  }
}```
When i'm doing this, whenever i let up my mouse it doesnt actually remove the mousemove listener because it still follows my mouse, i've added console.log's shpwomg these events ARE being ran it just doesnt want to remove them any idea why?
earnest phoenix
#
//Javascript
for(reward.value){
    rewardstatement + "★"
    reward - 1
  }```
amber fractal
#

the code you gave us and the code the error says you have is different

earnest phoenix
#

oh shoot

#

hold on

#

@amber fractal thats the error i get

amber fractal
idle basalt
#

^^ thats not how you use for loops

zealous veldt
#

Yeah yikes

earnest phoenix
#

yeah i got it

earnest phoenix
#

how to create a function that will always work? js

night imp
#

Please be more descriptive @earnest phoenix

earnest phoenix
#

when the bot is running I want to call a function in which certain actions will be performed
How in client.on('ready',()=>{}) to call this function?

#

like send something when the bot are online?

#

@earnest phoenix

lavish abyss
#

I can get the user that issued the command with ${message.author} right?

coral trellis
#

Yes, message.author returns a user

fiery quest
idle basalt
#

@earnest phoenix super late but thats the ready event. events fire when the action theyre listening to occurs. in this case, the ready event fires when your bot is ready, meaning the code you put inside of there will always run when the bot successfully turns on and connects. you dont have to call events

your question wasnt very specific so thats all i can really say

slender thistle
#

It's member.typing

fiery quest
#

@slender thistle Yeah, I saw before that with the new version many things have changed, for now I'm going back to the old one, lol

slender thistle
#

Ah okay

chilly comet
#

@modern sable hello bro am fix my bot add my bot again

modern sable
#

can you give me your bot ID?

chilly comet
#

ya

#

@modern sable 498036721104060417

modern sable
#

invited it

chilly comet
#

@modern sable thanx bro

#

@delicate zephyr @coral trellis thank you buddy for help me lot 🙂

delicate zephyr
#

No problem

quartz mist
#

I run a bot on my pc how do I keep it on 24 7

earnest phoenix
#

buy a vps

grim aspen
#

you can either do that, host on glitch with uptime robot (not suggested), or you can use a raspberry pi system on your pc

earnest phoenix
#

don't use free hosting

grim aspen
#

that's why i have "not suggested" in parenthesis

real portal
#

how to add emoji in bot status?

earnest phoenix
#

have you tried copying an emoji from a website and putting it into the status name?

#

i did that once and it worked for me

#

What code system are you using?

#

@real portal

real portal
#

code system?

earnest phoenix
#

language

grim aspen
#

i think he means-

#

yeah that

real portal
#

node

#

js

earnest phoenix
#

they, im nonbinary but misgendering is okay bc you didnt know

#

as in like actually node.js or are you using general javascript

grim aspen
#

then i'd say your gender is it

earnest phoenix
#

yeah okay let's go with that

#

im running on three hours of sleep so fuck it

#

anyways @real portal node js coding or general javascript

#

or discord.js

real portal
#

^

earnest phoenix
#

discord.js

real portal
#

ye

earnest phoenix
#

For that I just copied and pasted an emoji into the game status and it worked for me

#

Might just be me being stupid but it worked

real portal
#

ok

#

but... xd

earnest phoenix
unique nimbus
#

NevBot

real portal
#

ok that works, thanks

earnest phoenix
#

@York#0001 you can add "HostMyServer" for 2.5 € / month (EUR) 2GB ram - 1 CPU - 20GB SSD
and neesp.fr (French) 2 € / month - 1x E5-2680V4 - 2GB Ram DDR4 - 50GB HDD - Anti-DDoS : Game

mossy vine
#

he left the server

#

good service for cheap price

earnest phoenix
#

i have 2.22€ on this website but, the vps is 2.5 😭

worldly obsidian
#

I would like some help for when its does a command the bot says on which shard it is (ping me)

earnest phoenix
#

You have to be more specific. What language are you using to code the bot?

mossy vine
#

the library matters as well

worldly obsidian
#

Discord.js so Javascript

#

This is for a command that says the number of servers that has more than 500 users and I would like her to specify the shard

hushed berry
#

@worldly obsidian which lib are you using

worldly obsidian
#

Discord. Js

idle basalt
#

you can have servers with 500 users across multiple shards. if youre only searching the shard that the guild sending the command is in, then <Shard>.id is the array reference of your shard (meaning it starts at zero)

#

to get the first shard, you use <Shard>.id + 1

molten yarrow
#

message.guild.owner.user.tag in which channel type is user undefined?
i have already if (message.channel.type == "dm") return; before

earnest phoenix
#

message.guild.owner.tag

molten yarrow
#

then .tag is undefined

earnest phoenix
#

Wait

molten yarrow
#

message.guild.owner.user.tag works if i use eval for it on my server

earnest phoenix
#

the owner isnt cached

#

you have to request download of all users then you can use it

molten yarrow
#

but it works on most Servers but sometimes says in console that user is undefined ^^

idle basalt
#

or use id

molten yarrow
#
    guildID: message.guild.id,
    guildName: message.guild.name,
    guildOwner: message.guild.owner.user.tag,
    guildOwnerID: message.guild.owner.id,
    guildMemberCount: message.guild.memberCount,
    prefix: 'a!'
  })```
im using it for enmap
idle basalt
#

owner isnt always cached. use client.fetchUser(guild.ownerID)

molten yarrow
#

okay gonna try 😛 ty

earnest phoenix
#

you can use that too^

idle basalt
#

remember that its a promise and you have to resolve it to access the object

earnest phoenix
#

I forgot how to change status with eval how do you do that again?

#

!eval Client.user.setStatus(“meow”)

unkempt halo
#

you mean client.user.setPresence?

earnest phoenix
#

Yea that thing

#

~eval client.user.setPresence(“iAds | ~ads “)

unkempt halo
#

nodejs uses " quotes :D

earnest phoenix
#

how to get number of category ? i try message.guild.category.size but doesn't exist

late hill
#

Do guilds have categories

earnest phoenix
#

@earnest phoenix discord.js?

#

yes

late hill
#

👀

earnest phoenix
#

you'd have to get the channels

#

and filter them

#

okay thx

#

np

late hill
#

oh those

earnest phoenix
#

let category = message.guild.channels.filter(c => c.type === "category") like that ?

#

@earnest phoenix

#

.size

#

yes

#

okay

real portal
#

how using discord.js collect arguments with spaces: !command "first argument" "second argument"?

earnest phoenix
#

i've only used fs for command handlers

#

@earnest phoenix i suggest Klasa

#

is that a npm?

#

it is but use their master branch from github

#

aight

#

thanks

#

im reading the docs rn

idle basalt
#

@real portal message.content.split(/ +/g)

quartz mist
#

Does anyone know how to keep a bot on 24 7 with discord bot maker

earnest phoenix
#

Dont use that shit app

vale storm
#

Is there a bot that allows me to check invite leaderboards?

mossy vine
#

no, there isnt, at least im not aware of a method

#

@vale storm yes, search on the site lol

vale storm
#

I've tried multiple but they don't work

earnest phoenix
#

Yes but you need to fetch invites, count invites etc @vale storm

mossy vine
#

he is asking for an already existing bot, and this aint the channel to ask that

earnest phoenix
#

O

#

I see

#

Oops

vale storm
#

Oh

#

Ok

earnest phoenix
#

I thought since its #development he meant how to make one lol

earnest phoenix
#

well

mossy vine
#

client mods

#

ban

#

but according to the d.js documentation its base10

#

so i guess you just convert it to hex?

earnest phoenix
#

convert base 10 to hex/rgb ez

mossy vine
#

yes

#

thats what you do

#

FFF834

earnest phoenix
#

oh okay

quartz kindle
#

why does discord use base 10 colors instead of something that is standard everywhere like hex/rgb/hsl?

fiery birch
#

as you can see, discord is very unique and special

inner jewel
#

discord uses numbers

#

most languages already convert hex literals to numbers anyway

#

and storing a 3 byte number takes half the space than a 6 byte hex literal

quartz kindle
#

isnt rgb also 3 bytes?

inner jewel
#

discord's color number is rgb

quartz kindle
#

yeah but why represent it as another base?

inner jewel
#

numbers don't have base

#

json defines numbers as being encoded in base10

#

so you send them as base 10 text

#

after encoding to json

#

in memory, there's no base

#

just N bytes

quartz kindle
#

but like, couldnt they store it as 000000000-255255255?

inner jewel
#

and use literally 3x as much space?

quartz kindle
#

oh i see

#

i get it now, nvm

earnest phoenix
#

gg

gusty tartan
#

On nodejs lib
webhookAuth: 'password'
Can someone give a link to explain what webhookAuth means tk
like it is something we should setup on the website dashboard or something with the http server think

earnest phoenix
#

it means a password

#

its just so not anyone can send to the port i guess idk

gusty tartan
#

so it's not required ?

earnest phoenix
#

Nah

#

but anyone could send if its not used tho

gusty tartan
#

and i guess it's headers.password right ?

earnest phoenix
#

how would i add a reaction to the bot's message?

#

i have it like the following, and it's not working:

#
message.channel.send(sayEmbed)
  message.channel.sayEmbed.react("⚔")```
grim aspen
#

what library are you using

earnest phoenix
#

node.js

#

and d.js

#

i'm not quite clear on how to use the .then, and so i'd rather not use it

gusty tartan
#

message.channel.send(sayEmbed).then(m=>m.react("\⚔"))

#

here

earnest phoenix
#

thanks

gusty tartan
#

np

earnest phoenix
#

yeet

#

one more question, @gusty tartan

#

how would i make it check for the user's id, and make sure it was the message author that reacted?

#

oof

gusty tartan
#

use a reaction collector

#

if you are using d.js i'd suggest joining the proper server

earnest phoenix
#

okay wait

#
let m = message.channel.send(sayEmbed).then(m=>m.react("⚔").then(m=>m.awaitReactions(filter, {time: 30000})).then(m=>(collected => console.log(`Collected ${collected.size} reactions`)))).catch(console.error)``` 

I did that, right.

But it's saying that m.awaitReactions is not a function
amber fractal
#

react doesnt resolve into a message

idle basalt
#

await is preferable for reactions

#

especially since you have a billion chained thens

earnest phoenix
#

How to get number of emotes in a guild

#

In discord.js

#

?

real quiver
#

message.guild.emojis.size

earnest phoenix
#

doesn't work

real quiver
#

sad

earnest phoenix
#

i just miss the "s" at emojis

real quiver
obsidian shoal
#

hey is there a link for embeding?

#

ping me or dm me if you find something

#

or i might find something on firefox

unique iron
#

Wdym

buoyant wagon
#

are you asking how to embed?

real quiver
viral spade
#

guys i need help! sometimes a guild is on both my active shards at the same time and the bot responds double to users. Even after restart (pm2) its that way.

inner jewel
#

a guild is definitely not on two shards

buoyant wagon
#

how do you make a bot search for images

#

on the internet

amber fractal
#

google has an api idk how it works tho, but there's probably something better

buoyant wagon
#

nvm, found a way

idle basalt
#

regex scrape google images weSmart

balmy lantern
#

For my bot i kind of have hit a wall, im stuck at 18servers, i think most came from the 'new' page? is there anything else i can do other then have a few people vote on it? anyone have what they did?

#

ping me lol or dm

#

¯_(ツ)_/¯

earnest phoenix
#

Advertise it actively

idle basalt
#

make good bot -> people invite it -> people dont kick it -> people see it -> people use it

earnest phoenix
#

Go on forums, send it to your friends etc

balmy lantern
#

baller thanks

oblique edge
#

Somehow my bot hit the API limit on discord after nearly 6 months of the same/similar style code, and the same code for about a month as a whole.

#

¯_(ツ)_/¯

#

I think I know what happened based on logs to my DB, which may be something that is a comment fix

earnest phoenix
#

d!finnumber

#

d!findnumber

#

d!help

#

!help

#

MY DMS

#

nooo

coral trellis
#

#commands and don't use common prefixed commands

earnest phoenix
#

oke sorry

gusty tartan
#

Do i need now to fill code for the app.get or the module will do it him self tk

real quiver
#

Is it allowed to create a customizable prefix per user? Thonk

earnest phoenix
#

why wouldnt it be

real quiver
#

some bots are silent on the server because they respond to more than three different prefixes

earnest phoenix
#

yeah but thats global. per user prefixes are defined willingly and only work for one user, no?

real quiver
#

sure

graceful warren
#

hey

#

need some help

#

Error: Cannot find module 'C:\Windows\system32'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3

#

dm me or tag me if someone can help me..

slim heart
#

@graceful warren not sure if you’re joking or not, seems like a joke. But anyways, what’re you trying to do?

graceful warren
#

mhm, I want to make a spam bot discord to get t!reps

#

and it's not a joke

#

I mean to t!rep myself

unique nimbus
#

I think the bot doesnt respond to other bots

slender thistle
#

Yep, it doesn't

unique nimbus
#

Meaning that you physically can't

graceful warren
#

nop, account tokens

slim heart
#

we won’t support you here

slender thistle
#

Self-bot, violation of Discord and Tatsumaki ToS

graceful warren
#

and I can get banned from discord?

slender thistle
#

Yep

slim heart
#

Yes

graceful warren
#

thanks for the info I'll let it down

slim heart
#

And period, no one here will help you, and hopefully most places.

#

Also discord.js removed user login support so you can’t even

mossy vine
#

lmao they did?

unique nimbus
#

it was in async which died

slender thistle
#

Latest version still supports it lmao

unique nimbus
#

oh

slim heart
#

Latest version of what?

slender thistle
slim heart
#

Py or js

unique nimbus
#

python

slim heart
#

Oh ok

slender thistle
#

It's only the fact that you don't get your token through authorization header in network tab somewhere deep inside Discord requests

keen sigil
#

uuuuuuh hello yes i wrote a bot in python but idk what options i have to host it so i don't have to run it on my computer can someone point me in the right direction of some hosting options please?

slim heart
#

Well you’re gonna have to pay for it

keen sigil
#

well yeah ik that

grim aspen
#

vps

slim heart
#

^

grim aspen
#

best suggestion i can give you

slim heart
#

The only really*

keen sigil
#

mmk

#

thanks:)

earnest phoenix
#

Sad I can't have all my XP as a list, just want to confirm before I have to completely rewrite or change can I just write them one after another?

Other methods to do this?

unique nimbus
#

I mean you can if you add the id for each person with their xp

earnest phoenix
#

Noob here btw

#

Still learning is all

#

I need around 100 ish XP levels, but the json standard won't do the trailing commas

unique nimbus
#

oof I mean idrk myself

earnest phoenix
#

you can’t have commas after the last value in the json

#

It's not the last value

#

I need to add around 40 more, I can just write them all out, just wasn't sure if it's going to blow up on me because of the large list

carmine echo
#

How often can I update the game on my bot without it being API abuse

earnest phoenix
#

it isn’t but that trailing comma error is due to you doing this

{
1,
2,
3,
}```
instead of 

{
1,
2,
3
}```

#

i believe it is 5 minutes iirc

#

Okay okay! I see, so it's not going to blow up if I continue down the list?

carmine echo
#

the point is, the last value can't have a comma after it

#

so if you need to add more it shouldn't be an issue

#

unless you have 3 bytes of ram or something

earnest phoenix
#

you should be fine with the json if you add more

#

Thanks guys I guess I'll just give it a red hot go

fiery stream
#

ohh hi

earnest phoenix
#

How do I add a cool down to my command.

#

Discord.ja

#

*js

smoky spire
real portal
#

how to get correct info at ram usage by my bot? i'm looking for bot informations and i see various values, and i don't know my bot shows reliable value

unique nimbus
#

psutil is good

real portal
#

i seen one developed bot which had usage ram on level 30

#

my using +/- 100

amber fractal
#

What is level 30 ram usage?

#

Ram is usually measured in MB

real portal
#

30mb of course

idle basalt
#

depends which language

#

theres almost always a way to get usage from the process

real portal
#

node.js

quartz kindle
#

node.js by itself uses around 60-70mb

#

so its normal for a discord.js bot to use 100mb+

#

even with very little guilds

queen bone
#

So i am trying to install mysql but i keep getting this error, not sure what this means

idle basalt
#

damci, use process.memoryUsage().heapUsed / 1024 / 1024 to get your current memory usage in kb

mossy vine
#

hmm that seems weird

#

its wroking for me

queen bone
#

😮

mossy vine
#

@queen bone can you share the log?

idle basalt
#

try clearing your npm cache

#

npm cache clean --force

queen bone
#

Yeeess, that command helped, thank you all for help

idle basalt
mossy vine
#

ill remember that command when im having a similar issue

idle basalt
#

i got it from the first thread on google about the issue

#

google op

bright spear
#

@carmine echo maybe like one change per minute?

#

even half a min would probably be ok

carmine echo
#

Yea I decided to do 30 sec

amber fractal
#

Does .toString() not actually ping the role?

#

Ah I see nvm

#

Nvm I dont it wont actually tag the role lol

#

Lmao nvm I'm just dumb

earnest phoenix
#

nice

#

it wont ping the role if its in embed or u use the name ?

amber fractal
#

It wasnt that

earnest phoenix
#

kay

#

i can't figure out exactly what is wrong with this? am I missing a bracket somewhere that I'm not seeing or am I using outdated code or something?

lyric canyon
#

the double }}

earnest phoenix
#

and yes i have the require discord js thing at the very top, this is a bottom thing

amber fractal
#

^

lyric canyon
#

and another }

amber fractal
#

What's with the 2 }} on 432

earnest phoenix
#

im dumb is what

amber fractal
earnest phoenix
#

i am Chaotic Idiot

#

thank you

idle basalt
#

get a linter

earnest phoenix
#

im blind my god

idle basalt
#

also, you should probably separate your code because 430 lines is absurd

earnest phoenix
#

hhhhh

#

i don't know how to link documents

#

and last time it didn't work

idle basalt
#

perfect time to learn

#

youll be using module.exports

earnest phoenix
#

also the command i did isnt even working so im like,,,,, wasted question

idle basalt
#

well nothing will work if you dont join a channel so uh

earnest phoenix
#

i did join a channel

#

im using my test server

lyric canyon
#

guys - I just made a bot, is running on a vps, great. Now I need to show it to some guys for review, how do I go about that?

idle basalt
#

send them the bots invite link

earnest phoenix
#

you submit it for review on the website

mossy vine
#

invite them to a private server, add the bot, let them test it

earnest phoenix
idle basalt
earnest phoenix
#

i didddddd

lyric canyon
#

@idle basalt where do I get that invite link?

earnest phoenix
#

I have Dumb Bitch Syndrome

idle basalt
#

your bot page in the discord dev dashboard

#

or you can generate one through code (the method depends on which lib youre using)

grim aspen
mossy vine
#

actually, every lib can generate an invite

idle basalt
#

o its in faq thats nice

#

i changed it cyber

mossy vine
#

ah oka

earnest phoenix
idle basalt
#

thats not necessary

earnest phoenix
#

/yardım

idle basalt
#

the native discord dev dashboard creates the whole link for you

grim aspen
earnest phoenix
#

from my experience it only creates one without permissions attached

idle basalt
#

you can give it permissions

#

its all in the same panel

earnest phoenix
#

it just adds the bot scope and you have to manually add permissions

lyric canyon
#

@idle basalt I don't have an option to generate a link

earnest phoenix
#

unless im just stupid and dont know what im doing half the time

lyric canyon
grim aspen
#

yes

lyric canyon
#

Ok cool, thanks guys!

idle basalt
#

yes

earnest phoenix
#

just replace bla with your client id

idle basalt
#

nev, if you visit the oauth2 tab in the dev portal and select the bot scope, youll get a permissions checklist below

lyric canyon
#

Is there a clear guide on how to 'publish' or whatchamacallit the bot when everybody's happy?

grim aspen
#

here

earnest phoenix
#

...yeah im just fuckin stupid

#

oof

grim aspen
#

let me get a screen shot

idle basalt
#

if only i wasnt on mobile lol its too hard to take good screenshots

grim aspen
#

nvm

unreal rampart
#

why does this while loop go infinite times?

#

gjett = Guess
forsok = Tries
bokstav = character

pastel tiger
#

Because forsok never becomes 0 @unreal rampart

#

The else statement only happens when the if statement is false

#

So if the if statement is True the else won't happen.

#

And you have an if, else statement wrapped in a different if else statement

#

So thats probably where something is messing up

thorn nexus
#

d.js
Hey. help make command which displays the leaderboard from the level.json file.

idle basalt
#

require the file and iterate over the values

#

cant give specific advice without seeing your structures. also, you probably dont want to use json files as a database for user xp

thorn nexus
#
{
    "3666074412xxxxxxxx": {
        "xp": 75702,
        "level": 32,
    },
    "4069125348xxxxxxxx": {
        "xp": 51316,
        "level": 28,
    },
    "4564881476xxxxxxxx": {
        "xp": 40977,
        "level": 25,
    }
}```
idle basalt
#

iterate over the values with Object.values() to sort them and then post them however you like

thorn nexus
#

But can you give an example, I tried many ways but nothing happened

idle basalt
#

Object.values(yourjsonfilehere).forEach(val => console.log(val))

#

if you also want the key, use Object.entries(yourjsonfilehere).forEach(([key, val]) => console.log(key, val))

fading zealot
#

anyone who uses discord.py for their discord bot, because I have no clue how to implement the trigger_typing() method and how to disable the help command, so help would be appreciated, btw i tried reading the docs but i am hopelessly lost

pastel tiger
#

You want to remove the default help command @fading zealot?

fading zealot
#

yes @pastel tiger

pastel tiger
#

bot.remove_command("help")

#

If you defined it as client then make sure to swap bot out with client

fading zealot
#

oh thanks that worked

pastel tiger
#

No problem

fading zealot
#

do u know how to do the trigger_typing() thing @pastel tiger ?

pastel tiger
#

await ctx.channel.trigger_typing()

fading zealot
#

what is ctx

pastel tiger
#

it stands for context

fading zealot
#

is it the same as context?

async def googler(context):
pastel tiger
#

What version of d.py are you on?

fading zealot
#

1.0.0

pastel tiger
#

Rewrite then

fading zealot
#

?

pastel tiger
#

Well ctx is a required argument for commands

#

1.0.0 is also called the "rewrite" version

fading zealot
#

yeah

pastel tiger
#

Im guessing you need this for a command?

fading zealot
#

yes

#

so i mostly copied the code from a tutorial, and dont know how some of it works

pastel tiger
#

Thats a bad thing to do

#

If you can show some code that would be great

fading zealot
#

ok

#

@pastel tiger

@client.command(name='google',
                description="format: -google <optional: [(number of results) <= 9]> <query>",
                brief="Googles Stuff",
                aliases=["search"],
                pass_context=True)
async def googler(context):
    await client.tr
    a = context.message.content
    stuff = ""
    try:
        b = int(a[8])
    except:
        query = a[7:]
        num = 2
    else:
        query = a[9:]
        num = b
    search_results = google.search(query)
    for i in search_results[:num]:
        name = i.name[:i.name.index("/")-6]
        stuff += f"**{name}**\n{i.description} \n(<{i.link}>)\n\n"
    if len(stuff) > 2000:
        await client.say("Bro your request size is to **big**, try and tone it down maybe a little bit")
    else:
        await client.say(stuff)
pastel tiger
#

Did you write that or a straight copy?

fading zealot
#

i wrote this, but copied the frame work

pastel tiger
#

What is your traceback?

fading zealot
#

this is one i copied straight

@client.command(name='8ball',
                description="Answers a yes/no question.",
                brief="Answers from the beyond.",
                aliases=['eight_ball', 'eightball', '8-ball'],
                pass_context=True)
async def eight_ball(context):
    possible_responses = [
        'That is a resounding no',
        'It is not looking likely',
        'Too hard to tell',
        'It is quite possible',
        'Definitely',
        "No you're just bad, plus you owe me money"
    ]
    await client.say(random.choice(possible_responses) + ", " + context.message.author.mention)
#

what is traceback?

#

sorry i am unexperienced

pastel tiger
#

The error

fading zealot
#

nothing, i just need help implementing the trigger_typing() command

pastel tiger
#

Ah i was misunderstanding that

#

Are these commands under cogs?

fading zealot
#

no

#

context

pastel tiger
#

A cog is a seperate file with commands

#

await channel.trigger_typing()

#

This is what i can think of

#

Or

#

await client.channel.trigger_typing()

fading zealot
#

ok so i did await channel.trigger_typing()
and got NameError: name 'channel' is not defined

pastel tiger
#

Define channel

fading zealot
#

so i would do channel = context.message.channel?

pastel tiger
#

Yes that should work

fading zealot
#

now i got AttributeError: 'Channel' object has no attribute 'trigger_typing'

#

i did

channel = context.message.channel
await channel.trigger_typing()
pastel tiger
#

You must fetch the channel directly and then call the appropriate method. Example:

channel = client.get_channel(12324234183172) await channel.send('hello')
#

I was probably mistaken on the channel

#

I have never used this method before so i have no other ideas

fading zealot
#

how do i know the channel id?

#

wait i got the id

quartz kindle
#

in rewrite there is no trigger_typing()

#

its just typing()

fading zealot
#

ok how do i do that then?

quartz kindle
#
async with channel.typing():
    # do expensive stuff here
    await channel.send('done!')```
fading zealot
#

ah

quartz kindle
#

you dont need to get the channel by id, you can use message.channel as you were using

fading zealot
#

ok

#

where would u put async with channel.typing():

@client.command(name='google',
                description="format: -google <optional: [(number of results) <= 9]> <query>",
                brief="Googles Stuff",
                aliases=["search"],
                pass_context=True)
async def googler(context):
    a = context.message.content
    stuff = ""
    try:
        b = int(a[8])
    except:
        query = a[7:]
        num = 2
    else:
        query = a[9:]
        num = b
    search_results = google.search(query)
    for i in search_results[:num]:
        name = i.name[:i.name.index("/")-6]
        stuff += f"**{name}**\n{i.description} \n(<{i.link}>)\n\n"
    if len(stuff) > 2000:
        await client.say("Bro your request size is to **big**, try and tone it down maybe a little bit")
    else:
        await client.say(stuff)
#

@quartz kindle ?

quartz kindle
#

no idea, i dont use python, i just showed you what the docs say xd. but my guess would be anywhere as long as you define channel, you could try defining it right after context

fading zealot
#

ok

bright spear
#

try asking in the d.py server if you still need help

fading zealot
#

thats a server?

#

ok

rocky gyro
#

@fading zealot you add that before the block of code you want to be executed while your bot will be typing

fading zealot
#

like this?

@client.command(name='google',
                description="format: -google <optional: [(number of results) <= 9]> <query>",
                brief="Googles Stuff",
                aliases=["search"],
                pass_context=True)
async def googler(context):
    async with context.message.channel.typing():
        a = context.message.content
        stuff = ""
        try:
            b = int(a[8])
        except:
            query = a[7:]
            num = 2
        else:
            query = a[9:]
            num = b
        search_results = google.search(query)
        for i in search_results[:num]:
            name = i.name[:i.name.index("/")-6]
            stuff += f"**{name}**\n{i.description} \n(<{i.link}>)\n\n"
        if len(stuff) > 2000:
            await client.say("Bro your request size is to **big**, try and tone it down maybe a little bit")
        else:
            await client.say(stuff)
rocky gyro
#

try it x)

thorn nexus
#

d.js
help make command leaderboard tables from a json file. Here's what I got.

const userpro = require("config/userpro.json");
const Discord = require("discord.js");

exports.run = async(bot, msg, args) => {

        let completeString = '';

        Object.entries(userpro).forEach(([key, val]) => {

            let rankString = `${key} - ${val.xp} - ${val.level}\n`;
            completeString += rankString;
        })
        console.log(completeString)
    }```
How can this be limited to 10. and sort?
fading zealot
#

ok

#

@rocky gyro now i have AttributeError: 'Channel' object has no attribute 'typing'

rocky gyro
#

try just context.typing() ? idk

#

oh you're using async

#

well i really have no idea xD

fading zealot
#

well that didnt work

bright spear
#

i thought you said you were using rewrite 🤔

#

async is the old version which isnt good

rocky gyro
#

yup

#

rewrite includes features that were added recently

bright spear
rocky gyro
#

things like slowmode and nsfw check aren't (easy) to access using async

fading zealot
#

@bright spear i am using rewrite

bright spear
#

malarne says you're using async think

rocky gyro
#

it is clearly visible with the code

#

pass_context isn't needed on rewrite

fading zealot
#

when was rewrite made?

rocky gyro
#

as well as await client.say(stuff) is now await channel.send(stuff)

#

it's been a while now

fading zealot
#

how do i upgrade?

rocky gyro
#

but clearly, you're using async

#

pip install discord.py should now install rewrite by default iirc

#

just know that it's gonna break your code A LOT

fading zealot
#
Requirement already satisfied: discord.py in c:\users\<>\appdata\local\programs\python\python36\lib\site-packages (0.16.12)
Requirement already satisfied: aiohttp<1.1.0,>=1.0.0 in c:\users\<>\appdata\local\programs\python\python36\lib\site-packages (from discord.py) (1.0.5)
Requirement already satisfied: websockets<4.0,>=3.1 in c:\users\<>\appdata\local\programs\python\python36\lib\site-packages (from discord.py) (3.4)
Requirement already satisfied: chardet in c:\users\<>\appdata\local\programs\python\python36\lib\site-packages (from aiohttp<1.1.0,>=1.0.0->discord.py) (3.0.4)
Requirement already satisfied: multidict>=2.0 in c:\users\<>\appdata\local\programs\python\python36\lib\site-packages (from aiohttp<1.1.0,>=1.0.0->discord.py) (4.5.2)
Requirement already satisfied: async_timeout in c:\users\<>\appdata\local\programs\python\python36\lib\site-packages (from aiohttp<1.1.0,>=1.0.0->discord.py) (3.0.1)
#

thats what i got

quartz kindle
#

it says v 0.16.12

rocky gyro
#

-> async

#

wait i'm gonna check out that

#

@fading zealot pip install --force-reinstall --no-cache-dir discord.py --user maybe ?

fading zealot
#

i got

Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\users\\<>\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\~ultidict\\_istr.cp36-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
rocky gyro
#

retry x)

fading zealot
#

same thing

#

i tried on sys32 also

rocky gyro
#

pip install --force-reinstall --no-cache-dir discord.py>1.0.0 --user ?

quartz kindle
#

is your bot running or anything using it?

fading zealot
#

wellll..... yes

quartz kindle
#

shut it down first lol

fading zealot
#

ooops

rocky gyro
#

just know it'll be broken until you fix all your code to work on rewrite

fading zealot
#

yeah ik

#

ok now it says i have version 1.0.1

#

is that right?

quartz kindle
#

yes, that should be rewrite

rocky gyro
#

it should be rewrite now

fading zealot
#

ok thx

rocky gyro
#

and i'm absolutly not gonna hold your hand into every change you now have to do on your code, because i'm gonna sleep lol

fading zealot
#

nah i get u, i just needed help because i was looking for a command that didn't exist

rocky gyro
fading zealot
#

ok thx

quartz kindle
fading zealot
#

yup

mystic shell
#

what is a way i could save user-specific non-api data somewhere? like if i wanted a point/currency system or something for my bot

slender thistle
#

@rocky gyro incorrect

#

@fading zealot ☝

fading zealot
#

yes?

slender thistle
#

Use the link I sent instead

fading zealot
#

it says 1.1.0a in the corner though, isnt that the earlier version

slender thistle
#

What

#

No

bright spear
#

latest isnt async?

slender thistle
#

Anything under 1.0 is old version

#

Not anymore

fading zealot
#

oooohhhhhh

bright spear
#

d.py versioning is weird

slender thistle
#

rewrite was released

fading zealot
#

ok, im learning the new syntax now

slender thistle
mystic shell
#

so how can i save user-specific non-api-related data, like if i wanted to give my bot a currency system or something

amber fractal
#

Introducing databases!

mystic shell
#

i know what a database is, ive just never used a database with javascript before (im using node js for my bot)

amber fractal
#

There are plenty of databases

#

you want to choose one that's good and that you like

mystic shell
#

oh apparently node js works with mysql, i know mysql d:

idle basalt
#

beautiful

#

node works with basically everything

mystic shell
#

i am having issues, i tried the second link that you provided, and did everything as per the instructions, but now i am getting this error:
Unhandled rejection SequelizeDatabaseError: SQLITE_NOTADB: file is not a database
at Query.formatError (/home/runner/node_modules/sequelize/lib/dialects/sqlite/query.js:419:16)
at Query._handleQueryResponse (/home/runner/node_modules/sequelize/lib/dialects/sqlite/query.js:73:18)
at afterExecute (/home/runner/node_modules/sequelize/lib/dialects/sqlite/query.js:247:31)
at Statement.errBack (/home/runner/node_modules/sqlite3/lib/sqlite3.js:16:21)

soft eagle
#

this is a fuction reportschannel.send("message ")

#

but i got (node:1652) UnhandledPromiseRejectionWarning: TypeError: reportschannel.send is not a function

#

and i have let reportschannel = message.guild.channels.find(`name`, "logs"); if(!reportschannel) return message.channel.send("Plz Run a.setup");

#

anyone know why this is happining

fallen oak
#

I think that way of using find is deprecated

#

Might be using too high of a version to use it like that

#

@soft eagle

stable halo
#

yeah

#

change the way you defined reportschannel

#

let reportschannel = message.guild.channels.find(c => c.name === 'logs');

soft eagle
#

i fixed it

#

thx tho

stable halo
#

ah ok

languid dragon
#

does anyone have some anti-discord-invite RegExp i can steal

#

i'd rather not put effort into making one if it's already been done

#

nevermind i found a decent one, here it is if anyone wants to use it .*(?:https?:\/\/)?discord(.*(gg|com|app\.com))\S?([A-Za-z0-9]+){7}.*
not sure how effective it is but it catches invites which works for me

#

yes

idle basalt
#

add io to link endings

earnest phoenix
#

How would i allowed more then one owner to use dev commands etc

#

"owner" : ["528832428463095818"],

prime cliff
#

["456", "123"] for lists

earnest phoenix
#

doesnt work though

#

"owner" : ["528832428463095818", "554186251612323842"],

languid dragon
#

if owner.includes(user.id) then allow them

#

<Array>.includes(value)

earnest phoenix
#

would it work even if i do it this way if (message.author.id !== client.default.owner) return message.channel.send("Failed, you tired to use a dev command!");

mossy vine
#

no

#

message.author.id is a snowflake, and you are trying to compare it to an array

earnest phoenix
#

Oh how would i go about it then?

mossy vine
#
if(client.default.owner.includes(message.author.id)) {
    return message.channel.send("Failed, you tried to use a dev command!");
}```
earnest phoenix
#

@mossy vine I tried that but not working?

#

"owner" : ["528832428463095818", "554186251612323842"] is what i have in client.default

mossy vine
#

oh right

#

i forgot to negate it

#
if(!client.default.owner.includes(message.author.id)) {
    return message.channel.send("Failed, you tried to use a dev command!");
}```
#

@earnest phoenix thats what you need

earnest phoenix
#

I give that a try

#

Thanks @mossy vine 😃

#

thats works

mossy vine
#

youre welcome, sorry i didnt get it right the first try im tired lol

earnest phoenix
#
  const mention = new RegExp(`^<@!?${bot.user.id}>`);

const prefix = `${message.content.match(mention)} ` ? `${message.content.match(mention)} ` : db.default```
#

i'm trying to do a space

#

between mention and args

#

like @user ping

#

but doesn't work idk why

mossy vine
#

its probably an issue with your regex

#

great site for making and testing regex

earnest phoenix
#

okay thx

#

@mossy vine @userping work just not with space

mossy vine
#

hmm

#

according to the site your regex is fucked

earnest phoenix
#

Hey, does anyone know how I can put a YouTube API key into my code and allow my bot to connect to it? Google isn't providing clear answers.

#

And no, I don't have code ready yet.

mossy vine
#

what do you need to do with the youtube api?

earnest phoenix
#

For music playing in voice channels

#

Sort of like how Rythm does it

mossy vine
#

you dont need a youtube api key to do that

earnest phoenix
#

It isn't letting me connect, and somewhere it said that I needed one

mossy vine
#

what lib are you using?

earnest phoenix
#

Discord.js

mossy vine
#

for youtube

earnest phoenix
#

I'm confused

mossy vine
#

so you just want to play music from youtube in voice channels?

earnest phoenix
#

Yeah

mossy vine
#

there are several libraries/packages you can do it with

#

ytdl-core, lavalink (optionally discord.js-lavalink), etc.

earnest phoenix
#

I've tried to code it into NevBot several times. I have the music player thing installed

#

It's the yt-dl one that I have

#

I don't know if I installed FFMPEG wrong or not, though

#

I'm pretty sure I installed node opus right tho

earnest phoenix
#

@mossy vine i think its bc i have a handler let commandfile = bot.commands.get(cmd.slice(prefix.length)) if(commandfile) commandfile.run(bot,message,args); just this

viral spade
#

Guys i have a strange problem. I use discord js and pm2 on my digitalocean ubuntu vps. Sometimes, (i think after getting an error+ pm2 restart) the bot starts to send messages twice / two bots are running and have the same server on them. The bot is sharded but only running on 1 shard with 1k guilds. What can it be?

radiant scaffold
#
module.exports = async (bot, member) => {
  const lID = await db.fetch(`lChannel_${member.guild.id}`)
  if (lID === null) return;
  let lId = member.guild.channels.get(lID);
  if (!lId) return;
  const wID = await db.fetch(`wChannel_${member.guild.id}`)
  if (wID === null) return;
  let wId = member.guild.channels.get(wID);
  if (!wId) return;```
#

(node:12590) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined

#

I have that error

#

someone know how to fix that?

late hill
#

what is member

#

/where are you calling this from

radiant scaffold
#

this is guildMemberAdd event

#

i have another file called events/eventHandler.js

late hill
#

console.log(member) returns what?

radiant scaffold
#

check this

#

thats too much bigger

#

look at dm

radiant scaffold
#

someone?

earnest phoenix
#

const gettotal = format(number)
 const result = Math.round(gettotal)

 message.channel.send(result)``` when i remove "Math.round" the bots says `120,000` and when i re-add him, the bots say `NaN`
late hill
#

a comma

earnest phoenix
#

?

late hill
#

Your format functions returns a string most likely

#

You can't round a string

earnest phoenix
#

no i can but

#

i cant round a format

late hill
#

Math.round() probably converts to number

#

But the problem is

#

comma

earnest phoenix
#

idk whats comma mean

#

bc i speak french

late hill
#

, !== .

earnest phoenix
#

Math.round convert number with commas

late hill
#

js uses dots for decimals

#

Not commas

earnest phoenix
#

so, how to round a number with formated number and with commas ? thonkku

late hill
#

Round before format

earnest phoenix
#

its not possible

late hill
#

👀

earnest phoenix
#

because the number doesn't have commas

#

i cant round a number without commas

late hill
#

bruh moment

#

In your example there's no reason to round

#

Correct

#

What result are you expecting

#

..?

earnest phoenix
#

i'm just testing something for my database, show coins 120,000 to 120K

late hill
#

That's not what round does?

earnest phoenix
#

no because in my db number doesn't have ,

#

and i need to do format(number) for get ,

late hill
#

You want to use Math.round() to remove the numbers after the comma?

earnest phoenix
#

yes

late hill
#

Ok well it makes sense that that doesn't work

#

lol

#

Create your own function that removes them?

earnest phoenix
#

its hard

late hill
#

👀

earnest phoenix
#

i can but, idk if the bot send number of coins in a channel and fetch him, its an api abuse

late hill
#

what

earnest phoenix
#

wat

#

just the bots send 120,000 in a private channel and then fetch the message for round him thonkfdp

#

why would you do that again

late hill
#

Your format function is a function you made?

earnest phoenix
#

no

#

its a module

late hill
#

👀

#

Search for a module that formats the numbers the way you want

earnest phoenix
late hill
#

Or create your own function for it

#

Like

#

If a number is bigger than 1000 -> divide by 1000 -> add "K"

#

Shouldn't be that hard to create a function like that

earnest phoenix
#

yeah i do that in my old bot, but bots stop at the first function

#

Uh

#

@late hill i just remplaced , by . and its working

late hill
#

Guess that works

#

But what if the number is actually a decimal

earnest phoenix
#

it is

#

you just made it a decimal lol

#

yes

late hill
#

You're changing 120000 to 120.000 now

earnest phoenix
#

100 000 isnt 100.000