#development

1 messages ยท Page 907 of 1

quartz kindle
#

presence is an object

#

so presence: {}

#

then you need to specify, status, activity, etc

nocturne grove
#

yes but there's an object in the presence

high bough
#

Can't you just use

client.setActivity (`somewhatever`, { type: WATCHING })
quartz kindle
#

presence:{status:"online",activity:{name:"bla",type:"bla"}}

nocturne grove
#

yes that's easier but can disappear after time

quartz kindle
high bough
#

Wait what? It can? I never knew

quartz kindle
#

setActivity can be lost if the bot loses connection with discord

nocturne grove
#

oh nice that works. Still confusing ๐Ÿ˜‚

#

thanks

high bough
#

Hmmm...

quartz kindle
#

if you set the activity in the client options, all new connections will be started with that activity, so even if it loses connection it will just reconnect and apply the presence again

high bough
#

Okay, Imma change this then, thanks

earnest phoenix
#

@quartz kindle i want is my bot send message, not the webhook

quartz kindle
#

still, you need twitter webhooks

earnest phoenix
#

ok thx

nocturne grove
#
const client = new Discord.Client({ presence: { activity: { name: 'help', type: 'PLAYING' } } });```
do you get my confusion? ๐Ÿ˜‚
high bough
#

Nawp, that's normal for me that makes simple things complicated

#

@nocturne grove

nocturne grove
#

haha

#

I'm doing that too tho :p

high bough
#

@quartz kindle would this work or not?

const client = new Discord.Client({fetchAllMembers: true}, { presence: { activity: { name: `Arc-Neko!! | )help | ${client.guilds.cache.size} guilds | ${client.users.cache.size} total users`, type: 'PLAYING' } }});
``` ~~@nocturne grove see what I'm talking about?~~
nocturne grove
#

yes ๐Ÿ˜‚

#

I'm happy I just use new Discord.Client() and have an interval for my status xd

quartz kindle
#

@high bough there is only one options object

nocturne grove
#

Am I even allowed to set status every 60 seconds?

quartz kindle
#

{fetchAllMembers:true, presence: {}}

earnest phoenix
#

How would I do it so that only people that have voted get access to a command

high bough
#

{fetchAllMembers:true, presence: {}}
@quartz kindle Awight thanks

nocturne grove
#

@earnest phoenix store votes in a database

high bough
#

How would I do it so that only people that have voted get access to a command
@earnest phoenix #topgg-api

earnest phoenix
#

I did that last time and everyone said "you should know that lol"

#

Haha

quartz kindle
#

@earnest phoenix you can use the votes endpoint or use top.gg webhooks

#

the voting enpoints are known to be slow and outdated tho

nocturne grove
#

this stupid person just copied the wrong index to the host ๐Ÿ˜ญ

#

๐Ÿคฆ

quartz kindle
#

so a person that votes might take several minutes for the system to register their vote, which will reflect on your command

high bough
#

@quartz kindle , help me again ๐Ÿ˜ญ ```js
const client = new Discord.Client({fetchAllMembers: true, presence: { activity: { name: Arc-Neko!! | )help | ${client.guilds.cache.size} guilds | ${client.users.cache.size} total users, type: 'PLAYING' } }});
^

ReferenceError: Cannot access 'client' before initialization
at Object.<anonymous> (/home/kayuimineko/index.js:4:113)
at Module._compile (internal/modules/cjs/loader.js:1123:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:972:32)
at Function.Module._load (internal/modules/cjs/loader.js:872:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
[nodemon] app crashed - waiting for file changes before starting...

nocturne grove
#

oh yes sorry that's an option too ofc

quartz kindle
#

thats why using the webhooks and a database is the recommended way

earnest phoenix
#

I'm not to experienced with all that

quartz kindle
#

@high bough yes thats the limitation of setting the presence in the client option

#

you cannot use the client there

high bough
#

Wait, so how do i do it?

quartz kindle
#

you can make it show "loading" for example

nocturne grove
#

@high bough you can better just set an interval as the amount changes

quartz kindle
#

and then on ready you update the presence to show the member count

high bough
#

you can make it show "loading" for example
@quartz kindle Isn't that the same as before? Having the presence disappearing issue thingish

#

@high bough you can better just set an interval as the amount changes
@nocturne grove It actually deletes the Activity for me, Idk why

nocturne grove
#

wut

quartz kindle
#

yes pretty much

#

because thats how discord works

#

you can re-set the activity on shardResume for example

high bough
#

Muu~ ๐Ÿ˜ญ

quartz kindle
#

or make an interval

#

but the initial activity from the client options cannot access client data since the client did not load yet

high bough
#

or make an interval
@quartz kindle Yeah, about that, everytime the interval passes by, it deletes the activity, not resetting it

quartz kindle
#

then you did something wrong? idk

high bough
#
//Startup System
var botmain = client.on("ready", async () => {
  client.user.setAvatar(`${avatarURL}`);
  var guildw = client.guilds.cache.get("700948321904099370");
  guildw.setIcon(`${avatarURL}`);
       var totalGuilds = client.guilds.cache.size
       var totalMembers = client.users.cache.size
       try {
        setInterval(() => {
      cient.user.setActivity(`Arc-Neko!! | )help | ${client.guilds.cache.size} guilds | ${client.users.cache.size} total users`)
        }, 900000);
       } catch (error) {
       console.log(error.stack)
       }
       console.log(
         `Logged in as ${client.user.tag}.\nThere are ${client.users.cache.size} users and/or bots online.\n${client.user.tag} connected to: \n ${client.guilds.cache
         .map(g => g.name)
         .join(", ")}`
       );
  var channelw = await client.channels.cache.get("700948323393077313");
  channelw.send(`Webhook running at http://0.0.0.0:5000/arc-neko`).catch(err => console.log(err));
  channelw.send(`Logged in as ${client.user.tag}.\nThere are ${client.users.cache.size} users and/or bots online.\n${client.user.tag} connected to: \n ${client.guilds.cache.map(g => g.name).join(", ")}`).catch(err => console.log(err));
});
#
//Locator and Link + Configuration
const fs = require("fs");
const Discord = require("discord.js");
const client = new Discord.Client({fetchAllMembers: true, presence: { activity: { name: `Arc-Neko!! | )help | System Initializing...`, type: 'PLAYING' } }});
const config = require("./config.json");
const fetch = require('node-fetch');
const DBL = require('dblapi.js');
const mongoose = require("mongoose");
mongoose.connect('mongodb+srv://<dbuser>:<password>@arc-neko-gl57b.gcp.mongodb.net/test?retryWrites=true&w=majority', { useUnifiedTopology: true, useNewUrlParser: true }).catch(err => console.log(err))
const Profile = require("./models/profile.js")
const Guild = require("./models/guild.js")
const Channel = require("./models/channel.js")
const neko = require("./models/neko.json")
const clientneko = require('nekos.life');
const sfw = new clientneko();
quartz kindle
#

i think you need to specify a type

#

.setActivity("bla",{type:"WATCHING"})

high bough
#

Also, how quickly can an avatar be changed?```js
(node:29407) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
avatar: You are changing your avatar too fast. Try again later.
at RequestHandler.execute (/home/kayuimineko/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:29407) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29407) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

earnest phoenix
#

my bot isn't logging in for some reason

#

there isnt even an error

hasty lotus
#

is client.channels an array ?

earnest phoenix
#

it loads commands and then it just stops at the logging in part

split hazel
#

@high bough twice every 30 minutes

hasty lotus
#

@earnest phoenix discord.js ?

high bough
#

Oh thanks @split hazel

earnest phoenix
#

yes

#

discord.js

hasty lotus
#

hmm

#

v11 ?

#

or v12 ?

#

and send your code

#

it will be easier to help you with it ๐Ÿ˜‰

earnest phoenix
#

there isn't an error

#

it just doesn't login

#

i have no idea what and where is wrong with my code

hasty lotus
#

sendyour code

high bough
#

The piece that loggs it in would help

hasty lotus
#

@earnest phoenix

#

i can't help you without the code

#

๐Ÿคทโ€โ™‚๏ธ

earnest phoenix
#
const {Client, Collection} = require('discord.js');
const fs = require("fs")
const client = new Client({
  disableMentions: "everyone"
})
const Enmap = require('enmap')
client.commands = new Collection();
client.aliases = new Collection();
client.config = require('./config.js');
client.db = new Enmap({
  name: "Main"
});
client.prefix = client.config.prefix;
client.color = "BLURPLE"
client.login(process.env.token)
fs.readdir("./events/", (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    if (!file.endsWith(".js")) return;
    const event = require(`./events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, event.bind(null, client));
    delete require.cache[require.resolve(`./events/${file}`)];
  });
});

fs.readdir("./commands/", (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    if (!file.endsWith(".js")) return;
    let props = require(`./commands/${file}`);
    let commandName = props.name;
    let aliases = props.aliases || [];
    console.log(`Attempting to load command ${commandName}`);
    aliases.forEach(m => {
      client.aliases.set(m, props)
    })   
    client.commands.set(commandName, props);
  });
});
#

but i have no idea what part of the code is wrong cause there isnt an error

#

so i have no idea where is wrong with the code

hasty lotus
#

does the process stops ?

earnest phoenix
#

yea

hasty lotus
#

or just the bot doesn't log in ?

#

uh ok

earnest phoenix
#

ig

#

the bot doesn't log in

hasty lotus
#

does it prints this line console.log(\Attempting to load command ${commandName}`);` ?

earnest phoenix
#

yes

#

but the ready event log does not appear

hasty lotus
#

yeah shure

#

๐Ÿ˜‚

#

you haven't puted any client.login function

high bough
#

Lmao

#

Lol

#

That's just great

earnest phoenix
#

there is

wispy sparrow
#

sorry for that, but your bot didnt BANed?@earnest phoenix

hasty lotus
#

add somewhere in your cde client.login("TOKEN")

earnest phoenix
#

dude

#

there is

#

look

high bough
#

there is
@earnest phoenix In the bottommost

earnest phoenix
#

at the fucking top

high bough
#

at the fucking top
@earnest phoenix ๐Ÿค”

#

In the bottom bruh

#

It has to load the commands before logging in @earnest phoenix

hasty lotus
#

you're using glitch ?

high bough
#

LOL

earnest phoenix
#

same thing

#

yes glitch

high bough
#

who uses glitch these days

hasty lotus
#

are you shure that is it token

#

and not TOKEN

earnest phoenix
#

it is

hasty lotus
#

or whatever ?

earnest phoenix
#

its token

hasty lotus
#

hm ok

earnest phoenix
#

im not dumb

hasty lotus
#

well idk

#

๐Ÿคทโ€โ™‚๏ธ

#

just trying to help

earnest phoenix
#

it worked with the same token like minutes ago

#

it just stopped

#

for no reason

high bough
dull pine
#

You sure the token hasn't changed?

earnest phoenix
#

nope

#

no one asked about your vps

high bough
#

Can send me the code?

earnest phoenix
#

bruh

#

i sent you the code earlier wdym

high bough
#

Kk wait a sec

grizzled raven
#

fiqstro stop leaving yt sim

earnest phoenix
#

๐Ÿ˜ฉ

hasty lotus
#

why

disableMentions: "everyone"``` ?
earnest phoenix
#

i could come back but in a few months lol

hasty lotus
#

3rd line

green kestrel
#

just had to fix some bugs in my bot introduced by the new members intent

earnest phoenix
#

cause some prick might use the say command to ping everyone

green kestrel
#

anyone else had any issues with problems caused by the intents stuff?

earnest phoenix
#

maybe thats why my bot is so screwed up?

hasty lotus
#

@earnest phoenix try with an other bot

#

make an other bot and put the new token

high bough
#

Actually, do you require dotenv to be installed for it?

earnest phoenix
#

mhm aight

high bough
#

I don't think so, but I'm dumb at this, so...

#

I mean, I use json

green kestrel
#

i never used disablementions, you can nerf your mentions with a search and replace, put a unicode zero-width space in it

earnest phoenix
#

it works for the other bot

#

i might try and refresh my token

high bough
#

Try

earnest phoenix
#

maybe it got cucked or something

hasty lotus
#

but normally wrong token put an api error

quartz kindle
#

@green kestrel depends on what your bot does. without GUILD_MEMBERS intent you will not receive member join/update/remove, nor updates to guild.memberCount nor be able to use members.fetch() to fetch all members. without GUILD_PRESENCES you will not receive presence updates and will not be able to fetch members with presences. so depending on what your bot does, there might be some quirks with intents

earnest phoenix
#

nope

#

still didn't work

#

it didn't even give me an error

green kestrel
#

yeah, what it was, was in the dashboard it looks in the bots db to see if any guilds exist which you have permission on, if they do it displays and if there arent any it displays a cute image saying "one last step, please invite sporks to your guild" and then presents you with the invite link, the idea being that by the time youve done the captcha or whatever and returned, its receiced the member list for most guilds, and can pick up that change and display the list

quartz kindle
#

i forgot you dont use discord.js, but you probably know the endpoints and gateway commands the methods above refer to

green kestrel
#

with members intent and no presence intent, i have to request the list, because thats nerfed and sloooow due to rate limiting, for any larger guild it takes so long to get that list and pick up that the user is a member, they think its broken and come to my support guild

#

ive had to make some changes that it can pick up the owner id 'early' from the guild_create info

#

so the owner gets early priority to being able to see the dashboard on invite

quartz kindle
#

yeah some things are kinda stupid

#

not having an initial list of members on guild_create payload without presences intent

#

and not being able to request all guild members without guild members intent

green kestrel
#

i kind of hope they fix that, i dont want to have to request or use presence intents, they cause massive extra bandwidth and some extra cpu

#

and technically i cant justify that im "using them for bot features", i "need them because your api sucks, discord"

quartz kindle
#

yeah lmao

#

discord's approach to presences is basically all or nothing

#

if you want presences, here have them all. you dont want them? ok we'll block your access to them

high bough
#

Is 3.75 GB RAM big for a bot?

quartz kindle
#

depends on what it does and its size

high bough
#

If it is too big, can I get an estimate of how many servers it can handle?

#

depends on what it does and its size
@quartz kindle Has 80 commands, sends approx server amount * 2 requests every around 5 mins?

quartz kindle
#

i mean, how many guilds/members does it have

still merlin
#

how do you accept a team thing in discord developer

high bough
#

Oh, what I mean is how many guilds can it handle

#

how do you accept a team thing in discord developer
@still merlin I think in Email

quartz kindle
#

oh you mean 3.75 is the total ram of the vps?

high bough
#

Yes

quartz kindle
#

i thought it was the bots' current usage

high bough
#

Oh, no way, lol, I'd be dead if that were to happen

quartz kindle
#

well anyway it still depends on what the bot does, and how you approach caching issues
a default discord.js without any cache sweeping will use about 200-400mb per 1000 guilds

#

depending on how many members the guilds have

high bough
#

Oh, then it's really small, huh?

quartz kindle
#

if your bot grows into 10k+ guilds, then it will be worth to look into caching optimizations

high bough
#

I see

quartz kindle
#

which is basically deleting everything that your bot doesnt need to use

high bough
quartz kindle
#

for example, deleting members, users, channels, etc

#

from its memory

high bough
#

Right, thanks for the suggestion

quartz kindle
#

i've done some extensive optimization for my bot

#

maybe way over the top tbh

#

but it uses about 150mb on 3000 guilds

high bough
#

Cool

quartz kindle
#

but it depends on what your bot needs

high bough
#

Cuz like, I have people with 128 GB ram for a bot that uses 0.xxx% of its total memory and I was going like, wha?? waitWhat

quartz kindle
#

well if they have money, why not

#

lmao

#

i pay $3 for my vps

high bough
#

I pay, hmm..... $0?

quartz kindle
#

google's right? i have that one too for another project

#

but google's bandwidth is very limited for a discord bot, and their disks are slow af

high bough
#

Yeah, guess so, but still... Better than Glitch LMFAO

quartz kindle
#

for sure

#

if you're gonna stay on google, you should use intents and install zlib-sync

vague kite
#

150mb for 3000 that's insane

quartz kindle
#

or you're gonna start paying a lot for bandwidth usage

high bough
#

if you're gonna stay on google, you should use intents and install zlib-sync
@quartz kindle Right, I'll check up on it

green kestrel
#

zlib-sync?

#

@high bough my dedicated server has 32gb ram, my bot uses a tiny portion of that, but i dont just host a bot on it

restive furnace
#

how much eris uses per 1k guilds @quartz kindle?

high bough
#

Wait, last time I tried to do that it crashed both my bot and my app.

#

I mean like, the commands got thrown all over the place

quartz kindle
#

@green kestrel installing zlib-sync turns on zlib-stream in discord.js

green kestrel
#

ah ok

#

thats on as standard in aegis, never had to think about it

quartz kindle
#

@restive furnace no idea, havent used eris, but most likely similar amounts, maybe a bit less

green kestrel
#

@restive furnace i can give you my stats

#

currently im using 991668kb virtual and 214860kb rss, for 1850 guilds

#

the rss is the important one, but its always been around 215mb, all the way from 50 guilds up to 1800

high bough
restive furnace
#

thanks for the information and for the stats

green kestrel
#

thats not javascript though

#

so apple and orange etc

quartz kindle
#

215mb on 1800 is already better than discord.js and most likely will scale much better in the future

#

since its not javascript

green kestrel
#

mysql will be my bottleneck before the language i use will be

#

ive already had to optimise my queries, as its a very database-heavy bot

opaque seal
#

Anyone knows if I can connect 2 bots to the same dbl key

quartz kindle
#

yes

#

wait no

opaque seal
#

Thank you

quartz kindle
#

depends what you want to do

#

you cant post server count for two different bots using the same key

opaque seal
#

Check whenever someone votes and send it to a server

green kestrel
#

if you report two bots stats to the same key, the server counts etc will override each other

opaque seal
#

if you report two bots stats to the same key, the server counts etc will override each other
What if I don't do dbl.updateStats

quartz kindle
#

ah that no, you need a different key for each bot

high bough
#

What if I don't do dbl.updateStats
@opaque seal You'd rather not, and shouldn't

quartz kindle
#

the only thing you can use the same key for is getting information about bots on top.gg

#

wait maybe you can send too

#

but you need to manually send an api request with the bot's id

#

not using a dbl library

#

nvm most likely not

#

else you could go around changing other bots server counts lmao

opaque seal
#

I just want to receive whenever a user opvotes my bot and send a message to my support server with the user who votes

#

Is that possible

#

?

high bough
#

Just make it into one bot

#

It's highly possible

opaque seal
#

but why shouldn't I do it in another one?

high bough
#

Umm, coz they're different bots, it can be an issue

quartz kindle
#

receiving votes doesnt need a key, so you can receive votes from different bots in the same process yes

#

you just need to configure them all to send webhooks to the same url

high bough
#

^

#

Hard work for a result

earnest phoenix
#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
  const pingMessage = await message.channel.send("๐Ÿ“ Ping?");
  const pembed = new Discord.RichEmbed()
  .setTitle("**Ping!**")
  .setDescription(`**Pingul meu este ! ${pingMessage.createdTimestamp}ms!**`)
  .setFooter(bot.user.username.toUpperCase(), bot.user.displayAvatarURL);
  message.channel.send(pembed);

  message.delete(pingMessage);
}

module.exports.help = {
  name: "ping"
}

Why when i use the command the ping is very high, like milions?

quartz kindle
#

because youre using the messages timestamp

#

which is the date the message was created

high bough
#
message.createdTimestamp - pingMessage.createdTimestamp
``` @earnest phoenix
opaque seal
#

you just need to configure them all to send webhooks to the same url
kinda not getting what this means but I'll look it up

#

receiving votes doesnt need a key, so you can receive votes from different bots in the same process yes
thanks

high bough
#

Why the hard work tho?

opaque seal
#

I mean, there isn't much hard work to do there

grizzled raven
#

do you have access to the client user as soon as you login?

#

ok nvm you do

iron scroll
#

How i can push in embed new embed line?
Example:

const embed = new Discord.MessageEmbed()
    .setTitle('Command Help')       .setDescription(`${prefix}${command.name}\n${command.description}`)
if (command.aliases) embed.push(.addField(`${command.aliases}`))

discord.js

sonic lodge
#

don't push, just add the field

mossy vine
#

oh boy what the fuck are you even doing on that last line

iron scroll
#

embed.addField?

mossy vine
#

do you have any js experience

sonic lodge
#
if (command.aliases)
  embed.addField(`${command.aliases}`)```
iron scroll
#

ok

#

thx

mossy vine
#

why put it in a template literal

surreal notch
#
client.on("message", async message => {
  const args = message.content.slice(prefix.length).split(" ");
  const command = args.shift().toLowerCase();

  if (command === `buy-role-1`) {


    let cdata = db.get(`cdata_${message.author.id}`);

    if (cdata === null) cdata = 8000;

    if (8000 > cdata) {
      return message.channel.send("You do not have enough money");
    }
  db.subtract(`cdata_${message.author.id}`, 8000);

    await message.channel.send("Role purchased contact your server owner to get it");
  }
});
});```
why it is spamming
#

???

still merlin
#

is that even real paypal/credit card payment lol

surreal notch
#

No

#

My bot currency payment

split hazel
#

Of course it isn't ๐Ÿ˜‚

#

what did you think

surreal notch
split hazel
#

It shouldn't spam that unless you have some other code, or someone is spamming cmd

still merlin
#

I had a similar issue

surreal notch
#

i only tried 1 time

#

and these many came

#

and i have only 1 cmd

still merlin
#

I turned my bot on before and got like 50 messages and the way i did it was

#

just delete my files and created it again and pasted the code in with a new application

surreal notch
#

hmm

earnest phoenix
#

Or you just stop the other running applications

wise quartz
#

i am making a leveling system and i don't want my members spamming just to get xp.. so how do i add a 30s cooldown or so to the command so it doesn't give them xp unless the cooldown is finished?

#

(python)

slim hollow
#
DiscordAPIError
    at /rbd/pnpm-volume/815574e8-2b97-4378-ab2d-e7bcab619144/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15
    at /rbd/pnpm-volume/815574e8-2b97-4378-ab2d-e7bcab619144/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21
    at processTicksAndRejections (internal/process/task_queues.js:88:5) {
  name: 'DiscordAPIError',
  message: '',
  path: '/api/v7/gateway',
  code: undefined,
  method: 'GET'
}```
#

how can i resolve this error?

grizzled raven
#

undefined

#

do message reaction events just not emit if the member isnt there?

#

i mean cause i have presences intent enabled, it seems that when the member isnt cached the event just wont emit

wise quartz
#

anyone could help me?

#

i am making a leveling system and i don't want my members spamming just to get xp.. so how do i add a 30s cooldown or so to the command so it doesn't give them xp unless the cooldown is finished? (python)

earnest phoenix
#

You just gotta wait for someone who knows python

wise quartz
#

aha alr

#

i thought u guys knew

#

sry

earnest phoenix
#

@wise quartz are you storing all the users' data in a json

wise quartz
#

not json

#

but its a database

#

a real database u can say

earnest phoenix
#

oof, then i can't help ya

#

buut, you can store the timestamp of their last message

wise quartz
#

i mean does it rly matter? cant i just like add a cooldown to the on_message event?

earnest phoenix
#

nope

wise quartz
#

if i was using json how would it work then?

earnest phoenix
#

tbh as long as you can access data in ur database

#

just store the timestamp

wise quartz
#

aha

dusty onyx
#

ooh i have a command similar to that

earnest phoenix
#

cause you can subtract timestamps from one another

wise quartz
#

i can read & write to the database dw

earnest phoenix
#

then yeah, that's how you do it

wise quartz
#

so how would i substract the timestamps?

#

i don't really understand

#

tbh

earnest phoenix
#

timestamp - current_timestamp

pale vessel
#

negative value lol

earnest phoenix
#

so ```python
previous = #timestamp from your database
current = datetime.timestamp.now()
difference = current - previous

#

yeah my bad

wise quartz
#

aa....

earnest phoenix
#

it's pretty neat

wise quartz
#

am i stupid or i just don't get it?

#

๐Ÿ˜…

earnest phoenix
#

ok

#

so timestamp gives you the date and time

grizzled raven
#

so like

#

do message reaction events just not emit if the member isnt there?
i mean cause i have presences intent enabled, it seems that when the member isnt cached the event just wont emit

#

if not, why?

wise quartz
#

huh?

#

@earnest phoenix so i'd use timestamp to get the the time the xp is added to the user then i add 30s to it then wait for the time to end to run the cmd again?

hallow heath
#

@fast briar

viscid nymph
#

Hey just wondering if anyone could help me, when sending a request to get permissions of a role or user in a guild, it returns the permission as this, I understand each role has a value, but how would I go from this to the roles?

earnest phoenix
#

that's the permission bitmask

pale vessel
warm maple
#
0|index  |     at Function.resolve (/root/bot/node_modules/discord.js/src/util/BitField.js:150:11)
0|index  |     at Permissions.has (/root/bot/node_modules/discord.js/src/util/BitField.js:45:28)
0|index  |     at Permissions.has (/root/bot/node_modules/discord.js/src/util/Permissions.js:45:85)
0|index  |     at /root/bot/node_modules/discord.js/src/structures/GuildMember.js:268:53
0|index  |     at Map.some (/root/bot/node_modules/@discordjs/collection/dist/index.js:234:17)
0|index  |     at GuildMember.hasPermission (/root/bot/node_modules/discord.js/src/structures/GuildMember.js:268:29)
0|index  |     at Object.run (/root/bot/commands/moderation/setprefix.js:13:26)
0|index  |     at /root/bot/events/guild/message.js:39:15
0|index  |     at /root/bot/node_modules/mongoose/lib/model.js:4886:16
0|index  |     at /root/bot/node_modules/mongoose/lib/model.js:4886:16
0|index  |     at /root/bot/node_modules/mongoose/lib/helpers/promiseOrCallback.js:24:16
0|index  |     at /root/bot/node_modules/mongoose/lib/model.js:4909:21
0|index  |     at /root/bot/node_modules/mongoose/lib/query.js:4378:11
0|index  |     at /root/bot/node_modules/kareem/index.js:135:16
0|index  |     at processTicksAndRejections (internal/process/task_queues.js:79:11) {
0|index  |   [Symbol(code)]: 'BITFIELD_INVALID'
0|index  | }```
#

always when someone tries to set a new prefix it shows me this

#

it only works in my server

sudden geyser
#

show code

warm maple
#

there's a bunch of files for the code but ok

sudden geyser
#

no

#

show (/root/bot/commands/moderation/setprefix.js:13:26)

warm maple
#
const mongoose = require("mongoose");
const config = require("../../models/prefix.js");

module.exports = {
    name: "setprefix",
    description: "Set a custom prefix for the guild. (prefix must not include spaces!)",
    category: "moderation",
    usage: "(NewPrefix)",
  
    run: async(bot,message,args) => {
      
      if(!message.member.hasPermission("MANAGE_SERVER")) return message.channel.send("You do not have `MANAGE_SERVER`")
      
  config.findOne({ GuildID: message.guild.id }, async (err, prefix) => {
      
    if(!args[0]) return message.channel.send("Please provide me with a new prefix!");
  if(args[0] === prefix.Prefix) return message.channel.send("That prefix is already set!");
    
    prefix.Prefix = args[0],
      prefix.updated = true,
      prefix.save();
    
    let embed = new MessageEmbed()
    .setTitle("Success!")
    .setColor("RANDOM")
    .setDescription(`New prefix set! Updated prefix is \`${prefix.Prefix}\``)
    message.channel.send(embed);
    
if(err){
  message.channel.send(err)
}      
  })
  }
}
sudden geyser
#

MANAGE_GUILD

#

not MANAGE_SERVER

warm maple
#

ah

#

lets see

pale vessel
#

ae.user tonkku

#

lmaooo

#

sorry my bad

earnest phoenix
#

I need help

#

Do I do that

pale vessel
#

what are you trying to do

nocturne grove
#

no

earnest phoenix
nocturne grove
#

he wants to make a bot

pale vessel
#

i didn't read

#

no

earnest phoenix
#

wait

#

did you actually buy a developer license just for the bot?

pale vessel
#

that's just whitelist

#

he has to click bot

earnest phoenix
#

ahh nvm, i thought it was a developer license feature

#

So how would I make a bot

#

ON PHONE

copper cradle
#

you can create the client

#

but the coding part would be hard

earnest phoenix
#

I know nothing about coding

copper cradle
#

then you won't be making the bot anytime soon

#

you need to know a programming language in order to give 'life' to a bot

earnest phoenix
#

My dad is helping me code he knows everything he builds computers he fixes and stuff

#

So yeah anytime soon

copper cradle
#

building and fixing computers !== programming

#

unless he's a programmer

#

then you're fine

earnest phoenix
#

Yes he codes programms builds

copper cradle
#

well

earnest phoenix
#

Everything he's a master

copper cradle
#

create the client and then give him the data

#

aka the token of the bot

earnest phoenix
#

Well I'm not with him

copper cradle
#

to create it go into dev portal

earnest phoenix
#

I'm on that I did

sudden geyser
#

wrong part of the site

earnest phoenix
#

Now it says to do this

#

I did everything else

#

you're also not allowed to be on discord if you're aged under 13, which i sincerely believe you are indeed underage

#

My dad knows the language

shut inlet
#

boys epic gamer moment

#

Kite now supports javascript IDE

delicate zephyr
#

๐Ÿ‘€

shut inlet
#

holly fuk

#

bruh its was op for python, hopefully itll do the same for js

earnest phoenix
#

What

delicate zephyr
#

@earnest phoenix how old are you btw, we give special roles to people under the age of 13

earnest phoenix
#

Wow that's cool

shut inlet
#

king how old r u?

earnest phoenix
#

I am underage so you can kick me and whatever

shut inlet
#

oof

#

cya

earnest phoenix
#

I don't really care

shut inlet
#

@delicate zephyr

delicate zephyr
#

@earnest phoenix what is your exact age

earnest phoenix
#

11

pale vessel
#

F

grizzled raven
#

โšฐ๏ธ

shut inlet
#

que african dancing

grizzled raven
#

oops

shut inlet
#

oh gos

#

god*

grizzled raven
#

welp

tardy estuary
#

=f

grizzled raven
#

do message reaction events just not emit if the member isnt there?
i mean cause i have presences intent enabled, it seems that when the member isnt cached the event just wont emit
if not, why?

#

might have to opt into the presence intent K_vPensiveBread

sudden geyser
#

hey so cry was right

grizzled raven
#

what did he say

restive furnace
#

webstorm better than vsc + kite

sudden geyser
#

tell them to make a community version

grizzled raven
#

oh nvm

#

thought it was something related to

#

eh

#

how do i completely change a class/file from a package

tardy estuary
#

tbh the way he was talking, it was kinda obvious he was very young lol.

#

but hey at least he was honest with his age

grizzled raven
#

like

#

how can i override functions/props of classes

#

well

#

hm

sudden geyser
#

you make a property/method for it?

grizzled raven
#

nah nvm

maiden mauve
#

falling in love with this desmos calculator

#

Replaces countless hours of tabling results'

knotty steeple
#

wtf is kite

maiden mauve
#

๐Ÿช

wise quartz
#

how to stop bots from interacting with the on_message event? (python GWcodesPython )

#

i remember theres like a line of code u add that will keep the on_message event from tracking bot messages but i forgot what it is

#

lol

vivid crescent
#

check if the sender is bot?

wise quartz
#

i dont think its that

#

but that'll work probably

shut inlet
#

my messages are being deleted fine

#

is this a error, or a log

#

im sos confused

vivid crescent
#

@wise quartz says bot messages come through in the docs for the event

earnest phoenix
#

(node:25) UnhandledPromiseRejectionWarning: Error: SQLITE_ERROR: near "*": syntax error
(node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)

#

Anyone know how to fix thisn

wet osprey
earnest phoenix
#

It keeps booting my bot off

pale vessel
earnest phoenix
#

Anyone know how to fix this

(node:25) UnhandledPromiseRejectionWarning: Error: SQLITE_ERROR: near "*": syntax error (node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)

pale vessel
#

what's the query

earnest phoenix
#

It happens every time someone sets their description on my bump bot

pale vessel
#

please answer

earnest phoenix
#

I just said

pale vessel
#

it's an sqlite error

earnest phoenix
#

Anyway to fix it?

pale vessel
#

don't tell me you used a wrapper

earnest phoenix
#

No

pale vessel
#

you don't know what a query is?

wet osprey
#

Anyone know how to fix this

(node:25) UnhandledPromiseRejectionWarning: Error: SQLITE_ERROR: near "*": syntax error (node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
@earnest phoenix * = all check the line

earnest phoenix
#

I'm only telling you what I see on my control console

pale vessel
#

seems like you didn't code the bot

knotty steeple
#

learn how to use sql

tardy estuary
#

the issue is with the sql statement. unless we can see the statement theres practically no way we could help

silver cedar
#

ping low vps recommendation

tardy estuary
#

lol

#

is this a google search?

knotty steeple
#

@silver cedar can u not be annoying

#

and send in multiple channels

earnest phoenix
maiden mauve
#

put the image url in an embed

sudden geyser
#

@silver cedar scroll down through the pins of this channel.

haughty night
#

var x = new discord.RichEmbed()
.setImage(url)
@earnest phoenix

#

and then send x

summer torrent
haughty night
#

He could have pretty much found the same thing in the docs anyways

#

Dont forget to require discord.js as 'discord'

grizzled raven
#

or not

earnest phoenix
#

I got it

#

thanks

pale peak
#

I will be very happy if my discord bot has information about when it is approved.

earnest phoenix
#

when you get approved, you'll get pinged in logs and get a message from luca

pale peak
#

Can you guess how many days this all takes in total? and I will be very happy if you share it with me. @earnest phoenix

sinful belfry
#

it is around a week

grizzled raven
#

it can be UP TO 2 weeks OR MORE ~ pengduane

magic jackal
#

Anyone using GalaxyGate as a host here? My server randomly died and I cannot get it to start, I'm failing over to Digital Ocean but why does it randomly die like this? It seems to only happen on KVM type systems.

pale peak
#

@sinful belfry I threw it at 12 o'clock on Saturday

sinful belfry
#

yeah give it a couple days

#

and it will be checked out

earnest phoenix
#

never heard of galaxy gate

#

I use herou

#

heroku

grizzled raven
#

anybody used contabo before?

earnest phoenix
#

smh yall using vps and heroku? I use a samsung fridge

#

smh

grizzled raven
#

@earnest phoenix the internals of the samsung fridge must be cool

pale peak
#

@sinful belfry Well. Can I add it as a friend? if that won't bother you, of course.

earnest phoenix
#

. .

\/

#

angeryBOYE though if your think about it, if you host your bot on a samsung smart fridge, you could technically monitor it quite often

sinful belfry
#

please take it there

earnest phoenix
#

GWgoaSadness kk

grizzled raven
#

lets rewrite this conversation

#

so anyone used contabo before?

earnest phoenix
#

nah, but i might consider changing to them

#

having enough of my current vps provider, like their support is great and all

#

but i had issues of the vps not even booting quite often

#

and invoice issues even though i paid the servers

#

contabo seems sketchy

#

thats just my opinion

#

well their page does look like straight made from scratch in like 2015 or so, but i heard good things about them

grizzled raven
#

i like my current vps but i feel its really only one to be used for starting up

earnest phoenix
#

unless they donating sweaters to penguins in need I don't want it

#

jk

lyric mountain
#

ok guys, here I am once again in my journey to find help with oAuth2

#

anyone here has experience using it?

pale vessel
#

maybe

lyric mountain
#

ok, the issue I'm having is that I can't redeem the code returned by the "code grant" request (which IS being returned correctly, and I've also checked if my token request was being sent correctly with postman)

#

I've followed pretty much any doc/guide I've found online, but for some reason the "invalid_grant" error still pops up

#

the data sent is pretty much identical to the one present in the official Discord's oAuth2 docs

#

yet it doesn't work

balmy lantern
#

Hey is there like a bot ToS?
This one guy suggested I make a cmd that can make like 30 roles at once for all the color roles, but idk seems like it'd be breaking a rule or something

earnest phoenix
#

@balmy lantern all bots have to comply with discords TOS

#

and if you want to keep it on the dbl you should read theirs as well

sinful belfry
grizzled raven
#

pretty sure colour roles bots arent allowed on dbl but idk

sinful belfry
#

however if you are trying to make 30 roles at once, that is API abuse

#

nope, they are not

lyric mountain
#

meh, looks like my issue will not be seeing the light of the day anytime soon

grizzled raven
#

i guess oauth isnt what most people who read this chat know

#

so anyone used contabo before

lyric mountain
#

yeah, I guess

grizzled raven
#

just

balmy lantern
#

Fair enough

#

Thats why i asked first, thanks ๐Ÿ˜„

#

Why the canary in the link?

pale vessel
#

because starman uses discord canary

restive furnace
#

someone uses canary, someone else uses ptb, and most of them uses stable (just discordapp.com)

neat ingot
#

@grizzled raven I recently got a contabo server to test it out. i also thought the seemed sketch af. As far as i can tell, they have given me all cores, ram, ethernet speed, and storage promised for their low fee. ping to discord has been stable between 50-80ms, response times not much more than that. its been going for a few days and havent had any issues (yet)

#

^contabo hosted (usa ssd vps) bot

earnest phoenix
#

Tbh contabo seems a bit high

grizzled raven
#

ok cool

#

@neat ingot what plan did you get?

neat ingot
#

4 core, 8gb rams, 200mb-p/s ethernet, and i think 200gb ssd for like 4.99 euro per month

#

there is a 5 euro one time setup fee too

#

it took maybe an hour ort two for me to get the email with login details

earnest phoenix
#

Oh I thought you meant dedicated

neat ingot
#

nah, shared vps i got ๐Ÿ˜›

earnest phoenix
neat ingot
#

also, a huge thing for me, the ip address ccontabo gave me does NOT have any domains registered to id

blazing portal
#

anybody used contabo before?
@grizzled raven I have been using Contabo for roughly a year now. Happy customer, very good support, i get the performance promised... I don't know what seems sketchy about them lol

neat ingot
#

^thats the domains hosted on my current ip, and each of those except verylegit.pw forward spam traffic to various routes on my site

#

its been a huge pain

#

lol

grizzled raven
#

huh

#

how do you know its spam traffic

#

did that site tell you along with that list?

neat ingot
#

i use nginx and see each request made to my server

#

i get 3 requests each minute

#

for the /ecig.php route

#

my site obviously has nothing to do with e cigs

#

so to me, its spam

#

lol

#

surprisingly i get no spam on that site ๐Ÿ˜„

#

@earnest phoenix that was a full dedicated rack you rented?

grizzled raven
#

one question, do they email you the vps key or login or whatever

neat ingot
#

yea

grizzled raven
#

what exactly do they email

#

nvm thats a stupid question

pale vessel
#

umm the ip and password?

neat ingot
#

yea pretty much

#

i cant be bothered scrubbing my personal details from the email lol

#

apparently i also have access to like 65k ipv6 addresses

#

no idea who needs 65k ip addresses, but hey, its a thing apparently

grizzled raven
#

nah cause my last vps emailed a bunch of random stuff too which i cant remember

#

but that question doesnt matter

neat ingot
#

looks a bit like that

#

with extra details on support and a welcome message above it

grizzled raven
#

im debating whether to get the โ‚ฌ15 one or the โ‚ฌ9 one

#

okay cool

neat ingot
#

i went for the cheapest ssd based on, i think its 4.99 ๐Ÿ˜„

#

probably gonna get the next one up which i think is 8.99? but yea, just went cheapo to try it ๐Ÿ˜„

#

also made sure to choose usa which costs 1 euro more per month

#

apparently cause usa electricity etc is more expensive

#

but better ping to discord in usa than germany ๐Ÿ˜„

grizzled raven
#

yeah i will

#

also didnt know it was 1 eur more expensive

#

so โ‚ฌ21 or โ‚ฌ15

neat ingot
#

lol yea it tells you when you go to 'customize and order'

#

i say go for the cheapest option till you know your happy with their service ๐Ÿ™‚

#

they do seem to give what they say though

#

i thought they woujlda somehow skimped on the resources

#

some other dude from here says the 'steal' is high sometimes, meaning your resources are stolen (cpu/ram) by other vm's running in the same rack sometimes

grizzled raven
#

i think i've gotten many people's opinions on their service and most of them were good

#

except the whole steal situation

neat ingot
grizzled raven
#

but i thought it was only cpu steal lmao

#

guess it makes sense

neat ingot
#

tbh, my current host: digital ocean, gives me only 1core and 1gb of ram for the same $5 per month

#

and only 20gb ssd

#

so even if half my resources are stolen, im still way better off now ๐Ÿ˜„

grizzled raven
#

i guess their internet speeds might make up for it?

neat ingot
#

d/o? nah

grizzled raven
#

my current one is like 2gb and 32gb hdd i think

neat ingot
#

ive had issues with them since i got the server

grizzled raven
neat ingot
#

moostly with people who already rented the same ip from them

#

like, recycled ip addresses

#

forwarding traffic to my site

grizzled raven
#

whats the difference between 18.04 ubuntu and 20.04

neat ingot
#

pffft, your asking the wrong nerd

#

sec

#

im sure there are a LOT

grizzled raven
#

xd thats okay

#

who knows

neat ingot
#

i went 18 cause i wrote a complete guide for how to get my bot reinstalled on a new host, and my current host had ubuntu 18, so thats what i went with to be sure it'd be an easy switch

violet dagger
#

Alot of security staff for ubuntu

grizzled raven
#

i should do that

violet dagger
#

but 20.04 isnt fully supported by alot yet

grizzled raven
#

my last host was ubuntu 18.04 so thats why im asking

neat ingot
#

(my bot is stored in docker containers alongside other containers for other things, like database, website, nxgin, others...)

pale vessel
#

nginx you mean?

neat ingot
#

contabo does offer a v20 ubuntu

pale vessel
#

or not

tired nimbus
#

How can you hide letters or anything inside a codeblock

neat ingot
#

lol yea

grizzled raven
#

so would anything go bad if i choose 20.04?

pale vessel
#
test
#

space is not supported though

neat ingot
#

probably not, might run into an incompatibility with anything you might want to install, but probably not

tired nimbus
#

oof ill just search it up somehow

neat ingot
#

...

#

u just got an answer?

#

lol

pale vessel
#

lmao

#

pepega

tired nimbus
#

that doesnt give you the text when you copy it

pale vessel
#

what

tired nimbus
#

anyone play dank memer?

pale vessel
#

no shit it doesn't because you said "hidden"

neat ingot
#

you mean that image? ๐Ÿ˜„

pale vessel
#

i thought it's for bots to read or something

tired nimbus
#

if I want to copy a phrase from a code block it would not end up the same if i manually typed it

neat ingot
#

oooohhh

tired nimbus
#

thats the result I want

neat ingot
#

he might mean like

grizzled raven
#
h
neat ingot
#

||this||

#

^

#

?

tired nimbus
#

I asked in the Dank Official and they said they hid secret characters

#

Like the minigames that ask you to repeat the phrase:
I like making burgers

pale vessel
#

so you can't copy it

#

might have something to do with alternative version of a letter or different width space, idk

neat ingot
#

yea thats an interesting one

pale vessel
#

5Head devs tho

tired nimbus
neat ingot
#

wth

grizzled raven
#

oh

#

whitespace

#

probably

neat ingot
#

it must be based on how long you took to type?

#

oohhh

#

yea

#

good call

grizzled raven
#

see, they would put a whitespace and if they detect a whitespace in your message, you copied it

neat ingot
#

it could be filled wwith zeroi width spaces

tired nimbus
#

Test hi

#

eh I need eval

neat ingot
#

lol

#

^zero width spacing

pale vessel
#

there you have it

neat ingot
#

yes, when i copy it, its just text

tired nimbus
#

nice mystery solved thanks

pale vessel
#

no problem

neat ingot
#

^

tired nimbus
#

And I think we all learned something new today

neat ingot
#

you cant proove nuttin!

grizzled raven
#

any reason to get any of the administrator panels?

neat ingot
#

nah, i took the free one but havent used it yet, likely wont, and am already thinking of removing it ๐Ÿ˜„

#

if you can do command line, your good

grizzled raven
#

xd okay

#

gonna try order now i guess

neat ingot
#

GL!

#

hopefully im not a contabo employee in disguises here to scam you from your hard earned 10 euro ๐Ÿ˜„

magic jackal
#

@slim heart still programming huh, do you ever sleep? ๐Ÿ˜‚

slim heart
#

no

neat ingot
#

wow that was a fast response

magic jackal
earnest phoenix
#

i feel that

neat ingot
#

are you bot?

#

lol

#

ok, im about to feel super dumb for asking this, but its something ive never done... Is it possible for my bot to use emoji's from my server in other servers he is in, or for my bot to have a number of unique emoji's he can use in any server?

earnest phoenix
#

nope, afaik unlimited

#

as long as your server has enough emoji space ofc

neat ingot
#

i have a ittle battle screen thing that uses reactions to respond. it'd be awesome if i could make those custom icons

earnest phoenix
#

do it then, nothing is stopping you, you can use custom emojis in reactions too

neat ingot
#

but on other servers too? it would auto use those emojis?

earnest phoenix
#

its kinda like if the bot has some kind of nitro, it can use custom emotes everywhere

neat ingot
#

ooohhh awesome ๐Ÿ˜„

#

so my bot could use any emoji in any server he is in, as long as he ius in at least 1 server with those emojis?

tired nimbus
#

hi im back

neat ingot
#

thats pretty neat tbh

tired nimbus
#

long story short

#

it doesnt really

#

it

#

it matches

earnest phoenix
#

how do you code your bot and how do you activate your bot if i have someone to help me with full money?
@pale peak GWonoNanamiWhat

neat ingot
#

no idea what that means Clow. i use discord.js to code my bottie

earnest phoenix
#

a vps is more reliable

neat ingot
#

^

#

i currently use digital ocean, heroku, and contabo. contabo seems best but im new customer to them.

earnest phoenix
#

@pale peak a vps isn't like glitch, it's like a full computer

neat ingot
pale peak
#

are these links?

magic jackal
#

I currently use GalaxyGate

pale peak
#

@neat ingot @earnest phoenix so how do i transfer my commands in this glitch here

earnest phoenix
#

you just copy your code and reuse it on the vps

sterile minnow
#

Hi,

Does anyone know how to make a Shuffle Command with a JSON styled array as ServerQueue?

pale peak
#

but won't he make any mistake? @earnest phoenix

earnest phoenix
#

Hi,

Does anyone know how to make a Shuffle Command with a JSON styled array as ServerQueue?
@sterile minnow with some kind of RNG

#

@pale peak nope, if you do it correctly

neat ingot
#

to shuffle what?

sterile minnow
#

Songs

neat ingot
#

so youw ant to take a random song from an array, and then remove it from the array, or keep it there?

sterile minnow
#

One song is like that:

{ requester: 'Tayron#0001',
id: 'QYNF1YH9Ka8',
title: 'TIROW - ZWEITGEDANKE (prod. by LBL) #deutschrapnewcomer #deutschrapaktuell',
url: '',
thumbnail: ',
channel: 'TheTirow',
duration: '00:03:35' }

pale peak
#

@earnest phoenix all of my codes are in glitch and I put it in the computer file so there is no problem

sterile minnow
#

so youw ant to take a random song from an array, and then remove it from the array, or keep it there?
@neat ingot randomize the Whole array

pale peak
neat ingot
#

which code language?

sterile minnow
#

Javascript

pale peak
#

js

neat ingot
#

mmk, sec ๐Ÿ™‚

earnest phoenix
#

@sterile minnow yeah just use rng, save the ones that were played and check it on every next song

pale peak
#

what ?? @neat ingot

sterile minnow
#

@earnest phoenix what? I dont understand anything

#

I'm not a Native English speaker

earnest phoenix
#

random number generator

viscid nymph
#

Yo can someone explain to me how to get the permissions from the permission thing. Its a bit field. But cant seem to work it out from the discord docs or wikipedia

earnest phoenix
#

Like i said before, that's the permission bitmask

#

read the responses before you repost

viscid nymph
#

Ye I had a look at it

#

I am still confused

#

Thx btw, I typed it and left it

earnest phoenix
viscid nymph
#

Ye I get that, but how do I go from the permission code

#

to permissions

rocky lintel
#

Hello, does anyone know how to make the bot send a message when someone pings it? In discord.js

neat ingot
#
const songs = [{data:1}, {data:2}, {data:3}];
function getRandomSong() {
    return Math.floor(Math.random() * songs.length); 
}
function removeSongFromArray(song) {
    const id = songs.indexOf(song);
    songs.splice(id, 1);
}
// to use:
const chosen_song = getRandomSong();
removeSongFromArray(chosen_song);

@sterile minnow There are a few javascript functions to highlight what to do. probably not copy and paste, but it shows how to get a random element from the songs array, then if you pass that same song element to the remove song function, it should remove it from the array

#

#nottested

lyric mountain
#

Hello, does anyone know how to make the bot send a message when someone pings it? In discord.js
@rocky lintel check for if (msg === "<@YOURBOTID>" || msg === "<@!YOURBOTID>")

rocky lintel
#

Thanks!

sterile minnow
#

@neat ingot okay i'll try it

neat ingot
#

edited it a little to show how to use ๐Ÿ™‚

sterile minnow
#

ty

neat ingot
#

thats how i check if my bot was mentioned

#

message.mentions.has(guild.me)

lyric mountain
#

that check for a mention anywhere within the message

neat ingot
#

assuming you got guild from message.guild

lyric mountain
#

in his case he wants to send message only if the whole message is the mention

neat ingot
#

ahh yea, i do that too, but elsewhere in code. like, it runs help if mentioned and no other message or command is used

sterile minnow
#

@neat ingot and how do i randomize the whole thing?

neat ingot
#

the entire array?

sterile minnow
#

yes

neat ingot
#

oh lol

#

i would just rebuild a new array, perhaps something like umm...

sterile minnow
#

ouf

marble juniper
#

if you wanna randomize the array just...

#
function shuffle(array) {
  var currentIndex = array.length, temporaryValue, randomIndex;

  // While there remain elements to shuffle...
  while (0 !== currentIndex) {

    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;

    // And swap it with the current element.
    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;
  }

  return array;
}

// Used like so
var arr = [2, 11, 37, 42];
shuffle(arr);
console.log(arr);
#

I copied that from stackoverflow cuz im lazy

sterile minnow
#

this is what i tried

neat ingot
#
function rebuildSongs(){
    const newSongs = [];
    const length = songs.length;
    for (let index = 0; index < length; index++) {
        const song = getRandomSong();
        removeSongFromArray(song);
        newSongs.push(song);
    }
    songs = newSongs;
}
#

lol

royal tree
#

Is a problem if in the logs of my bot, every one min says ''reconnecting...'' ?

earnest phoenix
#

opcode reconnect stuff i reckon

sterile minnow
#

okay it doesnt Randomize at all

neat ingot
#

could probably change that for loop for while(songs.length) {}

#

lulz

sterile minnow
#

i'm fucking confused

neat ingot
#

oohh, sec

#
let songs = [{data:1}, {data:2}, {data:3}];
function getRandomSongID() {
    return Math.floor(Math.random() * songs.length); 
}
function getRandomSong() {
    return songs[getRandomSongID()]; 
}
function removeSongFromArray(song) {
    const id = songs.indexOf(song);
    songs.splice(id, 1);
}
function rebuildSongs(){
    const newSongs = [];
    const length = songs.length;
    for (let index = 0; index < length; index++) {
        const song = getRandomSong();
        removeSongFromArray(song);
        newSongs.push(song);
    }
    songs = newSongs;
}
// to use:
const chosen_song = getRandomSong();
removeSongFromArray(chosen_song);
#

the previous getRandomSong only returned id

#

cuz im dumb ๐Ÿ˜„

sterile minnow
#

okay works

neat ingot
#

yup, i tested it that time ๐Ÿ˜„

royal tree
#

some tips to make my music bot sounds better?

neat ingot
#

reggae music

sterile minnow
#

now it just Clears it

#

or leaves it normal

#

okay i'm dumb

#

Okay no

#

Its just reseting the Whole Queue

#

pls help

#

@neat ingot

oak cliff
#

Please wait patiently for someone to help you.

sterile minnow
#

yeah i thoght Dekita will help me cuz he helped me tho

oak cliff
#

if they are willing to help you they will when they have time, they might be busy and pinging them wont help

#

so just be patient please :)

heavy marsh
#

What permission does the bot need to fetch invites?

neat ingot
#

lol yea i was in a call ๐Ÿ˜„

#

what do you mean its resetting the queue?

digital oyster
#

Hello I have a question. Why is this not working if I react to a random message?

client.on('messageReactionAdd', (reaction, user) => {
  
   console.log("test")
})
delicate zephyr
#

because the bot hasnt cached the message

#

iirc you'll have to enable partials in order to have that work properly

glad jungle
earnest phoenix
#

you showed us everything but the actual error

glad jungle
#

oh woops it got cut off

#
0|index  | ReferenceError: Cannot access 'modThing' before initialization
0|index  |     at sendLog (C:\Users\Gideon\Code\Sir Foxy\logs.js:44:16)
0|index  |     at logs (C:\Users\Gideon\Code\Sir Foxy\logs.js:19:35)
0|index  |     at banFUNC (C:\Users\Gideon\Code\Sir Foxy\commands\mute.js:127:13)
0|index  |     at Object.execute (C:\Users\Gideon\Code\Sir Foxy\commands\mute.js:97:19)
0|index  |     at processTicksAndRejections (internal/process/task_queues.js:93:5)```
royal portal
#

anyone know what the problem is here?

#
if (command === "help") {
        if (!message.member.roles.cache.some(role => role.name === 'Server Administrator')) return;
        if (message.channel.permissionsFor(message.guild.me).has(["SEND_MESSAGES"], true)) {
        if(args[0] && args[0].toLowerCase() === "one") {
  const embed = new Discord.MessageEmbed()
  .setColor(16763812)
  .setTitle("Help one")
  .setDescription("help one")
  message.channel.send(embed).catch(console.error);
}
}
}

if (command === "help") {
        if (!message.member.roles.cache.some(role => role.name === 'Server Administrator')) return;
        if (message.channel.permissionsFor(message.guild.me).has(["SEND_MESSAGES"], true)) {
        if(args[1] && args[1].toLowerCase() === "two") {
  const embed = new Discord.MessageEmbed()
  .setColor(16763812)
  .setTitle("Help two")
  .setDescription("help two")
  message.channel.send(embed).catch(console.error);
  message.delete()
}
}
}
});
#

for some reason it wont delete the message

#

because the args

earnest phoenix
#

@glad jungle well... yeah, the code doesn't know when modThing is going to be a thing because sendLog is a function

royal portal
#

but if I change the args to [0] then it will send help one and delete the message

earnest phoenix
#

pass modThing through the arguments

glad jungle
#

hmm

#

ok

royal portal
#

so i'm not sure how to make it so if i send help two it will send that but then delete the message using message.delete

#

anyone know whats the problem

pale vessel
#

no indentation

#

cancer

earnest phoenix
#

that entire code is a dumpster fire from start to finish lol

royal portal
#

well I just don't know how to fix the args problem

pale vessel
#

what's up with the args

#

and why are there two help commands

royal portal
#

if i do args[1] then it will send the embed but wont delete the message

#

for help one and help two

pale vessel
#

no errors?

royal portal
#

no errors

#

args[1] will send the embed but wont delete the message

#

args[0] will send the help one embed and help two embed and deletes my message

pale vessel
#

seriously though

#

wtf are you doing

#

two help commands

#

combine them

#

if (args[0] === "one") { ... } else if (args[0] === "two") { .. }

#

or switch(args[0])

neat ingot
#

i personally have the first argument to my help command be a command name, to give specific help for that command

pale vessel
#

also, you didn't delete the message for the first command

#

only on the second one

neat ingot
#

like <prefix>help commandname

pale vessel
#

that's what i would do if an argument is passed

#

if not, it sends a list of commands

neat ingot
#

yea

earnest phoenix
#

hey guys im having trouble im getting this error

#

code: 'ER_PARSE_ERROR', errno: 1064, sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'desc = hi this is a test WHERE guildid = 703190260447969351' at line 1", sqlState: '42000', index: 0, sql: 'UPDATE settings SET desc = hi this is a test WHERE guildid = 703190260447969351'

#

this is the code im using for the query

#

} con.query(`UPDATE settings SET desc = '${desc}' WHERE guildid = ${msg.guild.id}`, (err) => { if (err) console.log(err) sendEmbed(msg, 'Description sucessfully updated.') })

split hazel
#

You're missing a quote @earnest phoenix

earnest phoenix
#

where

split hazel
#

And by the way you're vulnerable to SQL injection

pale vessel
#

SELECT * FROM data WHERE id = ? ๐Ÿ˜Ž

split hazel
#

guildid = [missing quote]${msg.guild.id}

pale vessel
#

that's fine

sudden geyser
#

May I ask if desc is direct user-input?

pale vessel
#

it's not missing

split hazel
#

just noticed

heavy marsh
#

What permission does the bot need to fetch invites?

earnest phoenix
#

Can someone explain how webhooks work i never used webhook

pale vessel
neat ingot
#

basically, a webhook is a reminder/trigger to call an api endpoint when a thing happens

#

for example, when a user votes

earnest phoenix
#

Thanks i little understand how its work i never use. Webhooks because i never need it

neat ingot
#

its like, a thing happens, lets say a user upvotes your bot. then dbl sends an api call to your defined webhook api endpoint, lets say mysite.com/upvoted. your api endpoint is then responsible for handling that information, for example, to reward the user who voted in some way.

#

so you would have the api sitting waiting for calls to it, just like a normal api endpoint, and then you handle the data that comes in, make sure its legit, w.e

earnest phoenix
#

ฤฐ understand

sterile minnow
#

Hey i'm back

#

my Bot wont even start in Discord js 12

neat ingot
#

lol

#

i've been upgrading my bot from v11->v12 for over a month now

#

tbf, ive been rewriting almost all of it

sterile minnow
#

okay i was on Node 8

#

what the even hell

neat ingot
#

f

smoky spire
#

U need node 12 for v12

neat ingot
#

what my bots using atm

sterile minnow
#

does someone know how to get a shard id in v12?

neat ingot
#

<never had a need for sharding ๐Ÿ’”

sterile minnow
#

A

#

And how do you get the Bots name?

smoky spire
#

Guild#shardID

#

ClientUser#username

clever garnet
#

can smeone help

smoky spire
#

Guild isn't a manager, it doesn't have a cache property

clever garnet
#

so how would i fix that

smoky spire
#

use a property of guild that actually is a manager

clever garnet
#

how do i do that tho

smoky spire
#

Look at the docs

slender thistle
#

That looks like a webhook token

clever garnet
#

oh no

#

i better refresh that quick

clever garnet
#

@smoky spire i cant find it in the docs

smoky spire
clever garnet
#

how do i use it

smoky spire
#

The same as any other property?

clever garnet
#

i dont understand this website for docs

smoky spire
#

That's what I sent

clever garnet
#

no

#

wait

#

i meant

smoky spire
#

Yes

clever garnet
#

discordjs.guide

#

thats what i meant

smoky spire
#

discordjs.guide isnt docs, it's a guide

clever garnet
#

yeah i dont understand the docs

smoky spire
#

Better learn to understand them then

#

Otherwise you won't be able to do anything on ur own

clever garnet
frigid oxide
#

Hello

winged orchid
#

How long does it take to get the bot verified?

earnest phoenix
#

a week or 2

winged orchid
#

Okay thx

earnest phoenix
#

just make sure your bot is ready because the pulled some sneaky stuff on me

#

I was in the middle of tweaking my bot to not be such a little bi-

oak cliff
#

this is development :)

grizzled raven
#

actualy let me

mystic violet
#

my discord bot isnt connecting for some reason

magic jackal
#

How can I shorten this you think?

msg.guild.channels.cache.get("channelID").send(`\`\`\`${logerr.inspect(e)}\`\`\``);```
#

Should I just make a function for it?

grizzled raven
#

nah thats okay

magic jackal
#

fair enough

#

I shall leave it

grizzled raven
#

ok what does that

#

wait

magic jackal
#

?

grizzled raven
#

probably the casing

#

i was talking about my issue

magic jackal
#

oh ok

mystic violet
#

my bot

#

isnt saying the ready message

#

any idea why

#

very slow

opaque seal
#

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

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

no because you sent nothing

lofty grove
#

I have a problem, is there someone to help?

mystic violet
#

flaze its in my ready event

#

lol