#development

1 messages · Page 971 of 1

astral yoke
#

should I put that in my code or can I-

#

nvm

paper phoenix
#

Obviously you'll need to store your list of blocked guilds - likely in a DB

#

And then query that list when it joins a guild.

astral yoke
#

well it's just one server

#

so what should I do for just one?

#

like I don't need an entire db for one

#

disallowedguilds im guessing you would set as a db

#

would this work?

#
 if( guild.includes( "theid" ) )
    guild.leave();
}```
#

@paper phoenix

paper phoenix
#
function guildCreate( guild ) {
  if( guild.id === '123456789012345678' )
    guild.leave( );
}
astral yoke
#

ty

quaint hornet
#

what error?

#
Promise.resolve(message).then(function(value) {
  value.delete()
})
``` try this
astral yoke
#

msg.delete()?

#

wait do

#
    await msg.delete();
    await msg.react("715383579059945512");
    await msg.react("715383579059683349");
  });```
#

@earnest phoenix

quaint hornet
#

scltxn but this will delete the embed

#

than the but just have sended

#

he want to delete the trigger message

#

on bottom of the msg.react

#

so the bot will react the embed message and delete the trigger message

astral yoke
#

i hoped i helped a little

#

quick question

#

how do you ban someone for a reason

#

i had my bot look at docs and it shows nothing

earnest phoenix
#

in which lib

astral yoke
#

d.js

astral yoke
#

ohhh brackets

#

ty

jade jungle
#

I made a pay command and there is no errors but when I try to pay someone it doesnt respond the only time it says anything is when i do c!pay but not when mentioning or saying a users name
Anyone have any idea how to fix?
This is the code: https://sourceb.in/58b834a696

slender thistle
#

Do you use a custom library or a public pre-made one

next remnant
#

Is there any way to profile my bot's (python) process running in a docker container?

summer torrent
#

how can I check message count per second/minute BlobosThinkos
@ me pls

next remnant
#

@summer torrent message sent or received?
If sent, count how many times you send
If received, count the number of times you got MESSAGE_CREATE

dreamy eagle
#
@bot.event
async def on_ready():
    await bot.change_presence(status=discord.Status.online, activity=discord.Streaming(name=f"{prefix} help",
                                                                                       url="https://www.twitch.tv/streaming_on_discord"))
    print(f'{bot.user} has connected to Discord!')
    
    import requests
    url = "https://discordbots.org/api/bots/" + str(bot.user.id) + "/stats"
    headers = {"Authorization": stableTOKEN}
    payload = {"server_count": len(bot.guilds)}
    requests.post(url, data=payload, headers=headers)

Help! Why isn't it working?

#

The server count

next remnant
#

requests

#

Don't use it

dreamy eagle
#

oh

#

any alternatives?

next remnant
#

Also wrong url

#

aiohttp

#

Dpy uses that internally

dreamy eagle
#

ah

next remnant
#

If you're wondering why

#

#topgg-api topic has link to docs from where you can find the url to POST to

dreamy eagle
#

ok thx

#
import aiohttp

dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}

async def on_ready():
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

async def on_server_join(server):
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

async def on_server_remove(server):
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

should i use this instead?

#

oh wait

#

thats the same url

next remnant
#

From where did you copy it?

next remnant
#

Those are outdated

#

...

#

It literally says that many times there

dreamy eagle
#

oh oops

next remnant
#

Also that's the more appropriate channel for help with top.gg api

dreamy eagle
#

oh ok thx

earnest phoenix
#

Code:

        await guild.leave()```
**Error:** ``Unknown Guild``
sick cloud
#

img cuts off

earnest phoenix
#

why this dont work?

    if (command === 'refresh') {
        if (!["507367752391196682"].includes(message.author.id)) {
            message.channel.send('No puedes usar el comando!')
        }
        exec('git pull master')
    }
#
const { exec } = require('child_process');
sudden geyser
#

What about it does not work? Also are you forgetting your return keyword above?

earnest phoenix
#

really?

#

is return exec?

#

why when i put git pull master

#

dont work?

#
fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights```
#

it isn't a git repo

#

like the error says

#

so?, how i fix it

#

use git clone to clone your repo and then you can run git pull in it

amber fractal
#

you probably meant to git pull origin

#

as master is normally a branch name

earnest phoenix
#

i'm trying host my bot in glitch

#

yikes

#

🚶

amber fractal
#

I'm surprised exec even works on glitch

earnest phoenix
#

Yes it hosts

amber fractal
#

update your node

normal nacelle
#

who?

earnest phoenix
#

HOw do I override channel permissions?
like add someone to the channel
by changing perms
ping me if u know

normal nacelle
#

how?

amber fractal
#

node, the runtime enviornment

#

idk how you would on that, it looks like glitch

#

or heroku

normal nacelle
#

give him a min to update nodes

torn tiger
#

Anyone know why this wont work>

earnest phoenix
#

im too lazy to type :p

torn tiger
#

halp pl0x

earnest phoenix
#

ok

#

i got it

#

try

torn tiger
#

ok

earnest phoenix
#

You can't cd it to desktop

ripe prairie
#

actually..

earnest phoenix
#

nvm

ripe prairie
earnest phoenix
#

cd "C:\Users\topla\Desktop"

#

try that

torn tiger
#

didnt work

earnest phoenix
#

ping me if u know

#

@torn tiger cd to your user folder lol

#

desktop doesn't exist in the folder you created

torn tiger
#

i tried that

#

i already uninstalled all the programs sooooooooooooooooo

earnest phoenix
torn tiger
#

my brain is so big

#

not even

#

5 of those emojis

#

could show the size

ripe prairie
#

@earnest phoenix if you were using python i could've helped pensiveCrabRave

earnest phoenix
#

😦

ripe prairie
earnest phoenix
hollow saddle
#

@earnest phoenix You could bind the client to the event and attach the map to the client

#

Or module.exports the map and require the bot file in the event

#

But I think the former is the better option

earnest phoenix
#

how

#

sorry

#

im new to command handlers

glacial beacon
#

Modules and exports are not specific to command handlers. You should learn to use node a little bit better

hoary lily
#

Uhm how can I delete channel overwrites? I used the alternative way but it's not working

mighty frost
restive furnace
#

those packages

#

are horrible

#

just use few packages as possible, normally i have like 1-3 packages per project

hoary lily
#

I suggest using termux

#

I don't need root permissions for it to work

restive furnace
#

i recommend using pc

#

it wont need root permissions since it runs on ur pc

hoary lily
#

When pc not applicable I mean I don't have pc, but I programmed mine

vale garden
#

hi

#

im really dumb

#
const Discord = require('discord.js');

module.exports = {
  name: "dice",
  description: 'rolls a dice',
  execute: (message, args) => {
    
    let dice_no = args[0]

    if (!args[0]){
      message.reply("Bruh enter the no of sides lol")
    }

    else {

     let ndice = parseInt(args[0]);


    let roll = Math.floor(Math.random() * parseInt)
    let diceEmbed = new Discord.MessageEmbed();
    diceEmbed.setColor("#00ff00");;
    diceEmbed.setTitle("The number rolled is..");
    diceEmbed.setDescription(roll);
    diceEmbed.setFooter("Requested by " + message.author.username);
    diceEmbed.setTimestamp();

    message.reply(diceEmbed);
    }
    


  }
}
#

pls someone tell me whats wrong with this

#

i am getting this

#

no errors

marble juniper
#

NaN means not a number

vale garden
#

oh

#

but

#

how do i make the arg

#

like

#

you know

steel drum
#

let roll = Math.floor(Math.random() * parseInt)

#

you're multiplying a number with a function lol

vale garden
#

yea

#

oh

#

wait

#

wait

#

omfg

#

im dumb

#

lol

#

it is supposed to be ndice

marble juniper
#

you gotta use ndice

#

yeah

vale garden
#

it still isnt working tho

#

see

#

also im getting this random correcting line

marble juniper
#

I think you can ignore dat

#

cuz vsc is dumb sometimes

vale garden
#

lol

#

but do you know why it still isnt working

marble juniper
#

idk

#

I stopped coding stuff long ago so

earnest phoenix
#

if you write anything but a number

#

it will parseInt into NaN

steel drum
#

not true

earnest phoenix
#

it is true

steel drum
#

no, its not

earnest phoenix
#

uhhhh

steel drum
#
parseInt(" 02 "); // 2
vale garden
#

i think i have an idea

earnest phoenix
#

thats a number

steel drum
#

the whole point of parse int

earnest phoenix
restive furnace
#

parseInt(args)

steel drum
#

is to parse a string

#

to into an int

earnest phoenix
#

stop being a wiseguy

vale garden
#

how do i

#

list the numberr of args

earnest phoenix
#

you know I meant a string with a number

vale garden
#

like

earnest phoenix
#

args.length

vale garden
#

[0, 1, 2] = args;

steel drum
#

no, i didnt

#

its not being a wise guy

vale garden
#

theres something like that right

steel drum
#

its not trying to misinform people

#

: )

earnest phoenix
#

yeah its args.length @vale garden

restive furnace
#

parseInt(num)

vale garden
#

yea but how do i define it

#

[0, 1, 2] = args;
@vale garden is this right

earnest phoenix
#

its already defined

#

no

whole summit
#

sup

vale garden
#

oh

restive furnace
#

const num = 1 + 2 * 3

earnest phoenix
#

const three = [1, 2, 3].length;

restive furnace
#

???

#

its join if he wants to count

#

them

earnest phoenix
#

uhh no

vale garden
#

im confused

earnest phoenix
#

its length

vale garden
#

i did ndice.length and its wrong

restive furnace
#

length = how many arguments lol

vale garden
#

doesnt work

#

oh yea

earnest phoenix
#

no...

vale garden
#

yea

#

it is

restive furnace
#

ok if u want dice command here u go

earnest phoenix
#

args.length not ndice.length

restive furnace
#

examole

#

not spoonfeed

vale garden
#

wha

restive furnace
#
const num = Math.floor(Math.random() * 6);

// then send num to chan or use it embed or what ever```
vale garden
#

i know that lol

#

how do i make it args

restive furnace
#

u dont need to

#

or what you want

vale garden
#

but i want to lol

restive furnace
#

or what you want
@freestyle#0001

vale garden
#

im trying to take the args as the

#

no of sides

restive furnace
#

then const num = args[0]?

#

wait

vale garden
#

ok and

#

have you seen my previous message

#

s

restive furnace
#

const num = parseInt(args[0])

vale garden
#

lol

restive furnace
#

that should work

vale garden
#
const Discord = require('discord.js');

module.exports = {
  name: "dice",
  description: 'rolls a dice',
  execute: (message, args) => {
    
    let dice_no = args[0]

    if (!args[0]){
      message.reply("Bruh enter the no of sides lol")
    }

    else {

     let ndice = parseInt(args[0]);


    let roll = Math.floor(Math.random() * ndice)
    let diceEmbed = new Discord.MessageEmbed();
    diceEmbed.setColor("#00ff00");;
    diceEmbed.setTitle("The number rolled is..");
    diceEmbed.setDescription(roll);
    diceEmbed.setFooter("Requested by " + message.author.username);
    diceEmbed.setTimestamp();

    message.reply(diceEmbed);
    }
    


  }
}
#

this is my code

#

and it doesnt work

#

it shows NaN

restive furnace
#

waat

#

then it means args[0] is null or smh

vale garden
#

lol idk

restive furnace
#

try console.log(args[0]) after message.reply

vale garden
#

ok

#

wha

#

it logged dice

#

??

restive furnace
#

send logs

vale garden
#

t!dice 4 this is the command

restive furnace
#

kk then make ndice to parseInt(args[1])

vale garden
#

ok

#

and the first one to 1 as well?

#

right

restive furnace
#

yes

#

all [0] to [1]

harsh hull
#

Hi people, I am trying to play two songs using connection.play(path.join(music_dir, music_list[0])); connection.play(path.join(music_dir, music_list[1])); but it is only playing the second song and skipping the first one. Any idea?

vale garden
#

it worked

#

but still logs dice

#

lol

#

doesnt matter

restive furnace
#

u can now remove the console.log in end of it tho

vale garden
#

yea ik

restive furnace
#

Hi people, I am trying to play two songs using connection.play(path.join(music_dir, music_list[0])); connection.play(path.join(music_dir, music_list[1])); but it is only playing the second song and skipping the first one. Any idea?
@harsh hull you mean like queue or what?

harsh hull
#

yeah something like that

restive furnace
#

that wont work, y gonna need to make collection of songs and then yeah

tight plinth
#

Well make a queue and put songs in it

harsh hull
#

I see thanks!

earnest phoenix
#
  if(message.content.startsWith('@teal latch')) {
      message.reply(`My prefix is **${prefix}**!`)
    }```
#

bot works

#

but doesn’t do command

restive furnace
#

send command handler/message handler and example of command... and possibly errors..

earnest phoenix
#

there is no errors

#

When I tag the bot

#

it doesn’t respond

restive furnace
#

could you read the whole message...

earnest phoenix
#

the editor reads it

steel drum
#

@earnest phoenix

message.mentions.members.has(Bot.user.id)
restive furnace
#

what??? "the editor reads it"? wdym by that

nocturne grove
#

A month or something ago, people recommended me to create, use and end a mysql connection for each query. Now I read that's not useful at all, as it will wait for the previous query to finish until it can end that connection and open a new one. Now I saw a pool is the best way, but people here said I could better do it like I described in the first sentence.

What should I do?

restive furnace
#

i usually just cache everything, and when program closes then put them back into db

nocturne grove
#

hmm yeah I heard about that but I haven't found a way to 100% sure detect the program closure

silver flare
#

G

restive furnace
#

signint signterm those are what i know (ctrl + c and pressing "x")

pure lion
#

not sure how to set something like this up to use in my bot

#

other than install superfetch

nocturne grove
#

@balmy knoll lol I just wanted to react

balmy knoll
#

Resolved

earnest phoenix
#

I can resolve that the discord bot leaves all servers?

small zenith
#
.setDescription("**Pong!**\nLatency Is "+Math.round(Date.now() - message.createdTimestamp)+"ms. API Latency Is "+client.ws.ping+"ms")```
#

is it correct? im first time making ping command

earnest phoenix
#

Hhhh

golden condor
earnest phoenix
#

I shouldn't be here

#

nice 😛

plucky harness
#

is there any way to stop user from using a command when another command is in progress. Like if !story is in progress user shouln't be able to use !story while its in progress. if he does it should show an error

#

anyone can help pls?

sinful belfry
#

yeah you can

#

hang on a sec

plucky harness
sinful belfry
#

ah sorry

#

i am sure it is possible, though i know nothing about python lmao

plucky harness
#

maybe js will help

#

to give me some idea

pure lion
#

can someone help me properly interact with alexflipnote api (using node superfetch)

golden condor
#

sure

pure lion
#

thankyou

golden condor
#

but I would recommend node-fetch

#

for this

pure lion
#

alright brb

#

node-fetch?

#

alright

slender thistle
#

@plucky harness on command usage, bot.cmdinprog = True

on another command usage: if bot.cmdinprog:

pure lion
#

@golden condor alright its installed and i did

fetch('https://api.alexflipnote.dev/')
golden condor
#

so

#

Here is a quick example

plucky harness
#

@slender thistle it would allow only one user to access ?

slender thistle
#

Following the logic, it should

plucky harness
#

i want a single user to not access command two or more times

golden condor
#

for if you wanted to grab stuff from homepage

plucky harness
#

others can access

pure lion
#

pornhub?text=text&text2=text

#

👀

#

just dont know how to get the image

golden condor
#
fetch("https://api.alexflipnote.dev/").then(res => res.json().then(data => {
res.support_server
}))
pure lion
#

ah

golden condor
#

But if you want the images

#

you don't need to fetch at all

pure lion
#

ohh

#

okay

golden condor
#

just do this

slender thistle
#

Well use a dictionary where you store user IDs

golden condor
#

and it shows up as the image

#

it's like an image server

leaden rover
#

I have made a Discord Music bot with node.js, but whenever I use the play command, it leaves the channel. Why does this happen?

pure lion
#

buthowdoigetmytextontotheimage?

leaden rover
#

It joins then leaves

pure lion
#

I have made a Discord Music bot with node.js, but whenever I use the play command, it leaves the channel. Why does this happen?
need more info

#

send codes

leaden rover
#

k

#

in a file?

pure lion
#

however you can

leaden rover
#

I've got an index.js file

pure lion
#

send the music code

mossy vine
#

first of all did you copy and paste the code

pure lion
#

that too

leaden rover
pure lion
#

no opus/ytdl/ffmpeg?

leaden rover
#

No

pure lion
#

how are you gonna play the music

leaden rover
#

I have ffmpeg

#

But what do I use for ytdl/opus?

#

I use npm

golden condor
#

buthowdoigetmytextontotheimage?
@pure lion use args

#

like

#
`https://api.alexflipnote.dev/pornhub?text=${text}&text2=${secondtext}`
pure lion
#

i already tried args

#

o h

#

o h

#

i was putting it in the wrong place lmao

golden condor
#

👍

real helm
#

Hiya

pure lion
#

sup

real helm
#

I'm doing a discord bot dashboard

#

And i need some help ;v

pure lion
#

never mind

real helm
#

how could you return me only the guilds where you have admin permissions

devout wagon
#

Get current user guilds and filter

real helm
#

What can i do in the filter

#

permissions example: 2146959351

devout wagon
#

Yeah, that's a bit set

#

You can look at the official docs to see which bit means what

real helm
#

All permissions except Admin

#

But i have manage guild

devout wagon
#

0x00000008

#

This is admin

real helm
#

mmh

digital ibex
#

u using a library in ur dashboard?

devout wagon
#

You can check this with bitwise and

real helm
#

0x00000008
@devout wagon But if you have only have admin

#

u using a library in ur dashboard?
@digital ibex passport

devout wagon
#

@devout wagon But if you have only have admin
@real helm wdym

digital ibex
#

i meant a discord library

real helm
#

If you have more permissions, the admin isn't 8

devout wagon
#

permissions & 0x8 == 0x8

real helm
#

mmh

devout wagon
#

Then you have admin

digital ibex
#

an api wrapper for discord?

devout wagon
#

Regardless of other perms

silk burrow
#

Wrong server reeee

leaden rover
#

How do I install ytdl and opus with npm?

digital ibex
#

npm i ytdl opus?

pure lion
#

How do I install ytdl and opus with npm?
@leaden rover npm i ytdl- core
npm i discord.js/opus

leaden rover
#

ok

pure lion
#

also can someone help me with args.toString because its being stupid

leaden rover
#

@pure lion opus can't install

pure lion
#

i cant remember the name of the package

#

but its something along the lines of discord.js-opus

leaden rover
#

ok

#

Done it, nothing is outdated! 😎

plucky harness
#

in discord.py how do i make it delete or ignore default help command

#

i have my custom one

earnest phoenix
#

any idea? i tried everything.. everything is defined

#
    at Object.module.exports.run (/home/Nana/Witch/Witch/commands/userinfo.js:21:4)
    at Client.module.exports (/home/Nana/Witch/Witch/events/message.js:36:11)
    at emitOne (events.js:121:20)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
    at WebSocket.onMessage (/home/Nana/Witch/Witch/node_modules/ws/lib/event-target.js:120:16)
    at emitOne (events.js:116:13)
(node:66113) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 14)

#

at embed

real helm
#

is .addField

#

no .setField

earnest phoenix
#
    at Object.module.exports.run (/home/Nana/Witch/Witch/commands/userinfo.js:20:4)
    at Client.module.exports (/home/Nana/Witch/Witch/events/message.js:36:11)
    at emitOne (events.js:121:20)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
    at WebSocket.onMessage (/home/Nana/Witch/Witch/node_modules/ws/lib/event-target.js:120:16)
    at emitOne (events.js:116:13)
(node:66113) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 15)
ornate needle
#

in discord.py how do i make it delete or ignore default help command
@plucky harness

client = commands.Bot(command_prefix="?", help_command=None)

earnest phoenix
#

ah

#

Haha

#

I can text here

misty sigil
#

Yea?

#

So @earnest phoenix what library and device are you on

earnest phoenix
#

Me is on mobile

misty sigil
#

oh dear

#

do you have a PC?

earnest phoenix
#
    at Object.module.exports.run (/home/Nana/Witch/Witch/commands/userinfo.js:27:51)
    at Client.module.exports (/home/Nana/Witch/Witch/events/message.js:36:11)
    at emitOne (events.js:121:20)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (/home/Nana/Witch/Witch/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
    at WebSocket.onMessage (/home/Nana/Witch/Witch/node_modules/ws/lib/event-target.js:120:16)
    at emitOne (events.js:116:13)
(node:66113) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 21)
#

any idea?

true ravine
#

Could you show the relevant code too?

misty sigil
#

yes please do

#

it’s something to do with “array” being unreadable

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

module.exports.run = async (bot, message, args) => {
  const user = message.mentions.users.first() || message.author
  const member = message.mentions.members.first() || message.guild.members.get(args[0]) || message.member || message.author;
  if(member.user.bot) return message.channel.send(`  | **${message.author.username}**, bots don't have a profile`)

    const status = {
    "dnd": ":red_circle:",
    "online": ":green_circle:",
    "idle": ":yellow_circle:",
    "offline": "![offline](https://cdn.discordapp.com/emojis/708392535684546610.webp?size=128 "offline")"
  }

const embed = new Discord.RichEmbed()
  .setColor("#ad91ff")
  .setThumbnail(`${member.user.avatarURL}`)
  .addField(`${status[member.user.presence.status]} ${member.user.tag}#${member.user.discriminator} (\`\`\`${member.user.id}\`\`\`)`)
  .addField(`Nickname`, `${member.nickname !== null ? `${member.nickname}` : '**No Nickame.**'}`)
  .addField('Created at', `{moment.utc(user.createdAt).format('dddd, MMMM Do YYYY, HH:mm:ss')}`)
  .addField(`Robot`, `${user.bot.toString().toUpperCase()}`)
  .addField('Activity', `${member.user.presence.game === null ? "**No Activity**" : member.user.presence.game.name}`)
  .addField(`**Member**`)
  .addField('Joined At', `${moment.utc(member.joinedAt).format('dddd, MMMM Do YYYY, HH:mm:ss')}`)
  .addField('Member Roles:', `${member.user.roles.array()}`)
  .setFooter(`© Witch Bot by ${customisation.ownername}`);

  message.channel.send({embed});
}
exports.conf = {
  enabled: true,
  guildOnly: false,
  aliases: ["userstats"],
  permLevel: 0
};
#

..

true ravine
#

Users don't have a roles property

#

It should just be member.roles

#

Assuming member is a member

vale garden
#

hi why am i getting this error

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

module.exports = {
    name: 'poem',
    description: "sends you a poem",
    execute(message, args) {

      const poemEmbed = new Discord.MessageEmbed()
      poemEmbed.setColor("#ffa500")
      .setAuthor('Author')
      .setTitle("Title")
      .setDescription("Poem")
      .setFooter(`Requested by ${message.author.username}`)
      .setTimestamp()

      message.reply(poemEmbed)



    }
}
#

i think there is nothing wrong with the command

#

and message.author.username is correct right

#

i have never defined it in any previous commands where i used it

#

and it goes perfectly

#

could it be

#

because the .setAuthor doesnt have an image url

#

i got

#

it

#

its nothing related to any author

#

i put a . instead of a ,

#

lol

#

hey

#

but

#

is there a way to make it so that

#

the main code

#

index.js

#

anyways

#

dude

#

do you know a way

#

yea

#

by which when there are like many strings and you randomly generate one

#

like a = [1, 2, 3]

#

and

#

let b = Math.floor(Math.random() * a.length)

#

yea i meant that

#

sorry im in a hurry

#

gtg soon

#

so like you make another array

#

and is it possible

#

that if one of the elements of an array gets generated only a specific one from the other array appears

#

if a = [1, 2, 3] and b = [1, 4, 9]

#

and 3 gets selected

#

is it possible to make 9 also send

#

ok

earnest phoenix
#

any idea why this undefined

#

appear?

#
  .setColor("#ad91ff")
  .setThumbnail(`${member.user.avatarURL}`)
  .setAuthor("User Info")
  .addField(`${status[member.user.presence.status]} ${member.user.tag} (\`\`\`${member.user.id}\`\`\`)`)
  .addField(`Nickname`, `${member.nickname !== null ? `${member.nickname}` : '**No Nickame.**'}`)
  .addField('Created at', `${moment(user.createdAt).toString().substr(0, 15)}\n(${moment(user.createdAt).fromNow()})`)
  .addField(`Robot`, `${user.bot.toString().toUpperCase()}`)
  .addField('Activity', `${member.user.presence.game === null ? "**No Activity**" : member.user.presence.game.name}`)
  .addField('Joined At', `${moment(muser.joinedAt).toString().substr(0, 15)}\n(${moment(muser.joinedAt).fromNow()})`)
  .addField('Member Roles:', `${muser.roles.array()}`)
  .setFooter(`© Witch Bot by ${customisation.ownername}`);
#

@earnest phoenix u can help me too?

vale garden
#

see i know that

#

but im talking about when there are 2 arrays

#

and like 2 gets selected in the first array

pale vessel
#

use a loop

vale garden
#

so i need another element to be there

#

but the thing is its gonna get too ong

#

long

#

oof is there an npm for poems

earnest phoenix
#

anyone can help me?

#

u have up my problem

#

nevermind

#

i put as description

#

but instead of false

#

how can i do like this

#

instead of false

#

to say bot

#

or user

#

i made this ${user.bot.toString().toUpperCase()}

#

where to put that

#

ah

#

tysm @earnest phoenix

#

My connection to the server always time out before it can even finish the mongod command. Any solutions as to how to make it faster?

#

Nice bot 👌

#

any idea to make the bot

#

to ping highest role

#

like member ones?

pale vessel
#

filter them by their positions

earnest phoenix
#

example? ${member.highestRole.name}

pale vessel
#

my bad, you can just sort them

earnest phoenix
#

nevermind

#

i found

#

anyway thx for sort

pale vessel
#

i'm not even sure at this point

digital ibex
#

@earnest phoenix theres a lot of factors for why its timing out, and wdym you can't finish the mongod command? and what do you want to be faster?

pale vessel
#

can you even sort a collection

digital ibex
#

ya lul

pale vessel
#

you can

#

yeah

#

so you can do something like <Roles>.sort((a, b) => a.position - b.position)

#

it could be backwards, idk lol

digital ibex
#

its b.- ye

pale vessel
#

after that you can just map them by mentions

earnest phoenix
#

flaze

#

i aleardy did that

#

read

#

also it don't ping role..

${message.guild.roles.sort((b, a) => a.position - b.position || a.id - b.id).first().name}```
slender thistle
#

Hint: .name

earnest phoenix
#

i did

#

look

#

no ping

#

.

digital ibex
#

thats not going to mention

#

<@&510453675425136651> = mention
Certified Bot = name

#

im a little confused for why this isn't working: ```js
const button = document.getElementById('btn');

button.addEventListener('click', (event) => {
console.log('e');
});``` i have this, its not logging e

#

and theres no errors

#

anyone know why its not doing anything?

#

the html: ```html
<div id="btn">
<button class="button is-success is-light">Save Changes</button>
</div>

earnest phoenix
#

uh

#

divs don't have a click event

#

do they?

digital ibex
#

oh, idk

#

i changed my html to html <div class="btn"> <button class="button is-success is-light" id="btn">Save Changes</button> </div> but still nothing happens

quartz kindle
#

anything can have a click event as long as you add one

#

ids are unique accross the entire document

#

is that the only button you have in the entire page?

earnest phoenix
#

@earnest phoenix theres a lot of factors for why its timing out, and wdym you can't finish the mongod command? and what do you want to be faster?
@digital ibex it timed out before i can even type a command again meaning the mongod command has not finished executing yet

digital ibex
#

would i have to link the html and js together? or does the document automatically get it?

#

yeah, thats the only button i have on that page, i have more but none with the id of btn

earnest phoenix
#

oh

#

are you not referencing your js file

digital ibex
#

sunSOG, what even is mongod?

quartz kindle
#

how are your files organized?

digital ibex
#

o

quartz kindle
#

you have a separate html and js file?

digital ibex
#

yeah

quartz kindle
#

then you need to link it

digital ibex
#

i thought the document would automatically do it, sorry 😄

quartz kindle
#

<script src="myscripts.js"></script>

#

in your html file

digital ibex
#

yeah, i have that underneath

#

would that be in the head tag or body?

quartz kindle
#

end of body

digital ibex
#

kk

earnest phoenix
#

isn't it the head

#

nvm it's the body

quartz kindle
#

you can, but end of body is the preferred placement in order to defer script loading

earnest phoenix
#

i haven't done vanilla web dev in ages

digital ibex
#

nothing happens um

#

this is my full html code: html <body> <div> <div class="columns"> <div class="column"> <p class="ef">hi</p> </div> </div> </div> <div class="btn"> <button class="button is-success is-light" id="btn">Save Changes</button> </div> <script src="../../public/scripts/index.js"></script> </body> if that helps

quartz kindle
#

open dev tools

#

check network tab

#

and refresh the page

digital ibex
#

kk

quartz kindle
#

see if your index.js file loaded correctly

digital ibex
#

yeah, it loads

pure lion
#

so

#

so

#

s o

#

so

quartz kindle
#

@digital ibex open dev tools, go to console, and paste your script there

digital ibex
#

kk

slender thistle
#

replace spaces with +

pure lion
#

oh

slender thistle
#

unless I'm misunderstanding it

pure lion
#

ill try

#

ok thanks

pale vessel
#

it's easier to use encodeURIComponent()

digital ibex
#

@quartz kindle it works in the console

#

thats confusing

quartz kindle
#

are you sure the js file loaded correctly? does it show status 200 in network tab?

digital ibex
#

its 304

quartz kindle
#

do you have the "disable cache" checkbox ticked?

digital ibex
#

'not modified'

pure lion
#

it's easier to use encodeURIComponent()
@pale vessel e?

digital ibex
#

how do i do that?

quartz kindle
#

its in the network tab

digital ibex
#

its unchecked, do i tick it?

quartz kindle
#

yes

digital ibex
#

ah, now i got 200

#

thanks :)

quartz kindle
#

check if it works now

digital ibex
#

it doesn't log to the console

quartz kindle
#

what if you do console.log(button) in your js file

#

then reload the page with the console tab open

digital ibex
#

kk

#

do i log it in the .addEventListener?

#

no or

#

nothing logs, i added it outside it

quartz kindle
#

reload with the network tab open

#

and show a pic of the network tab

digital ibex
#

kk

quartz kindle
#

what about your console? its showing 1 warning and 1 error

digital ibex
#

i don't even have a < in my index.js file

quartz kindle
#

click where it says "index.js:1"

digital ibex
#

kk

#

oh

#

<p>test</p>

#

i was testing if res.send would work in html

#

like res.send('html')

quartz kindle
#

lol

#

that will never work (using express code in client side)

#

or you mean doing res.send("<html here>") in your server?

#

that will work yes

digital ibex
#

thats coming from the 404 page btw the error

slender thistle
#

What is res in this case

digital ibex
#

do u kno why its loading the 404 page and why its erroring?

#

uhhh

#

response

quartz kindle
#

go to your network tab

#

and click on "all" instead of "js"

digital ibex
#

kk

#

what do i do now?

raven urchin
#

Im having an issue with the vote webhook

quartz kindle
#

does it have any redirection?

raven urchin
quartz kindle
#

scroll a bit more up

#

there should be more information about the error

raven urchin
quartz kindle
#

there you go

#

you cannot use the same port multiple times

misty sigil
#

im making a basic rate command

quartz kindle
#

port 3000 is already being used

raven urchin
#

Ahh ok

misty sigil
#

and i want to have things that give 0/10 and things that give 10/10

quartz kindle
#

if you have an existing webserver, such as express.js, add it to dblapi instead

misty sigil
#

any idea how i could do that

digital ibex
#

error 1: GET http://localhost:3000/favicon.ico net::ERR_CONNECTION_REFUSED

error 2: Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/guilds/689243278666760201/stylesheets/main.css".

quartz kindle
#

for example, instead of webhookPort:3000 you put webhookServer:server/listener with the server or listener of your existing webserver

misty sigil
#

any idea how i could do that?

pale vessel
#

use Math.random() + math

misty sigil
#

i've done the basic stuff

#

but i want the command to return 0 for some things

quartz kindle
#

@digital ibex you should not be using relative paths for js and css with dynamic urls, thats too messy

digital ibex
#

o

quartz kindle
#

put your js and css in a single location, define them as static in your express.js, and use absolute urls instead

digital ibex
#

they are in separate places

raven urchin
#

So I tried other ports but didn't work. I have a port in the env which is 3000, and a app.listen(4000)

quartz kindle
#

@raven urchin you're using glitch right?

digital ibex
#

and i am defining them as static in express

raven urchin
#

Yeah

quartz kindle
#

glitch only allows port 3000 afaik

raven urchin
#

Damn

quartz kindle
#

so you have to use the same server for both, like i showed

digital ibex
#

by define them as static u mean: app.use(express.static(path.join(__dirname, 'public'))); ?

quartz kindle
#

webhookServer:yourserverhere

raven urchin
#

when I do 3000 still shows an error

quartz kindle
#

@digital ibex yes, they are both in your public folder?

#

your js and css files

digital ibex
#

yeah

#

seperate files tho

quartz kindle
#

yeah

#

do you see them if you go to localhost:3000/public/file.js?

digital ibex
#

lemme see

raven urchin
#

So i possibly can't use 3000?

digital ibex
#

its not loading, no idea why

quartz kindle
#

@raven urchin i told you, use the same server for both

raven urchin
#

I did

quartz kindle
#
let listener = myserverhere.listen(process.env.PORT)
let dbl = new DBL("bla",{webhookServer:listener})
raven urchin
#

Ah I'm stupid

quartz kindle
#

@digital ibex what if you go to localhost:3000/public

digital ibex
#

lemme see

#

still just loads

quartz kindle
#

whats your directory structure?

digital ibex
#

localhost:3000/src/public -> i'm doing & that is the directory structure

quartz kindle
#

i mean which files are where

#

in your server

digital ibex
#

public is in my src folder, index.js is in public/js/index.js

quartz kindle
#

wait im confused

#

so basically this?

index.js (the express server)
src
  public
    js
      index.js
    css
      index.css
digital ibex
#

its: ```
src
app.js ( express )
public
js
index.js

quartz kindle
#

ah

#

and css is public/css/index.css?

digital ibex
#

ye

#

its main.css tho

quartz kindle
#

ok

#

so if you access localhost:3000/public/js/index.js it doesnt work?

#

also try localhost:3000/js/index.js

digital ibex
#

kk

#

wait, remove the src?

quartz kindle
#

yes

surreal sage
#

try it

earnest phoenix
#

How i show total server in top.gg

surreal sage
#

How i show total server in top.gg
@earnest phoenix wdym

digital ibex
#

kk

#

localhost:3000/public/js/index.js -> nothing, just loads
localhost:3000/js/index.js -> shows the index.js file

quartz kindle
#

ok good

earnest phoenix
surreal sage
#

good

earnest phoenix
#

change N/A

#

to number of all server

surreal sage
#

look at the api

#

i dont have examples atm

earnest phoenix
#

client.guilds.cache.size

quartz kindle
#

so in all your html/ejs files, you can simply do <script src="/js/index.js"></script>

#

same with your css files: <link rel="stylesheet" href="/css/main.css">

digital ibex
#

o ok

quartz kindle
#

so basically loading them from root regardless of what the url is

digital ibex
#

kk

quartz kindle
#

that should fix the css error, as for the favicon error, just put a favicon.ico file in your public folder

digital ibex
#

kk

raven urchin
#

@quartz kindle so it's saying server.listen isn't a function, how idea?

quartz kindle
#

how did you start your server before?

raven urchin
#

I used app.listen

quartz kindle
#

then do the same thing lol

digital ibex
raven urchin
#

Ah ok

digital ibex
#

its just loading now tf

quartz kindle
#

show network tab

misty sigil
#

anyone got any idea how to make a random number between args[1] and args[2]

digital ibex
#

kk

summer torrent
#

@misty sigil javascript?

misty sigil
#

yes

digital ibex
summer torrent
#
Math.floor(Math.random() * maximum) + minimum``` iirc
haughty night
#

Math.floor(Math.random() * num1) +num2;

#

that ye

digital ibex
#

@quartz kindle any ideas?

haughty night
#

Lmao

plucky harness
misty sigil
#

restart command

#

might make one of them

plucky harness
#

ik how to close or logout

quartz kindle
#

@digital ibex show your app.js file

plucky harness
#

but start ?

digital ibex
#

all of it?

quartz kindle
#

yes

plucky harness
#

i dont wanna login manually

#

via code basically

#

which'll log out then logs in

#

i dont think so

quartz kindle
#

@plucky harness to restart a bot the easiest way is to simply use a process manager

plucky harness
#

oh? how do i do that

earnest phoenix
#

How can i fix this?

quartz kindle
#

there are many process managers out there, for example pm2 which is primarily for js, but it also works for py. not sure if there is anything better for py

earnest phoenix
#

Anyone?

plucky harness
#

alright ty ill go look into it

#

thanks!

digital ibex
#

okiedoke

quartz kindle
#

@digital ibex move up the app.use(static) line to be the first "app.use". there are some posts saying that static should always be the first thing to be loaded

summer torrent
#

docker blobthinking @quartz kindle

tulip ledge
#

I have this json file with monsters and every monster has a level but I want to get every monster that is the same level as the player or 1 level higher how do I do that?

digital ibex
#

okiedoke

tight plinth
#

there are many process managers out there, for example pm2 which is primarily for js, but it also works for py. not sure if there is anything better for py
@quartz kindle pm2 works for everything, not only js or py

pale vessel
#

he didn't imply it only works for those

#

the user was using py

#

that's why he mentioned python

earnest phoenix
#

Anyone?

#

Ok, nvm

dapper compass
#

Hello,
I'm working with discord.py
Is there a method to take Hours arguments for a function ?
I have a function that make a substraction between two hours (eg. 03h26 - 21h35), but I don't know how my bot can catch the hours from the command, anyone can help ?

I'm trying to do it with regex but I'm not understanding the process..

async def(self, ctx, hour : [00-23]h[00-59]):```
quartz kindle
#

you need to convert both to a uniform value for example seconds or miliseconds, then apply the subtraction, then convert them back to hours and minutes

digital ibex
#

its just loading again

dapper compass
#

Yeaa @quartz kindle the substraction insn't the problem, but how my command can catch hours ?

clever tree
#

Could someone help me pls ? It returns undefined. But ServerMusicQueue.songs returns all the songs in the queue.

var ServerMusicQueue = queue.get(message.guild.id);

        var queuestandartminutes = 0;

        var queueduration = ServerMusicQueue.songs.forEach(song => {
            Math.floor(queuestandartminutes + song.duration.minutes)
        });
quartz kindle
#

@digital ibex send something in your .get("*") route

#

can be simply a 404

#

but all routes have to send something back

earnest phoenix
#

guys neeed help

quartz kindle
#

@dapper compass there are many different ways to format hours, so there is no one-liner to do it all

earnest phoenix
#

how i can run a .bat file on linux

#

sad

#

i am working on lavalink

digital ibex
#

o ok

earnest phoenix
#

and i cant start the .bat file

quartz kindle
#

linux doesnt understand batch files

earnest phoenix
#

yes

#

sad

quartz kindle
#

they are windows files

earnest phoenix
#

:((

#

yes

#

i tried to use wine

#

but notwoking

quartz kindle
#

linux uses .sh files aka shell script

dapper compass
#

@dapper compass there are many different ways to format hours, so there is no one-liner to do it all
@quartz kindle Yea, i'm searching with regex right now, taking hours by strings and dividing them into hours / minutes

earnest phoenix
#

so can i replace .bat with .sh

#

?

quartz kindle
#

no

earnest phoenix
#

sad

quartz kindle
#

you need to rewrite the entire file in shell script

tulip ledge
#
            let viablemonsters = [];
            let monsters = Object.keys(monsterfile);
            console.log(monsters)
            console.log()
            for (let i = 0; i < monsters.length; i++) {
                console.log(monsters[i].level)
                if(monsterfile[monsters[i]].level === 1 || 1 + 1) viablemonsters.splice(-1, 0, monsters[i])
                console.log(monsters[i])
                
            }

I can't seem to get the level integer saved in the json file: "monsterfile"

earnest phoenix
#

😫

quartz kindle
#

what does your bat file do?

earnest phoenix
#
java -jar lavalink.jar
#

this only

#

to start a .jar file

quartz kindle
#

lmao

#

then it should be literally the same thing in shell script lol

earnest phoenix
#

wut

#

rly

#

lol

#

wait

#

what is the .js .bat . . .. bla in shell script

digital ibex
#

it loaded

quartz kindle
#

.sh

earnest phoenix
#

ok

#
java -jar lavalink.jar
PAUSE
#

what it will be the PAUSE

quartz kindle
#

PAUSE is not shell script

earnest phoenix
#

so

#

break

#

?

#

dude i dont know the shell script

tulip ledge
#

anyone knows my issue?

digital ibex
#

thank you so much @quartz kindle 😄

#

it works :)

earnest phoenix
#

input

sudo ./*.sh

output

sudo: ./start_bot.sh: command not found
quartz kindle
#

whats your file name?

earnest phoenix
#

start_bot.sh

quartz kindle
#

just run ./start_bot

earnest phoenix
#

ok

digital ibex
#

wait uhhh, the original problem was the button not working, and uh, its not working

quartz kindle
#

go back to the network tab

#

what does it show now

earnest phoenix
tulip ledge
#

anyone can help me?

honest perch
#

maybe state your problem?

digital ibex
#

thats the network tab

tulip ledge
#
            let viablemonsters = [];
            let monsters = Object.keys(monsterfile);
            console.log(monsters)
            console.log()
            for (let i = 0; i < monsters.length; i++) {
                console.log(monsters[i].level)
                if(monsterfile[monsters[i]].level === 1 || 1 + 1) viablemonsters.splice(-1, 0, monsters[i])
                console.log(monsters[i])
                
            }

I can't seem to get the level integer saved in the json file: "monsterfile"
@tulip ledge

#

I need to get the level key from the json file

earnest phoenix
#

ok

quartz kindle
#

@digital ibex so you have 2 files? btn.js and index.js?

tulip ledge
#

But I tried alot of different things and none work

earnest phoenix
quartz kindle
#

@earnest phoenix run ls

digital ibex
#

yeah, i put the button code into btn.js when when i was waiting,

quartz kindle
#

do you see your start_bot file?

earnest phoenix
#

wait

#

should i chmod +x ./start_bot

#

?

quartz kindle
#

@tulip ledge your console.logs are wrong, they are logging monsters[i].level instead of monsterfile[monsters[i]].level

earnest phoenix
#

oh it works

#

:))

tulip ledge
#

TIm it doesn't work either

earnest phoenix
#

@quartz kindle what is the PAUSE in shell script

#

pls tell me

tulip ledge
#

Since I have 3 entries in the file a level 1, 2 and 3 but the level 3 shouldn't be put in the array I'm making but it still is

quartz kindle
#

there is sleep but idk about pause

#

why do you need to pause it?

earnest phoenix
#

oh

#

pasue

#

wait

quartz kindle
#

@tulip ledge your if is also wrong

tulip ledge
#

oh

earnest phoenix
#

but not working

digital ibex
#

tim, any ideas?

quartz kindle
#

@tulip ledge ```js
if(level === 1 || level === 2)

tulip ledge
#

no

#

But

quartz kindle
#

otherwise 1+1=2 which is true

earnest phoenix
tulip ledge
#

Its a placeholder rn

#

Its needs to be

mystic violet
#

Anyone know how I could create a channel in a specific category?

tulip ledge
#

level === userlevel || level === userlevel + 1

earnest phoenix
#

i mean this

tulip ledge
#

Oh

#

I noticed

#

I'm stupid

#

Sorry lol

quartz kindle
#

@earnest phoenix your lavalink.jar file is with capital L

earnest phoenix
#

:0

#

thx

#

it works

quartz kindle
#

@digital ibex any errors in the console tab?

digital ibex
#

none

quartz kindle
#

reload the page with the console tab open

digital ibex
#

kk

quartz kindle
#

do you still have that console.log(button) from before in your js files?

digital ibex
#

yeah

#

nothing logs & still no errors

quartz kindle
#

go to network tab and click on the js file and click on response

#

wait what

digital ibex
#

i have that outside of the event

#

so im guessing the file loads

tulip ledge
#

So now I have this problem I have no idea how to start with.
So I have the same json file and every monster has it's own chance: 25, 30, 50 (these are percentages)
Now they might not add up to 100% and I need to get a random one of them depending on the chances.
Any idea how I would do this?

digital ibex
quartz kindle
#

wait so it does work

#

why do you have your console split into categories like that?

digital ibex
#

thats operas console

#

it works in the console, not in the code

quartz kindle
digital ibex
#

kk

quartz kindle
#

and always use that one

#

so you can see all logs

earnest phoenix
#

anyone could tell me what the nodes : [] in config.json file looks like

#

for lavalink

digital ibex
quartz kindle
#

and clicking still does nothing?

digital ibex
#

nothing, unless i do it in the console then it works otherwise it doesn't

raven urchin
#

Working but shows the error still

digital ibex
#

oh boy

#

im stupid

#

sorry tim, it works

earnest phoenix
#

@raven urchin bro you are the best programmer in the world. Programming a Bot in a phone

raven urchin
#

...

earnest phoenix
#

i cant do that

#

bro

tulip ledge
#

Anyone knows how to fix my problem?

quartz kindle
#

@raven urchin you still have things trying to use the same port. look in your code all lines that have 3000 or process.env.PORT

raven urchin
#

I have that in uptime.js to keep my code up

quartz kindle
#

you cannot use the same port more than once across your entire project

#

not only per file

#

all code that uses some kind of webserver and ports should be put in the same file and use the same webserver instance

digital ibex
#

hey tim, quick question

tulip ledge
#

no one knows how to do it?

digital ibex
#

atm the users guilds displays one and then new line one new line one etc, how can i make it do one two new line one two new line?

#

like

#

rn^^ i want two on each column, any idea how i can do thta?

quartz kindle
#

there are many ways to do it@tulip ledge for example, sum all percentages into a total percentage, generate a random number between 0 and the total, then loop over the percentages until you find one that fits the random number

tulip ledge
#

alright thank you

quartz kindle
#

@digital ibex are you using flexbox?

digital ibex
quartz kindle
#

never used bulma so idk

digital ibex
#

o okie

summer torrent
#

how can I check message/second ? Is there any best way to do this?

hasty sparrow
#

@digital ibex Use bulma columns

digital ibex
#

yeah, thats what im using atm

#

this is my code: html <div class="container"> <div class="columns"> <div class="column"> <a href="guilds/<%= guild.id %>"> <img src="https://cdn.discordapp.com/icons/<%=guild.id%>/<%=guild.icon%>.png"> </a> <p class="bd-notification"><%= guild.name %></p> </div> </div>

#

but if i add another column its going to show the same server twice

hasty sparrow
#

Why would it show the same guild twice?

digital ibex
#

because im adding another column

hasty sparrow
#

Are you using that entire markup block when looping over the guilds?

digital ibex
#

yes

#

ik i need to use a for loop but idk how it needs to look

hasty sparrow
digital ibex
#

yeah

#

thats was what i was following

hasty sparrow
#

Loop over the columns, not the container

digital ibex
#

how tho

#

thats the bit confusing me

hasty sparrow
#

The same way you are doing it now, just without .container and .columns

digital ibex
#

wdym

#
<div class="container">
   <div class="columns">
      <div class="column">
         <a href="guilds/<%= guild.id %>">
         <img src="https://cdn.discordapp.com/icons/<%=guild.id%>/<%=guild.icon%>.png">
      </a>
      <p class="bd-notification"><%= guild.name %></p>
      </div>
<div class="column">
         <a href="guilds/<%= guild.id %>">
         <img src="https://cdn.discordapp.com/icons/<%=guild.id%>/<%=guild.icon%>.png">
      </a>
      <p class="bd-notification"><%= guild.name %></p>
      </div>
</div>``` u saying like that?
hasty sparrow
#

Show your loop

digital ibex
#

ik its not a loop but thats all i could thknk f

#

kk

#
user.guilds.forEach((guild) => {
}
#

thats all it is, the whole thing actually is just js <% user.guilds.filter((e) => e).forEach((guild) => { %> <%- include('dash/guilds', { guild }) %> <% }) %>

#

don't mind the .filter((e) => e)

hasty sparrow
#

There we go

#

Move the container and columns divs from the dash/guilds template to the one containing that template loop

digital ibex
#

kk

#

done

hasty sparrow
#

What you currently have: For each guild, add container, columns and the column
What you want: For each guild, add a column

digital ibex
#

huh

#

i've already added a column