#development

1 messages Β· Page 1078 of 1

sudden geyser
#

What are you saving the contents of the channel to a file for

earnest phoenix
#

Hey so I am trying to make a Smash or pass discord bot and I'm trying to get the images from reddit. Most subreddits are NSFW tho and apis like random-puppy or imageapi don't work when the reddit is marked NSFW. Does anyone know how to bypass this? Here is my code if you need it

const Discord = require('discord.js');
const api = require("imageapi.js")
module.exports = {
    name: 'girl',
    run: async (client, message, args) => {
        let subreddits = [
            "RealGirls"
        ]
        let subreddit =
        subreddits[Math.floor(Math.random() * subreddits.length)];
        let img = await api(subreddit, true)
        message.channel.send("Here's a girl image...")
        message.channel.send(img)
    }
}

@earnest phoenix anyone can help me?

tulip ledge
#

So me and my friend we made an NPM package and we can't add myself to the Collaborators anyone knows how to do it?
It just shows my friend

static trench
#

Is it usual for a bot to be in the que of approval for over 2 weeks?

hidden lynx
#

Yep

solemn latch
#

you have to store it somewhere right?

#

it doesnt affect channelMessages, it affects whatever its on
const newvar = channelMessages.reverse()

hidden lynx
#

Try logging the channelMessages in the console and look what it returns

#

I'd do it exactly like Woo wroteπŸ‘

#

You can also just go with channelMessages.reverse() without creating a new array.

#

Try to do it after the Promise. Not in the .then

sick cloud
#

@earnest phoenix make the api request yourself

#

subreddits have json

summer torrent
#

remove .name

#

just role => role

cosmic basin
#

how can i know when my bot will be officialy vΓ©rified?

summer torrent
#

Luca will DM you

cosmic basin
#

ah ok

#

@summer torrent and how much time will i wait ? x)

summer torrent
#

3+ weeks

cosmic basin
#

humm ok

earnest phoenix
#

.setThumbnail(message.guild.iconURL)
This doesnt give me an error but it doesnt show the image for the embed, does anyone know why this is happening?

tight plinth
#

if youre using v12 <Guild>.iconURL is a function, like <User>.avatarURL

earnest phoenix
#

Yeah im using v12, im a bit slow and im embarrased to say but i have no clue what that means

fickle arch
#

This happen when I tried to ban someone with reason but if without reason it's fine am I doing something wrong or I need to add specific lines for reason of ban ?

#

wow snipping tools fucked.

solemn latch
#

it did that because you drew bigger than the screenshot

#

anyway, stats needs to be defined

fickle arch
#

Hmmm yes.

solemn latch
#

where did you define it?

fickle arch
#

I think I didn't define it yet.

#

ah it's on index.js

#

fixed

vital fiber
#

oh

summer torrent
#

yes

fickle arch
#

In my help command I didn't use group(folder) for each command and if I do put them into groups should I be adding ${cmd.folder} ?

      helpEmbed.addField(
        `**${message.client.prefix}${cmd.name} ${cmd.aliases ? `(${cmd.aliases})` : ""}**`,
        `${cmd.description}`,
        true
      );```
digital ibex
#

yes?

#

and btw

#

the forEach function is slow, you shouldn't use it often when map does the exact same thing but faster

fickle arch
#

what should it be ?

digital ibex
#

use map instead of forEach

#

idk

#

whatever you assign the category to be

fickle arch
#

like commands.map because replacing forEach ?

digital ibex
#

yes

fickle arch
#

Alright, let me experiment with something, thanks for it.

sick cloud
#

@digital ibex do you have actual evidence that it's faster

#

and have you also considered for loops

digital ibex
#

1 sec

#

and im pretty sure map is faster than for loops too, idk i'll have to check

fickle arch
sick cloud
#

let me do some benchmarks

earnest phoenix
#

.setThumbnail(message.guild.iconURL) Doesnt display the server's icon and has no error. Im using v12 discord.js and was told that iconURL was a function but i dont know how to apply that and im more confused now. Thanks if you can help

solemn latch
#

iconURL is a function

#

()

earnest phoenix
#

oh

#

ohh

#

i feel stupid

sick cloud
#

read the docs

earnest phoenix
#

yeah i did but didnt get much outta them

#

thanks guys

digital ibex
#

so...

#

i couldnt find the actual source

#

so

#

i timed it, and the difference is only a small 0.3ms

#

thought it was much bigger tbh

fickle arch
#

after I put all commands to specific folder like moderation and music bot doesn't dm anything after changing and adding ${cmd.folder}

digital ibex
#

no

#

whats not working as it should?

sick cloud
fickle arch
#

doesn't show any error.

digital ibex
#

lol

fickle arch
#

lol.

#

that's equal.

digital ibex
#

then whats not working?

#

bor

fickle arch
#

hold.

digital ibex
#

thats console.time, right?

fickle arch
sick cloud
#

does array.fill not work

fickle arch
#

it is possible to use klasa and discord js at the same time ?

sick cloud
#

klasa is discord.js

#

it's just a framework that adds stuff to it

fickle arch
#

Oh, dumb me.

#

I think I gonna recode some of stuff from my previous bot.

digital ibex
#

umm

#

quick question

#

the code isn't on github, any ideas?

#

~~ yes ik i spelt upstream wrong shut~~

fickle arch
digital ibex
#

this might help, idk

sick cloud
#

@digital ibex for loops seem the fastest

#

using 300000 entries

digital ibex
#

oh cool

sick cloud
#

hm

#

actually

#

for each seems fastest sorry

#

broke for loop benchmark

digital ibex
#

oh

sick cloud
#

with 1.5 million entries, forEach is the fastest at 35ms, followed by map at 40ms, then for loop at 49ms

#

this is on a ryzen cpu also

fickle arch
#

hmm.

sick cloud
#
Using value: 991       
Array entries: 15000000
   
forEach took: 466 ms

for loop took: 459 ms

map took: 454 ms
#

with that many entries you can see that forEach still works faster

#

not by much but there's a diff

digital ibex
#

oh

misty sigil
#

science?

digital ibex
#

never knew that

sick cloud
#

thing is, map is designed to return a value

digital ibex
#

i thought it was map

#

yeah

fickle arch
#

hmmm

digital ibex
#

for each is undefined, which i believe was on the stackoverflow i got that info from

#

idk

sick cloud
#

for loops and forEach don't need to. i don't know why for loops are slow but forEach clearly seems superior

fickle arch
#

how to make the bot see commands inside a folder, because when I put commands into another folder like ban to moderation it don't shown anything on help command.

sick cloud
amber fractal
#

for is blocking

fickle arch
sick cloud
#

can't help you without code

fickle arch
digital ibex
#

send the code where ur exporting the command

fickle arch
#

module.exports = {
  name: "help",
  aliases: ["h"],
  description: "Display all commands and descriptions",
  execute(message) {
    let commands = message.client.commands.array();

    let helpEmbed = new MessageEmbed()
      .setTitle("Bill Cipher Help")
      .setDescription("List of all commands")
      .setColor("#F8AA2A");

    commands.map((cmd) => {
      helpEmbed.addField(
        `**${message.client.PREFIX}${cmd.name} ${cmd.aliases ? `(${cmd.aliases})` : ""}**`,
        `${cmd.description}`,
        true
      );
    });

    helpEmbed.setTimestamp();

    return message.author.send(helpEmbed).catch(console.error);
  }
};
digital ibex
#

it doesn't have a folder property

fickle arch
#

then.

amber fractal
earnest phoenix
#

How do I get data from an array, froma get request?

digital ibex
#

wdym

sick cloud
#

@amber fractal how's that

digital ibex
#

just fetch('url', { method: 'get' }); ?

sick cloud
#

i did this to test it

module.exports = (array) => {
    const start = Date.now();

    let strs = [];

    for (const item of array) {
        strs.push(item);
    }

    return Date.now() - start;
}
earnest phoenix
#

I mean, how do I get the data from the get request

fickle arch
#

@digital ibex What should I add next like ${cmd.folder} or something ?

digital ibex
#

how did u get the commands name

#

?

earnest phoenix
#

@earnest phoenix make the api request yourself
@sick cloud hmm could you show me an example on how to do that

solid falcon
#

how to display all commands and description on discord.py?
Is this the right code?

for command in bot.commands:
digital ibex
#

try it

fickle arch
#

@digital ibex before putting the commands to folder it shown fine before putting it to folder.

earnest phoenix
digital ibex
#

no you're not

#

well

#

u r

earnest phoenix
#

For example, how do I get data from that url

digital ibex
#

but to get the commands name

#

you're not doing that

#

how r u getting the name of the command?

fickle arch
digital ibex
pure lion
#

Wait a sec

earnest phoenix
#

I know that part, but how do I get data from an array?

digital ibex
#

well yeah

#

like i said

sick cloud
digital ibex
#

just use node-fetch :p

pure lion
#

If mongo is backend only then how do I interact from the webserver

sick cloud
#

node-fetch is bloated

pure lion
#

:d

digital ibex
#

it is?

sick cloud
#

yes

pure lion
#

:o

sick cloud
#

phin is good

pure lion
#

Snek fetch

digital ibex
#

thats how i make all my api requests in my discord lib 😳

sick cloud
digital ibex
#

uck

#

fuck

sick cloud
#

snekfetch is discontinued

fickle arch
#

m

pure lion
#

:(

digital ibex
#

gona use snekfetch

pure lion
#

Yes

#

Yea

#

Yes

#

Yes

amber fractal
quartz kindle
#

request is also deprecated

pure lion
#

Timmm :>

amber fractal
#

but also the benchmark that website had

#

running it many times

digital ibex
#

is console.time slow also? i've never seen people use it, they always use date.now

earnest phoenix
#

hey can someone help me, im trying to get the nickname of a user but it keeps returning "undefined".
my code is

.addField("Nickname:", `${message.author.displayName}` || "None", true)
quartz kindle
#

the overhead of console.log far outweighs the overhead of forEach

#

redo the test without logging

digital ibex
#

users dont have the displayName property

earnest phoenix
#

what would it be?

digital ibex
#

its member, not user

earnest phoenix
#

ive looked thru discord.js

amber fractal
#

The loops both do the same thing

digital ibex
#

you're looking in the wrong place, look at member, not user

sick cloud
#

only guild members can have a nickname therefore displayName doesn't exist on a user

amber fractal
#

And forEach would win if you just do nothing with the array

#

but for is generally more performant in a real situation

#

to my knowledge anyways

sick cloud
#

ok then

digital ibex
#

yeah, nothings happening there kek

amber fractal
#

I mean that's just from my testing I've noticed

digital ibex
quartz kindle
#

js basically optimizes them both to the same thing

tulip ledge
#

Tim

#

DO u know how to add people as contributors to an NPM package

#

As me and my friend made a package but we can't put me on there

quartz kindle
#

but here you go lol

amber fractal
tulip ledge
#

And we already have 130 downloads in 2 days so I would likke to be put on there as a contributor

amber fractal
digital ibex
#

you probably havent chicken

#

npms data is all fucked

amber fractal
#

I hate to break it to you most new packages get a lot of downloads because of package managers

tulip ledge
#

?

#

I dont care I still want to be put as a contributor

digital ibex
#

their data is fucked

#

ok

#

on the package

#

u'd need ur friend or whoever 4 this

#

btw

amber fractal
#

You should just have to be a collaborator on the projects github

#

I think that's where it gets them from

tulip ledge
#

I am as a collaborator on the github page

#

But it doesn't show me on the npm page

amber fractal
#

What's the package?

tulip ledge
digital ibex
#

tell ur friend to go to <package > contributors > add user > <ur npm username>

earnest phoenix
#

@earnest phoenix find a http request lib, request the reddit json (reddit.com/r/subredditname.json) and tada
@sick cloud Sorry for asking so many questions 😦 Now that I have the json how do I implement it into my d.js bot?

amber fractal
sick cloud
#

require the lib, request the url, use the json, do whatever you want with it

tulip ledge
#

We tried it

#

It doesn't show the "+" for my friend

digital ibex
#

screenshot?

tulip ledge
#

he just had to go

#

But he was screensharing

digital ibex
#

u probably cant be both then

tulip ledge
#

oh

earnest phoenix
#
@client.event
async def on_ready():
    servers = list(client.guilds)
    print('Theo is online!')
    print("-----")
    print(f"{client.user.name} is Connected on {str(len(servers))} server(s):")
    print("-----")
    print("Bot created by .rareh#2968")
    print("-----")
    print('\n'.join(server.name for server in servers))
    print("-----")
    
    members = 0
    for guild in client.guilds:
        members += len(guild.members)

    messages = cycle([f"Theo Zeciu", f"{str(len(servers))} servers", '.help', '.rareh'])
    status = cycle([3, 2, 2, 2])
    while True:
        curr_message = next(messages)
        curr_status = next(status)
        await client.change_presence(status=discord.Status.online, activity=discord.Activity(name=curr_message, type=curr_status))
        await asyncio.sleep(7.5)```
#

any ideea?

#

the bot it's not oppening

#

like nothing will print

#

i think smth is wrong there

#

require the lib, request the url, use the json, do whatever you want with it
@sick cloud ```js
const Discord = require("discord.js");
const snekfetch = require('snekfetch');

module.exports = {
name: 'meme',
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);
}
}
}``` I did this and it didn't work. I am sure i did something wrong lmfao

viral plover
#

For rareh's thing, I don't think a string can use the .join method. Did you get any kind of error message?

#

Yo, is that a webhook?
I came here to ask about those.

digital ibex
#

is what a webhook

viral plover
#

What Valckyz posted. snekfetch?

digital ibex
#

no

earnest phoenix
#

@viral plover

viral plover
#

Oh.

earnest phoenix
#

what do you mean

#

oh yes i did

#

1 sec

digital ibex
#

quick question if anyone knows

viral plover
#

So @earnest phoenix.
Error says that it crashed because .join(server.name for server in servers) isn't a string.

digital ibex
#

the owner of a repo merged the master branch into my branch, god knows why. how can i remove his, the owners, merge so i can push?

sick cloud
#

@earnest phoenix errors or none

quartz kindle
#

why do people keep using snekfetch

digital ibex
zenith terrace
#

I did this and it didn't work. I am sure i did something wrong lmfao

if you are using v12 and the error is .get is not a function then you clearly copied the v11 code cause I have that as well

viral plover
#

Is it possible to make a webhook using a website that doesn't have built-in support for them?

digital ibex
#

webhooks requires webservers

#

as long as you've got a webserver, you can

viral plover
#

What do you mean by webserver?

solid falcon
#

I want to make a while loop on discord.py
is this work?

from discord.ext import commands import asyncio
client = commands.Bot(command_prefix='!')

async def background_task():
    await client.wait_until_ready()
    counter = 0
    channel = client.get_channel(123456) #Insert channel ID here
    while not client.is_closed():
        counter += 1
        await channel.send(counter)
        await asyncio.sleep(10)

client.loop.create_task(background_task())
client.run('token')
viral plover
#

I probably should've just Googled that.

digital ibex
#

and im talking about a proper webhook too

earnest phoenix
#

@earnest phoenix errors or none
@sick cloud No errors but nothing posts

digital ibex
#

what language r u using for the website?

#

just html/css?

#

or js, go or something

viral plover
#

I use javascript.

digital ibex
#

for the backend, express?

zenith terrace
#

why do people keep using snekfetch
@quartz kindle I use node-superfetch for it now lol

viral plover
#

I'm not trying to pull data from a website I made.

digital ibex
#

if you want to pull data from your website, make the api public

solemn latch
#

You dont pull data with webhooks

quartz kindle
#

webhooks can be converted using a middle man

viral plover
#

I mean send data to Discord via a webhook.

digital ibex
#

you can probably just make it only so ur IP can make requests to get data, not sure though. im just assuming it

#

yeah

#

make a <method> request

viral plover
#

Not send data to the website.

quartz kindle
#

there are a few services that do that, such as ifttt

viral plover
#

The website (MAL) isn't supported on ifttt.

quartz kindle
#

does mal emit webhooks?

viral plover
#

No.

quartz kindle
#

then what do you want to do?

digital ibex
#

you'd need to make ur own discord API request then (u can use a library but thats kinda hacky)

somber root
#

hi

viral plover
#

I want to be able to use a webhook to get data from MAL and send it to Discord, but I'm not sure if it's possible since MAL doesn't have built-in support for webhooks.
I came here to know if it's possible.

quartz kindle
#

a discord webhook is actually a webhook receiver

#

it needs to be sent data to

digital ibex
#

halp

#

whats a mal

quartz kindle
#

if mal doesnt emit webhooks, then you need to build the interface yourself

viral plover
#

Yeah, that's MAL.

quartz kindle
#

a program that periodically downloads from mal, then sends to discord

digital ibex
#

i feel for u that u know that but ok

viral plover
#

Okay, so it is possible, but difficult (as expected).

quartz kindle
#

depending on what you need its not difficult

#

if mal has an api, you can just query their api

viral plover
#

Earlier search results showed something for API, but the primary links on it all lead to 404s.

digital ibex
#

is that what mal is meant to be?

#

if it is

viral plover
#

Yeah, it's a website.

digital ibex
#

then u can just literally

earnest phoenix
#

@sick cloud ```js
const Discord = require("discord.js");
const snekfetch = require('snekfetch');

module.exports = {
name: 'meme',
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);
}
}
}``` I did this and it didn't work. I am sure i did something wrong lmfao
@earnest phoenix Can someone help me? It doesn't send the message and no errors

viral plover
#

Since it didn't crash, it's likely that it just didn't receive any data to post, yeah?

digital ibex
#
channel.send(JSON.stringify(bob));
function bob() {
// api requests
}
zenith terrace
#

@earnest phoenix are you using v12 discord or v11

quartz kindle
zenith terrace
#

cause thats a v11 code mmulu

slow dragon
#

does anyone know how to delete a specific array element in a document using mongoose

earnest phoenix
#

@earnest phoenix are you using v12 discord or v11
@zenith terrace v12...

#

what do I have to change

sudden geyser
#

Mal's API requires authentication

digital ibex
#

what does the data look like?

#

just { key: [] } ?

slow dragon
#

uh

#

so basically

viral plover
#

Do you know how this authentication is granted?
From what I saw earlier, I'd expect through their Discord in some way.

slow dragon
#

wait let me send a picture

strange trout
#

MAL API isn't the best. I'd use another service like kitsu

slow dragon
#

looks like this

finite bough
#

@quartz kindle mal api is dead

sudden geyser
#

The API is intended to expect the user to be working with it. Aka, you can't do something like get an API key then send a request to the API to get your anime data. A user must log in with your client and you should use that token to request data.

earnest phoenix
#

@earnest phoenix are you using v12 discord or v11
@zenith terrace What do I have to change in it to make it a v12 code

digital ibex
#

then use the $pull operator

sudden geyser
#

I recommend you use an alternative API, such as AniList or Kitsu. I recommend AniList myself (even though it's graphql).

digital ibex
#

.updateOne({ $pull: { name: 'removeme' } });

#

and it will remove that whole object

slow dragon
#

oh ok

#

hold on i'll see if i get it

sudden geyser
#

You could also use a scraper such as Jikan, but those tend to be slower and less reliable.

finite bough
#

@sudden geyser oh thanks for thar

viral plover
#

The main data I want from MAL is the popularity of the anime. Since this is based on users, it naturally varies from website to website.

quartz kindle
#

ah ok, i dont use mal myself so i just googles for mal api and found that

viral plover
#

Scraper?
It doesn't need to be fast.

finite bough
#

mal scraper died

sudden geyser
digital ibex
#

no

quartz kindle
#

but you want to post popularity updates or what?

winter basalt
quartz kindle
#

webhooks are meant for periodical data and updates

viral plover
#

It's more complicated...

digital ibex
#

its not

viral plover
#

I mean why I want the info.

zenith terrace
#

Β―_(ツ)_/Β―

viral plover
#

I'm not going to pretend I'm an expert on webhooks.

quartz kindle
#

if you want to make bot commands, its better to just make the bot do the job, no need for a webhook

slow dragon
#

ok so it didn't work but i'm assuming it's an issue with what i'm doing

digital ibex
#

i've never used mal or anything, but if it requires authentication.. all u need to do is make an account or whatever, and use that

solid falcon
slow dragon
#
  if (!message.author === message.guild.owner) return;

  let removeItemEmbed = new MessageEmbed()

  shop.find({ Guild: message.guild.id}, (err, data) => {
    if (err) console.log(err);

    if(!data) {

      message.channel.send("You haven't set up your shop!")

    } else if (data) {

      let itemName = args.slice(0).join(" ")

      data.updateOne({ $pull: { name: `${itemName}`}})

      data.save()

      removeItemEmbed.setTitle("Item Removed")
      removeItemEmbed.setDescription(`Item removed: ${itemName}`)

      }


  })
#

uh

#

so basically

viral plover
#

Does that mean I can make the bot look at the website and gather data? @quartz kindle

quartz kindle
#

basically the reason to use webhooks is to post stuff on discord without needing a discord account nor a bot

#

if you have a bot, you dont need a webhook anymore

digital ibex
#

wait

viral plover
#

Oh.

digital ibex
#

waht

#

thank the fuck god

#

tim quick questipn

sudden geyser
#

i've never used mal or anything, but if it requires authentication.. all u need to do is make an account or whatever, and use that
@digital ibex it's user authentication. Not normal "grab my key and send a request" auth.

digital ibex
#

i need to send a message, and it requires me to connect

#

how cnan i do the same but with webhooks?

quartz kindle
#

i dont get it

digital ibex
#

so like

quartz kindle
#

what message

viral plover
#

What kind of message?

digital ibex
#

im not using a library

#

and im also not connecting to discord

#

so i cant send a message to a channel

quartz kindle
#

yes you can send a webhook

digital ibex
#

can i use webhooks to bypass this?

#

ooh

quartz kindle
#

where do you want to send it to tho?

#

webhooks basically need to be "opened from inside"

#

by going in your server's configuration and adding it there

digital ibex
#

yeah

#

i just need to send it to a channel for a verification thing im doing

quartz kindle
#

a channel in your own server right?

#

then it should be fine

digital ibex
#

yeah

#

another question

viral plover
#

This is the most help from the most users I've gotten from all my inquiries. (Is it because I mentioned MAL?)

Thanks @quartz kindle. I have research to do now~

digital ibex
#

im trying to do this automatically

quartz kindle
#

its because im here

#

lmao

digital ibex
#

what im doing is: creating user account, enter discord id, send discord id to modmail bot, manually verify they're claiming to be x user, and if they are, change their user model to pending: false, all im trying to do is make it all automatic.. do u know how i can do this?

#

(this isn't related to discord btw, i just need their discord id so i cant use <member>.id or whatever)

quartz kindle
#

so you're not using oauth2 for this?

digital ibex
#

nope

quartz kindle
#

is modmail your bot?

digital ibex
#

just a fork of a modmail bot

#

but i've got perms as if i made it

quartz kindle
#

alright, so when a user enters their discord id in your website, you would need to send this id to your modmail program, probably through a small api

#

you can slap an express server inside the modmail bot so it can receive stuff like that

digital ibex
#

im trying to remove the whole modmail thing

quartz kindle
#

then what do you need? send a message to this id and ask them to verify? what if they do not share a server with modmail? then modmail cant dm them or anything

#

ah

digital ibex
#

yeah

quartz kindle
#

do they need to be in your server?

digital ibex
#

nope

#

rn they do

quartz kindle
#

you cant send webhooks to dms

digital ibex
#

but im trying to make it not do anything

#

yeah

#

i was thinking..

#

i can send the message to a channel as a webhook, and get the webhook and match the code and the code they got provided.. (to verify they say who they are)

#

hm

crimson vapor
#

Tim what port should I use for the dbl webhook?

digital ibex
#

i can try that actually

quartz kindle
#

wdym lol

#

@crimson vapor idk, most people use 3000/5000/8080

crimson vapor
#

ok

digital ibex
#

wdym

#

its prob gonna be slow cuz im not using ajax 😩

quartz kindle
#

how are you gonna "get the webhook to match the code"?

crimson vapor
#

Instead of using a webhook to transfer data, use post requests on a small api

digital ibex
#

and split it with "code: whatever"

quartz kindle
#

but how is that gonna verify anything?

digital ibex
#

what im doing is

#

user creates out account, once creating and they pass security checks, they get prompted a "enter ur discord id" thing, and they enter their id, the id which they provided gets sent via a webhook to a channel with the info:
code: <secret code>
id: <discord id>
and then, it gets matched with their actual id

#

which actually thinking about

#

how am i gonna get their id πŸ€”

quartz kindle
#

there's only two options:
the user needs to go into discord, get the code themselves and paste it back in the website
use a bot to send the user a dm and read the user's response or to give them the code they should paste in the website

digital ibex
#

yeah, thats where the modmail thing came in

#

which is exactly what im doing, but without a human checking the thing

#

still does fasten the process but shrug

quartz kindle
#

the only way to be fully automated is oauth2

digital ibex
#

i've done oauth2 once before

#

and the codes a mess

#

and to open source that shit πŸ₯΄

#

well i mean

#

use that code in an open source repo πŸ₯΄

#

also tim, one more question, i hope. do u know how to revert a merge?

#

for some reason, the owner of the master branch merged master into dev

#

i tried git revert --hard HEAD^ but nothing happened

zenith terrace
#

quick question. If you use mongoDB and your off your laptop/desktop does everything still store onto mongo

(never used it before so just wondering)

digital ibex
#

yes

#

if ur using localhost, it can only be accessed by that machine

#

if ur using atlas, it can be accessed via anything

zenith terrace
#

im guessing theirs also a documentation on how to use Mongo as well (like what quick.db has)

digital ibex
#

yes

zenith terrace
#

alright, thanks

past needle
#

Can any body see if what i want will happen ? Search for my server > name all humans in β€§Λš*ΰΌ“β˜Ύuser nameβ˜½ΰΌ“*Λšβ€§

    if(message.content.startsWith('!test')){
srvmembers = client.guilds.cache.get('705909917558767616').members.array
srvmembers.forEach(user => {
if(user.bot) return;
if(user.id === '586997743478636556' || user.id === '464870886621708290') return;
        user.setNickname(`β€§Λš*ΰΌ“β˜Ύ${member.username}β˜½ΰΌ“*Λšβ€§`)
    })};
zenith terrace
#

try it sip

past needle
#

I don't want to

#

what if it doesn't work

#

i just want to be sure :-:

zenith terrace
#

then you can fix it...

zinc parrot
zenith terrace
#

discord

zinc parrot
#

Ok smart ass

past needle
#

no

#

@zenith terrace

#

i have 150 members

#

;_;

zenith terrace
#

then go into a testing server and use it

normal sandal
sudden geyser
#

what

slow dragon
#

i've been trying to work out how i'd remove data from an array for a little while. if anyone can tell me what i'm doing wrong i'd appreciate it.

#
const { MessageEmbed } = require("discord.js")
const shops = require("../../models/shop.js")

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

  if (!message.author === message.guild.owner) return;

  let removeItemEmbed = new MessageEmbed()

  let itemName = args.slice(0).join(" ")

  shops.findOne({ Guild: message.guild.id }, (err, data) => {
    if (err) console.log(err);

    if(!data) {

      return message.channel.send("You haven't set up your shop!")

    } else if (data) {

      data.update({$pull: {Name: itemName}}) // remove object 

    }


  })

}

module.exports.help = {
  name: "removeitem",
  description: "removes an item from your guild's shop",
  arguments: "<item name>",
  category: "Economy",
  aliases: ["shop"]
};
#

the data is stored in an array object

#

the code doesn't error it just doesn't remove the object

digital ibex
#

what are you doing to remove the item?

slow dragon
#

basically i'm getting the document and then pulling the name field from that document

digital ibex
#

like prefix removeitem what here?

slow dragon
#

.removeitem <itemname>

digital ibex
#

you're looking for args[0]

slow dragon
#

yes

digital ibex
#

not args.slice(0).join(' ')

#

which is what ur doing

#

which is basically the whole thing

slow dragon
#

yeah but if the item has spaces it'll error

digital ibex
#

console.log(itemName)

slow dragon
#

it's what i expect it to be

#

it might be because it's not referencing the array

#

but the document as a whole

#

although data.Items throws an error

digital ibex
#

what i do is, give the object a name

#

so its easy

#

what does the schema look like?

slow dragon
#

just in a new schema?

#
const mongoose = require('mongoose');
let Schema = new mongoose.Schema({
  Guild: String,
  Items: Array,
})

module.exports=mongoose.model("shops", Schema)
digital ibex
#

thats why

#

no offence, but its a stupid way

#

do

#

Items: { type: [ { name: String, price: Number } ] }

slow dragon
#

oh i see

#

let me try that

digital ibex
#

that way you can easily do it

slow dragon
#

uh quick question

#

when you put in number and string

#

are they case sensitive?

digital ibex
#

yes

slow dragon
#

ok

digital ibex
#

well i mean

#

number isn't of course

#

but string is

slow dragon
#

no i mean

#

when you have name and price

#

are they case sensitive

digital ibex
#

price should be a number since ur only storing numbers

#

and name is case sensitive

slow dragon
#

i mean when you define name and price

#

like this

#

are they case sensitive

digital ibex
#

and with numbers theres no uppercase / lowercase

#

oh

#

yeah

slow dragon
#

ok cool

digital ibex
#

quick question

#

do u have a schema for each thing

#

like a schema for prefix, shops etc/

slow dragon
#

uh

#

yes

#

is that a bad thing

digital ibex
#

yes

#

just mkae one model

#

for guild and thats all u need to do

#

and add the properties onto it

slow dragon
#

so just read data from one document basically

digital ibex
#

no

#

make a document for each guild

#

but put everything in that document

slow dragon
#

is it possible to add a document for a guild as soon as the bot joins a guild?

solemn latch
#

djs?

digital ibex
#

yes

slow dragon
#

yes

digital ibex
#

no

#

woo

slow dragon
#

not that

#

like detecting when the bot joins a guild

digital ibex
#

u can do it like that

solemn latch
#

so not when you join a guild, but when you join a guild?

digital ibex
#

but im p sure it'lll be slower

slow dragon
#

yeah probably

solemn latch
#

events are slower?

slow dragon
#

still doesnt want to delete

#

hmmm

digital ibex
#

just if (!guild) { create guild } else { guild.updateOne({ guild }) }

#

no

earnest phoenix
#

Hey, can any one help me? How can I fix this?

let textChannels = message.guild.channels.cache.find(x => x.type == "text");
      await textChannels.overwritePermissions([{
        id: message.guild.roles.cache.find(x => x.name === "Muted"),
        deny: ["SEND_MESSAGES", "ADD_REACTIONS"],
      },
    ]);

Console Error:

(node:6360) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not an User nor a Role

digital ibex
#

the first parameter is a string which is User or Role, not an array

half bison
#

who can help me

#

i check logs no error

#

but in discord bot off

azure quail
#

?

solemn latch
#

is the code running?

crude narwhal
#

someone here is a python boi?

half bison
earnest phoenix
#

cool

half bison
#

but in discord bot off

solemn latch
#

Iirc.
Glitch doesn't run things 24/7

earnest phoenix
#

Yea

#

How do I slice of a command?

#
    let query = message.content.split('!!querytest ')
    message.channel.send(`${query}`)
  }```
#

When I do this, it leaves a comma

half bison
#

how to fix

solemn latch
#

Use something other than glitch

ebon kelp
#

@earnest phoenix .split() makes an array

earnest phoenix
#

can you elaborate on that?

#

@half bison After the tos change for glitch, I started to use repl.it
It works like a miracle, you should try it

ebon kelp
#

Hello world.split(" ") -> ["Hello", "world"]

earnest phoenix
#

Ohhh, so how should I solve the problem?

ebon kelp
#

I use this:

// Message: "!Ban 671483717826379787" Advertisement

let messageArray = message.content.slice(prefix.length).trim().split(/ +/g);
// MessageArray = ["Ban", "671483717826379787", "Advertisement"]

let cmd = messageArray[0].toLowerCase();
// cmd = "ban"

let args = messageArray.slice(1);
// ["671483717826379787", "Advertisement"]
#

And pay attention to the capitalization

earnest phoenix
#

// Message: "!Ban 671483717826379787" advertisement

let messageArray = message.content.slice(prefix.length).trim().split(/ +/g);
// MessageArray = ["Ban", "671483717826379787", "advertisement"]

let cmd = messageArray[0].toLowerCase();
// cmd = "ban"

let args = messageArray.slice(1);
// ["671483717826379787", "advertisement"]

ebon kelp
#

Then you can do:

if (cmd === "ban") {
  // CODE
}
digital ibex
#

hi

spare goblet
#

Be careful not to spoonfeed, cough

digital ibex
#

does anyone know why im getting this error, { message: '404: Not Found', code: 0 } ?

ebon kelp
#

Hahahhaa @spare goblet

earnest phoenix
#

Thanks for the help.

ebon kelp
#

np

digital ibex
#

what im doing is: console.log(await createWebhook('735455517509681195', 'hi'))

#

what im doing is: console.log(await createWebhook('735455517509681195', 'hi'))

ebon kelp
#

Oh and to put args to a full string, use: args.join(" ")

#

@earnest phoenix

digital ibex
#

its saying it cant find the channel id

#

for some reason, when it can

earnest phoenix
#

Ok, tysm

half bison
#

@earnest phoenix ok

digital ibex
#

anyone know why im getting: { message: '404: Not Found', code: 0 } ? my code: js async function createWebhook(channelID, name, avatar) { const fetch = require('node-fetch'); const webhook = await fetch(`https://discord.com/api/channels/${channelID}/webhook`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bot ${require('./token')}` } }).then((e) => e.json()); return webhook; }

spare goblet
#

Obviously the message isn't found

solid falcon
#

How to execute code using exec() function on discord.py?

digital ibex
#

what message @spare goblet ?

lavish peak
#

how do i code

solemn latch
#

thats a very massive question.

lavish peak
#

it seems so interesting tho 😭

digital ibex
#

if you're referring to { message.. in the error...

#

thats not the error message

#

not the message which isn't found - and what message isn't found

lavish peak
#

...

delicate shore
#

Hey

#

I have started using a command handler

#

Is there any way that I can do it such a way

#

That if person does

#

s!hell command name

#

It tells the info like name description and usage ?

#

Itself

earnest phoenix
#

Just do exports.config

#

and export data and stuff

trim saddle
#

i don't think that's how you use a webhook

delicate shore
#

@trim saddle i am not referring to webhook

#

Just do exports.config
@earnest phoenix can u explain a bit more i am not good at coding

earnest phoenix
#

Anyone know when the "always-on" repls is coming out? Or how long it's been "coming soon"?

#

Its up to them, you need to follow da news

#

Where

#

Idk blog?

#

it's not on it

clever vector
#

Guys anyone can help me

earnest phoenix
#

β–‘β–‘β–‘β–‘β–‘β–β–€β–ˆβ–€β–Œβ–‘β–‘β–‘β–‘β–€β–ˆβ–„β–‘β–‘β–‘
β–‘β–‘β–‘β–‘β–‘β–β–ˆβ–„β–ˆβ–Œβ–‘β–‘β–‘β–‘β–‘β–‘β–€β–ˆβ–„β–‘β–‘
β–‘β–‘β–‘β–‘β–‘β–‘β–€β–„β–€β–‘β–‘β–‘β–„β–„β–„β–„β–„β–€β–€β–‘β–‘
β–‘β–‘β–‘β–‘β–„β–„β–„β–ˆβ–ˆβ–€β–€β–€β–€β–‘β–‘β–‘β–‘β–‘β–‘β–‘
β–‘β–‘β–‘β–ˆβ–€β–„β–„β–„β–ˆβ–‘β–€β–€β–‘β–‘
β–‘β–‘β–‘β–Œβ–‘β–„β–„β–„β–β–Œβ–€β–€β–€β–‘β–‘ This is Bob
β–„β–‘β–β–‘β–‘β–‘β–„β–„β–‘β–ˆβ–‘β–€β–€ β–‘β–‘
β–€β–ˆβ–Œβ–‘β–‘β–‘β–„β–‘β–€β–ˆβ–€β–‘β–€ β–‘β–‘ Copy And Paste Him In Every Discord Server,
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–„β–„β–β–Œβ–„β–„β–‘β–‘β–‘ So, He Can Take
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–€β–ˆβ–ˆβ–ˆβ–€β–ˆβ–‘β–„β–‘β–‘ Over Discord
β–‘β–‘β–‘β–‘β–‘β–‘β–β–Œβ–€β–„β–€β–„β–€β–β–„β–‘β–‘ (dont spam him tho)
β–‘β–‘β–‘β–‘β–‘β–‘β–β–€β–‘β–‘β–‘β–‘β–‘β–‘β–β–Œβ–‘β–‘
β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘
β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘
β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘
β–‘β–‘β–‘β–‘ β–„β–ˆβ–ˆβ–„β–‘β–‘β–‘β–‘β–‘ β–„β–ˆβ–ˆβ–„β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘

clever vector
#

Gay

earnest phoenix
#

I’m trying to make a code to collect things from the sky block wiki, such as values and crafting recipes any ideas?

turbid pivot
#

use axios

#

or cheerio

cinder patio
#

There's an API

turbid pivot
#

oh k then

earnest phoenix
#

There's an API
@cinder patio can you dm me that api?

cinder patio
#

I'm on mobile it'd be faster if you searched it yourself, but I am sure there's one

earnest phoenix
#

Ight

cinder patio
#

By wiki do you mean wikia/fandom?

earnest phoenix
#

Yeah

turbid pivot
#

oh hello there we r on mobile

#

me scan and goog

cinder patio
#

Yea for sure there's one

delicate shore
#

@hazy sparrow i think

#

there is an error

#

with the command file

#

can u show that

#

of the coinflip.js

hazy sparrow
#

ok wait hold on

delicate shore
#

alr

hazy sparrow
#
module.exports = {
    name: 'ping',
    description: "this is a ping command!",
    
    execute(message){
       const cf = Math.floor(Math.random() * 1001) + 1
        if(cf===1 ){
            message.channel.send ("**"  + `OMG ${message.author.username}!!!` + "**" + `THE COIN LANDED ON ITS SIDES `)
       }
       else if(cf<=500){
        message.channel.send ("** :bowheads: |"  + `${message.author.username}` + "**" + ` it was heads!`)
       }
       else{
        message.channel.send ("**"  + `${message.author.username}` + "**" + ` it was tails!`)
       }
     }
 }
delicate shore
#

alr

#

i found the error

#

@hazy sparrow the name

#

the name is ping

#

change it to cf

hazy sparrow
#

but the name of file is cf.js

delicate shore
#

that does not matter

#

this name matters

#

change it and see

hazy sparrow
#

and the reload command reloads cf.js only

#

it sends that ping was reloaded

delicate shore
#

becuase ping is name

#

so it will say ping only

#

@hazy sparrow change name and try again

#

it should say correct

hazy sparrow
#

ah ok wait

#

it works

#

ty

digital ibex
#

does anyone know how I can fix Promise { { _misc: [ 'Only dictionaries may be used in a DictType' ] } } ?

#

my code:

#
async function sendWebhook(content, username, avatarURL, webhook) {
   const fetch = require('node-fetch');
   const hook = await fetch(`https://discord.com/api/webhooks/${webhook.id}/${webhook.token}`, {
   method: 'post',
   body: { content: JSON.stringify(content), username: JSON.stringify(username) }
   }).then((e) => e.json());
   return hook;
}```
#

await sendWebhook('hi', 'hi', 'https://bob.png', webhook);

delicate shore
#

ty
@hazy sparrow mention not

#

omg

#

a new change just happend for bots

#

if u do any cmd which has a link

#

it will automatically remove link and attach it as an file

#

wow

#

for ex like gif

#

it will hide it!

loud matrix
#

it does that for humans

delicate shore
#

not sure

#

/giphy ok

#

yes it does

#

how do i make people add my bot?

#

i have worked hard on it/ i pay 10$ for it's hosting but people keep removing it from their server

#

it was in 92 servers 3 days before

#

and now it is in 86

#

including 2 my servers

#

so 84

earnest phoenix
#

Not bad

#

Very good imo

wary flame
#

Not bad although I'd say you should use another color palette

#

Oh in that case nevermind

valid frigate
#

interesting font

hazy sparrow
#

will the first if statment ever run?

module.exports = {
    name: 'bottleflip',
    description: "this is a ping command!",
    
    execute(message){
       const cf = Math.floor(Math.random() * 101) + 1
        if(cf<= 5 ){
            message.channel.send (':bowbottlecap: | OMG! The bottle landed on its cap! What a pro!')
       }
       else if(cf<= 30){
        message.channel.send (':bowbottlesuccess: | The bottle stands on the ground! you got lucky there..')
       }
       else{
        message.channel.send (':bowbottlefail: | The bottle landed on its side. LOL')
       }
     }
 }
lusty quest
#

maybe but only with a 5% chance

earnest phoenix
#

OOF MY BRAIN

mental canopy
#

If you guys needed help with making your bot online 24/7 feel free to dm me

solid falcon
normal kraken
#

In discord.js how would i make it so my bot can detect a language the user speaks and redirects them to another channel? ( if that is possible to do )

cosmic iris
#

Hello, can someone please help me. My bot runs of my raspberry pi and the scripts are still running, it is connected to wifi and the token is correct but my bots are offline?

normal kraken
#

@cosmic iris have you tried stopping the bot than starting it up again? and have you tried double checking the token? cause the token is above 32 characters.

cosmic iris
#

Yeah I did

normal kraken
#

hmm

#

Do you have a online status system built in?

frank jackal
#

Your pi 100% have internet?

lusty quest
#

did you got a console log?

#

@normal kraken you could use something like the Google translate API to detect the language

normal kraken
#

Aight thx @lusty quest xD

solid falcon
cosmic iris
#

Your pi 100% have internet?
@frank jackal Ive been using it for a week

#

just now it stopped

#

I checked if my tokens changed and replaced them still doesnt work

#

its not the pi cuz it doesnt work on my pc too even with new tokens and stuff

feral aspen
#

Hey Guys

#

Quick question

#

If I buy the Developer license, what perks or features will I get.

earnest phoenix
#

create announcements channels

#

that's the only special thing you'll get

#

and obv publish SKUs

#

the dev license is meant for gane developers

feral aspen
#

You buy it once and finish, you have it forever, right?

earnest phoenix
#

correct

stiff stream
#

command:

#

error:

#

?

#

someone know what to do?

slow dragon
#

are you sure member is defined

stiff stream
#

no

#

ik thats the problem

#

idk how to defined it

slow dragon
#

well assuming you have the message

stiff stream
#

?

slow dragon
#

you can use message.member

stiff stream
#

in the Thumbnail?

slow dragon
#

well no

#

you'd have to do

#

message.member.user.displayAvatarUrl()

#

you should really read the docs

stiff stream
#

@slow dragon

earnest phoenix
#

Can my bot be accepted if it's using a image from google as pfp?

stiff stream
earnest phoenix
#

define person

stiff stream
#

oh wait i know how

acoustic orchid
#

Dm me pls if u can help me i am trying to make my first bot

earnest phoenix
#

if you pay me, sure

acoustic orchid
#

Uhmm I just need help with making it

earnest phoenix
#

yeah, my services are paid mmLol

#

anyways

#

you can ask any questions you have in here

slow dragon
#

use this site if you want to make a bot

#

it walks you through everything you need to know

acoustic orchid
#

Ok

#

Thx @slow dragon

slow dragon
#

πŸ‘

lusty quest
#

it still needs basic understanding of javascript

slow dragon
#

im assuming all he wanted to do was get his bot up and running

lusty quest
#

Dm me pls if u can help me i am trying to make my first bot
@acoustic orchid sry for the ping

slow dragon
#

it gives you instructions on how to do that

#

not to mention they provide links to js courses

acoustic orchid
#

I already have my bot but idk how to add commands

lusty quest
#

ok also you got then basic knowledge this helps a lot. many users join here and expect to get Spoonfed

acoustic orchid
#

Oh ok

restive furnace
#

yes

thick gull
#

half the questions / commands people ask for are already online too lol (noticed this in every dev discord lol)

hazy sparrow
lusty quest
#

looks like it doesnt load the prefix (without looking at the code)

#

hmm the main file looks ok

hazy sparrow
#

thats the problem since i added aliases to one of my commands

#
module.exports = {
    name: 'cf',
    description: "this is a ping command!",
    aliases: ['coinflip', 'cointoss'],
    execute(message){
       const cf = Math.floor(Math.random() * 1001) + 1
        if(cf===1 ){
            message.channel.send ("**"  + `OMG ${message.author.username}!!!` + "**" + `THE COIN LANDED ON ITS SIDES `)
       }
       else if(cf<=500){
        message.channel.send ("** :bowheads: |"  + `${message.author.username}` + "**" + ` it was heads!`)
       }
       else{
        message.channel.send ("**:bowtails: |"  + `${message.author.username}` + "**" + ` it was tails!`)
       }
     }
 }
lusty quest
#

how did you define the aliases for the other commands?

thick gull
#

are the aliases different

lusty quest
#

its possible that the bot gets them as a empty string and executes every command bcs of this

clever vector
#

Hello guys can you help me convert the bot code from glitch to repl.it

lusty quest
#

client.commands.find(cmd => cmd.aliases && cmd.aliases.includes).execute(message); this could be the issue

hazy sparrow
#

i dont have aliases for other commands

obtuse lantern
#

Hello

lusty quest
#

yea it looks like you only execute commands that have a alias

weary ridge
thick gull
#

looks like an error

weary ridge
#

ik but it was working perfectly for months

lusty quest
#

maybe you need to update something

fickle arch
#

or maybe change something.

burnt summit
#

Does anybody know how to setSelfDeaf a bot?

pale vessel
#

voicestate#setSelfDeaf(true)?

weary ridge
#

umm @lusty quest thats weird my other bot isn't displaying errors

#

but that one bot is

lusty quest
#

i have no knowledge about py

weary ridge
#

hmm super weird tho

versed ravine
#

can someone help me? i have a script to play music but somehow it always skipping the music, not playing it, heres the script

#
        bot.joinVoiceChannel(msg.member.voiceState.channelID).catch((err) => { // Join the user's voice channel
            bot.createMessage(msg.channel.id, "Error joining voice channel: " + err.message); // Notify the user if there is an error
            console.log(err); // Log the error
        }).then((connection) => {
            if(connection.playing) { // Stop playing if the connection is playing something
                //connection.stopPlaying();
                return "> a song was played";
            }
            const musicStream = ytdl(url, {
                audioonly: true
            });
            connection.play(musicStream); // Play the file and notify the user
            bot.createMessage(msg.channel.id, `Now playing **${url}**`);
            connection.once("end", () => {
                bot.createMessage(msg.channel.id, `Finished **${url}**`); // Say when the file has finished playing
            });
        });```
#

can anyone help me find the problem and the solution? (im using js eris)

weary ridge
#

@lusty quest lol all i had to do was python -m pip install -U discord.py

#

in my terminal

lusty quest
#

told you to update

weary ridge
#

hmm lol i didn't know how to rip

#

lol thx anyways πŸ™‚

plucky harness
#

yo if i restart my vps would the docker container running stop?

fervent goblet
#

yes

#

anyone know how to solve this error with lavalink?

lavalink/server/info/AppInfo has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
fickle arch
#

My command handler it's working fine with help and some music commands but when I tried using ban, kick, purge it always shown this error, I had 2 command handler the first one I'm using and the second one works on ban but not on music.

#

the scond one is simplified of the first one.

nova jay
#

I use heroku for my bot and website host and I want to use the vote webhook I go to set it up but it doesn't work is that just a heroku issue it doesn't give any errors

plucky harness
#

depends on how you are using it

tranquil sandal
#

Hi, someone have how to install the top.gg api in dpy?

#

is a cog?

slender thistle
#

The dblpy example is a cog, yes

tranquil sandal
#

Ah tnx

fickle arch
#

how to fix this it says commands.get not a function working on music commands but not in moderation commands.

      commands.get(message, args);
    } catch (error) {
      console.error(error);
      message.reply("There was an error executing that command.").catch(console.error);
    }```
#

If using second command handler music command do the same like moderation but the moderation works fine.

cinder patio
#

what's commands?

tranquil sandal
#

@slender thistle and theres a way to put the dblpy direct to code?

slender thistle
#

Well, yes, if you know what to remove

earnest phoenix
#

does anyone have python flask code for a DBL webhook handler as mine is currently not working (they aren't passing anything in headers etc ._.)

slender thistle
#

I had one in my repos list

#

let me dig it up

earnest phoenix
#

tysm ❀️

nova jay
#

this is what i have

// server.js
// where your node app starts

// we've started you off with Express (https://expressjs.com/)
// but feel free to use whatever libraries or frameworks you'd like through `package.json`.

const DBL = require('dblapi.js');
const express = require("express");
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

// make all the files in 'public' available
// https://expressjs.com/en/starter/static-files.html
app.use(express.static("public"));

// https://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, response) => {
  response.sendFile(__dirname + "/views/index.html");
});

// listen for requests :)
const listener = app.listen(process.env.PORT, () => {
  console.log("Your app is listening on port " + listener.address().port);
});

server.listen(5000, () => {
  console.log('Listening');
});```
earnest phoenix
#

sadly it has to use python lol

slender thistle
earnest phoenix
#

hm thx

nova jay
#

so the js one does not work?

earnest phoenix
#

uh, idk

#

i have to use python as that's my main codebase lang and api lang

#

.-.

#
    if request.headers.get('Authorization') == webhook_password:

``` that isn't working though as it isn't passing any headers
#

seems like i forgot to print theform and post data, now to use another alt to try that .-.

slender thistle
#

Test button πŸ‘€

earnest phoenix
#

hmm

#

does that give fake data

slender thistle
#

"fake", yeah

earnest phoenix
#

oh ok

#

good

#

lemme try that then

#

cuz on nginx, it came as a get request iirc

slender thistle
#

You get a request as you voting for the bot where request_type will be equal to 'test'

#

It always comes as a POST request

earnest phoenix
#

hm

#

hm ok

#

hmm

#

it seems to not be sending the authorization code as a header?

slender thistle
#

Did you set the Authorization field as anything?

earnest phoenix
#

yes

slender thistle
#

I wonder why it's empty

#

How are you printing that stuff?

earnest phoenix
#

lemme get that code

austere creek
#

Mind if I poke 165?

earnest phoenix
#

that's the full code for that part

solid falcon
#

I can't Get Guild Webhook, it's returned 401 Unauthorized, What's URL should look like?

pale vessel
#

authorize

earnest phoenix
#

hm?

#

ah

#

lol

slender thistle
#

https://discordapp.com/api/v6/webhooks/700788404195033135/ or something similar

#

The ID being ID of the webhook

earnest phoenix
#

hmm, is there an issue with dbl's webhook system

golden condor
#

No, that's not dbl webhooks, that's discord webhooks.

earnest phoenix
#

i know

#

dbl's webhook broke on me sooo Β―_(ツ)_/Β―

#

lmao

golden condor
#

What IP did you route it to?

nova jay
slender thistle
#

What is vote_keys

earnest phoenix
#

to my api url

#

its a list of authorization tokens

golden condor
earnest phoenix
#

Β―_(ツ)_/Β―

slender thistle
#

ehh not necessary

earnest phoenix
#

well i was asking for code but it kinda broke on me

slender thistle
#

Did you press Save before pressing Test

earnest phoenix
#

yes

slender thistle
#

Mind sending me your auth key and URL in DMs?

earnest phoenix
#

ok

#

done

nova jay
#

I just got it working I can't host my website and the Web hook at the same time for some reason

misty sigil
#

They might be on the same port

slender thistle
#

I suggest you regenerate that token ASAP

#

:^)

nova jay
#

yeah i see that

#
// server.js
// where your node app starts

// we've started you off with Express (https://expressjs.com/)
// but feel free to use whatever libraries or frameworks you'd like through `package.json`.

const DBL = require('dblapi.js');
const express = require("express");
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL("~~~", { webhookAuth: '~~~', webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

// make all the files in 'public' available
// https://expressjs.com/en/starter/static-files.html
app.use(express.static("public"));

app.get('/', (request, response) => {
  response.sendFile(__dirname + "/views/index.html");
});

server.listen(process.env.PORT, () => {
  console.log('Listening');
});```
#

sigh i fixed it

earnest phoenix
#

how

jaunty junco
#

this is the code

client:on('memberJoin', function(member)
    if member.guild.id == "735405634111012985" then
       local memberid = member.id
       local joinAt = member.guild:getMember(memberid).joinedAt
       member.guild:getChannel("735410662016155679"):send("some dude joined at "..joinAt.." !")
   else return 0 end
end)
indigo stone
#

why my bot not here

jaunty junco
#

cause it has not been accepted?

clever vector
#

Guys how to thumbnail bot icon

jaunty junco
#

eh?

#

you mean set the profile picture?

acoustic orchid
restive pebble
#

Dbd

acoustic orchid
#

Is this good I am trying to learn how to make a bot this is my first time trying it

#

Can someone maybe help

tranquil sandal
#

hey

#

i need help

jaunty junco
#

with

tranquil sandal
#

installing de dblpy

jaunty junco
#

cant help

tranquil sandal
#
discord.ext.commands.errors.CommandNotFound: Command "update_stats" is no
t found
#

i have this error

hollow crypt
#

I want to know how to set botton style

slender thistle
#

update_stats is a loop, not a command

#

it runs by itself in the code once you start it

hollow crypt
#

No one know...

acoustic orchid
#

Is this good?

tranquil sandal
#

update_stats is a loop, not a command
@slender thistle ah

restive furnace
#

@acoustic orchid dont spam.. if its in your opinion good, then it is good.

livid rivet
#

hey guys I need help with regex

tranquil sandal
#

but i cant see the servers

acoustic orchid
#

@acoustic orchid dont spam.. if its in your opinion good, then it is good.
@restive furnace I mean idk I have never done this

tranquil sandal
#

says n/a

livid rivet
#

how do I split a string (example: "1d12h15m7s") into "1d", "12h", "15m" and so on

acoustic orchid
#

I am asking if what I did is good

hollow crypt
#

@acoustic orchid Hmmm Your bot may not be able to add to DBL

slender thistle
#

Split by a non-numeric character (regex probably)

acoustic orchid
#

What’s dbl

restive furnace
#

@acoustic orchid Hmmm Your bot may not be able to add to DBL
@hollow crypt yeah, cuz dbd

slender thistle
#

Bot maker apps are fine as long as the bot isn't a clone of a template

restive furnace
#

ah, good to know

hollow crypt
#

Hmmm

acoustic orchid
#

I am trying to do something but I have like 0 idea of what I am doing

hollow crypt
#

So How to set all button style

tranquil sandal
#

@slender thistle but in the website don't work

#

the conunter

slender thistle
#

show code

#

@hollow crypt CSS?

hollow crypt
#

@hollow crypt CSS?
@slender thistle Hmmm IDK how to do

slender thistle
#

I'm asking you what you want to use to edit the "buttons"

hollow crypt
#

Yes css

slender thistle
#

A rule for button if you want to edit all button elements

tranquil sandal
#

@slender thistle ok

slender thistle
#

apply a certain class to the elements and then add a rule for .yourclass in your CSS if you only want to edit certain buttons

tranquil sandal
#

shit

slender thistle
#

Regenerate that token

tranquil sandal
#

my token

#

yeah

#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'thetoken' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token)

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

        # if you are not using the tasks extension, put the line below

        await asyncio.sleep(1800)

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))
#

token regened

#

what's the error

slender thistle
#

just when I thought I needed to update the docs everywhere

tranquil sandal
#

?

slender thistle
analog kestrel
slender thistle
#

see the example including update_stats

#

aka the first one

#

-faq @analog kestrel

#

...

#

-faq 1

gilded plankBOT
tranquil sandal
#

where's the code?

acoustic orchid
slender thistle
#

@tranquil sandal Scroll down

#

until you see the first snippet of code

tranquil sandal
#

a

#

ok

#

here?

slender thistle
#

yes

tranquil sandal
#

ah ok

#

but it's the same from the docs?

hollow crypt
#

I'm asking you what you want to use to edit the "buttons"
@slender thistle Oh sorry...Its HTML...

slender thistle
#

You want to edit all <button> elements, correct?

hollow crypt
#

Yes

tranquil sandal
#

this code will auto update?

#

or manualy

slender thistle
#
button
{
    /* my stuff here*/
}```
#

Automatically @tranquil sandal

tranquil sandal
#

ah, and the last code, that says autopost

#

whats?

#

if the first code autopost

slender thistle
#

It automatically grabs length of client.guilds and posts it on the website

#

aka what update_stats currently does for you

tranquil sandal
#

ah, and whitch is better?