#development

1 messages · Page 656 of 1

mossy vine
#

up to a week

earnest phoenix
#

okey

#

thx

hybrid ruin
#

@languid dragon w3schools

languid dragon
#

can you send link

hybrid ruin
#

Sure 1s

#

Lighter color, round borders, same result

#

I spoke to Dreams in DMs about it twice, they said it was fine in both cases

languid dragon
tight heath
#

w3schools is bad

#

use mdn

mossy vine
#

wasnt w3schools the site that had obvious sql injection vulnerabilities in their sql examples

tight heath
languid dragon
#

@hybrid ruin why would you speak to a mod about css?

#

my question is why it looks extremely similar to another persons design

#

and by similar i mean it's quite literally the same CSS + colours

hybrid ruin
#

Because I looked at it, liked the design, and wanted something similar, so I asked Dream if it was okay to do so, and they said yes

languid dragon
#

but you did the exact same colours and design :^)

hybrid ruin
#

Okay

languid dragon
#

copying someone elses work :^)

tulip wave
#

Ken isn't that like Evey Turkish bot tho

indigo geyser
#

(Python) How can I emb a link in a Title? (I know how to do it in a descr or in a value)

#

Pls helpExcusemeWtf

late hill
#

Embeds have a URL property which is what clicking the title will link to

#

So check the docs for your library

#

They'll probably have it as a separate property too

earnest phoenix
#

How do y’all feel about a website being made strictly in HTML5, CSS, and JS?

mossy vine
#

as in no stuff like react or angular or anything like that?

earnest phoenix
#

Mhm!

slim heart
#

Fine but when it comes to really beefy sites like anything you see on the internet it’s better to do something like react or angular, even ejs

#

I’d say the steps would be
Normal Stuff => PHP => ejs => react then probably make ur own framework or something

mossy vine
#

for static sites its pointless

slim heart
#

Well yeah but for genuine sites that’d be the route probably

#

Like for actually useful sites lol

mossy vine
#

should i bother implementing analytics in my bot? its a simple and small bot (~270 guilds) bot the people who use it love it. several people went out of their way to contact me and tell me that they like the bot and enjoy using it. since the bot is extremely small, i dont know if implementing analytics would be benefitial at all, or if i should focus on something else

slim heart
#

You can use Marcos built in analytics for now honestly

#

It gives good insight and perfect for small creators who don’t want to dedicate their time to making analytics it’s just not very good for larger bots cuz it only keeps track of 30 days

mossy vine
#

im talking about more than just guild counts

#

for example activity in servers and by users

slim heart
#

Hm, well, if it’s not too difficult to setup it is quite satisfying to look through large analytics like that

mossy vine
#

probably

#

i would love to add more to the bot but the concept itself is extremely limiting

#

12 lines of code

#

that includes stat posting to bot lists

slim heart
#

Wym?

mossy vine
#

the concept is the following: you send a specific message, bot responds with specific thing

#

honestly, implementing analytics might be fun

#

but idk if its worth my time

#

and another thing is how much i want to know and what is considered being too nosey

#

i would love to know which channels it gets used the most in, but that would include collecting the name and idk if i want that mmLol

#

im guessing listing all guilds and their channels would be breaching privacy?

#

guild names, channel names, channel topics

earnest phoenix
#

not rl

#

unless its private servers

#

and its with invites

mossy vine
#

yeah but how do you know if a server is private or not

earnest phoenix
#

welp if u leak invites then

#

its breach

#

techniclly

mossy vine
#

i dont want invites

earnest phoenix
#

welp i aint leaking it anyway xd

#

from ma bots

halcyon nymph
#

@mossy vine what language do you programme in?

mossy vine
#

js

#

why?

earnest phoenix
#

py

slim heart
#

@mossy vine you can view them yourself just not release them

mossy vine
#

@slim heart okay good thanks

slim heart
#

As long as they’re encrypted in a db u can view atleast

mossy vine
#

i was gonna dump them in plaintext and view them

opaque eagle
#

Ok marco

slim heart
#

Or you can make them accept a tos on join that says channel names can be exposed etc.

#

Hm plaintext might not be enough be tbf it’s not like discord can snoop ur host

mossy vine
#

yeah vim can encrypt text files

#

so if i dump them in plaintext then encrypt with that

#

and obviously dont share anything

#

i should be fine?

slim heart
#

Shoooould

#

Obviously it’d be better to just push to an encrypted database but

sacred minnow
#

how can i make text in canvas be smaller if theres more text?

mossy vine
#

wdym

#

yes

quartz kindle
#

@sacred minnow you can use the maxWidth option

#

maxWidth Optional
The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text. However, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width.```
sacred minnow
#

and how can i make it put a line break every x characters?

quartz kindle
#

there are no line breaks in canvas, you have to change the x/y coordinates to change the line. so you either split your text into sections based on character count, and each section gets its own fillText, or you can use measureText to get the size of the rendered text to make sure it fits the size you wish

sacred minnow
#

ok

#

thank you

earnest phoenix
#

can someone help me with shards

#

43

#

the one i have atm

#

ima gon be making a new one

#

rn

#

thats why i want shars

#

shards

#

i want it

lime fiber
#

Discord.py

Why is my 1.2.3 bot load the jsons, but not????

It is working in 0.16.12 somehow !!!!????

with open("filtersettings.json") as f2:
    filteropts = json.load(f2)

I've got no errors, but nothing in filteropts.

waxen meteor
#

whee

slender thistle
#

They need a dict from that JSON file

#

And that snippet looks fine

halcyon nymph
#

Oh k

lime fiber
#

The problem fixed.

It was just the new discord.py int str thing

waxen meteor
#

What the hell is up with bot.say in the latest Discord.py version

slender thistle
#

it's Messageable.send

#

Messageable is any object you can send a message to

#

Use ctx that you pass in function params

waxen meteor
#

um ok

#

so what would I change await bot.send_message(bot.get_channel('539982011713191967'), 'Bot is now online! Time: ' + time.asctime()) to?

slender thistle
#

<text_channel>.send(some_content)

#

And IDs are int now

waxen meteor
#

Oh, they are now?

#

Fucking hell.

#

I need to change all my fucking JSON files.

#

I don't have a real database :/

slender thistle
#

Or just iterate through each key, convert IDs to int and overwrite the previous data

waxen meteor
#

alright, first I gotta change every single instance of bot.say or bot.send_message

#

whee

slender thistle
#

F

#

Migration be like that sometimes

waxen meteor
#

And game presence

#

That's proken too

#

broken*

#

I should've just stayed back at 1.0.1

#

or whichever version I was using before

slender thistle
#

Definitely not 1.0+ :p

#

So 0.16.12

waxen meteor
#

I was on rewrite

#

It had the async/await stuff which is only rewrite, right?

slender thistle
#

rewrite didn't have str IDs

bright spear
#

async didnt have async? what

shy turret
#

Does anyone how to fetch a user by id?

earnest phoenix
#

in which library

shy turret
#

discord.js

mossy vine
#

client.users.get(id)

earnest phoenix
#

it will attempt to pull the user from cache first, if it fails it's going to make a REST request to get the information about the user

shy turret
#

how still don't know...

#

message.fetchUser

#

?

mossy vine
#

why message WaitWhat

shy turret
#

idk

#

client.get.fetchUser

#

idk

mossy vine
#

why get

#

client.fetchUser

earnest phoenix
#

did you not read the link

mossy vine
#

did you even look at the link cry sent

shy turret
#

imma noob

#

so do test = client.fetchUser(id)

earnest phoenix
#

if you don't await it, test will be a promise

mossy vine
#

its a promise so you should await it

#

or if you dont want async, use .then()

slender thistle
#

@bright spear async branch was, in fact, asynchronous

#

Unless I'm missing something

maiden mauve
#

anyone ever get weird websocket errors from discord?

#

my bot crashed while i was asleep and console was a ton of discord server errors

mossy vine
#

i remember that yesterday people were complaining about 500 errors

maiden mauve
#

can you even handle stuff like that? I'm not even sure what prompted it

#

it would be catching the "on event" code block I suppose

earnest phoenix
#

Question? For the Yui Bot how can you make self assignable roles like, press on a reaction for a certain role

halcyon nymph
earnest phoenix
#

I'm not sure- Like I'm using it for a server

turbid gale
#

Looks for the support server on its page

mossy vine
#

@halcyon nymph what

#

how is that related to the question

#

lmao

earnest phoenix
#

it sent me here

mossy vine
#

wrong button then

opaque eagle
mossy vine
#

click the "Support server" button

#

or that

earnest phoenix
#

oh ty

turbid gale
#

Someone sent them here for some reason

opaque eagle
#

No they click on the Join Discord button at the top of the page, which takes them here

turbid gale
opaque eagle
turbid gale
#

Is what I mean

opaque eagle
#

oh

earnest phoenix
#

Oh, so I pressed that and it sent me here

#

for some reason?

#

but it's all good now

west sand
#

how can i make my bot to create a forever invite ? in discord.js

grim aspen
#

what do you exactly mean by that? like generate an invite when requested that doesn't expire?

west sand
#

yes

earnest phoenix
#

does anyone know if bots are able to send custom statuses yet

#

if so, which type is it

grim aspen
#

i don't think bots can do it automatically

earnest phoenix
#

wot

grim aspen
#

but you can generate 1 invite that last forever, oh i meant to knzo's question

earnest phoenix
#

oh, my bad

west sand
#

not automatically

cursive dagger
#

Bots cant do it cause they cant have statuses with a set id

#

sadly

west sand
#

i make it generate invite only for 2 hours

#

i want it to never expire

earnest phoenix
#

wym @cursive dagger

#

the guild id parameter in the op?

#

i can attempt to mimic it, i just dont know if you can send it yet

cursive dagger
#

custom statuses

west sand
#

..

#

i use this and i want the invite to never expire

message.channel.createInvite().then(invite => {
})```
quartz kindle
west sand
#

okay ..

earnest phoenix
#

anyone here good with html?

pale marsh
#

Just ask your question and if someone knows how to help they'll drop by

earnest phoenix
#

Alright, Im trying to make an "Embed" like the discord.js.org link has above and im not sure how to. Or what to ever search to find some documentation on it

pale marsh
#

meta tags

#

I don't remember how exactly

earnest phoenix
#

Ah, okay thank you

pale marsh
#

@earnest phoenix try looking for Open Graph Protocol

#

I think that was it iirc

earnest phoenix
#

Alright

opaque eagle
#

Is there a way to eval js code in rust?

indigo geyser
#
@client.event
async def on_reaction_add(reaction, user):
  message = reaction.message
  if reaction.message.author == client.user:
    if user.id != client.user.id:
      if message.content == 'Will you participate?':
        if reaction == '![join](https://cdn.discordapp.com/emojis/599185765741756458.webp?size=128 "join")':
          emb = discord.Embed(title='New Join!', description = f'<@{user.id}>', colour = 0x66d4af)
          await message.channel.send(content=None, embed=emb)

does not recognize the reaction

#

pls help

slender thistle
#

rtfd

#

reaction isn't an emoji

earnest phoenix
#

you're comparing a whole reaction to an emoji object

dusky marsh
opaque eagle
#

ty

slender thistle
#

a stringified version of emoji, to be precise

indigo geyser
#

ok ty

vagrant bison
#

help me

#

lol

naive gull
#

epic

vagrant bison
#

?

#

what?

sudden geyser
#

lol

late hill
#

One vps for all bots or split them up megunani

vagrant bison
#

??

late hill
#

I like having them all on the same but like if I want to upgrade it would be double what I have now

#

Which I really don't need meguded

vagrant bison
#

WHY???

earnest phoenix
#

I DONT KNOW????

vagrant bison
#

/:

smoky spire
#

we can't do anything if you give us nothing

naive gull
#

^

mossy vine
#

we were given the unexpected behavior

#

now our task is to figure out whats wrong

silver light
mossy vine
#

right click the image

#

click download/save idk what it is

silver light
#

ah frick i ment automatically using a bot

#

meant*

mossy vine
#

oh lol

quartz kindle
#

which lang?

#

make an http request and save it as binary

mossy vine
#

thats an album link anyways

silver light
#

idk how to do that lol

quartz kindle
#

which lang?

silver light
#

whats lang

quartz kindle
#

language

silver light
#

python

quartz kindle
#

idk python, but probably with aiohttp

silver light
#

k

#

i have no idea how to use aiohttp lol

slender thistle
#

Use aiohttp if you want to implement that in your Discord bot

quartz kindle
#

then learn

mossy vine
#

any module that can do http requests really

naive gull
#

lol idk means its from a yt tutorial?

trail dagger
#

Why does this command add like 500000 roles named 'Muted* when it should just add one role

    async def mute(self, ctx, member: discord.Member=None):
      for role in ctx.guild.roles:
        if not role.name == 'Muted':
          await ctx.message.guild.me.guild.create_role(name="Muted")
          role = discord.utils.get(member.guild.roles, name="Muted")
          await member.add_roles(role)
        else:
          role = discord.utils.get(member.guild.roles, name="Muted")
          await member.add_roles(role)```
slender thistle
#

and requests is usually a good thing for sync code

silver light
#

k

naive gull
#

lmaooo when you copy and paste a code but dont understand it

woven zealot
#

for every role in roles
if it's not muted, make a new role called muted

hmmm

slender thistle
#

Well obviously you are iterating through guild.roles and create a role

trail dagger
#

I understand it jack ass

slender thistle
#

Don't fight kids

naive gull
#

how dont u see what it is doing then lol

topaz fjord
mossy vine
#

i think you are creating a role every time a role isnt the muted role

topaz fjord
#

^

naive gull
#

if there isnt a role called "Muted" it will make one and give that

mossy vine
#

and then adding it

topaz fjord
#

Instead you should fetch the role muted and if it doesn't exist create it

#

Instead of looping through all the roles

mossy vine
#

^

naive gull
#

^

slender thistle
#

Honestly, discord.utils.get where the iterable is guild.roles and name kwarg is 'Muted'

#

Works just fine

trail dagger
#

Oh now i see

#

Thanks

naive gull
#

why do people like adding a role silently lol

topaz fjord
#

Because people are incompetent and can't follow directions

naive gull
#

ah

opaque eagle
#

For some reason, whenever I do export PREFIX="+" and do any of these tasks, I get those results:

echo $PREFIX in bash -> '+'
process.env.PREFIX in Node REPL -> '+'
console.log(message.content, process.env.PREFIX); during messageCreate event in my bot -> +help /usr/local

indigo geyser
#
@client.event
async def on_reaction_add(reaction, user):
  message = reaction.message
  if reaction.message.author == client.user:
    if user.id != client.user.id:
      if message.content == 'Will you participate?':
        if reaction == ':join:':
          emb = discord.Embed(title='New Join!', description = f'<@{user.id}>', colour = 0x66d4af)
          await message.channel.send(content=None, embed=emb)

pls help, it doesen't work again with the reaction

earnest phoenix
#

you made it even worse

indigo geyser
#

rip

earnest phoenix
#

all you had to do was compare reaction.emoji instead of reaction

indigo geyser
#

WumpusColorGif thanks

#

reaction = reaction.emoji?

#

@earnest phoenix

earnest phoenix
#

jesus christ

indigo geyser
#

ohno

#

i didn't understand

opaque eagle
#

Can someone help me figure out why the last part happens?

#

When I either a) echo the env or b) log the env in node repl, it works fine... when I log it during the message event of my bot, I get /usr/local

#

I still have the same problem even if I change the env

#

This error is driving me nuts

inner jewel
#

what does yarn start do?

#

whatever it does is ignoring that env var

#

or overwriting it

pale marsh
#

Try running node directly

sick cloud
dusky marsh
#

what are your margins on the body element

sick cloud
#

i got it, turns out i needed box-sizing

silver light
#

for discord.py, is there like a message.content for embeds

opaque eagle
#

yarn is like npm but faster

#

anyways I strongly feel like the problem is with my node.js nightly builds

#

i switched over to a docker container with stable node and it works fine

earnest phoenix
#

can someone tell me why my rob command not working tho

#
    

    let user = message.mentions.members.first()
    let targetuser = await db.fetch(`bal--${user.id}`) // fetch mentioned users balance
    let author = await db.fetch(`bal--${message.author.id}`) // fetch authors balance


    if (!user) {
        return message.channel.send('User not found.')
    }
    if (author < 500) { // if the authors balance is less than 500, return this.
        return message.channel.send(`You need at least $500 to rob somebody.`)
    }

    if (targetuser <= 0) { // if mentioned user has 0 or less, it will return this.
        return message.channel.send(`${user.user.username} does not have anything to rob.`)
    }


    let random = Math.floor(Math.random() * 500) + 1; // random number 500-1, you can change 500 to whatever you'd like


    let embed = new Discord.RichEmbed()
    .setDescription(`${message.author} you robbed ${user} and got away with ${random}!`)
    .setColor("GREEN")
    .setTimestamp()
    message.channel.send(embed)


    db.subtract(`bal--${user.id}`, random)
    db.add(`bal--${message.author.id}`, random)
  }
    ```
sudden geyser
#

Do you get an error, or just nothing

earnest phoenix
#

nothing

half pike
#

Hi

earnest phoenix
#

Hi

#

Do you need help

#

@half pike

slender thistle
#

@silver light message.embeds?

half pike
#

Hi there

#

My knight should be here

steel trellis
#
let emojiList = message.guild.emojis.map((e) => e.name + " " + e).join('\n');
        if(emojiList.length > 1000) {
            let emojiList = "Character count is too large!"
        }

I get an error saying that the RichEmbed field is too large (the emojiList)

sinful lotus
#
let emojiList = ...
if (...) {
  let emojiList = ...
}
#

you are not changing the value of the first emoji list

steel trellis
#

how would i change it then...

#

i’m used to variables so yeah

half pike
#

Hi

sinful lotus
#

as simply as

let emojiList = ....
emojiList = ...

Basic JS concept,
Please review your JS knowledge, clearly you are coding in blind here and have not sufficient knowledge yet
@steel trellis

steel trellis
#

dude i’m at an airport currently my brains gone to shit

dusky marsh
#

It's still extremely simple as to what the issue would've been, brain having been 'gone to shit' or not

steel trellis
#

look the last thing i wanna be doing is fixing code on my phone, there’s a couple more errors i gotta get thru i’m just stressed, tired and pissed off

#

anyways thank you for helping me fix this little problem

opaque eagle
#

I'm trying to send a 404 error in a small server with the HTTPS module but I'm running into some trouble here... ```js
const https = require("https");

https.createServer((req, res) => {
res.writeHead(404, { "Content-Type": "text/plain" });

res.write("404 Not Found");
res.end();

}).listen(4000);``````
$ curl localhost:4000
curl: (52) Empty reply from server```

earnest phoenix
#
const randomApi = require('some-random-api');
const Discord = require("discord.js");

module.exports.run = async (client, message, args) => {

    if(!args[0]) return message.channel.send("**:x: `tb!lyrics artist-song`**");
    
    var lyrics = await randomApi.lyrics(args[0]);
    console.log(lyrics);
    
  if (lyrics.lyrics.length > 2048) return message.channel.send(":x: Sorry, The lyrics were too long.");
 
   let embed = new Discord.RichEmbed()
    .setAuthor("Lyrics of "+lyrics.title+" - "+lyrics.author)
     .setThumbnail(lyrics.thumbnail.genius)
    .setDescription(lyrics.lyrics)
    .setColor("RANDOM")
    .setFooter(client.user.username, client.user.avatarURL)
    .setTimestamp()
   message.channel.send(embed);
}``` how to fix length problem using multiple embeds?
#

split the string by the latest possible space that doesn't go over the char limit

#

can you provide an example?

spare goblet
#

use substring

#

<string>.substring(0,1000) is usage

proper inlet
#

How can I send a DM message to a person by id? (discord.js)

earnest phoenix
#

client.users.get("id").send("I have send this DM")

mossy vine
#

its better to use fetchUser

#

cuz if the user is not cached it will fetch it from the api

proper inlet
#

(node:10948) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined

spare goblet
#

Yeah use fetchUser then

#

Because of what Cyber said above

twilit rapids
#

And that error comes when you send to an unfeched user^

proper inlet
#

Thank you very much!

#

Why it doesn't work?

client.fetchUser("id")({ 
}).then((user) => {
for(let i = 0; i < 5; i ++)
{
user.send("test message");
} 
});

ERROR : TypeError: client.fetchUser(...) is not a function

earnest phoenix
#

The fuck is that

#

Why the ({})

#

Theres also one user from fetchUser

#

Oh nvm ur looping messages

proper inlet
#

How do I do this? I do not know well discord.js

tight heath
#

Why would you pass an empty object to the result of fetchUser

languid dragon
#

yes

tight heath
#

@proper inlet do it without the ({})

sinful lotus
#

fetchUser is a promise @proper inlet

#

oh you are usiing ,then

#

didnt notice that

#

but that ({}) is certainly not needed

tight heath
#

It breaks

#

Actually

#

Since it's a function call unto a promise

#

Like what

sinful lotus
#

also why you want to send a user 5 messages

tight heath
#

yes

mossy vine
#

it makes no sense lol

sinful lotus
#

do you want to annoy them or something

tight heath
#

Let's not question the objectives

sinful lotus
#

well if I see that bot on queue I'll just mmLol

tight heath
#

I suggest you mmulu

frank wyvern
#

Anyone know how to get who deleted a channel - discord.py?

slender thistle
#

Audit logs should have that

frank wyvern
#

@slender thistle How do I get who did it though, I can get which channel was deleted?

slender thistle
#

AuditLogEntry is returned from guild.audit_logs()

#

And that object has name property

#

The user who initiated this action. Usually a Member, unless gone then it’s a User.

frank wyvern
#

brill thanks

earnest phoenix
#

how i can parse args in command

#

(not regex)

languid patio
#

Is there a way to let a music bot enter without commando summon, and then write play and he goes in alone?
(my english is not the top)

stray garnet
#

module.exports.run = async (bot, message, args) => {
  message.delete();
  
  if (!message.member.hasPermission(`ADMINISTRATOR`)) return message.reply('no permission!').then(msg => msg.delete(15000));
  
  let user = message.mentions.users.first();
  if (!user) return message.channel.send("Please mention a user");
  
  const reason = args.join(" ").slice(22);
  if(!reason) return message.channel.send("Please specify a reason.");
  
  const logsChannel = message.guild.channels.find(r => r.name === "log") || message.channel;
  if(!logsChannel) return message.channel.send("Internal Error");
  
  message.guild.member(user).ban(reason);
  message.channel.send(`@${user} was banned.`);
  
  const embed = new Discord.RichEmbed()
  .setTitile("User banned")
  .addField("Banned user", user)
  .addField("Banned by", message.author)
  .addField("Reason", reason)
  .setColor("f10000")
  
  logsChannel.send(embed);
  
}
module.exports.help = {
   name: "ban",
   aliases: ["*"]
}```

it dont sends an message in the "log" channel
sudden geyser
#

Is something sent instead, or no response

stray garnet
#

no response

sudden geyser
#

nvm I'm an idiot

stray garnet
#

lol why?

sudden geyser
#

Stable allows for <Message>.delete(ms) but master has <Message>.delete({ timeout: ms }). I don't see the actual problem unless it's something like that

#

Is the message sent getting deleted too (the top method)

stray garnet
#

@sudden geyser Ok

earnest phoenix
#

thx i will use regex

fading wigeon
#

@earnest phoenix you can literally split spaces

#

bruh

west spoke
#

message.content.split(" ", # of words needed, ex 3)

#

For py

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

the command is undefined then

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

marsh pier
#

show code

#

@sage bobcat

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

index.js

marsh pier
#

index js till line 19

sage bobcat
#

One message removed from a suspended account.

woven zealot
#

Are you definite command.help or are you just defining command.name

#

because it can't read name of undefined and what appears to be undefined is props.help

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

woven zealot
#

If that's in your command file and there aren't any other errors then I have no idea what the problem is

#

godspeed

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

console.log(props)

#

one of them might be broken

topaz fjord
#

^

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

right after you define props in your command loader

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

that should log the contents of all commands

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

put it before the bot.commands.set

quartz kindle
#

^

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

Are those the only commands

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.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hollow saddle
#

That’s why I have auto save enabled bloblul

waxen meteor
#

So I'm trying to make a temporary command for my friend's server to apply roles to everyone that's already there, except I'm not sure how to make it work right. Here's the code:

    @commands.command(pass_context=True)
    async def execute_macro(self, ctx):
        await ctx.message.channel.send("Ok here we go")
        for member in ctx.message.guild.members():
            if (member.bot != True):
                try:
                    role = discord.utils.get(ctx.message.guild.roles, id="600446514254577664")
                    await member.add_role(role)
                    role = discord.utils.get(ctx.message.guild.roles, id="600447866997178368")
                    await member.add_role(role)
                    role = discord.utils.get(ctx.message.guild.roles, id="600446000783425542")
                    await member.add_role(role)
                    await asyncio.sleep(1)
                except Exception:
                    await ctx.message.channel.send("Something happened")
        await ctx.message.channel.send("Executed. Any errors will appear on the console.")
#

And here's my error:

Ignoring exception in command execute_macro:
Traceback (most recent call last):
  File "C:\Users\fires\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\fires\PycharmProjects\Chocobot\owner_cmds.py", line 97, in execute_macro
    for member in ctx.message.guild.members():
TypeError: 'list' object is not callable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\fires\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\bot.py", line 863, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\fires\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 728, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\fires\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 88, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'list' object is not callable
slender thistle
#

guild.members is a list

#

not a function

waxen meteor
#

But is it possible to iterate through a list with a for loop?

slender thistle
#

Yes?

#

A list is iterable

waxen meteor
#

That's what I'm trying to do

#

with for member in ctx.message.guild.members():

#

And I probably have to compensate for ratelimits better

woven zealot
#

the () makes it call a function

waxen meteor
#

Oh, and now this

#
'Member' object has no attribute 'add_role'
cursive dagger
#

Its add_roles

waxen meteor
#

oh ok

slender thistle
#

Which one is usually more memory efficient?

from .package import *

or

import package
```?
swift topaz
#

Let's say I'm making a bot command for class officers, and I want that command to have a default sendMessage output if I don't provide a second argument. How do I do this? This doesn't seem to work:

    
        msg.channel.send('Officers:\nAdviser: \nPresident \n');

        if(args[1] === 'president'){
            msg.channel.send('The president is...');
        }
        else if(args[1] === 'adviser'){
            msg.channel.send('The adviser is...');
        }

        else{
            msg.channel.send('Invalid argument.');
        }

    break;
}```
mossy vine
#

check for length of args

near igloo
#

how will i publish my html project

swift topaz
#

I did something like this:

if(args[1].length === 0){
            msg.channel.send('Officers:\nAdviser: \nPresident \n');
        }

and it doesn't work. I know the logic but I just can't seem to use the right syntax

near igloo
#

how will i publish my html project

#

how will i publish my html project

cursive dagger
#

Dont spam

near igloo
#

im not spamming

cursive dagger
#

You are

#

And you just buy a host?

near igloo
#

i want it for FREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE............

#

Im nott spaming tho

earnest phoenix
#

bruh momentom

near igloo
#

?

#

bruh?

#

for what?

cursive dagger
#

Everything in life isnt free

near igloo
#

will any 1 help me to publish my html project

topaz fjord
#

free hosting

near igloo
#

Epic stop typing

topaz fjord
#

What a joke

near igloo
#

Epic is a LIE

cursive dagger
topaz fjord
#

free hosting is a lie

near igloo
#

My Life IS a LIE😰

mossy vine
#

you can use github pages

#

its free and actually good

slender thistle
#

Let's not get too off-topic 👀

near igloo
#

OH REALLYYYY?

mossy vine
#

its perfect for hosting static websites

#

so as long as its just html it will handle it perfectly for you

near igloo
#

YAY THANK U

#

NOW MY LIFE IS NOT A LIE

#

BUT EPIC WAS A LIE

#

BYE

topaz fjord
#

@mossy vine mmLol GitHub gey

mossy vine
#

it works

near igloo
#

.... IT SEEMS TO WORK VERY WELL

mossy vine
#

ok now stop using caps thanks

near igloo
#

namasta

stray garnet
#
const bot = new Discord.Client();
const snekfetch = require('snekfetch');
exports.run = async (client, message, args) => {
    try {
        const { body } = await snekfetch
            .get('https://www.reddit.com/r/dankmemes.json?sort=top&t=week')
            .query({ limit: 800 });
        const allowed = message.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
        if (!allowed.length) return message.channel.send('It seems we are out of fresh memes!, Try again later.');
        const randomnumber = Math.floor(Math.random() * allowed.length)
        const embed = new Discord.RichEmbed()
        .setColor(0x00A2E8)
        .setTitle(allowed[randomnumber].data.title)
        .setDescription("Posted by: " + allowed[randomnumber].data.author)
        .setImage(allowed[randomnumber].data.url)
        .addField("Other info:", "Up votes: " + allowed[randomnumber].data.ups + " / Comments: " + allowed[randomnumber].data.num_comments)
        .setFooter("Memes provided by r/dankmemes")
        message.channel.send(embed)
    } catch (err) {
        return console.log(err);
    }
}
module.exports.help = {
  name: "meme",
  aliases: []
}```

Error:
#

Error: Cannot find module 'snekfetch'6:22 PM

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)6:22 PM

at Function.Module._load (internal/modules/cjs/loader.js:508:25)6:22 PM

at Module.require (internal/modules/cjs/loader.js:637:17)6:22 PM

at require (internal/modules/cjs/helpers.js:22:18)6:22 PM

Jump to

at Object.<anonymous> (/app/c/hof.js:3:19)6:22 PM

at Module._compile (internal/modules/cjs/loader.js:701:30)6:22 PM

at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)6:22 PM

at Module.load (internal/modules/cjs/loader.js:600:32)6:22 PM

at tryModuleLoad (internal/modules/cjs/loader.js:539:12)6:22 PM

at Function.Module._load (internal/modules/cjs/loader.js:531:3)

#

Error: Cannot find module 'snekfetch'6:22 PM

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)6:22 PM

at Function.Module._load (internal/modules/cjs/loader.js:508:25)6:22 PM

at Module.require (internal/modules/cjs/loader.js:637:17)6:22 PM

at require (internal/modules/cjs/helpers.js:22:18)6:22 PM

Jump to

at Object.<anonymous> (/app/c/hof.js:3:19)6:22 PM

at Module._compile (internal/modules/cjs/loader.js:701:30)6:22 PM

at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)6:22 PM

at Module.load (internal/modules/cjs/loader.js:600:32)6:22 PM

at tryModuleLoad (internal/modules/cjs/loader.js:539:12)6:22 PM

at Function.Module._load (internal/modules/cjs/loader.js:531:3)

mossy vine
#

did you try running npm i snekfetch

amber fractal
#

Yeah, you dont have snekfetch

#

Which is outdated anyways

stray garnet
#

huh but... it worked before

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

Depends where they are stored

stray garnet
#

@mossy vine didnt worked but Luckily i had an backup that i made yesterday

swift topaz
#

how do I get the bot's thumbnail for an embed thumbnail?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

Yes

#

Depends where those are stored

#

Like, if you store them at client.commands, you should log client.commands

swift topaz
#

yeah but the parameter. I got it now. bot.user.avatarURL

#

Is there a syntax for like, a certain command is only usable by users with certain roles in them?

#

"member.hasRole.equals(roleName)" is what I'm thinking

tight heath
#

master or stable

swift topaz
#

how does that work?

tight heath
#

(require('discord.js').version)

#

Tell me your version

swift topaz
#

11.5.1

tight heath
#

And I'll tell you the code

#

So stable

#

member.roles.has("id")

swift topaz
#

is there a way for me to make a member object or I don't need to?

tight heath
#

Members are objects

#

And why would you make one

#

A guild in discord.js has a Collection of GuildMembers

#

Mapped by ID

swift topaz
#
 if(member.roles.has("Server Master")){
            if(!args[1]) return msg.reply('Specify the number of chats to delete.');
        
            msg.channel.bulkDelete(args[1]);
        }
``` this should work right?
#

I have no one online in my server to test it with

tight heath
#

A name is not an ID

#

Your user name is Viciou

#

Your user ID is 285060581176901633

#

names are not unique

#

IDs are

#

That's why they're used as keys

#

So first, you'd have to get the ID of the role

#

I suggest const serverMaster = msg.guild.roles.find(r => r.name === "Server Master").id

swift topaz
#

and then that variable serverMaster will be placed inside the member.roles.has(serverMaster) like this?

tight heath
#

Yes

swift topaz
#

I get a ReferenceError: member is not defined

tight heath
#

member => msg.member

#

You didn't define what member is

#

So the line becomes

#

if(msg.member.roles.has.....

swift topaz
#

ohhhh I get it now thanks!

#

msg.member means the sender of the message right? If I try to say it in plain English

tight heath
#

well

#

there's two properties

#

msg.author

#

Literally "Message Author"

#

And msg.member

#

imo js is not very good for clear English

#

You gotta think in that object/property way

cursive dagger
#

I am getting

#
Error: 
/D:/Desktop/DBLMC/out/production/DBLMC/windows/source/mainScreen.fxml:9

When trying to load this FXML document

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

I have no clue, share some code

sage bobcat
#

One message removed from a suspended account.

tight heath
#

Are you using anidiots.guide

sage bobcat
#

One message removed from a suspended account.

tight heath
#

Or discordjs.guide

#

Or any video

#

Or komada

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

I doubt that since you can't even tell me where you store your commands

#

Which implies you have either a prebuilt command handler

#

Or none at all

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

Thanks

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

client.commands

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

:)

sage bobcat
#

One message removed from a suspended account.

sacred minnow
#

i need some help, let rep = await db.fetch(`rep_${message.author.id}`) does not output the rep of the author, why?

#

it outputs someone elses rep

warm marsh
#

Probably store it incorrectly.

earnest phoenix
#

Hey guys! I'm making a multi-language discord bot. So if you speak any other language than English and are interested in becoming a translator, dm me! dblSmile

cursive dagger
#

Just use google translate smh

earnest phoenix
#

@cursive dagger heck no MegaThonk

#

Also, isn't this the right channel? I mean, it's about the development of the bot...

sage bobcat
#

One message removed from a suspended account.

tight heath
#

@sage bobcat well use it somewhere where your client is defined

#

Like in the index.js

sage bobcat
#

One message removed from a suspended account.

tight heath
#

No

amber fractal
#

They did, it says index.js:44

tight heath
#

Client is not defined there tho

amber fractal
#

Yeah, that was obvious

#

@sage bobcat are you sure you called it client

tight heath
#

Well thanks for the conversation

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

You have it named bot

#

Gotta know your variables

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tight heath
#

Why would you name it bot

amber fractal
#

A lot of people do

#

My bot has it called bot, my newer private ones call it client

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

But it's just a variable you can call it whatever you want

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.

#

One message removed from a suspended account.

topaz fjord
#

Can you send the whole thing

sage bobcat
#

One message removed from a suspended account.

topaz fjord
#

Not just that part

#

The whole file in a pastebin

#

Index.js

sage bobcat
#

One message removed from a suspended account.

tight heath
#

console.log(bot.commands)

#

Though it's a map

topaz fjord
#

^

tight heath
#

So

topaz fjord
#

not client.botcommands

tight heath
#

console.log(bot.commands.keyArray())

#

At least that works with v12 collections, idk about v11

swift topaz
#

So uh, how do I make my bot msg.channel.send() markdown formats?

#

what

#

ohhh cool thanks!

earnest phoenix
#
var maxLen = 18
	let memberid = args[0];
	if(!memberid) return message.channel.send("**❌ Veuillez indiquer un identifiant.**")
	if(memberid.length !== maxLen) return message.channel.send("**❌ L'identifiant n'est pas valide.**")
	
	bot.fetchUser(memberid).then(u => {
		u.ban()
	}) ```

u.ban is not a function```

how can i do ?

unique nimbus
#

idk js but you havent defined what u is

#

I think

twilit rapids
#

@earnest phoenix fetchUser returns a user and users can't be banned. You should just fetch the member from the Guild object and then ban them

earnest phoenix
#

@twilit rapids yeah but if a admin executes the command, is for ban by the id user target

#

and the target isn't in guild

onyx summit
dark dust
#

someone here knows something about discord py?

slender thistle
#

Depending on what exactly

tight heath
#

@earnest phoenix guild.members.ban(id)

dark dust
#

@slender thistle so, I wanna make a quiz game but I do not wanna use on_message.. there's a way to listen to the answers without it?

slender thistle
dark dust
#

and another question, my bot was not verified yet, but I was reading mod-logs and I saw that my bot can be declined if he changes status frequently, it is changing 2 status in 5 and 5 seconds, the minimum alowed is 12 seconds? (it will be good to know before someone verifies it, because I can fix it right now)

#

my version of discord py is the latest

slender thistle
#

The ratelimit is 5 times per minute

#

Usually suggested once per 12-13 seconds

dark dust
#

Really thank you! I will adjust it right now

earnest phoenix
#

you don't need to do anything

slender thistle
#

And... client.wait_for('message', check = etc) sounds like what you need

earnest phoenix
#

also you shouldn't hardcode ratelimits, they're dynamic and can change anytime

#

what often occurs is if you spam an endpoint too often and get ratelimited too often the ratelimits get more restrictive

dark dust
#

@earnest phoenix are you talking to mee?

#

@slender thistle inside cogs?

slender thistle
#

Wherever you have access to Bot instance for

waxen meteor
#

Does on_message work in the latest version of Discord.py?

slender thistle
#

But in your case adding it to cogs sounds like the most sense-making option

dark dust
#

@waxen meteor yepp

slender thistle
#

If it didn't work, you wouldn't be able to handle commands jn the first place

dark dust
#

so furuhashi, lemme show ya what I was trying to do:

waxen meteor
#

Is there a decorator I need in the cog?

dark dust
#
    @commands.command(aliases=['QUIZ', 'Quiz'])
    async def quiz(self, ctx): # command quiz

        #QUIZA = str(QUIZ2)
        #print(QUIZA)

        await ctx.send('The quiz will start in 5 seconds, be ready!')
        await asyncio.sleep(5)

        QUIZQ, QUIZA = random.choice(QUIZP)

        await ctx.send(QUIZQ)

        #print(ctx.message.content)
        #print(QUIZA)

        if ctx.message.content == QUIZA:
            await ctx.message.add_reaction(emoji=f":star:")
        elif ctx.message.content == QUIZA:
            await ctx.send(f'<@{ctx.author.id}> encontrou a resposta!')```
slender thistle
#

for events in cogs - commands.Cog.listener()

dark dust
#

I just started this code, theres no loop yet

slender thistle
#

Yeah bot.wait_for sounds like what you need then

dark dust
#

how would I implement it? i never used before

waxen meteor
#

ok I think I fixed it

slender thistle
#

Docs should explain that quite better than I can rn

dark dust
#

I tried

dark dust
#

there they are using in on_message

#

is it strict to on_message?

slender thistle
#

Nah

#

You can use it anywhere where you have access to yoie bot instance

#

(But it's a better choice to do it in commands or on_message)

dark dust
#

instead of message I could use ctx

slender thistle
#

And also those examples don't use commands.Bot, so on_message is the only way to make a command

#

ctx has message property

dark dust
#

not so sure if I understood the "And also those ex...."

slender thistle
#

Basically

#

The "API Reference" page is not related to commands extension. Those two have their own pages and stuff

#

So, in this case the docs are on API Reference, where commands.Bot is not used

dark dust
#

So it cannot be used in commands.Bot? (that's what I understood about your message, sorry if I got it wrong) pandasad

slender thistle
#

Nah

#

It can be used in commands.Bot

dark dust
#

so It's just not related

#

got it now hahahhahaha

slender thistle
#

Basically yeah

dark dust
#

thank ya for your help/time!!!!!

#

nice mod

slender thistle
scenic vapor
#

Heya, anyone know any good ways to log console for node?

#

into a file

topaz fjord
#
console.log(literally anything)
lime sluice
#

This is a lavalink related question, but what bitrate does lavalink run at?

inner jewel
#

whatever bitrate the source has

#

the bitrate setting in channels doesn't affect bots

scenic vapor
#

@topaz fjord I didn't mean log to console..

broken shale
#

then what @scenic vapor

scenic vapor
#

I meant log everything occurring in the node terminal into a file such as log_7-17-19.txt

earnest phoenix
#

Umm someone has a command which shows all members with a role (EX : MODERATORS)

hybrid ruin
#

Js?

earnest phoenix
#

Node js

broken shale
#

loop through all members which has that role

earnest phoenix
#

I'm i don't know how

#

it's a little hard for me

spare goblet
#

@earnest phoenix if you're on discord.js, iirc you are; there's a <members> property for roles :D so for example <role>.members would return a colleciton of members. then just split it split after .map() of collections and boom !

pastel spear
#

Im currently looking for a small discord.js command that can send a single message to every servers default channel the bots in. The only method i found is outdated. Is this even possible with discord.js? Im mainly wanting to use it to send maintenance notices

#

Before the bot was public i just did it via client.channels.get method but now that its open i need a new way

bright spear
pastel spear
#

woah

spare goblet
#

@pastel spear Hello there blobthumbsup

iirc .defaultChannel property is depracated because new servers don't have such property

Also, making it do that could potentially abuse Discord API? because if your bot is in like 500 guilds thats like telling it to send 500 messages at once synchronously lol

pastel spear
#

ah. Never thought about when it gets big lol

spare goblet
#

😂

#

np have a good day

bright spear
#

@pastel spear "default channels" dont exist anymore

#

they were removed like a year ago

earnest phoenix
#

Try first channel thinga

#

It worked for me

#

@pastel spear

pastel spear
#

@earnest phoenix dmed you to look into it.

earnest phoenix
#

Ok

ember atlas
#
  let reportembed = new discord.RichEmbed()
        .setDescription('Reports')
        .setColor('#15f153')
        .addField('Reported User', `${rUser} with ID: ${rUser.id}`); 
       .addField('Reported By', `${message.author} with ID: ${message.author.id}`)
        .addField('Channel', message.channel)
        .addField('Time', message.createdAt)
        .addField('Reason', reason);

Why do I get the error: https://i.imgur.com/JdPa5ka.png

#

nvm

sick cloud
#

remove the ; mid way

ember atlas
#

ik

#

which is why i said nvm

desert slate
#

I feel incompetent for asking, but I'm currently (albeit loosely) following Peter Spelos' tutorials (.NET 2.0 version), but he hasn't done anything with commands, and I can't seem to figure it out myself.

#

I've got my command handler written up, but I can't figure out how to implement it into the actual program to read the commands.

earnest phoenix
#

are you sure it's net 2.0? that's ancient 🤔

desert slate
#

That is?

earnest phoenix
#

net 2.0 was released in 2009

#

you're probably confusing net framework and net core

desert slate
#

Shows how little I pay attention.

#

Uh, lemme see...

#

It's .NET Core.

earnest phoenix
#

which library are you using

desert slate
#

I believe so, yes.

earnest phoenix
#

you generally shouldn't follow youtube tutorials, follow the official docs instead

desert slate
#

I did try that-

#

Should have read the first page, though. I was focused on commands, so I read up on that as I worked.

earnest phoenix
#

@tight heath but the id isnt in this guild

#

how i can overwrite permission of the everyone role in a channel?

#

i n w h i c h l i b r a r y

#

djs

amber fractal
#

@earnest phoenix the everyone role has the same id as the guild

earnest phoenix
#

@earnest phoenix

let role = message.guild.roles.find("name", "@everyone");
        c.overwritePermissions(role, {
            SEND_MESSAGES: true,
            READ_MESSAGES: true
        });```
#

@amber fractal oh k thx

#

@earnest phoenix already try

#

Supplied parameter was neither a User nor a Role.

#

^

#

defaultRole doesn't exist in djs

#

@amber fractal thx it's working

#

so message.guild

sick heron
#

what is this error?

warm marsh
#

Also, @earnest phoenix when using .find make sure you use a callback not key, value. e.g. .find(role => role.name == 'rolename');

earnest phoenix
#

yeah

warm marsh
#

My bad, Who ever's code it is, Make sure you do what I just said.

earnest phoenix
#

@sick heron which library ?

#

sry im French ^

warm marsh
#

express

sick heron
#

@earnest phoenix I'm doing bot with discord.js. This is the dashboard.

warm marsh
#

Yeah. You're trying to call a directory that doesn't exist.

earnest phoenix
#

oh, ok, i known't

#

I don't know if it's said

warm marsh
#

@sick heron send code.

earnest phoenix
sick heron
#
  const renderTemplate = (res, req,guild, template, data = {}) => {
    const baseData = {
      bot: client,
      path: req.path,
      user: req.isAuthenticated() ? req.user : null
    };
    res.render(path.resolve(`${templateDir}${path.sep}${template}`), Object.assign(baseData, data));
  };```
#

error here. what should I do.

#

@warm marsh

warm marsh
#

Ok

#

Where is templateDir defined?

sick heron
#

what,

warm marsh
#

The variable templateDir

sick heron
#

renderTemplate(res, req, "guild/stats.ejs", {guild})

warm marsh
#
path.resolve(`${templateDir}${path.sep}${template}`)```
#

templateDir is equal to/app/dashboard/templates/

#

?

sick heron
#
res.render(path.resolve(`${templateDir}${path.sep}${template}`), ```
The error is here.
warm marsh
#

Yeah, template is undefined

sick heron
#

what should I do.

warm marsh
#

define it

#

What is template supposed to be equal to?

#

Also, You're missing a parameter.

sick heron
#

@warm marsh Dm

warm marsh
#
const renderTemplate = (req, res, guild, template, guild={}) => {

}```
earnest phoenix
#

tfw you want to be spoonfed so you ask people to go into a dm

#

cant relate

warm marsh
#

I won't spoonfeed.

earnest phoenix
#

I use lowdb :

setWelcomeChannel command :

let server = message.guild.id;
	if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send("**❌ Vous devez avoir la permission de gérer le serveur afin d'effectuer cette commande.**")
	let channel = message.mentions.channels.first();
	if(!channel) return message.channel.send("**❌ Veuillez mentionner le salon de message de bienvenue !**")
	let channel_id = channel.id;
	if(!db.get("welcomemsg").find({ serveur: server }).value()) {
		db.get("welcomemsg").push({ serveur: server, salon: channel_id }).write()
		message.channel.send("**✅ Le message de bienvenue à été configuré sur le salon " + channel + " avec succès.**")
	} else {
		db.get("welcomemsg").remove({ serveur: server }).write()
		console.log(`.`)
		db.get("welcomemsg").push({ serveur: server, salon: channel_id }).write()
		message.channel.send("**✅ Le nouveau salon de bienvenue est maintenant " + channel + "**") 
	} ```

removeWelcomeChannel command :
```let server = message.guild.id;
	if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send("**❌ Vous devez avoir la permission de gérer le serveur afin d'effectuer cette commande.**")
	
	if(db.get("welcomemsg").find({ serveur: server }).value()) {
		db.get("welcomemsg").remove({ serveur: server }).write()
		message.channel.send("**✅ Le système à été retiré de votre serveur avec succès.**") 
	} else {
		message.channel.send("**❌ Ce système n'a pas été activé sur votre serveur.**")
	} ```
#

But why when I put it in the json, I check and everything is well put (id of the server, id of the channel) but when I want to remove with the command to remove, it tells me that the system has not been configured (it does not find the server ID) knowing that I have checked and there in the json

haughty thunder
#

hi folks - do bot have any limits on how much DM they can sand?

earnest phoenix
#

yes, there's a ratelimit on everything, in terms of message limit, no

#

dmall is illegal

mossy vine
#

if you are talking about mass dming users, simply dont

haughty thunder
#

we're granting steam keys for our open beta when user joins our server

mossy vine
#

yeah that seems fair

#

just dm the user once when they join

haughty thunder
#

yeah, but bot is getting unauthorized

earnest phoenix
#

or do the bot with guildMemberAdd event

haughty thunder
#

looks like after sending too many dms

mossy vine
#

@earnest phoenix or dont assume what library they are using bloblul

haughty thunder
earnest phoenix
#

messaging a user can fail if;
you have no shared servers with the user
the user has their dms disabled
you got ratelimited

haughty thunder
#

user and bot share the same server, i assume most users have dms enabled

#

what are thos ratelimits?

earnest phoenix
#

they define how much of a certian action you can do within a timespan

#

if you cross it you get put on a cooldown and cant do that action for x amount of time

#

discord.py mostly handles ratelimits for you though so you don't have to worry about it much

haughty thunder
#

yeah, but i just want to check the logs to confirm we're hitting those limits

#

any explanation in docs?

sick cloud
#

discord doesn't really document ratelimits

#

there's some known ones like 5 messages every 5 seconds but its unreliable

#

you gotta check the ratelimit header on requests

earnest phoenix
#

it's documented in discord, libraries don't document it though because they have no reason to, it's being handled internally

#

(mostly)

haughty thunder
#

ok, this seems resonable but I'm now thinking about a way o handle it

earnest phoenix
#

try catch

#

or, try except in python

#

you should always try except dms to users because it's pretty much a 50/50 chance it's going to fail

haughty thunder
#

hmm, ok but how try except can prevent our bot get rate limited? i dont get this

earnest phoenix
#

you don't have to worry about ratelimits

haughty thunder
#

ok, i'm starting to see this,

#

thanks for pointing me into this direction!

warm marsh
#

So, Does your bot actually have to be on all the time once its inside this server?

mossy vine
#

no, but it should be

warm marsh
#

Like, Will it get kicked if its offline for a x amount of hours

mossy vine
#

noone wants to use a bot thats down for hours every day

earnest phoenix
#

you're allowed to have downtime, but if it has more downtime than uptime it'll probably get kicked

warm marsh
#

Alright, Thanks.

earnest phoenix
#

how to use slices

warm marsh
#

slices?

slow crypt
#

How do i add how many server's the bot is in

#

Like i typed the ids it didn't work

#

In the website

earnest phoenix
#

in js

limber ore
#

Hi @earnest phoenix , thanks for response I'm with @haughty thunder in team. Bot got unauthorized error while still being online. And when we try to restart it, we cannot, everytime gets response unauthized (403). I tried to regenerate token - it doesn't help. If I create new app, it's working for about 8h, and then got's unauthorized. It happened twice

earnest phoenix
#

403 is not unauthorized

#

unauthorized is 401

#

403 is forbidden, you can't message the user because their dms are disabled

slow crypt
#

How to fix how many server are the bot In the website

quartz kindle
#

if you want to add them to the "servers that are using this bot" section, those servers need to be added to the dbl server list

#

if you want to show the total servers, you need to send the number to the dbl api

earnest phoenix
slow crypt
#

Oh

limber ore
#

sorry cry it's not 403 it's 401
I digged in logs, and there one more thing:
File "/env/lib/python3.7/site-packages/discord/gateway.py", line 468, in poll_event
msg = await self.recv()
File "/env/lib/python3.7/site-packages/websockets/protocol.py", line 350, in recv
yield from self.ensure_open()
File "/env/lib/python3.7/site-packages/websockets/protocol.py", line 512, in ensure_open
self.close_code, self.close_reason) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 4004 (private use), reason = Authentication failed."

code 4004 (private use) - how can we set bot for non private use? What does private use mean? Is it time restricted?

quartz kindle
#

should be possible if your mongo db is a remote db

#

ie in another server

earnest phoenix
#

are you using some kind of free hosting @limber ore

#

oke

#

i found js docs

limber ore
#

no, we are on gcloud @earnest phoenix

earnest phoenix
#

can i make my mongodb a remote db?

quartz kindle
#

@limber ore is your bot set to private in your discordapp developer settings?

limber ore
#

we have our own app based on discordpy and aaiohttp

quartz kindle
#

@earnest phoenix yes, if you can run a mongo server

earnest phoenix
#

regex still useful

#

this shouldn't happen mid-connection, it should happen when establishing a ws connection to discord 🤔

limber ore
quartz kindle
#

yes

earnest phoenix
#

that's irrelevant

#

it only affects the oauth scope, part of REST, not websockets

#

@limber ore are you by any chance reading the token from a text file

inner jewel
#

did the same token work before?

#

also, check the email of the account that owns the bot

#

it may have been reset

#

unlikely, but not impossible

limber ore
#

to start bot we have:
discord_client.loop.create_task(discord_client.start(TOKEN))
and TOKEN is.... hardcoded in source

@inner jewel yes - token was working before. I checked emails: unfortunately nothing

inner jewel
#

also "private use" above means that code has no meaning defined by the websocket spec - all 4xxx codes are reserved for applications

#

so they can mean whatever the applications wants it to be

limber ore
#

@inner jewel sorry, I don't quite get it. 4004 is raised from discord.py. We do not handle those codes

inner jewel
#

that's the code sent by discord

limber ore
#

I'll try reach to discord then, thank you @inner jewel

wicked pivot
#
bot.on('guildMemberAdd', async (member) => {

  if(member.user.bot){
    let guilds = member.guild
    console.log(guilds.members.filter(member => member.hasPermission('MANAGE_GUILD')).map(m=> m.user.username))
    return bot.channels.get("535553754359922705")
    .send(`@eve un membre viens d'ajouter un bot nommer ${member.user.username}`)
  }
})```how to remove the bots from this list?
pine escarp
#

Hum

wicked pivot
hallow olive
#

Yo my bot is offline

#

this is the error wait

#

is there any personal info here?

late hill
#

Did you install discord.js

prime cliff
#

It literally tells you the error
also "is there any personal info here" after posting the screenshot gg 👏 👏

hallow olive
#

wait

#

so there is personal info

#

?

whole magnet
#

Hola.

#

I need some help with my bot, not sure why its not working the way it should

mossy vine
#

post the related code and the exact issue

whole magnet
#

Sure.

#

one se

#

c

#

Going to upload the code since its too long

#

@mossy vine

#

Using pastebin because hastebin is having problems sorry

#

It doesn't error. When creating the channels the embed doesn't have the correct names and the wrong teams are given permission to see the channel

mossy vine
#

nice api key mmLol

whole magnet
#

lol rip

mossy vine
#

might wanna reset that

whole magnet
#

forgot to remove that

#

ya sec

#

here is the new paste

mossy vine
#

did you just post your key again

whole magnet
#

no?

#

pastebin is aids

#

going to add it here too

earnest phoenix
#

Oof

whole magnet
#

@mossy vine

#

Final paste

#

Here is the problem I'm facing:

#

It doesn't error. When creating the channels the embed doesn't have the correct names and the wrong teams are given permission to see the channel

earnest phoenix
#

Does someone's has discord bot join voice channel JavaScript

hallow olive
#

hey i am having a error in , could someone pls help me fix it?

earnest phoenix
#

dont ask 2 ask

#

just show the error

#

😂😂

sinful lotus
#

thats master tho

earnest phoenix
#

Ty

#

I wil try it

#

Is JavaScript same as discord.js?

twilit rapids
#

no

earnest phoenix
#

Ow

#

That's reason it doesn't work XD

twilit rapids
#

Discord.js is a module for JavaScript to do things with the Discord API

earnest phoenix
#

Is there an simpel JavaScript command to edit last message bot send?

mossy vine
#

m = await message.channel.send()
m.edit()

earnest phoenix
#

With channel ID?

mossy vine
#

that was just an example

#

read the d.js docs for further info

#
#

also since you asked if discord.js is the same as javascript, i assume you dont know much about js

#

remember that google is your friend

earnest phoenix
#

I tries

#

Tried

mossy vine
#

and 9 out of 10 times it will answer your simple questions

ember atlas
#
    .addField('Channels', message.guild.Channels)
    ^

SyntaxError: Unexpected token .```
Why?
#

Line 16
.addField('Channels', message.guild.Channels)

whole magnet
#

Code ^

#

Here is the problem I'm facing:

#

It doesn't error. When creating the channels the embed doesn't have the correct names and the wrong teams are given permission to see the channel
This bot uses the challonge (https://challonge.com/sl_s2) API.

tight heath
#

@earnest phoenix still works

earnest phoenix
#

@tight heath ok

tight heath
#

It's an API call which does not give a single shit about if the ID is in the guild or not

#

Member#ban is just syntax sugar

earnest phoenix
#

ok

#

so

#

message.guild.members.ban(id)

tight heath
#

Yes

modest pendant
#

can someone give me a css i want to do a image are floating

earnest phoenix
hybrid ruin
#

@modest pendant You mean you want it to slowly go up and down?

#

Feel free to ping me back

earnest phoenix
#

Who knows about lowdb?

west spoke
#

@ember atlas did you set the embed variable up correctly

ember atlas
#

Yes

west spoke
#

you did something wrong

#

Idk what

#

But you did

hollow saddle
#

@ember atlas Could you show the surrounding code

#

And message.guild.channels is a collection

#

I don't believe you can just shove that in an embed

#

You would have to map the collection or manipulate it in some way

twilit rapids
#

He has Channels so it would still be undefined

#

Capital C^

hollow saddle
#

true

sick cloud
#

@ember atlas its because you've probably put a ; at the end of the last line

swift topaz
#

Question:

Let's say I have a bot command a!note. And I want every args after the note command to be replied by the bot to the message author. How do I do that with ${args}?

hollow saddle
#

You could join the args and then send it to the author

#

args.join(' ')

swift topaz
#

what would the parameter inside the join() be? just whitespace?

hollow saddle
#

whitespace if you want spaces

#

The param is the character to join with

#

So if I did args.join(',')

#

Args would become soemthing,like,this

#

It's the character to join the array with basically

swift topaz
#

Thanks! Another question though, how do I remove the note args from the bot's response?
I did something like this msg.reply(`Note: ${args.join(' ')}`); , but since the note command is part of the args, it would show something like Note: note <note here>. I want to remove the note part if possible.