#development

1 messages ยท Page 1388 of 1

north birch
#

yeah that code is completely incorrect
@sage bobcat May i know why? The code actually work lmao

tardy hornet
#
const msg = await message.channel.send(helpss);
await msg.react('๐Ÿ—‘๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐Ÿ—‘๏ธ"), {max: 1, time:15000})
.then(async collected => {
  if(collected.first().emoji.name == "๐Ÿ—‘๏ธ"){msg.delete(), message.delete()}
  else return message.channel.send("error")
})
break;

someitimes it just send a error that emoji is not define, but most of the time its working well

lean wing
#

how to put style on my html on the top.gg website ?

earnest phoenix
#

@north birch it depends on what exactly you are doing

#

you also gave a snippet of code, which doesn't help

north birch
#

you also gave a snippet of code, which doesn't help
@earnest phoenix Sorry xd

boreal iron
#

That's api spam I think
I don't think so.

opaque seal
#

I do instead xD

digital ibex
#

@lethal grail u still need help?

vale garden
#

hi

bronze fable
#

hi

#

why is this not working

#

no errors, but it doesnt log username when user joins

sudden geyser
#

do you have the intent required for that enabled

bronze fable
#

wait

#

is that a new thing?

pale vessel
#

ye

bronze fable
#

what am i supposed to do to get that intent

sudden geyser
#

When initializing Discord.Client, you'll need to pass ws as a key, with the value of the expected object: https://discord.js.org/#/docs/main/stable/typedef/WebsocketOptions

#

There's an intents key/value after you pass it, which I think you should include GUILD_MEMBERS

bronze fable
sudden geyser
#

For example: js new Discord.Client({ ws: { intents: [Discord.Intents.GUILD_MEMBERS] } })

bronze fable
#

ah i see

#

so do i have to intent everything now? wtf

sudden geyser
#

You should add intents for what you need.

#

You'll also need to enable it on the developer portal for your bot.

bronze fable
#

is that privileged intent

molten yarrow
#

GUILD_PRESENCES is for presenceUpdate if u need that
GUILD_MEMBERS is for guildMemberAdd, guildMemberRemove, guildMemberUpdate

sudden geyser
#

yes

earnest phoenix
#

How to make porn command

#

i failed

#

i thought i made it

bronze fable
#

they keep making things more complicated

earnest phoenix
#

but it failed

bronze fable
#

xd

crystal wigeon
#

hey does anyone know the battle formula for an rpg?

earnest phoenix
#

Imagine if i could ping @earnest phoenixry1

crystal wigeon
#

im trying to figure out the ratio in which the 80hp points is converted to 1900 hp during battle

earnest phoenix
#

O

#

I pinged EVE

#

@earnest phoenix help

#

Hahahhahaa

#

i found a bo there

crystal wigeon
#

;-;

pale vessel
#

you mean @umbral zealot

#

or not

umbral zealot
crystal wigeon
#

help pl0x ;-;

molten yarrow
#

80hp to 1900hp is 23.75 or what u mean? xD

ivory seal
#

is it possible to give roles as people vote in top.gg server?

lethal grail
#

@digital ibex yep

molten yarrow
#

@lethal grail you dont have execute() function in your command

#

only run()

lethal grail
#

so i change run to execute?

molten yarrow
#

yes or in your message to run

lethal grail
#

????

crystal wigeon
#

What i mean is, the hp here shows a 80 or 90, but then during the actual battle its scaled to 2390 etc. how is this ratio calculated?

molten yarrow
#

in your message event, where u check if its a command or not and run it

lethal grail
#

so i change run to execute

molten yarrow
#

just change in your commands run: to execute:

#

@crystal wigeon it depends how u want it, on my Bot i used 1 point = 100hp, but u can scale it how u want tho

crystal wigeon
#

is it like a maxHp you can have?

#

ah yeah

#

thanks

stable eagle
#
            if(err) console.log(err)
          if(!money) {
          const newCoins = new coins({
            _id: member.id,
            money: 0
          })
            newCoins.save()
          } else {
             return money.money
          }
        })

This returns as [object Promise] for some reason, does anyone know why?

crystal wigeon
#

use await before coins.findOne

stable eagle
#

ok, imma try

crystal wigeon
#

also you dont need async in the cb

earnest phoenix
#

await and .then? i think thats incorrect

stable eagle
#

im hyptonised by the always make functions async spell

crystal wigeon
#

xD

lethal grail
eternal osprey
#

hey guys

#

why is my code sending out lastcoordinate = o? Eventhought that is not true:

stable eagle
#

still returns [object Promise]

eternal osprey
#
  function toRad(value) {
            return value * Math.PI / 180;
        
        }
        
        function calcCrow(lat1, lng1, lat2, lng2) {
            var R = 6371;
            var dLat = toRad(lat2 - lat1);
            var dLon = toRad(lng2 - lng1);
            var lat1 = toRad(lat1);
            var lat2 = toRad(lat2);
        
            var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            var d = R * c;
            return d;
            
        }
        let lastcoordinate = calcCrow(lat1, lng1, lat2, lng2)
        
console.log(lastcoordinate)```
bronze fable
#

where do i enable this

molten yarrow
#

developer portal

bronze fable
#

is it the right thing?

sudden geyser
#

the other one

bronze fable
#

theres 3

sudden geyser
molten yarrow
#

oh im to slow xD

eternal osprey
#

anyone that knows how to solve my issue?

bronze fable
#

it worked

solemn latch
#

just a heads up, if your using priv intents you should really learn the rules of them.

queen crescent
#

what might cause random data to be deleted from a mongodb collection? not all data gets deleted but some do randomly

solemn latch
#

timed deletion?

queen crescent
#

Nah

violet furnace
#

nah yaraklar

solemn latch
#

if mongo has logs, I would look at those.

eternal osprey
#

anyone that could help me out please?

quartz kindle
#

@eternal osprey console.log(lat1,lng1,lat2,lng2)

earnest phoenix
#

Hey guys, i'd like to make my bot displaying how many messages a certain user sent, any help with that?

eternal osprey
#

@quartz kindle lat2 and lng2 return 4 and 0

#

at all times

#

literally

quartz kindle
#

@eternal osprey then you're still getting them wrong

#

you didnt read the answer i gave you

eternal osprey
#

i can't be getting them wrong

quartz kindle
#

i told you to split by comma

eternal osprey
#

i did read everything

#

yeas i did

#
  const lat1 = raid.lat;
          const lng1 = raid.lng.substring(1);
          fs.writeFileSync("./lastcoordinate.json", [lat1, lng1])
          console.log(name, + "\n" + raid.gym_name, + "\n" + raid.lat, + "\n" + raid.lng);
          
            
          const coordinates = fs.readFileSync("./lastcoordinate.json","utf8").toString()
          const final= coordinates.split(",")
          const lat2 = final[0]
          const lng2 = final[1]
          console.log(lat2 + "\n" + lng2 )```
#

look

quartz kindle
#

and what does that console.log show ?

eternal osprey
#

let me run it for you. 0/

quartz kindle
#

another thing

#

if lastcoodinate.json is literally lat1 and lng1

#

why the fuck do you save them into a file then read the file again?

eternal osprey
#
Egg 0RAILROAD Park 040.824952 0-73.915779
program.js:65
40.824952
73.915779
program.js:72
0
#

that is because this code does refresh every 10s

#

i want to compare the newer lat1 and lng1 with the previous ones

#

(the distance between them)

#

that is why i am saving them

quartz kindle
#

you're writing to a file and reading from the same file right afterwards

#

there is no reason to do that

#

you can literally do lat2 = lat1

eternal osprey
#

look let me show you an example

#

hold on

quartz kindle
#

what previous ones, if you literally write new ones to the file before you do anything else?

eternal osprey
#

basically my bot sends an embed with these coords:

#

40.824952
73.915779

quartz kindle
#

you're deleting any previous thing before anything

eternal osprey
#

these will be saved in the json file.

#

wait i am stupid

#

you are right

#

that is why it i 0 ofcourse

#

huh but how would i do it then?

lusty quest
#

why did you save it in the first place?

eternal osprey
#

to know the distance between 2 raids:

lusty quest
#

you could maybe get away with using variables to temporary store them. this maybe fixes some of your issues

eternal osprey
#

i want to save the previous coords and compare it with the newer ones

#

as my code generates a new raid every 10s

lusty quest
#

ive had an idea but it will not work

solemn latch
#

if its every 10s do you need it to be stored between restarts anyway?

eternal osprey
#

yeah right now i am really stuck.

lusty quest
#

yea you write and read every 10 seconds from a json thats not good

#

i guess saving between restarts is stupid

#

since its quickly replaced anyways

#

and if the first run shows a 0 in your distance i dont think someone cares

eternal osprey
#

yeah

#

is there any way to let the json file overwriting skip one cycle (of the setinterval = 10s)

#

can't i try to put a cooldown on the json writefilesync of like 10s?

molten yarrow
#

why u dont save it in a map?

eternal osprey
#

wdym?

lusty quest
molten yarrow
#
  1. Raid Map(1) delete after 30sec
  2. Raid Map(2)
  3. Raid Map(3)

or do you need all your data from all Raids?

lusty quest
#

you store values in a Cache and can set a automatic self destruction of the data

pure lion
#

I'm trying to post a json to my api, it receives the post and its meant to return the res.body bUuuuUuuuU its not sending the body or anything other than an empty json

lusty quest
#

and its easy to use

eternal osprey
#

hmm i have never ever worked with it tho.

#

i will try my best.

pure lion
#
require("node-fetch")("https://dice.ryadev.xyz/database/accounts/registerGJAccount.php", {method: "post", "Content-Type": "application/json", body: {"userName":"Dice", "password":"dghiousdahhfsdughs", "email":"se@x.com","secret":"Wmfd2893gb7"}}).then(res => res.json()).then(b => JSON.stringify(b))``` here's how im posting
lusty quest
#

me neither but it looks easy to implement

#

@pure lion did you use postman for API tests?

pure lion
#
router.post("/database/accounts/registerGJAccount.php", async (req, res) => {
    res.send(req.body).status(200);
});
``` and here's the route
#

nah i posted with my bot

#

postman is lag for my pc

#

depressing ik

lusty quest
#

you can use it in a browser

pure lion
#

oh

#

sick

#

but still need help

lusty quest
#

why did you send the body in a post event?

pure lion
#

testing

lusty quest
#

make a console.log and see what it spits out?

pure lion
#

it returns {} empty json

#

oh i am a retard

#

brb

vital lark
#

did you pass any data when making a request

pure lion
#

fixed it

#

i am astronomically stupid

#

app.use(express.urlencoded({extended: true})); kekw

lusty quest
#

cant be as bad as the dude that made his bot spam nsfw pictures in 80 guilds

pure lion
#

ah-

lusty quest
#

@eternal osprey would recommend using (if you use the node-cache) .set to set your last location and .take to retrive it (take will get the data and delete the key)

eternal osprey
#

i just put a 10s cooldown on the writefilesync

pure lion
#

it didnt fix it

lusty quest
#

also works

pure lion
#

feck

lusty quest
#

but its a placebo

#

would recommend using the node-cache or something like this

#

has some pros over your file system

#

the largest one is its faster

eternal osprey
#

hmm okay i will study node-cache

lusty quest
#

and wont corrupt since its stored in ram

#

its easy to use

eternal osprey
#

but this what i did is good right?

#

well good, working?

lusty quest
#

its working not good

lyric mountain
#

"good" is subjective

quartz kindle
#

doesnt he need it stored in disk tho?

lusty quest
#

why?

#

he overwrites it 10 seconds later

quartz kindle
#

to compare after a bot restart

lusty quest
#

then is it for the first 10 seconds 0

eternal osprey
#

yeah i tested it

quartz kindle
#

but sure, if hes fine with having no comparison the first time the bot runs it, then its fine, but in that case he doesnt really need a module lol

pure lion
#

im using express as my API ting (and body-parser to parse the json). it works when im in browser, sending as a form with a name but when I'm just sending the JSON it console logs absolutely nothing

slim umbra
#

bruh

#

dont

lusty quest
#

sure

slim umbra
#

store stuff in cache

eternal osprey
#

thanks boys, really happy that i got it working!

slim umbra
#

its like u want to fuck ur performance

lyric mountain
#

Can't u just store a hash for post-restart comparison?

eternal osprey
#

thanks for the tips etc!

solemn latch
#

cache is slow?

#

tf

slim umbra
#

no

#

memory

lusty quest
#

lol everyone who uses redis wants a talk with you

eternal osprey
#

@slim umbra i've got a vps

slim umbra
#

what?

quartz kindle
#

lol

solemn latch
#

bots use memory Thonk

#

theres no way around using it

eternal osprey
#

it would not affect my pc performance if you were talking about that?

slim umbra
#

no lmao

lusty quest
#

and he will store a few kb in the cache usually it will impact nothing

slim umbra
#

i meant ur bots memory usage

lyric mountain
#

Everything uses memory actually

eternal osprey
#

owh

#

sorry

slim umbra
#

bc alot of people just shove shit into memory

#

then "owo why memory high"

solemn latch
#

hes storing a few bytes per guild it looks like

#

most guilds names are more than what he is caching

pure lion
#

cansomeonepleasehelpmewithexpresspleaseplease

lyric mountain
#

Could you express that better?

solemn latch
#

lol

pure lion
#

i hate you

eternal osprey
#

.slice(3) will make sure that the string will cut after character 3 right?

quartz kindle
#

lmao

eternal osprey
#

so starting from 0

pure lion
#

so basically when i send the JSON from the browser using a form and posting the inputs with names it works

#

but when I just post the JSON it does absolutely nothing

lusty quest
#

did you call the correct endpoint?

quartz kindle
#

@pure lion are you using the json body parser? because forms dont use json, they use urlencoded

solemn latch
#

beautiful formatting

lyric mountain
#

Const ๐Ÿ˜ฉ

pure lion
#

@pure lion are you using the json body parser? because forms dont use json, they use urlencoded
@quartz kindle yes i called router/app.use(bodyParser.json())

lusty quest
#

@earnest phoenix you know that you can make a code block with 3x` then your code and 3x ``

pure lion
#
new new new new new new new new new new new new new new new new new new new new new new new new ```
solemn latch
#

i would like a new new

lyric mountain
#

```here you go```

solemn latch
#

or
```js

```

pure lion
#

or

#

```x86asm

quartz kindle
boreal iron
#

lmao

pure lion
#

lmao indeed tim please help me

lyric mountain
#

That'll await faster

pure lion
#

yes

quartz kindle
#

idk show code?

pure lion
#

the more awaits the better

#

alr

lusty quest
#

would be stupid if with every await it uses a new thread

lyric mountain
#

Js has no threads tho

lusty quest
#

i know

quartz kindle
#

where are you?
awaiting the promise
hurry up
await await promise()

pure lion
#
app.use(express.urlencoded({extended: true}));
app.use(bodyParser.json());

app.use("/", endpoints.register);

app.listen(port, () => console.log(`[ALERT/express server] Server running on local port ${port}`));
const router = require("express").Router()
const bodyParser = require("body-parser")
router.use(bodyParser.json());

router.post("/database/accounts/registerGJAccount.php", async (req, res) => {
    res.send(req.body).status(200);
    console.log(req.body);
});

module.exports = router;```
#

ill try posting again

lyric mountain
#

Did u try postman?

pure lion
#

console is {}

lusty quest
#

i asked him this too but his potato wont run the desktop app

quartz kindle
#

are you pretending your website runs on php?

pure lion
#

hEr*

quartz kindle
#

lmao

lyric mountain
#

If it ain't a local api just try apistester

pure lion
#

well kinda

#

its for geometry dash and because of the way bytes are written to requires them to report the correct size

#

that means the endpoints have to be the same length

#

and nobody wants to write the dll

keen drift
lyric mountain
#

I need help with the code ```const fs = require ('fs');

client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'))
for(const file of commandFiles){
const command = require(./command/${file});

client.commands.set(command.name, command);

}

@earnest phoenix error? Tips? Info?

pure lion
#

oh it worked

lyric mountain
#

TIL codeblocks can't be quoted, but inline codes can

#

Show the log

pure lion
#

@lyric mountain mobile looks like shit

lyric mountain
#

I meant the actual log file

#

Waitaminute

pure lion
#
{"{\"name\":\"poggery champus\"}":""}
```so this is the res...
#

hm

lyric mountain
#

But anyway, you probably have some syntax issues there, but it's quite hard to find it without highlighting

lusty quest
#

looks like a json parser ran over it

pure lion
#

yeah

lusty quest
#

but it looks fine

pure lion
#

ah

#

hmm

#

i need to post json

lyric mountain
#

Why don't u use ' inside "?

lusty quest
#

yea makes it way easyer

pure lion
#

but i did post json

lusty quest
#

are you sure?

pure lion
#

oh it was posting urlencoded

#

just added the application/json header

eternal osprey
#

hey peeps

#

back at it again

#
   let lastcoordinates = lastcoordinate.slice(0,3)
         ``` lastcoordinate.slice(0,3) is not a function?
lusty quest
#

is lastcooditate a string?

eternal osprey
#

it is an array

lusty quest
#

and you want to keep the first 3 entrys?

eternal osprey
#

exactly!

lusty quest
#

are you sure its an array and not an object?

eternal osprey
#

yeah

lusty quest
#

run a console.log(lastcoordinate) and see if it is an array

eternal osprey
#

let me just use isArray()

lusty quest
#

or console.log(typeof lastcoordinate)

lyric mountain
#

it's a huge problem

earnest phoenix
#

why tho

#

why 11

lyric mountain
#

you shouldn't need more than 3 listeners

#

even 3 is a bit too much

earnest phoenix
#

one is enough

#

not use 11 listeners

#

use 1 listener

#

bruh

lusty quest
#

how did you run your commands?

solemn latch
#

listen once

lusty quest
#

i have a bad feeling about this one

solemn latch
#

meanwhile erwin, 250 listeners

earnest phoenix
#

i have a bad feeling about this one
same

#

wtf

lyric mountain
#

no no

solemn latch
#

dont increase your listener count

#

just use one listener

earnest phoenix
#

no shit

#

ofc u got an error

lyric mountain
#

show how you're creating ur listener

earnest phoenix
#

tf

lyric mountain
#

no

earnest phoenix
#

please learn js

solemn latch
#

you dont need to set max listeners

eternal osprey
#

@lusty quest the console.log returns: number

solemn latch
#

you just need to use less of them

lusty quest
#

so its not an array @eternal osprey

lyric mountain
#

there should be something like addEventListener somewhere in ur code

#

unless...is that code copypasted?

lusty quest
#

how many times did you listen to the on message event?

eternal osprey
#

aha so i cannot use slice

#

what other methods are there then?

lusty quest
#

exactly

solemn latch
#

slice?

#

oh diffrent guy

lusty quest
#

you have a single number?

solemn latch
bronze fable
#

does anyone know a way to send files using a webhook? c#

earnest phoenix
#

@earnest phoenix what language and library

#

meh you're going

eternal osprey
#

could i maybe use substring?

earnest phoenix
#

and lib?

lusty quest
earnest phoenix
#

eris or discord.js?

#

do u have an event handler?

#

aight can i see your code

eternal osprey
#

so any suggestions on how to cut off the string after the 3rd character?

earnest phoenix
#

in a sourcebin, hide your token if it's there

#

in a sourcebin...

solemn latch
#

your not working with a string are you? but a number @eternal osprey

bronze fable
#

@lusty quest its not the same, example there is using discord.net, im trying to send webhook raw using requests

earnest phoenix
#

ok lol

lusty quest
#

ohh ok. sadly my C# knowledge is not that good for now

#

@eternal osprey try toFixed(3)

solemn latch
#

to fixed is just after the decimal right?

lusty quest
#

ohh right only decimals

solemn latch
#

my thought was maybe .toString then slice it.

eternal osprey
#

owhyeah okay i will try!

lusty quest
#

yea will probably work better

solemn latch
#

dw tim will show up in a bit with a better solution

lusty quest
#

probably

earnest phoenix
#

Js

lyric mountain
#

multiply the value by 1000, then cast to int, then cast to float and divide by 1000

#

gg

lucid prawn
#

how do i fix this it only break when it done like this tuphug but when it done like this tuphug @ someone it didnt break
here error

  .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
                                                                                                            ^
TypeError: Cannot read property 'username' of undefined
    at Client.<anonymous> (C:\Users\love\Documents\Discordbot\index.js:101:109)
    at Client.emit (events.js:327:22)
    at MessageCreateAction.handle (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\love\Documents\Discordbot\node_modules\discord.js    at WebSocketManager.handlePacket (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\love\Documents\Discordbot\node_modules\ws\lib\event-target.js:125:16)  
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\love\Documents\Discordbot\node_modules\ws\lib\websocket.js:797:20)
#

here code

            if(message.content.startsWith(prefix + "hug" )){
                message.channel.send('**OMG YOUR HUGGING**');
                }
                if(message.content.startsWith(prefix + "hug" )){
                  var embed = new Discord.MessageEmbed()
                        .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
   
                        .setTimestamp()
                        .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
                    message.channel.send(embed);
              }
lethal grail
#

module.exports = {
    name: "avatar",
    aliases: ["av"],
    category: "Utility",
    usage: "avatar/avatar @user",
    description: "Gives avatar for message author or mentioned user.",
    execute: async (client, message, args) => {

let user = message.author || message.mentions.users.first();

let embed = new discord.MessageEmbed()
.setTitle(`${user.username}'s Avatar!`)
.setImage(user.avatarURL({size: 2048, dynamic: true, format: "png"}))
.setColor("RANDOM");
message.channel.send(embed);

    }
};```
avatar command, wont respond
lusty quest
#

@lucid prawn if you use Node 14+ use optional chaining alternative check if a user is mentioned or not and handle accordingly

#

@lethal grail did you get an error?

lethal grail
#

logs?

#

lemme check

#

oh i did

lucid prawn
#

when i user is mention it work when a user not mention it break

lusty quest
#

i know

#

bcs it cant find the mentioned user

lusty quest
#

did you know basic js?

lethal grail
#

nope started today

limpid shadow
#

h

lusty quest
#

yea would suggest reading into the language a bit

#

makes it easyer for both of us

lethal grail
#

for you*

lusty quest
#

no for you too. since you will understand what i talk about

lucid prawn
#

should i put this in my coded to fix it ```js
if(!args[0]) return msg.channel.send('Please mention someone to hug');

lusty quest
#

if you want or check if there is a mention and add it if aviable

#

@lethal grail you got somewhere a promise that throws an error that is not handled. did you got any sort of Error handling?

lethal grail
#

yep

#
        return message.channel.send(`An error happened while executing this command, the error is as follows:\n\`\`\`\njs${err}\n\`\`\``);```
lusty quest
#

there is somewhere a error that is not handled

lucid prawn
#

like this ```js
if(message.content.startsWith(prefix + "hug" )){
message.channel.send('OMG YOUR HUGGING');
}
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return msg.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)

                    .setTimestamp()
                    .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
                message.channel.send(embed);
lusty quest
#

why 2 checks for the command?

restive otter
#

kiss cmd ?

prisma bramble
#

@lucid prawn thats wrong

lucid prawn
#

???

restive otter
#
if(message.content.startsWith(prefix + "hug" )){
    message.channel.send('**OMG YOUR HUGGING**');
    }
    if(message.content.startsWith(prefix + "hug" )){
        if(!args[0]) return msg.channel.send('Please mention someone to hug');
      var embed = new Discord.MessageEmbed()
            .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)

            .setTimestamp()
            .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
        message.channel.send(embed);
    }
#

or error

prisma bramble
#

the first check - if you type only hug it returns OMG YOU'RE HUGGING

#

and then on the second check

solemn latch
#

not sure why theres two checks

#

๐Ÿค”

prisma bramble
#

yea

lucid prawn
#

so remove one

#

?

prisma bramble
#

the first one .. yes

lucid prawn
#

ok

#

like this ```js
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return msg.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)

                    .setTimestamp()
                    .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
                message.channel.send(embed);
          }
restive otter
#

msg not defined

earnest phoenix
#

what is your error @lucid prawn

#

use this it may work

#
if(message.content.startsWith(prefix + "hug" )){
                    if(!args[0]) return message.channel.send('Please mention someone to hug');
                  var embed = new Discord.MessageEmbed()
                        .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
   
                        .setTimestamp()
                        .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
                    message.channel.send(embed);
              }

solemn latch
#

your message variable is probably message not msg if msg is undefined

earnest phoenix
#

yh

restive otter
lucid prawn
#

my error ```js
ReferenceError: args is not defined
at Client.<anonymous> (C:\Users\dogli\Documents\Discordbot\index.js:97:21)
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\dogli\Documents\Discordbot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\dogli\Documents\Discordbot\node_modules\ws\lib\websocket.js:797:20)

solemn latch
#

define args

lucid prawn
#

how

solemn latch
#

as an array of the source message content probably.

#

with the command and prefix removed

lucid prawn
#

i only worked with args once so

restive otter
#
const Discord = require("discord.js")
let prefix = ","
module.exports.run = (bot, message, args) => {
    if(message.content.startsWith(prefix + "hug" )){
        if(!args[0]) return message.channel.send('Please mention someone to hug');
      var embed = new Discord.MessageEmbed()
            .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)

            .setTimestamp()
            .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
        message.channel.send(embed);
    }}

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

solemn latch
#

stop using msg and use message @restive otter

bronze fable
#

aaa can someone help
im trying to send file as webhook, but it doesnt work ๐Ÿ˜ก

#

this is the code

lusty quest
#

maybe ask on the Discord Developers or Discord API server idk how many people here actually use C#

lucid prawn
restive otter
#

use my code @lucid prawn

lucid prawn
#

ok

restive otter
#

wait

lucid prawn
#

what

restive otter
#

2 seconde

solemn latch
#

client mods

#

AHH

north birch
#

I was about to say that lmao @solemn latch

#

Remember that clients mods are against Discord TOS, watch out or somebody can report you
@restive otter

prisma bramble
#

client mods what?

#

i mean things like Better Discord?

lucid prawn
#

clients mods what that Thonk

north birch
#

Yeah @prisma bramble

solemn latch
#

modifying your client

#

in any way

lethal grail
#

module.exports = {
name: "kick",
usage: "kick <@user> [reason]",
description: "Kick a user from the guild.",
execute: async (client, message, args) => {
    
        let user = message.mentions.users.first();
        let reasonkick = message.content.split(' ').slice(2).join(' ');
        let guild = message.guild;
        let memberkick = message.guild.member;
    
    if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send(`You Require `KICK MEMBERS` Permission to Execute this Command`)
    
     if (message.mentions.users.size < 1) {
            return message.channel.send('You need to mention someone to kick!');
        }
    
     if (!reasonkick) {
            reasonkick = "No Reason Given"
        }
    
    if (!message.guild.member(user).kickable) {
            return message.channel.send("That Member couldn't be kicked due to role hierarchy");
        }
    
    message.guild.member(user).kick();
    
    let embed = new Discord.MessageEmbed()
    .setTitle("User Was Successfully Kicked")
    .setDescription(`${user.username}#${user.discriminator} was kicked by ${message.author.username}`)
    .addField(`Reason :-`, `${reasonkick}`)
    .setColor("RANDOM")
    message.channel.send(embed)
    
     let DmEmbed = new Discord.MessageEmbed()
    .setDescription(`You were Kicked from ${guild} for: ${reasonkick}`)
    .setColor("RANDOM")
    user.send(DmEmbed)
  }
}```
this kick command makes my bot not start at all
north birch
#

@lucid prawn BetterDiscord for example

lucid prawn
#

ok

prisma bramble
#

I've used it. Once you use hundreds of themes you'll realize nothing is better than default discord

restive otter
#

Remember that clients mods are against Discord TOS, watch out or somebody can report you
@restive otter
@north birch poukave

solemn latch
#

whats the error @lethal grail

lucid prawn
#

the coded is not working @restive otter

restive otter
#
const discord = require("discord.js");

module.exports = {
  name: "kick",
  usage: "kick <@user> <raeson>",
  run: (client, message, args) => {
    
    if(!message.member.hasPermission("KICK_MEMBERS")) {
      return message.channel.send(`**${message.author.username}**, Vous ne disposez pas des autorisations nรฉcessaires pour utiliser cette commande`)
    }
    
    if(!message.guild.me.hasPermission("KICK_MEMBERS")) {
      return message.channel.send(`**${message.author.username}**, Je n'ai pas assez de permission pour utiliser cette commande`)
    }
    
    let target = message.mentions.members.first();
    
    if(!target) {
      return message.channel.send(`**${message.author.username}**, Veuillez mentionner la personne que vous souhaitez kick`)
    }
    
    if(target.id === message.author.id) {
     return message.channel.send(`**${message.author.username}**, Vous ne pouvez pas vous expulsez`)
    }
    
  if(!args[1]) {
    return message.channel.send(`**${message.author.username}**, Veuillez donner une raison pour interdire`)
  }
    
    let embed = new discord.MessageEmbed()
    .setTitle("Action: Kick")
    .setDescription(`Kicked ${target} (${target.id})`)
    .setColor("RANDOM")
    .setFooter(`Kicked by ${message.author.username}`);
    
    message.channel.send(embed)
    
    target.kick(args[1]);

  }
}

module.exports.help = {
    name: "kick"
  }
#

kick cmd

#

no error

lethal grail
solemn latch
#

stop spoonfeeding my dude

#

lol

restive otter
#

just create channel "logs"

north birch
#

I've used it. Once you use hundreds of themes you'll realize nothing is better than default discord
@prisma bramble Me too, i tried it but it slows down discord

solemn latch
lucid prawn
#

the coded is not working @restive otter

restive otter
#

shut hup now @north birch beacause y have used

prisma bramble
#

@lethal grail you're missing ) somewhere

north birch
#

shut hup now @north birch beacause y have used
@restive otter Dont worry i used it too one time

lethal grail
#

yes i know that but idk where @prisma bramble

restive otter
solemn latch
#
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send(`You Require `KICK MEMBERS` Permission to Execute this Command`)
#

the `` around kick members

#

is messing up your quotes

#

try using

"You Require `KICK MEMBERS` Permission to Execute this Command"

instead

#

please stop spoonfeeding

#

its against rules

lucid prawn
#

sorry

restive otter
#

I'm french @lucid prawn , my code is french

lucid prawn
#

my error js ReferenceError: emitter is not defined

bronze fable
#

i cant find api server

#

dm if u have any pls

restive otter
#

what u code?

solemn latch
#

api server? ๐Ÿค”

earnest phoenix
#

Define emitter

bronze fable
#

discord api, or developers server

lucid prawn
#

coded ```js
emitter.setMaxListeners()

north birch
#

Btw i want to make a christmas countdown with parse-ms, on reaching date trigger that function, anyone is expert with that?

lusty quest
solemn latch
#

why are you changing the number of max listeners?

earnest phoenix
#

Define emitter @lucid prawn

lusty quest
earnest phoenix
#

Yeah even better question ^^^

lucid prawn
#

my coded ```js
client.on('guildMemberAdd', member => {
// Send the message to a designated channel on a server:
emitter.setMaxListeners()
const channel = member.guild.channels.cache.find(ch => ch.name === 'general');
// Do nothing if the channel wasn't found on this server
if (!channel) return;
// Send the message, mentioning the member
channel.send(Welcome to the server, ${member});
});

earnest phoenix
#

Tf

lusty quest
#

wtf?

solemn latch
#

setting max listeners on every guild member KEKW

lucid prawn
#

what

solemn latch
#

why are you doing that line

#

emitter.setMaxListeners()

lusty quest
#

have you any idea what you are coding?

lucid prawn
#

yes i do

lusty quest
#

it doesnt appear to

solemn latch
#

okay whats this line for
emitter.setMaxListeners()

lucid prawn
#

this bot is in alot if server so

#

i did that

solemn latch
#

you only need one listener per event

lusty quest
#

i dont use it and im now at 300 guilds?

solemn latch
#

which can handle all guilds

lucid prawn
#

so how do fix it

lethal grail
#

now the kick command wont respond and no error in logs

solemn latch
#

theres very rarely a reason to setMaxListeners more than once at startup.
theres also very little reason to set it at all. the default of 10 is plenty in 99% of cases.

#

if you have a specific reason to use it, use it, but you need to know exactly why and where to use it.

#

not just put it randomly somewhere.

lucid prawn
#

it was working but it stop today

solemn latch
#

even if it was working, its not the right way to do things.

lucid prawn
#

ok so what do i change

north birch
#

is there any website where can i take ms till xmast on every bot startup?

lethal grail
#

@solemn latch your solution for the kick command didint work what should i do?

solemn latch
#

get rid of the emitter.setMaxListeners() line.

lucid prawn
#

ok

lethal grail
#

i mean its able to start now but the command wont respond

solemn latch
#

is it giving a new error?

lucid prawn
#

i will check

solemn latch
#

my fix solved the error that was displayed, or should have ๐Ÿคทโ€โ™‚๏ธ /

lethal grail
#

is it giving a new error?
@solemn latch nope

#

nothing in logs

solemn latch
#

is it giving any response at all when you do the command?

lucid prawn
#

no error but i need someone to join to see of it give me a error

lusty quest
#

create an alt account

lethal grail
#

is it giving any response at all when you do the command?
@solemn latch nope

lucid prawn
#

ok

#

brb

north birch
#

Guys is there a source when i can get updated milliseconds left to christmas on my bot so i can make a countdown command?

solemn latch
#

you could do the math yourself.

#

dont think it would be that hard

#

just set a date to christmas, then subtract now, then thats the miliseconds remaining right?
using Epoch time ofc.

#

is the command properly added to the commands collection(or however your storing them) @lethal grail

lucid prawn
#

didnt work

solemn latch
#

what didnt work?

lucid prawn
#

it change

solemn latch
#

okay. but what error happened.

lucid prawn
#

no error

solemn latch
#

so, what part didnt happen? did it get the channel and not send the message? did it not even run the event? did it not find the channel?

main trench
#

@earnest phoenix what kind of help?

lucid prawn
#

it didnt send the message

solemn latch
#

did it find the channel?

main trench
#

@lucid prawn did you have a channel called "general"?

#

Its best to use a db so people can have custom channels for things like a welcome message

lucid prawn
#

i change it to spam

main trench
#

Because not everyone has a channel called General

tardy hornet
#
const msg = await message.channel.send(helpss);
await msg.react('๐Ÿ—‘๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐Ÿ—‘๏ธ"), {max: 1, time:15000})
.then(async collected => {
  if(collected.first().emoji.name == "๐Ÿ—‘๏ธ"){msg.delete(), message.delete()}
  else return message.channel.send("error")
})
break;

someitimes it just send a error that emoji is not define, but most of the time its working well
even when it dose send the error
its deleting it after 30s instead of instantly deleting

please ping when asnwer

main trench
#

@lucid prawn ok so do you have a channel called "spam" then?

lucid prawn
#

yes

main trench
#

Hmm

lethal grail
#

is the command properly added to the commands collection(or however your storing them) @lethal grail
@solemn latch yeah

solemn latch
#

so when you console.log it it shows up?

lucid prawn
#

what?

solemn latch
#

what error

lucid prawn
#
                  client.on('guildMemberAdd', member => {
                    const channel = member.guild.channels.cache.find(ch => ch.name === 'spam');
                    if (!channel) return;
                    channel.send(`Welcome to the server, ${member}`);
                  });
tardy hornet
#

please someone dont ignore me

#

!

vocal sluice
#

if a bot is missing say manage_roles permission how would you have it send an error message if it is?
I know it's like:

    return message.channel.send('missing manage_roles');```
what would you put before .hasPermission?
tardy hornet
#

message.member

#

@vocal sluice

solemn latch
#

anything else logged or just that @earnest phoenix

stable eagle
#
      if(err) console.log(err)
    if(!money) {
    const newMoney = new money({
      _id: member.id,
      money: 0
    })
      newMoney.save()
    } else {
      return money.money
    }
  })

Normally, this should show an int, but instead it returns [object Promise], does anyone know why?

lucid prawn
#

no error @solemn latch

solemn latch
#

you have a promise you need to resolve

tardy hornet
#

please someone dont ignore me

solemn latch
#

honestly, not sure with just that info. @earnest phoenix
I would try using npm filename in your projects folder to run it.

tardy hornet
#

okay i see

#

thx for the help everyone, i will come back in 1h hopefully someone will want to help me then

solemn latch
#

its kinda hard to solve that issue

#

I dont have enough info to really debug that ๐Ÿคทโ€โ™‚๏ธ

#

maybe try logging the channels collection and see if spam actually exists as far as the bot is concerned?

lucid prawn
solemn latch
#

like i said broken, I want to help, but i dont have enough info

tardy hornet
#

i thought you talked to him

solemn latch
#

my guess is its not finding the channel @lucid prawn
I would log on the return to see if it is finding it or not.

tardy hornet
#

hold up let me send it here again

#

so i could see it

#
const msg = await message.channel.send(helpss);
await msg.react('๐Ÿ—‘๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐Ÿ—‘๏ธ"), {max: 1, time:15000})
.then(async collected => {
  if(collected.first().emoji.name == "๐Ÿ—‘๏ธ"){msg.delete(), message.delete()}
  else return message.channel.send("error")
})
break;

someitimes it just send a error that emoji is not define, but most of the time its working well
even when it dose send the error
its deleting it after 30s instead of instantly deleting

#

i dont see the problem

solemn latch
#

and this is the entire command?

tardy hornet
#

well, there is the embed

solemn latch
#

is there a specific line the error is pointing to?

tardy hornet
#

is there a specific line the error is pointing to?
@solemn latch no

lucid prawn
#

maybe it look for the channel called spam it every server I ๐Ÿค” @solemn latch

tardy hornet
#

sometimes it doing it in seconds like it should

#

and sometimes its taking to it 60s

solemn latch
#

well, it taking longer can be due to ratelimits or lag.

#

reactions have a harsh ratelimit

tardy hornet
#

i know, i thought it was because the host,

solemn latch
#

@lucid prawn its looking in the guild specific to member.
member.guild.channels.cache.find(ch => ch.name === 'general');

tardy hornet
#

but then i tried to do it on my own

#

with node .

#

and its still took time

lucid prawn
#

brb

solemn latch
blissful coral
#

Is it had I forgot about the rate limit event

#

Bad*

solemn latch
#

noo

#

it might be a good idea to have the event log into a private channel.

#

so you can see when ratelimits are caused.

#

but i dont think its needed.

lucid prawn
#

ok i recoded it to this ```js
const Discord = require('discord.js')
const client = new Discord.Client()

const config = require('./config.json')
const welcome = require('./welcome')

client.on('ready', () => {
console.log('The client is ready!')

welcome(client)
})

client.login(config.token)

#

@solemn latch

tardy hornet
#

yo @solemn latch i checked, and after it deletes that, it send:

#
(node:6440) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
    at RequestHandler.execute (D:\among us emojis\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async RequestHandler.push (D:\among us emojis\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
    at async MessageManager.delete (D:\among us emojis\node_modules\discord.js\src\managers\MessageManager.js:126:5)
(node:6440) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6440) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
vocal sluice
#

message.member
@tardy hornet isn't that for checking a members permission

wicked pivot
tardy hornet
#

@tardy hornet isn't that for a member not a bot?
@vocal sluice bro......

#

it actually say message.member

lucid prawn
#

ok i recoded it to this ```js
const Discord = require('discord.js')
const client = new Discord.Client()

const config = require('./config.json')
const welcome = require('./welcome')

client.on('ready', () => {
console.log('The client is ready!')

welcome(client)
})

client.login(config.token)

my code

umbral zealot
#

Do you have a question to go with that code?

paper cliff
#

No I have no question

lucid prawn
#

what

umbral zealot
#

@lucid prawn what is your question?

#

What's not working, what do you need, etc etc

#

Re-state the issue so we can know what you need.

safe quail
#

development

umbral zealot
#

@safe quail wtf are you even doing

safe quail
#

people who cant read

#

so they read it

umbral zealot
#

ok?

#

read what?

safe quail
#

the channels

umbral zealot
#

And you think your one message in each is going to accomplish what exactly

#

in channels that move up every minute

safe quail
#

uhh lokl

umbral zealot
#

It's 100% pointless.

safe quail
#

completely seeing the pointless\

earnest phoenix
#

with which module can we recover the images?
@wicked pivot node-fetch

#

i need help

#

ok

#

so i want to make bingo bot and i want to every 5 minutes to send results of bingo

#

how can i do that

#

or i cant

#

Use a timeout function

#

yes but how to make it automatically every 5 minutes

#

without command

#

like I said

quartz kindle
#

an interval

lethal grail
#

anyone know how to check the operating system using eval

earnest phoenix
#

yes but how i will send message

#

yep meant interval

solemn latch
#

get the channel, then send to it.

umbral zealot
#

@lethal grail it's more "check with nodejs", eval is just a way to run nodejs code

earnest phoenix
#

get the channel, then send to it.
@solemn latch how i will get their specific channel for bingo of every server

#

thats is my problem

#

bruh

lethal grail
#

... is there any way tho

umbral zealot
#

there's process and fs depending on what you need

#

and also the os module

#

it depends what oyu need to do

lethal grail
#

!eval process, i see

solemn latch
#

depends @earnest phoenix

umbral zealot
#

no..

earnest phoenix
#

what depends

umbral zealot
#

you d'ont just eval an entire module

#

You find what specifically you need to get, and you run that code.

solemn latch
#

if you want every server to select the channel, youd make a database to store that info

earnest phoenix
#

i have database

umbral zealot
#

whether it's run in eval or a .js file makes no difference, you still need to know what it is you want.

solemn latch
#

okay, store the ids of the bingo channels for each guild

#

then fetch those channels each interval and send to them.

earnest phoenix
#

yes but how i gonna remember servers what has that specific channel

#

do servers have id?

solemn latch
#

yes

earnest phoenix
#

yes

lucid prawn
#

hi

earnest phoenix
#

ok thanks

#

it helped alot

lucid prawn
#

i fix it @solemn latch

solemn latch
#

or something like that.

lucid prawn
#

what

solemn latch
#

was for shovel

lucid prawn
#

ok

sour cargo
#

hello~ i have a question

lucid prawn
#

what ur question

sour cargo
#

im trying to use discord.ext commands, however when I use the @client.event async def on_message(message): command none of my other commands like

async def _help(ctx):``` work
#

I feel like its an easy fix, like im missing one small thing

#

and whhen i comment out on_message, the help command works. If i keep it uncommented the help command doesnt work

lucid prawn
#

ummm sorry i cant help because i do javascript

sour cargo
#

:(

#

all good thanks tho

#

wait maybe this will help

#

ill let yyall know if it works

#

it works

earnest phoenix
#

how to get it

solemn latch
earnest phoenix
#

thx

hard anchor
#

Hey guys, how do I get my discord.py bot to randomly send memes?

north birch
#

Does doing some setInterval with 1000ms as an interval create a problem with the bot?

hard anchor
#

I don't know how to program an embed for memes haha

solemn latch
#

Set interval is fine to use even at 0ms

north birch
#

Set interval is fine to use even at 0ms
@solemn latch Perfect

olive vortex
#

hi I am new to this so not that experienced at this and was wondering how to get a bot to dm someone? i am on c# discord.net

humble rock
restive otter
#

one guys have code musique ?

#

dm me

lucid prawn
#

how do i fix this

if(!args[0]) return message.channel.send('Please mention someone to hug');

my error ```js
ReferenceError: args is not defined

humble rock
#

what is the problem?

lucid prawn
humble rock
#

how do i fix this

if(!args[0]) return message.channel.send('Please mention someone to hug');

my error ```js
ReferenceError: args is not defined

@lucid prawn mmmh

north birch
#

how do i fix this

if(!args[0]) return message.channel.send('Please mention someone to hug');

my error ```js
ReferenceError: args is not defined

@lucid prawn Can you send the full code?

solemn latch
#

@humble rock you need the Privileged presence intent to get presence data.

lucid prawn
#

๐Ÿ™‚

earnest phoenix
#

await client.send_message doesnt work can someone help me

solemn latch
#

what library

earnest phoenix
#

1.5.1

humble rock
#

Eris

earnest phoenix
humble rock
#

.....

solemn latch
#

py is on 1.5.1 so probably had to be it :p

earnest phoenix
#

Instance of 'Bot' has no 'send_message' member

solemn latch
#

yeah, dont think clients have that method.

humble rock
#

await client.send(<message>);

i use this, but i've different discord.py vers

slender wagon
#
async execute (args, msg){
const name = args.join(' ');```
it hit me with the args.join is not a function
lucid prawn
#

my coded

            if(message.content.startsWith(prefix + "hug" )){
                    if(!args[0]) return message.channel.send('Please mention someone to hug');
                  var embed = new Discord.MessageEmbed()
                        .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
            
                        .setTimestamp()
                        .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
                    message.channel.send(embed);
                }

my error

ReferenceError: args is not defined and poop is not defined
solemn latch
#

define args and poop

earnest phoenix
#

yes

lucid prawn
#

how

#

do

earnest phoenix
#

lol

slender wagon
#

define args and poop
the last one is easy

lucid prawn
#

i defined args

solemn latch
#

in the same scope?

lucid prawn
#

๐Ÿ˜•

earnest phoenix
#

await client.send(<message>);

i use this, but i've different discord.py vers
@humble rock thanks it works

humble rock
#
const args = message.content.slice(prefix.length).trim().split(/ +/g);
earnest phoenix
#

nvm

#

it doesnt

north birch
#

lmao

earnest phoenix
#

what function is used for dming people

solemn latch
#
{
  const args = arg def;
}
{
  console.log(args); // this line will error args was defined out of scope

}
#

user.send()

#

in most libs

earnest phoenix
#

what user

solemn latch
#

user class/object

earnest phoenix
#

how to get it

humble rock
#

@earnest phoenix
await ctx.send(<message>)

lucid prawn
solemn latch
#

no

humble rock
#
const args = message.content.slice(prefix.length).trim().split(/ +/g);
#

This work

solemn latch
#

thats showing how just because you define something doesnt mean it will be defined in other scopes

earnest phoenix
#

@earnest phoenix
await ctx.send(<message>)
@humble rock i want to dm more than 1 people

#

the result of bingo

#

i mean what they won

lucid prawn
#

new error

                    .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
                                                                                                        ^    

TypeError: Cannot read property 'username' of undefined
earnest phoenix
#

oh discord user

lucid prawn
humble rock
#

Maybe this
message.mentions.users.first().user.username

#

Or

const member = message.mentions.user.first()

member.user.username
solemn latch
#

message.mentions.users.first() is already a user object.

earnest phoenix
#

help

#

Module 'discord.user' has no 'send' member

solemn latch
#

what event are you trying to do this in

earnest phoenix
#

do you want to i send you my source code?

lucid prawn
#

the command work

#

but when it done like !hug it crash

restive otter
#

one guys have musique cmd please ?๐Ÿ™ƒ

solemn latch
#

we dont spoonfeed here

earnest phoenix
#

i want to do it in def sendResults(a,b,c,d,e,f)

lucid prawn
#

how do i fix it

#

@solemn latch

earnest phoenix
#

abcdef is numbers of result in bingo

#

@solemn latch

solemn latch
#

are you mentioning someone in the command @lucid prawn

lucid prawn
#

yes

#

when i dont mention it crash

solemn latch
#

okay, you need to add a check if someones mentioned

#

if(!message.mentions.users.first()) return; // send message maybe if you want?

earnest phoenix
#

how to dm someone with having only their id

solemn latch
#

fetch the user

earnest phoenix
#

and

solemn latch
#

then user.send() on the fetched object

earnest phoenix
#

but user.send doesnt work

#

as i said

solemn latch
#

did you fetch the user?

earnest phoenix
#

sec

solemn latch
#

or are you just writing discord.user.send

#

because that doesnt make sense

lucid prawn
#

like this @solemn latch

            if(message.content.startsWith(prefix + "hug" )){
                if(!message.mentions.users.first())
              var embed = new Discord.MessageEmbed()
                    .setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
        
                    .setTimestamp()
                    .setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
                message.channel.send(embed);
            }
solemn latch
#

i would return on that line

#

if(!message.mentions.users.first()) return;

#

and send a message if you want to saying you need to mention someone

lucid prawn
#

so here do i put it

earnest phoenix
#

what arguments user.send() needs

solemn latch
#

I think it only requires content, or an embed, or an attachment.

#

it would be on that docs page

earnest phoenix
#

what about fetched user?

solemn latch
#

fetching just requires the ID afaik

lucid prawn
#

if(!message.mentions.users.first()) return;

@solemn latch here do i put it

solemn latch
#

the same line you had it on

earnest phoenix
#

it doesnt work

#

still same error

solemn latch
#

can i see the lines?

earnest phoenix
#

yes

lucid prawn
#

no error

#

but it did not send

earnest phoenix
solemn latch
#

@lucid prawn only when you dont mention someone correct?

opal plank
#

delcaring on an if?

#

really?

#

if() var = this

lucid prawn
#

yes @solemn latch

opal plank
#

cant declare things on an if statement

earnest phoenix
#

yes

solemn latch
#

@lucid prawn isnt that what you want? you cant hug someone without mentioning someone else.

lucid prawn
#

thx

opal plank
#

or be edgy and hug yourself if you dont mention anyone

earnest phoenix
#

i will do what i needed to do from start

opal plank
#

actually thats a decent idea unironically

solemn latch
#

would be easy to do

#

||

earnest phoenix
#

what edgy means

#

edgy = nervous?

solemn latch
earnest phoenix
#

sorry google translate doesnt make sence

solemn latch
#

if i could describe it as anything, its like being 13, hating everything

boreal iron
#

Itโ€™s just a funny idea to huge yourself if you havenโ€™t mention anyone,

earnest phoenix
#

why would someone hate everything

boreal iron
#

Thatโ€™s what they wanna say

earnest phoenix
#

or make MissingArgumentError

#

r/im14andthisisdeep

lucid prawn
#

i only helped 466 Developers find answers to 968 problems.

#

on Grepper

earnest phoenix
#

why people are obsessed with anime

pure lion
#

why are people obsessed with having conversations in bot development channels

earnest phoenix
#

i am not obsessed

#

just begin noob on this server

#

ok i give up on dming people clearly i cant do that

solemn latch
#

lol

earnest phoenix
#

but seriously

#

there is no function for that

solemn latch
#

discord.user.send i dont think makes any sense

#

your looking at sending to the user, not discord.user.send

earnest phoenix
#

i wrote discord.user.send(fu, "message")

#

it doesnt work

solemn latch
#

i think you want fu.send("message")

molten yarrow
#

user.send("yourmessage")

solemn latch
#

.send sends to what its used on

earnest phoenix
#

ohhhh

#

you meam

#

user like username?

molten yarrow
#

and fetch the user before

solemn latch
#

^

earnest phoenix
#

that makes sence

solemn latch
#

which, fetch is also async isnt it ๐Ÿค”

#

when I think youll need to await it, or however py handles async.

earnest phoenix
#

it works now

#

thank oyu

solemn latch
#

or not KEKW

earnest phoenix
#

await or async

solemn latch
#

i dont know how python handles async stuff so if it works, it works

#

dont mind me

earnest phoenix
#

me too

sudden geyser
#

async function, await anything that's an async function/returns a coroutine

earnest phoenix
#

so its like def and return?

lucid prawn
#
   if(message.content.startsWith(prefix + "meme" )){
                if(!message.mentions.users.first()) return;
              var embed = new Discord.MessageEmbed()
                    .setDescription(message.author.username + ' memed ' + message.mentions.users.first().username)
        
                    .setTimestamp()
                    .setImage('www.meme.com/pooponme')
                message.channel.send(embed);
            }

how do i get it to change meme every time someone use the command

rustic nova
#

store the sent message and edit it each time they use your command

#

oh wait

#

you want a different each time you enter the command

#

use an api that gives you a random image each time

lucid prawn
#

how

rustic nova
#

parse the image url from the examples on the github and setImage with that url

lucid prawn
#

this is spoonfeeding

rustic nova
#

No

#

giving you the full code is spoonfeeding

#

explaining how you can make use of this is not

lucid prawn
#

ok

#

๐Ÿ˜• @rustic nova

rustic nova
#

read the Meme_api on there. You can parse the web request through that api and receive the image url to use in your MessageEmbeds .setImage

earnest phoenix
#

await fu.send("test") doesnt cause error but it doesnt dm user

lucid prawn
rustic nova
#

yup, the github documentation should explain it

earnest phoenix
#

can someone help me

rustic nova
#

does the user have dms disabled maybe?

molten yarrow
#

did u fetched the user?

rustic nova
#

and that

earnest phoenix
#

i am that user

#

yes i fetched

#

i did not disable dms

molten yarrow
#

show me this two lines where u fetch and send

earnest phoenix
#

ok

lucid prawn
#

my brain is died now @rustic nova

earnest phoenix
#

fu = client.fetch_user(i)
await fu.send("test")

#

i is the id

#

of user

rustic nova
#

If you are not able to understand what i sent, then you are unfortunately not able to do this with your current knowledge yet. Maybe come back to it once you have more experience in Web Requests

earnest phoenix
#

yes

#

@molten yarrow what now

#

oh i didnt put await when declaring "fu" nvm i fixed it

solemn latch
#

oh, i thought you said it worked

#

๐Ÿค”

earnest phoenix
#

yes your function works

#

but my declaration didnt

#

now it works

hasty mulch
#

Is there a way to show how many guilds my bot is in using the status with the Python language?

ancient nova
#

do you guys know any cool apis I can yoink for image manipulation

solemn latch
#

the yoink api

ancient nova
#

does that even exist

solemn latch
#

doubt it

ancient nova
#

I googled it

#

it actually does

solemn latch
#

lol

ancient nova
#

lol

solemn latch
#

is it cool

ancient nova
#

nah

#

a math one

solemn latch
#

oh wow, whoever made this put in a lot of work

#

screw work tho

ancient nova
#

lmao yes

solemn latch
#

the one dank memer uses

earnest phoenix
#
   if(message.content.startsWith(prefix + "meme" )){
                if(!message.mentions.users.first()) return;
              var embed = new Discord.MessageEmbed()
                    .setDescription(message.author.username + ' memed ' + message.mentions.users.first().username)
        
                    .setTimestamp()
                    .setImage('www.meme.com/pooponme')
                message.channel.send(embed);
            }

how do i get it to change meme every time someone use the command
@lucid prawn i would use superagent for that

ancient nova
#

@solemn latch it needs a key

solemn latch
#

most apis do

ancient nova
#

there's a lot that don't

earnest phoenix
#

most that i use dont

ancient nova
#

can you give me some for image manipulation please

solemn latch
#

lol

earnest phoenix
#

i have a log of those

#

some where on my computor

ancient nova
#

I'm too lazy to make one myself

#

so I use apis

#

lol

#

@earnest phoenix lemme add you

#

if you find them

#

then send them

#

okey?

earnest phoenix
#

ok

ancient nova
#

tysm

earnest phoenix
#

discord js tho

ancient nova
#

ye

earnest phoenix
#

k

ancient nova
earnest phoenix
#

im playing rouge company rn tho

solemn latch
#

they are apis ๐Ÿค” it doesnt matter the lib

ancient nova
#

don't worry

#

I'll wait

earnest phoenix
#

ok

solemn latch
#

wait, why is requesting a token bad

#

its actually seriously 7 questions

ancient nova
#

it's not

#

I just don't wanna

solemn latch
#

lol

ancient nova
#

use apis with tokens

#

ยฏ_(ใƒ„)_/ยฏ

solemn latch
#

whats the difference?

earnest phoenix
#

u guys got any code to log data in a json

ancient nova
#

@solemn latch time

solemn latch
#

๐Ÿค”

ancient nova
#

yup

lucid prawn
#

back

#

who ping me

earnest phoenix
#

scroll up

#

scroll

vapid rock
#

@hasty mulch

async def on_guild_join(guild: discord.Guild):
    await bot.change_presence(status=discord.Status.online, activity=discord.Game(f"Guilds: {len(bot.guilds)}"))

@bot.event
async def on_guild_remove(guild: discord.Guild):
    await bot.change_presence(status=discord.Status.online, activity=discord.Game(f"Guilds: {len(bot.guilds)}"))

@bot.event
async def on_ready():
    await bot.change_presence(status=discord.Status.online, activity=discord.Game(f"Guilds: {len(bot.guilds)}"))```
lucid prawn
#

ok

#

what superagent

earnest phoenix
#

google npm i superagent