#development

1 messages ยท Page 1407 of 1

amber thistle
#

i tested the webhook

cerulean jetty
#

Like

amber thistle
#

it logged that

quartz kindle
#

you need to enable a web dyno

static marsh
#

I don't understand you, I use a bot to catch Pokemon, but for some reason I have numbers instead of emojis

cerulean jetty
#

Stop

#

mute him

amber thistle
earnest phoenix
#

Don't spam

quartz kindle
#

what the fuck

earnest phoenix
#

Tim i have another problem! when i do the "!start" command it says "TypeError: Cannot read property 'send' of undefined"

cerulean jetty
#

Some help for me?

earnest phoenix
#

do u know why?

quartz kindle
#

you did something wrong in your code

#

show your code

earnest phoenix
#

Anyone know to to setup top.gg vote webhook to heroku

quartz kindle
#

there should be an option for "dynos" and a toggle to switch a "web dyno" on or off

earnest phoenix
amber thistle
#

web npm start

#

theres that button ^

quartz kindle
sudden geyser
#

why do you have an extra else there

amber thistle
#

but i dont think its the web dyno thingy

earnest phoenix
amber thistle
#

oh god the syntax errors

earnest phoenix
#

can help to solve?

#

i want to finish

#

@quartz kindle

amber thistle
#

ur return

earnest phoenix
#

does someone help me?

amber thistle
#

put it in the same line as if(message.author.bot)

amber thistle
earnest phoenix
#

๐Ÿ˜ฆ

#

no one help me

#

Done thaks

#

TypeError: Cannot read property 'send' of undefined

quartz kindle
earnest phoenix
#

still says it

amber thistle
#

aight

quartz kindle
#

instead of channel

earnest phoenix
#

thanks

zenith knoll
#

(node:11) Warning: Accessing non-existent property 'Message' of module exports inside circular dependency

#

uh

earnest phoenix
#

It says erooor

#

Oof

quartz kindle
earnest phoenix
#

How to solve?

#

Ohk web dyno

amber thistle
#

:}

zenith knoll
#

u put a }

#

after toLowerCase()

amber thistle
#

u remove the }

zenith knoll
#

line 20\

quartz kindle
zenith knoll
#

(node:11) Warning: Accessing non-existent property 'Message' of module exports inside circular dependency
uh the error only pops into consol,e on my host, on my pc it wont have the error

#

idk if its important

quartz kindle
zenith knoll
#

but msgs are very used in bots so idk if i needa fix quick

zenith knoll
#

thats syntax which is ez to fix so like its not something to like reinstall djs right

earnest phoenix
amber thistle
#

ok aperantly that web dyno runs the npm start <file> script,how do i change it to the web dyno that u mentioned?

solemn latch
#

Those errors need to be solved too.

earnest phoenix
#

Whats the difference between them

quartz kindle
earnest phoenix
#

pls someone help that

#

Worker i know it helps in keep app online

zenith knoll
earnest phoenix
#

But what is web?

weary ridge
#

So i need sum help with Js/Ejs and here is what i need help with.
Alright so on profile.js, I am trying to get example req.user.username into my ejs file so i have done

router.get('/', isAuthorized, (req, res) => {
res.render('profile', {
username: req.user.username,
email: req.user.email
});
});

And on the profile.ejs file I have done the following:
<%= username %>

So that way I would be able to display the users name on my html.
But every time I put <%= username %> in the ejs I don't see the username on the http://localhost:1000/profile and no errors.

All Images Below.

https://cdn.discordapp.com/attachments/730797139604668486/780801165482262539/unknown.png

https://cdn.discordapp.com/attachments/730797139604668486/780801480579350528/unknown.png

https://cdn.discordapp.com/attachments/730797139604668486/780802044453191720/unknown.png

quartz kindle
#

web runs a webserver where you can receive requests

earnest phoenix
#

Ohh thanks

zenith knoll
#

@solemn latch sorry for ping but can u elaborate if ur helping me on that msg

#

if not sry

solemn latch
#

Tim responded to it i believe

#

Hes better with exports.

zenith knoll
#

where do i find the error? is it in index file

#

or in a command file

earnest phoenix
#

๐Ÿ‘€

#

see your triminal

zenith knoll
#

because all my other bots dont have the error

quartz kindle
zenith knoll
#

and it looks the same

quartz kindle
#

do you have exports in your index file?

zenith knoll
#

okay,

#

no

#

unless you count command.execute

quartz kindle
#

wut

#

you have module.exports in command.execute?

zenith knoll
#

no like

#

in command files i have module.exports

#

but in every file i have require()

quartz kindle
#

ah ok

#

are you accidentally requiring in a circle?

#

require file A which requires file B which requires file A

zenith knoll
#

any examples?

#

I mean, my files all require fs, djs, 2 json files

#

but index has like

#

other collections

quartz kindle
#
// file A.js
require("./B.js");

// file B.js
require("./A.js")
zenith knoll
#

wdym

#

sorry

quartz kindle
#

if one of your files requires another one of your files

#

and that other file, requires the same file again

zenith knoll
#

keep in mind that the error only cvomes on my host

#

if i run it on my pc it wont occur

#

or it wont log it

#

its the same code ('shjould be, i tranfered it like 30 mins ago')

quartz kindle
#

did you transfer the node_modules folder?

zenith knoll
#

yep

quartz kindle
#

dont

zenith knoll
#

uh

quartz kindle
#

node_modules should never be transfered

zenith knoll
#

well before i did it was an empty directory

#

so i cant run the bot like that,,,

#

unless it has built in feature to instlal things from package.lock?

cinder patio
#

npm i...

zenith knoll
#

i cannot send cmds in the host console lol

quartz kindle
#

you should transfer package.json, then run npm install in the host

zenith knoll
#

wait i think i can

#

sorry

#

im dumb

#

im supprised only thar bot has the error then

#

cause ive always tranfered the node modules and my other bot is fine

solemn latch
#

Its a bad practice, especially when changing OS

quartz kindle
#

it doesnt necessarily cause problems, but it opens up a lot of opportunities for problems to occur

zenith knoll
#

shoot yea the host is on linux or sum yea

quartz kindle
#

if you have a native module like sqlite, it will crash if you move it to a different OS

earnest phoenix
#

@quartz kindle hey sry for ping if i enable both web and worker it sends message double

zenith knoll
#

i use json for storage AND BEFORE i get bombarded with ppl sayin its corruptible the bot is small so no one uses it anyway

earnest phoenix
#

pls help

#

idk what to do

solemn latch
#

You closed your { on the line before it

quartz kindle
zenith knoll
#

yes

quartz kindle
#

why do you keep adding these

#

lol

zenith knoll
#

idk but did he set his linter to do that or sum extension

earnest phoenix
#

Tim if i enable web and worker it sends message double

cinder patio
#

No, the IDE expects a ), not a const statement

zenith knoll
#
[..................] / rollbackFailedOptional: verb npm-session 017a8967a25b61d [ ................] | loadDep:ws: sill install loadAllDepsIntoIdealTree [ ...........] \ postinstall: sill install executeActions [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ...........] / extract:fs: verb lock using /home/container/.npm/_locks/ [ ..........] / extract:mime-types: http fetch GET 200 https://registry. [ ......] / extract:tweetnacl: sill extract tweetnacl@1.0.3 extracte [ ......] / extract:tweetnacl: sill extract tweetnacl@1.0.3 extracte [ ......] - extract:discord.js: sill extract discord.js@12.4.1 extra [ ......] - extract:discord.js: sill extract discord.js@12.4.1 extra [ ......] - extract:discord.js: sill extract discord.js@12.4.1 extra [ ......] \ refresh-package-json:fs: timing action:finalize Complete npm WARN OXYGENSecurity@1.0.0 No description
npm WARN OXYGENSecurity@1.0.0 No repository field.
added 16 packages from 17 contributors and audited 16 packages in 0.844s
found 0 vulnerabilities
[WitherHosting] Server marked as OFF
[ .....] - prepare:container: sill install printInstalled
 Server marked as ON
 ---------- Detected server process in a crashed state! ----------
 Exit Code: 0
 Out of Memory: false
Error Response:
 Server process detected as entering a crashed state; rebooting.```
#

when i do npm i

#

for host

quartz kindle
zenith knoll
#

shoot do i needa delete package.lock?

earnest phoenix
#

@amber thistle your webhook works

#

?

quartz kindle
#

it turned off after it finished installing

zenith knoll
#

o ok

#

why in a crashed state lol

#

and can i delete the .npm and .config folders

quartz kindle
#

i guess

zenith knoll
#

oki thx

earnest phoenix
#

I deleted my code

quartz kindle
#

lol ok

earnest phoenix
#

I did it tomorow

zenith knoll
#

sorry im dumb at coding lol i started coding like 4 months ago and never formally learned i only read docs

quartz kindle
#

dont worry about that, you're doing good

earnest phoenix
#

no prob

solemn latch
#

A lot of issues are just bad practices you learn over time.

earnest phoenix
#

I will did it tomorrow good

#

No err

zenith knoll
#

also are you able to write a bot in a js file linked to a html? like to run a bot linked to a webpage

solemn latch
#

Yeah

zenith knoll
#

so it can do sdtuff based on what a user does on a website

#

cool

quartz kindle
#

technically yes, but its a whole different story

earnest phoenix
#

Anyone? About heroku webhoom

#

Webhook?

quartz kindle
earnest phoenix
zenith knoll
earnest phoenix
#

If i enable both web and worker it sends this

zenith knoll
#

worker as the startup cmd in heroku?

earnest phoenix
#

Yep it keps bot online

zenith knoll
#

not node <entryfile>?

earnest phoenix
#

Tim ^^

zenith knoll
#

thats like

#

really small and kinda blurrry

earnest phoenix
#

Oof wait

zenith knoll
#

do it in landscape mode

earnest phoenix
#

Now?

zenith knoll
#

wait so

quartz kindle
#

what if you disable worker and edit web to node index.js instead of npm start?

earnest phoenix
#

@quartz kindle how to do that cauz its defaulf web npm start

quartz kindle
#

the edit button?

earnest phoenix
#

Ohk

#

need to did it again

#

๐Ÿฅบ

#

Is it kepp bot online?

#

No

#

I turn off

#

When i finish i wrote the on command

#

(node index.js)

zenith knoll
zenith knoll
#

which is like free, paid, or etc

#

i used procfile when i used heroku

earnest phoenix
#

who is the mee6 creator?

#

is on server?

solemn latch
#

Mee6 has a dev team

ivory seal
#

mee6 is a company righ

#

ye

earnest phoenix
#

k

#

In procfile
Web node index.js

#

Like this?

#

yes

#

but without web

earnest phoenix
zenith knoll
#

wat lang is mee6 in

#

it says Other

ivory seal
earnest phoenix
zenith knoll
#

u can do 'MANAGE_PERMISSIONS'

#

iirc

earnest phoenix
#

i start it using that 15 times

#

Vote webhook working but im not sure about bot can stay online!

ivory seal
zenith knoll
#

oop

#

wait

#

its not a permisison in bits right?

#

you needa manually give it per channel

#

or like the bot requires it in invite

solemn latch
#

Hes looking for the bitwise of the permission

ivory seal
#

^

#

like MANAGE_MESSAGES

#

but for permissions

#

i trid manage permissions but nada

solemn latch
#

Yeah I can't seem to find it either

ivory seal
#

that weird

#

i got it

#

its actually MANAGE_ROLES

#

also @solemn latch remember the postman thing not working
it was because i didn['[t have the agent installed and apparently there's a limit without the agent

tired panther
#

IS there way to fetch invites from a another shard, I have the guild id?

#

ping me , when u have a anwser

solemn latch
#

Depends on the library

tired panther
#

discord js djspride

solemn latch
#

You can broadcast eval that.

tired panther
#

okay

solemn latch
crisp geyser
#

If I add this method to String prototype it only works on the file I made the modification, how do I change it in all documents?

String.prototype.getEmojiID = function () {
return this.split(':')[2].split('>')[0];
};```
cinder patio
#

don't attach it to a prototype just make a separate file for it and import it where you need it

#

or have a file full of utility functions

crisp geyser
#

You mean make it like a normal function? Not a prototype method?

cinder patio
#

correct

crisp geyser
#

What if I wanted it in the string prototype?

#

Is it possible to make it?

cinder patio
#

Why do you want it there? I don't think so

crisp geyser
#

Ok thank you man!

leaden lake
#

is it possible to know if 4 values in a row in a list are same ? Like for a connect 4 if 4 values are in a row, we are winner.

Without list all the possibilities (in python)

earnest phoenix
#

I am brasilian, I think it would be better for google cloud which has recommended region

solemn latch
#

I dont like aws.
Their performance per price is meh until you start getting into higher cost VPS's.

earnest phoenix
#

Understand

#

But which of these two do you think better?

solemn latch
pale vessel
#

That is for MongoDB, if you haven't noticed

#

Mongo Cloud or whatever you call it

#

So you should get something that's close to your VPS location

earnest phoenix
#

okok

#

thanks

sterile lantern
#
    if(err) return console.log(err)
    files.forEach(file => {
        if(!file.endsWith('.js')) return
        const event = require(`./events/${file}`)
        const eventName = file.split(".")[0]
        client.on(eventName, event.bind(null, client))
        delete require.cache[require.resolve(`./events/${file}`)]
    })
})```

Keep getting require.resolve is not a function
slender wagon
#

which one would be a good command handler?
do u guys have any suggestion

sterile lantern
#

tbh any cmd handlers are fin

#

e

#

theres a basic one for discord.js

slender wagon
#

u got something for me? idk which one to choose

sterile lantern
#

you can choose one from here

slender wagon
#

ait

sterile lantern
#

anyone know why the error is happening ^^^^

quartz kindle
#

are you running that code in node.js?

sterile lantern
#

yes

quartz kindle
#

which version?

sterile lantern
#

2.6

#

wait no thats fetch

#

15.3.0

#

well it still doesnt work sadly

quartz kindle
#

what does console.log(require.resolve) show?

pure lion
#

How install serenity

earnest phoenix
#

i suggest using the lts build

#

for node ^

pure lion
#

Por rust

sterile lantern
quartz kindle
#

can you show the full file?

sterile lantern
#
const Discord = require('discord.js');
const Config = require('./config.json');
const fs = require('fs');


const TOKEN = Config.token;
const PREFIX = Config.prefix;
const client = new Discord.Client()


client.commands = new Discord.Collection()
client.cooldowns = new Discord.Collection()

const commandFiles = fs.readdirSync('./commands').filter(f => f.endsWith('.js'))
    for(const file of commandFiles) {
        const command = require(`./commands/${file}`)
        client.commands.set(command.name, command)
    }
fs.readdir('./events/', (err, files) => {
    if(err) return console.log(err)
    files.forEach(file => {
        if(!file.endsWith('.js')) return
        const event = require(`./events/${file}`)
        const eventName = file.split(".")[0]
        client.on(eventName, event.bind(null, client))
         console.log(require.resolve)
        delete require.cache[require.resolve(`./events/${file}`)]
      
    })
})
client.login(TOKEN)

quartz kindle
#

and you just run that file with node filename.js?

sterile lantern
#

yes

#

idk why i get require.resolve isnt a function

quartz kindle
#

how about console.log(process.version, require.resolve.toString())

sterile lantern
#

TypeError: Cannot read property 'toString' of undefined

quartz kindle
#

then require.toString()

sterile lantern
#

``` delete require.cache[require.resolve(./events/${file})]
^

TypeError: require.resolve is not a function```

#

same error

quartz kindle
#

but what does the console show

sterile lantern
#

that

#

thats all

quartz kindle
#

it should log something before that

sterile lantern
#

oh

#

v12.18.3 function () { [native code] }

quartz kindle
#

your node version is v12 not v15?

sterile lantern
#

huh

#

in my package it is v15

rigid raven
#

Hi! My bot (developed using discord.py) is not answering commands if other bot send it (but it does when a user send the command). How can I let the bot answer to other bot text? I defined the commands using the @client.command() decorator

quartz kindle
#

where are you hosting?

sterile lantern
#

repl

quartz kindle
#

replit does not allow you to change node version

sterile lantern
#

oh oof

quartz kindle
#

when you created your project, did you select node.js as the project type?

sterile lantern
#

yes

#

so would this not work in repl

#

or is there a workaround for it

rigid raven
sterile lantern
#

i think it's because you have a return function if the user is defined as a bot

#

so it ignores the command if the user is a bot

quartz kindle
#

repl.it is doing something weird with their node.js version

sterile lantern
#

hm well

#

is there any other way i can

#

call the events without that function

#

its basically a message event so it detects a cmd

molten yarrow
#

you can try without the delete line

quartz kindle
#

repl.it doesnt seem to support require.cache either

sterile lantern
#
                                   ^

TypeError: event.bind is not a function```
#

doesnt have event.bind

#

either

#

this is sad

#

well couldnt i just replace that block of code with my msg.js

#

but it errors if i do that

#

well i did put my msg.js in my index

#

but

#

now its not responding to cmds

#

any reason why?

#
module.exports = (client, message) => {
  const commandFiles = fs.readdirSync('./commands').filter(f => f.endsWith('.js'))
    for(const file of commandFiles) {
        const command = require(`./commands/${file}`)
        client.commands.set(command.name, command)
    }
    if(!message.content.startsWith(PREFIX)) return
    if(message.author.bot) return
    if(message.channel.type == 'dm') return

    const args = message.content.substring(PREFIX.length).split(" ")

    const command = client.commands.get(args[0])
        || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(args[0]))

    if(!command) return

    if(!client.cooldowns.has(command.name)){
        client.cooldowns.set(command.name, new Discord.Collection())
    }
    const now = Date.now()
    const timestamps = client.cooldowns.get(command.name)
    const cooldownAmount = (command.cooldown || 0) * 1000

    if(timestamps.has(message.author.id)){
        const expirationDate = timestamps.get(message.author.id) + cooldownAmount

        if(now < expirationDate){
            const timeLeft = (expirationDate - now) / 1000
            return message.channel.send(`Please wait ${timeLeft.toFixed(1)} before reusing the ${command.name} command`)
        }
    }

    timestamps.set(message.author.id, now)
    setTimeout(() => timestamps.delete(message.author.id), cooldownAmount)

    try{
        command.execute(message, args, client)
    }catch (error){
        console.log(error)
        return message.channel.send("There was an error executing this command. Please contact a staff member if you believe this is a bug.")
    }
}
client.login(TOKEN)
module.exports = (client) => {
    console.log(`Logged in as ${client.user.tag}!`)
}
delicate shore
#
const giveMeAJoke = require("discord-jokes");

module.exports = {
    cnjoke: function cnjoke() {
        try {
            giveMeAJoke.getRandomCNJoke(function (jokee) {
                return jokee;
            })
        } catch (err) {
            throw new Error("An error occurred , error: " + err);
        }
    }
}```
#

My code is this

#

but problem is

#

it returns undefined

#

Can we not have a func in a func

cinder patio
#

Nope. You should return a promise

return new Promise(resolve => {
   // inside the function, do (resolve(jokee)
};
rigid raven
# sterile lantern so it ignores the command if the user is a bot

hmmm I checked it anyway but nope.
Thanks anyway. We was trying to use a tester bot to test our bot, but at least we will test using the traditional way hahaha

        logging.info("Reading bot config data")
        intents = discord.Intents.all()
        self.client = discord_commands.Bot(os.getenv('DISCORD_PREFIX'), guild_subscriptions=True, intents=intents)
        self.token = os.getenv('DISCORD_TOKEN')
        self.index = 0
        self.client.remove_command('help')
        logging.info("Reading bot functions")
        @self.client.command()
        async def help(ctx):
...

If someone have any idea it will be appreciated โค๏ธ

delicate shore
cinder patio
#

cnjoke

delicate shore
#

oh

#

in which part I mean

#

Like after the inner func

#

or in the inner func

delicate shore
cinder patio
#

The cnjoke function should return a promise

#

containing jokee

delicate shore
#

ok

static marsh
#

Can anyone help me please ๐Ÿฅบ

delicate shore
#

dont ask to ask

static marsh
#

I use a bot to catch Pokemons, but for some reason I have numbers instead of emojis

#

Like this

#

Pleaseee, help me๐Ÿ™

quartz kindle
#

is your bot in the same server as the emojis?

#

does your bot have "use external emojis" permission?

delicate shore
#

It must not be having permission

rose warren
#

When the joke api is a joke TrollFace

delicate shore
#

Kek

static marsh
#

But I can see emoji in my PC

#

In that server only I have this problem

umbral zealot
#

@static marsh you were already told very clearly that you cannot show emojis inside codeblocks.

#

Asking again does not change that answer.

delicate shore
#

Oh yeah

mellow jewel
#

How can I style only the Invite button.
I cant find the selector

static marsh
#

I don't understand what is codeblocks

umbral zealot
#

And for reference: ` is the codeblock

#

this is code

#

you cannot have emojis inside code. Or mentions. Or anything, really, it's meant to show code.

#

If you want emojis to show, remove the backticks (`) around the text.

delicate shore
#

Evie your pfp is correct representation of work you do while reviewing bots XD

umbral zealot
#

Well, no, it's the correct representation of me having to show people things that should be relatively clear ๐Ÿ˜‚

#

aka "schooling noobs" (not here, specifically, but overall on Discord, Facebook, and at work)

delicate shore
#

I see what you did there

#

๐Ÿคฃ

umbral zealot
#

I often refer to the concept of "mashing away at the keyboard" so I love that avatar for that ๐Ÿ˜›

delicate shore
#

๐Ÿ˜

static marsh
umbral zealot
#

uhm, remove them from the embed code?

static marsh
#

....okay

#

Thanks for the information

stark abyss
#

I am not getting any help from the other react server and it's been over 15 hours so ๐Ÿ˜”

umbral zealot
#

Try the reactiflux server

#

best server to get help on react things. ๐Ÿ™‚

stark abyss
#

yes I tried that

#

๐Ÿ™

#

I don't understand why isn't anyone helping I am just tryna learn this stuff and it's probably very easy for them ๐Ÿ˜”

umbral zealot
#

You're asking a specific question that would require someone to have more knowledge of react native than yourself. This, particularly, is a guild where you will not get a whole lotta people with that knowledge.

pure lion
#

Can rust use .env files and if so, how?

sudden geyser
#

yes

#

If you have a .env file in the root project of your directory, you need to use the dotenv crate.

#

You can use the env!() macro to get the environment variable's value, but it'll cause a panic if it doesn't exist.

sonic copper
#

Hey friends! So, I'm trying to add the "total users" thing to my bot and I used to have it working. But now, I can't seem to figure it out for the life of me. I could do the client.users.cache.size but then it would look weird in servers that are inactive.
"100 servers"
"60 users" type of thing.

I can't seem to figure out how to fetch all the members.

It's been a long time since I've done any actual work to my bot so I'm a bit rusty. whoops.

I'm heading to work though, so if anyone has an answer, ping me ๐Ÿ™‚

sudden geyser
pure lion
#

Yeah I'm using env::var

#

Just got confused when my env file was readn't

umbral zealot
#

If you're talking about some client plugin, don't. This is against the terms of service, and you will not receive help for this on this guild, as we follow the terms of service and the discord community guidelines.

sudden geyser
#

@sonic copper you'll need to iterate over guild and add up the guild's .memberCount

#

You can use the .reduce method on <Client>.guilds.cache to add up the total.

delicate shore
#
const giveMeAJoke = require("discord-jokes");

module.exports = {
    cnjoke: function cnjoke() {
        try {
            giveMeAJoke.getRandomCNJoke(function (jokee) {
                return new Promise(resolve  => {
                    resolve(jokee)
                })
            })
        } catch (err) {
            throw new Error("An error occurred , error: " + err);
        }
    }
}
#

Don't laugh at me

#

What am I doing wrong just guide peacefully no violence or abusive language
Thanks and take care

#

This code returns me a undefined

#

But it should return the joke

cinder patio
#

The cnjoke should return the promise not the callback to the other function

hollow sedge
#

bruh are you seriously using a package to get jokes

delicate shore
#

Yes

pure lion
#

how do i install crates without it throwing the no binaries found err? I edit my cargo.toml and i get the intellisense but when compiling i get a can't find crate error

sudden geyser
#

@pure lion can you show the error message

dull blade
#

Search the crate first ig

#

Btw how do u interact with discord api on rust

sudden geyser
#

Most developers will use the serenity library.

dull blade
#

Well I mean is there any other way ?

#

I wanted to try use api with no crates but I'm so stupid to do it

sudden geyser
#

Yes, you could write your own API around it.

#

Though you probably won't use no crates

#

For example, hyper for HTTP requests.

pure lion
dull blade
#

Yeah

#

I mean without using crates that interact with the discord api

rose warren
#

If a bot adds roles to a user upon joining a server, doesn't it show in the audit logs? The reason I ask is because I have the Patreon bot on my server and when people link Discord to their Patreon account before joining, then join my support server, it doesn't show Patreon bot adding roles in the server audit logs. It also doesn't show up any sort of roles being added in mod logs through bots like YAGPDB or Probot, yet the user has the roles. How is that achieved? On the GuildMemberAdd event?

umbral zealot
#

It should show, but that's more of a Discord issue than a programming one, tbh.

rose warren
#

Yeah. Basically, I have my own bot that checks if a guild member gets updated with any of the patreon roles and if so it adds them to the db as a Patron and unlocks the patreon features automatically. It doesn't work if the user links Patreon before joining the server though. So I guess I need to add similar code to GuildMemberAdd event on my bot?

pure lion
#

is there any way i could make my main fn async?

rose warren
#

I'm just wondering, can I even check if the user has roles in the guildMemberAdd event on my bot if the Patreon bot is adding roles in the same event ๐Ÿค”

earnest phoenix
#

if the member just joined, they won't have any roles

#

everyone gets the same member object in the event

rose warren
#

Well according to Discord that isn't true since it doesn't show the member getting modified. My question is if a bot assigns roles in the guildMemberAdd event, can another bot check for those roles in their guildMemberAdd event?

umbral zealot
#

Not unless you wait a bit and get the member again from cache

rose warren
#

Yeah I was thinking of that.

#

Probably the easiest option

#

But I can put that in the guildMemberAdd event right?

cinder patio
#

yeah I don't think you even have to get the member again from the cache

rose warren
#

Don't want to run a cron type function or anything

cinder patio
#

you can use a setTimeout

rose warren
#

Yeah that's what I was hoping to do

#

But if I do setTimeout in the guildMemberAdd event it should work right?

cinder patio
#

yeah why wouldn't it work

#

You can also save when the user joined in a map or somewhere else, and listen to the memberUpdate event (I think it's called something else) and see if they get a role in X milliseconds

summer acorn
#

my mongodb completely broke earlier today, but sadly I can't completely uninstall it because I have no backups of the data it holds.
I am only getting the errors in the screenshot below, and I've been trying to fix this for the past 8 hours, reinstalling, restarting the VPS, doing literally everything possible, nothing is working, nothing I've done is able to fix it.

cinder patio
#

But setTimeout is the easier approach

rose warren
#

Yeah I'll go with setTimeout

#

Just weird it doesn't show in audit logs ๐Ÿ‘€

dull blade
#

Hmm

pure lion
#
    let env_token : Result<String, env::VarError> = env::var("CLIENT_TOKEN");
```how could i parse this to a string so i can use it as a client token?
#

nvm

sudden geyser
#

You could use pattern matching (if let Some(t) = t {...}), unwraping (.unwrap(), will cause a panic if it doesn't exist), .expect, etc.

#

legit one second

pure lion
#

i did .expect

#

also now im having an async issue, i made an async func and called it in main but it says it requires .await or .poll and poll looks ehhh-

sudden geyser
#

If you're using tokio you can annotate the main function with the #[tokio::main] attribute. Then you can mark the main function as async (async fn main() {...})

pure lion
#

would i need to install tokio?

sudden geyser
#

yeah

pure lion
#

sic

sudden geyser
#

a lot of crates (and I think serenity too) already use it so it won't be much of a toll

pure lion
#

i was confused before; i tried to use tokio::main and it looked like it was already installed but ig not afgadsga

#

hm

#

hmmmmm

#

oooo

#

i can specify a version

#

ok that's useful

leaden lake
#

is it possible to have a list value position ? like I have a value at a list position named grille[0][3] and I would like to have it as a grille[x][y+3]
python language

pure lion
#

@leaden lake you'd need a 2 dimensional array

leaden lake
#

I got it

#

@pure lion

pure lion
#

hmmmm

#

@sudden geyser sorry for ping but im so confused-

sonic lodge
#

add a main function?

pure lion
#

fn main()

#

there already is one

#

nvm i dum

queen crescent
#

how can i make the manage button inline with Server 1 but keep it floated right? heres the css:

pure lion
#

use a flex box and some padding

queen crescent
#

im not a frontend dev so uh

quartz kindle
#

a quick fix would be setting both the button and the server 1 to vertical-align:middle

queen crescent
#

@quartz kindle that didnt make a difference

quartz kindle
#

make them both inline-block

queen crescent
#

removing the float right?

#

because they're inline until i add float right

quartz kindle
#

default should be display:block

#

display:inline-block will enable vertical align to work

queen crescent
quartz kindle
#

does the vertical align stop working if you add the float back?

queen crescent
#

well ii cant have float and display inline-block

quartz kindle
#

well another option would be to use float and manually center it with padding

earnest phoenix
#

flex-grow

quartz kindle
#

or just change everything to flexbox

earnest phoenix
#

^

quartz kindle
#

or have 2 container divs with width 50% and set them to text-align left and right

#

xD

#

or make everything text-align center and then separate them with % margins

#

the possibilities are endless

strong tundra
#

cani see the top of your main function @pure lion

#

and what serenity version are you using

pure lion
#

@strong tundra i fixed it

strong tundra
#

oh lol

pure lion
#

i am 100% an idiot

#

also what does & do

strong tundra
#

hmm not sure

pure lion
#

it un-warnified my thingy

#

ah

strong tundra
#

ohh

pure lion
#

oh it works

strong tundra
#

it passes a ref to the object you put the ampersand on

pure lion
#

so &String makes it str

strong tundra
#

yeah

pure lion
#

this is so cool

#

i love it

pure lion
#

ah gotcha

#

hmm

#

i wanna exit with code 0 how i do?

sudden geyser
#

Use std::process::exit(code)

pure lion
#

ah

sudden geyser
#

yeah you need to fix that

#

I had that issue a while back but forgot how I fixed it

#

can you show your main file

pure lion
#

alrighty

#
extern crate serenity;
extern crate dotenv;

use serenity::prelude::*;
use serenity::model::prelude::*;
use serenity::Client;
use serenity::framework::standard::{
    StandardFramework,
    CommandResult,
    macros::{
        command,
        group
    }
};

use std::env;

struct Handler;
struct General;

impl EventHandler for Handler {}

#[tokio::main]
async fn main() {
    dotenv::dotenv().ok();
    start_client().await;
    std::process::exit(0);
}

async fn start_client() {
    let token  = env::var("CLIENT_TOKEN").expect("token");
    let prefix = env::var("PREFIX").expect("prefix");
    let framework = StandardFramework::new().configure(|c| c.prefix(&prefix));

    println!("{}", &prefix);
    println!("{}", &token );

    let mut client = Client::builder(token).event_handler(Handler).framework(framework).await.expect("Error creating client");

    if let Err(error) = client.start().await {
        println!("An error has occurred when trying to run the client: {}", error)
    }
}
#

yeah didn't work anyway

#

also is formatting good? uWu

sudden geyser
#

It may be due to serenity requiring tokio's version to be between 0.2.0 and 0.3.0 (exclusive). However, you're probably using the latest version (0.3.4). If you try downgrading to some version like 0.2.23, does it work?

pure lion
#

alright will downgrade

#

runnig

whole knot
#

Hello, so I got a question. Everytime I restart my bot all the reactions do not work anymore. I know for fact that I have to gain access to the json which I created but after a restart the bot is not "opening" the JSON-file. Where did I do something wrong?

wise quartz
#

how do i get a message that someone sent?

#

after he runs a specific command

slender thistle
#

ctx.message?

wise quartz
#

like

slender thistle
#

wait_for("message")?

wise quartz
#

exactly

#

thanks

#

is there any easier ways of using wait_for('message') instead of hard coding it?

slender thistle
#

wdym hardcoding

pure lion
#

variables in the place of the string "message" I'd assume

strong tundra
#

oh yea

#

serenity doesn't work with tokio 3 yet

#

waiting on some deps

wise quartz
#

i'm trying something lets see if it works

hollow sedge
#

for what?

#

what are you checking for @wise quartz

wise quartz
#

wait_for('message')

hollow sedge
#

you're waiting for a message?

#

how is that hardcoding

#

what does that have to do with the ifs

wise quartz
#

thats how my cmd works...?

hollow sedge
#

yes but what are you checking for in your command

wise quartz
#

i give options and wait for the author's msg then check if the msg he sent is a b or c

#

understood?

hollow sedge
#

yeah

wise quartz
#

and then i'd have to redo the same thing over and over for how many times i want

hollow sedge
wise quartz
#

i was wondering if theres a way to have like something that keeps checking the user's msg after each msg the bot sends

#

you get it?

hollow sedge
#

well you might need to rework the command to better fit discord then

wise quartz
#

i am trying to use a loop or smthing

#

sounds dumb but idk

#

lol

hollow sedge
#

yeah you could..

wise quartz
#

a while loop would fit it

hollow sedge
#

why?

#

you dont know how many times you want the author's message?

wise quartz
#

well the way i am using it is

#

if the user responds with a b or c then the loop is over

#

if he responds with something else

#

repeat

#

until he does it correct

hollow sedge
#

yeah

slender thistle
#

...

hollow sedge
#

you can add that into the check function

slender thistle
#

Yeah

wise quartz
#

btw does something like

while True:
    if 1 == 1:
        print("genuis")
        return False
    else:
        return True
``` work?
slender thistle
#

I'd say a while-loop is appropriate here

#

unless you can make on_message work with it

wise quartz
#

nah its a cmd

#

not an event

hollow sedge
#

wait are you for real?

#

what's the point in a while loop

wise quartz
#

maybe?

hollow sedge
#

when this is already built into the library

wise quartz
#

huh?

#

i dont get it

hollow sedge
#

hold on ill send a link

slender thistle
#

Well, it depends, Cloud

#

I'd say it'd be valid if there was some kind of a response for incorrect input

slender thistle
#

Other than that, disregarding everything and letting d.py rely on the check function

#

I'm sorry what

hollow sedge
#

oh that's true

wise quartz
#

btw does something like

while True:
    if 1 == 1:
        print("genuis")
        return False
    else:
        return True
``` work?
slender thistle
#

what does THAT have to do with this case

wise quartz
#

yEs/nO?

slender wagon
#

what does it take to selfhost a mongodb?

wise quartz
#

just wondering

slender thistle
#

It will work

wise quartz
#

alr

#

if it returns True the loop wont break right?

#

aka it'll repeat

hollow sedge
hollow sedge
wise quartz
#
def check(m):
    return m.content = "A"
wait_for('message', check=check)
#

that?

hollow sedge
#

yeah

#

and you can use in with a list too

wise quartz
#

so this will basically wait until the author sends a

#

right?

slender thistle
#

= is assignment

#

Use comparison

wise quartz
#

==*

#

forgot

slender thistle
#

yes

wise quartz
#
return m.content.lower == "A"
slender thistle
#

.lower()

#

and no

wise quartz
#

so i'd need multiple checks for each option?

#

right?

slender thistle
#

m.content.lower() will be a, and comparing it to A will be false

#

Yes

wise quartz
#

return "A" in m.content.lower()

#

?

slender thistle
#

Valid

#

Almost

#

Again

#

A is uppercase

wise quartz
#

does it have to be a

slender thistle
#

you are trying to check if an uppercase character is included in a message where you lower everything

wise quartz
#
await ctx.send("a,b,c")
def check(m):
    return m.content.lower() == "a":
await wait_for('message', check=check)
await ctx.send("You got it finally")
def check(m):
    return m.content.lower() == "b":
await wait_for('message', check=check)
await ctx.send("huh")
def check(m):
    return m.content.lower() == "c":
await wait_for('message', check=check)
await ctx.send("Learn me some code")
#

so thats how i'll use it?

slender thistle
#

brlgh

wise quartz
#

i can use 1 check and use ifs

#

to see if the content is a b or c

#

right?

slender thistle
#

Correc

#

and just use one wait_for on top of that

slender thistle
#

And don't put colon after a return

wise quartz
#

what is a colon?

slender thistle
#

:

wise quartz
#

owh ye

#
Command raised an exception: NameError: name 'wait_for' is not defined
#

do i need to import something?

slender thistle
#

It's attached to your bot object

wise quartz
#

client.wait_for

#

i knew something was missing

#

@slender thistle psst

#

didn't work

slender thistle
#

self.bot.wait_for

wise quartz
#

that self bs

#

alr

#
    @setup.command()
    async def cash(self, ctx):
        await ctx.send("What would you like to manage?\n(``A``) Starting amount\n(``B``) Idk")
        def check(m):
            return m.content.lower() == ['a','b']
        msg = await self.client.wait_for('message', check=check)
        if msg.lower() == "a":
            await ctx.send("How much would you like the starting amount to be?")
            def check(m):
                return m.content.type == int
            msg = await self.client.wait_for('message', check=check)
            await ctx.send(f"Your new starting amount has been set yo {msg}")
        elif msg.lower() == "b":
            await ctx.send("later")
#

soooooooooo....

#

any ideas why that ain't working?

#

i am sure its from the check

#

OHHHH

#

it needs to be in

#
Command raised an exception: AttributeError: 'Message' object has no attribute 'lower'

nice

#

lmao

#
    @setup.command()
    async def cash(self, ctx):
        await ctx.send("What would you like to manage?\n(``A``) Starting amount\n(``B``) Idk")
        def check(m):
            return m.content.lower() in ['a','b']
        msg = await self.client.wait_for('message', check=check)
        if msg == "a":
            await ctx.send("How much would you like the starting amount to be?")
            def check(m):
                return m.content.type == int
            msg = await self.client.wait_for('message', check=check)
            await ctx.send(f"Your new starting amount has been set yo {msg}")
        elif msg == "b":
            await ctx.send("later")
#

seriously now why it doesn't work?

hollow sedge
#

return m.content.type == int???

#

that's not how it works

#

use type(var)

#

or isinstance

wise quartz
#

idk i tried

#

but its not even sending the msg before the second check

pure lion
#

@hollow sedge m.content will always return a string

#

If I'm nkt mistaken

wise quartz
#

makes sense tbh

pure lion
#

@wise quartz you need to use a try/except statement

wise quartz
#

aint this getting a bit overcomplocated?

pure lion
#
try:
  int(m.content)
except ValueError:
  pass```
#

also its type(m.content)

hollow sedge
#

@pure lion yeah i realize that

wise quartz
#

yeah..

hollow sedge
#

there were just too many problems

pure lion
#

Ah

hollow sedge
#

and i looked over that

wise quartz
#

cuz the msg before the second check aint working

#

i'd like to fix that u know

hollow sedge
#

elif msg == "b":

pure lion
#

What do you want to happen and what's not happening

hollow sedge
#

if msg == "a":

#

isnt it msg.content?

pure lion
#

Yeah

wise quartz
#

alr

pure lion
#

msg returns the actual message object

wise quartz
#

yeah makes sense now

pure lion
#

Epico

wise quartz
#

alr fixed

#

thanks

#

can u remind me how to make a command require specific permissions?

pure lion
#

Not sure with that one, I'd recommend looking at the docs

hollow sedge
wise quartz
#

alr np

#

ty

#
@commands.has_permissions(administrator=True)
#

just reading the link made me remember it

#

lol

hollow sedge
#

Lol

leaden lake
steel drum
#

are audit logs return in order of recent to oldest?

hollow sedge
#

Lol use for loops

leaden lake
#

๐Ÿ˜… for me it is

hollow sedge
#

I mean yeah it's readable but why

#

why not just use for loops

amber thistle
#

oh god

leaden lake
#

because I didn't know how to made one for this

hollow sedge
#

r/programminghorror

#

It would've been much easier to just use a loop

leaden lake
#

I know ๐Ÿ˜…

hollow sedge
#
for num in range(len(list)):
    for num2 in range(len(list[num])):
        print(list[num][num2])
#

Wrong way but similar

#

To the actual solution to your problem

amber thistle
#

aight i get this error when im testing to receive votes

 at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=beatsdcbot.herokuapp.com request_id=646b4a71-5ac8-4a63-88fc-bc53e330996d fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
quartz kindle
#

didnt you enable the web dyno?

cinder dagger
#

command(client, 'setup', (message) => {
if(message.author.bot) return;
message.channel.send('are you new to discord yes or no')

})
i want it to respond to a user if you say yes or no

#

can some one help

surreal escarp
#

does anyone here know how to create a ot

leaden lake
#

how reaction.message.id works on a command ?? Because when I try to print it I got an error (python language)

surreal escarp
#

or am i stupid

earnest phoenix
#

Hello

wet scroll
#

@earnest phoenix Does your long description have a custom CSS element for the bot icon by chance?

earnest phoenix
#

No

#

btw

#

The image appeared at the beginning

#

But when I changed it, it disappeared

wet scroll
#

Sounds like its a bug with the site.

#

I would report it on the github

earnest phoenix
#

I don't know

#

but

#

I hope u can help me

#

I will appreciate it

wet scroll
#

I mean you can try using a custom CSS element to force it

earnest phoenix
#

Oh

#

well, I will see

#

tysm

#

But

#

I am bad at "CSS"

#

I just can put codes in "JS"

#

Can I change it by a web or smth like that?

wet scroll
earnest phoenix
#

Oh, well

#

How long will it take?

wet scroll
#

To fix the bug? No clue.

earnest phoenix
#

Oh

#

fine

#

thanks for helping

wet scroll
#

np.

earnest phoenix
#
@tasks.loop(hours=24)
async def my_loop(*args, **kwargs):
    now = datetime.datetime.utcnow()
    next = now + datetime.timedelta(hours=24)
    data = {}
    with open('progress.json', 'w') as f:
       json.dump(data, f)
    with open('correctpotd.json', 'w') as s:
       json.dump(data, s)
    with open('incorrectpotd.json', 'w') as d:
       json.dump(data, d)
    with open('POTD.json', 'r') as p:
       bruh = json.load(p)
    guild = client.get_guild(764893841068261447)  
    role = guild.get_role(765213445997068319)
    for member in guild.members:
      if role in member.roles:
        await member.remove_roles(role)
    channel = client.get_channel(764903892081180682)
    today = date.today()
    todaypotd = bruh[str(today)]
    todayproblem = todaypotd["problem"]
    yesterday = today - timedelta(days = 1)
    yesterdaypotd= bruh[str(yesterday)]
    yesterdaysource = yesterdaypotd["source"]
    yesterdayanswer = yesterdaypotd["answer"]
    yesterdaypoints = yesterdaypotd["points"]
    await channel.send(f"Source: ||{yesterdaysource}||")
    await channel.send(f"Answer: ||{yesterdayanswer}||")
    await channel.send(f"Points Received: ||{yesterdaypoints}||")
    for role in guild.roles:
      if role.id == 765410849254277150:
        await channel.send(f"{role.mention} New POTD! DM your answers to me! Do ``;potd`` to receive the problem! Problem: {todayproblem}")
    congrats = client.get_channel(764903893409857586)
    await congrats.send(f"----------------------POTD Of {str(today)}----------------------")
    now = datetime.datetime.utcnow()
    interval = next - now
    self.change_interval(hours=interval.hours, minutes=interval.minutes, seconds=interval.seconds)

@my_loop.before_loop
async def my_loop_before():
    now = datetime.datetime.utcnow()
    next = datetime.datetime.utcnow()
    next.replace(hour=23, minute=27, second=0)
    if next < now:
        next.replace(day=now.day + 1)
    await asyncio.sleep((next - now).total_seconds())
#

i wrote this code for daily tasks

#

which i got from docs

#

it doesnt send anything

#

and im not finding any places to fix

earnest phoenix
#

heya, does anybody here make npm packages? I'm having some trouble
fs.readFileSync() and fs.readdirSync() work but require() doesn't
it requires inside the npm package itself instead of in the file that I'm requiring the npm package in
sorry if that doesn't make any sense

quartz kindle
#

i have a couple packages

#

can you show your code?

earnest phoenix
#

yeah

#
const cmdInit = (client, path) => {

    const commandFolders = fs.readdirSync(path);

    let commandlist = ['']
    for (const folder of commandFolders) {
        const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));


        for (const file of commandFiles) {
            const commander = require(`${path}/${folder}/${file}`);
            client.commands.set(commander.name, commander);
            commandlist.push(commander.name);
        }
    }

    return commandlist;
}
#

@quartz kindle

#

(sorry for the ping)

quartz kindle
#

and this is inside a package that you install from npm?

earnest phoenix
#

yes

quartz kindle
#

whats the path you're giving it?

earnest phoenix
#
const companion = require('little-api-companion')
const commandlist = companion.cmdInit(client, "./commands");
quartz kindle
#

make it require(${process.cwd()}/${path}/${folder}/${file});

#

then just give it "commands" as the path

earnest phoenix
#

kk lemme test

#

uh what

#

what is it doing

#

@quartz kindle

#

oh wait that was from one of my commands, requiring my old code

#

well, not my old code, but the old location I had the code

#

OMG YESSSS IT WORKS

#

TYSM

earnest phoenix
#

Someone help me please

#
Error: Error parsing info: Unable to retrieve video metadata
#

i just started getting this error

#

my music bot would be working fine

#

anyone know how i would go about incorporating an api like dog.ceo into my javascript bot with an embed

broken matrix
#

Learn js

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

i have

#

i'm just not sure

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

I have learned js

#

would you like to see my bot's code?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

amber thistle
#

ah im getting this error when im testing to recieve webhooks

at=error code=H14 desc="No web processes running" method=GET path="/dblwebhook" host=beatsdcbot.herokuapp.com request_id=9ee38fca-175a-491a-ad6f-f9a1ea5b8937 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
earnest phoenix
#

@sage bobcat Never mind i'm just stupid and forgot to put something in my code

sage bobcat
#

One message removed from a suspended account.

amber thistle
#

i have a question

#

can i put the webhook url a discord webhook url?

quartz kindle
#

no

amber thistle
#

oh

amber thistle
quartz kindle
#

did you not enable the web dyno?

amber thistle
#

that just runs a npm start script

quartz kindle
#

disable the worker and edit the web dyno to run node index.js

#

or whatever your worker does

amber thistle
#

aight imma try that

earnest phoenix
#

Someone help me please

#
Error: Error parsing info: Unable to retrieve video metadata```
#

idk why

quartz kindle
#

ask whoever made the library you use

wide flicker
#

Ok so I'm working on a bot for a client to get Top.gg votes.. is there any examples I can refer to? I'm also curios of where they get their dbl token from

quartz kindle
#

they need to be verified in top.gg

#

then the token will be available in the bot's edit page

wide flicker
#

Well they want to get the votes for their server not their bot.. so would that token be in the same place? I think they should be verified they have 85,000+ members

quartz kindle
#

ah

drifting wedge
#

how would i make a webhook url?
in dpy?

quartz kindle
drifting wedge
#

no just in general

#

like the bot makes one

#

for logging

quartz kindle
#

ah a discord webhook?

#

should be in the dpy docs

wide flicker
quartz kindle
#

i think so, not sure what are the contents of the server webhooks

wide flicker
#

Can you refer me to the page or docs on that because I'm only finding the DBL API

quartz kindle
#

not sure there are docs lol

#

but in theory it should work the same way as the bot webhooks

#

there is no library for it tho, afaik, you need to setup a webserver yourself

#

but its pretty trivial

wide flicker
#

Ahh ok. I was hoping their was an API like how the bots have. Guess I'll try to figure out something

quartz kindle
#

just setup a webserver like express (assuming js)

#

and give its url in the server's edit page

#

then log the data you receive

wide flicker
#

Alright and I'm actually using Python. I've not done anything like this before but I'm going to give it a try

quartz kindle
#

i believe most python users recommend flask or sanic

wide flicker
#

Alright thanks for the info

hollow sedge
#

flask is pretty nice and lightweight

gritty sinew
#

Is Microsoft powershell ok or will it make the bot lag to much when the bot gets more active

earnest phoenix
umbral zealot
#

How is list defined?

#

#needsmorecode

earnest phoenix
#

var list = [];

umbral zealot
#

oh I get it. you're defining the embed inside your loop but sending it one outside the loop. makes sense

#

what you're doing is ```
for each list item {
msg = a brand new embed
}
send(msg)

solemn leaf
#
local util = require("commandUtil")
return function(msg, timeout, maxPeople, channel, emoji, description)
    msg:delete()
    print(type(msg.channel))
    timeout = type(timeout) == "number" and timeout or 600
    maxPeople = type(maxPeople) == "number" and maxPeople or 15
    channel = type(channel) == "table" and channel or msg.channel
    emoji = type(emoji) == "string" and emoji or "๐Ÿบ"
    description = description or "React to this message if you want to play Werewolves! We need %d reactions to start."

    msg:reply(emoji)

    msg:reply(string.format(description, maxPeople))
    msg:addReaction(emoji)
end
{"message": "405: Method Not Allowed", "code": 0}
#

it replies with the correct emoji too

red coral
#

im confused how u make the bot send a different message everytime u use the cmd

#

a cmd*

#

any help?

normal blade
#

im a noob but
if i were u i would try using random

#

or using an if statement

drifting wedge
#

how can i mention a text channel?

#

in dpy?

red coral
#

on djs?

#

for the if statement

#

i code in djs not dpy

solemn latch
#

<#id>

drifting wedge
#

o ok

#

its <#modlog id>?

solemn latch
#

Should be

red coral
#

yeah the channels id

#

example: < #325648177178869760>

#

no space tho

drifting wedge
#

o ok

#

ty :3

#

youre all very pog

red coral
#

ok?

drifting wedge
#

how can i check if the channel exisits lmao?

solemn latch
#

You can check if its in cache.

drifting wedge
#

like if the channel is in that server?

solemn latch
#

Does py not use guild.channels ?

wide flicker
#

Is there a way to send a test vote for servers like how you can for bots?

solemn latch
#

Yeah, in the servers webhook section

red coral
#

how do u make the bot send a different message everytime u use the cmd

#

any example?

#

fordjs

#

djs*

wide flicker
#

Ok.. also yes py uses guild.channels

solemn latch
#

I would use an array and pick an item from that array

drifting wedge
#

guild.channels returns array of ids?

#

or names?

red coral
#

any example?

wide flicker
#

It returns a list of channel objects

drifting wedge
#

ye

red coral
#

yes

drifting wedge
#

just like: entouehrtoiuheroeopr6ho054hop?

#

or like from a list?

red coral
#

from a list

drifting wedge
drifting wedge
solemn latch
#

The whole channel object

red coral
#

for example

#

?beg

solemn latch
#

From what I can tell

red coral
#

bot: no u

drifting wedge
#

but in python its like list = ["pp", "poopoo"]

red coral
#

agin

#

?beg

drifting wedge
#

and u select a random one

red coral
#

bot: here is 5000

#

o ok

#

that is py

#

lol

drifting wedge
#

yes

#

but u can try to adapt it?

red coral
#

ok

drifting wedge
#

like make an array

#

should be very similar

solemn latch
#

Arrays are practically the same as a python list.

drifting wedge
#

wait it returns channel objects

#

how can i access them?

solemn latch
#

Its just a list

drifting wedge
#

is that a thing?

wide flicker
#

for x in guild.channels: y = x.id

drifting wedge
#

r all channel ids the same lenght?

#

yes ok pog

red coral
#

nope doesnt work

solemn latch
#

What doesnt, what did you try.

red coral
#

idk if ok?

#
    let random = Math.floor(Math.random() * 3);
    if (command === 'beg') {
        message.channel.send(`***Dank Memer*** has Donated 500 coins to @${message.author.username}!`)
    };```
solemn latch
#

Your not sending any specific random reply

#

Your sending whats in-between ()

red coral
#

o?

#

what do i do to change it

#

?

earnest phoenix
#

Uhh what is going on here

solemn latch
#

Put the reply array and the index in your send

red coral
#

what index?

#

srry im a beginner

solemn latch
#

The variable random would be your index.

drifting wedge
#
a = b[2,19]
print (len(a))```
#

anyone help?

#

gave error

#

a = b[2,19]
TypeError: string indices must be integers

ember lodge
#

and it doesnt reacts

solemn latch
#

Emojis are such a pain sometimes.

ember lodge
#

ye

red coral
#

can u send an example how tochange it

solemn latch
#

Is your db configured to store that type of data?

red coral
#

script?

ember lodge
#

I think so

solemn latch
#

you just need to use replies[random] @red coral

ember lodge
#

when i do console.log of the data that contains the emoji

solemn latch
#

So, I had a simular issue before.
I belive I had to change the encoding type for the emojis in the db.
I belive it would console log the emoji correctly.

#

I think discords a bit more picky about it.

ember lodge
#

yeah

#

thanks to

hollow sedge
#

Ik this is late but you could convert it to unicode and save that @ember lodge

tribal siren
#

so i tried using canvacord and discord-xp to try build up a rank card

#

i got this

#
const member = message.mentions.members.first() || message.member;
  const user = await Levels.fetch(member.id, message.guild.id);
  const requiredXP = Levels.xpFor(parseInt(user.level) + 1);
  if(!user) return message.channel.send('You have no rank. Try sending some messages first!')
  const rank = new canvacord.Rank()
    .setAvatar(member.user.displayAvatarURL({ dynamic: false, format: 'png' }))
    .setCurrentXP(user.xp)
    .setRequiredXP(requiredXP)
    .setStatus(member.user.presence.status)
    .setProgressBar('#FFA500', 'COLOR')
    .setUsername(member.user.username)
    .setDiscriminator(member.user.discriminator)
  rank.build()
    .then(data => {
      const attachment = new Discord.MessageAttachment(data, 'https://media.discordapp.net/attachments/735897160943534121/778864919092789259/PicsArt_11-19-02.11.02.jpg?width=1442&height=320')
      message.channel.send(attachment);
    })```
#

it logs no error or something and at the same time it does nothing

median vector
earnest phoenix
#

@drifting wedge to slice, you do b[2:20]. Though, i don't think IDs are the same length. So another approach would be:

  1. b.strip('<#>')
  2. ''.join([i for i in b if i.isdigit()])

But what are you trying to do? If you were to make a command that takes channel mention, it's better to type hint the parameter instead

median vector
#

You can type hint to discord.TextChannel

earnest phoenix
#

discord.Channel isn't a thing?

median vector
#

Fixed