#development

1 messages ยท Page 728 of 1

radiant jay
#

Google it

languid dragon
#

and if you want a real answer you're gonna need to figure it out yourself

solar wraith
#

lel

unique nimbus
#

Check if someone voted -> Give Coins

winter hawk
#

Anyone know how to count how many members that has no roles? Or any bot that provides this feature?

#

Since prune members feature from discord returns 502 error and can't be used in our server.

earnest phoenix
#

what library

sudden geyser
#

I mean, you can loop through each member and check the length of the roles list

earnest phoenix
#

^

cloud agate
#

for member in guild: if member.roles in (0,1): he has no roles
idk if it'd be 0 or 1 lol

#

nice

#

@weak parrot ur online cmere

modest maple
#

@modern sable sorry for ping but he's done it to every channel

#

Even more of a sorry it might just be my discord not reloading which is why he's still in for me

#

Sorry for the ping

modern sable
#

ty

cloud agate
#

my ping didn't get mod attention :pepehands:

weak parrot
#

I have have no idea what you're even talking about

grim aspen
#

ads

green kestrel
#

Pop quiz. You have a JavaScript function where you can put any code you like apart from some restrictions and you want to cause hassle for the system. Your restrictions are your code can't run more than 10ms, it can't use more than 256k and it can't access I/O except to send discord messages and manipulate some objects set before your code runs. Each time the execution ends the complete state is reset. Based on these restrictions, what abuse could be done? I'm trying to cover all bases I can in my bots sandbox.

quartz kindle
#

does it have access to the discord client?

#

can it be used to mass dm people?

#

or to kick/ban/edit guilds and members?

green kestrel
#

It can only do what I give it an interface to do, @quartz kindle

#

I was thinking that DM would not be a feature of that interface

#

The bot doesn't have access to kick, ban, etc as it's not a moderation bot, unless someone altered it's invite to give it more permission than intended

#

It's generally a chat bot

#

My main concern is flooding, but you can only message channels within the guild your event was triggered in

#

So if you flood anything you flood your own server and the underlying client has rate limiting

#

The main interface I was going to give was: find channel on guild by id, find user on guild by id, message channel by id with embed or plain text

#

That should be enough to do some nice stuff with for starters for beginners yes?

modern sable
#

~~okay so
i'm trying to get all distinct weeks ("2019-18", "2019-19", etc.) and and the sum of all bids during that week that are marked with outbid = 0 and a certain product name

My first attempt was sql SELECT DISTINCT week, (SELECT SUM(amount) AS amount FROM bids b2, products WHERE b1.name = b2.name AND b1.week = b2.week AND outbid = 0 AND b2.name = products.productname AND products.id = '1') AS amount FROM bids b1 ORDER BY b1.week ASC;
but this duplicates all weeks like this https://luca.is-inside.me/Ko9W4WbZ.png

My second attempt after using a left join was

SELECT DISTINCT week, b2.amount
FROM bids
LEFT JOIN (SELECT SUM(amount) AS amount
            FROM bids, products
            WHERE outbid = 0
                AND bids.name = products.productname
                AND products.id = '1') b2 ON bids.week = week
WHERE
    outbid = 0
ORDER BY bids.week ASC;```
While this doesn't duplicate the weeks, sum(amount) obviously ignores the individual week now~~

nvm got it
#

I want weeks with no bids to show up aswell so thats why a simple group by doesnt work

hidden aurora
#

Does anyone know what software I need to make a music bot other than discord.js, node.js, and Visual Studio Code?

mossy vine
#

either node-opus or opusscript for voice support

#

visual studio code isnt necessary. any code editor will do

valid frigate
#

webstorm gang

mossy vine
#

vim gang

unique nimbus
#

nano gang

earnest phoenix
#

notepad gang

vital lark
#

notepad++

earnest phoenix
#

no

quartz kindle
#

sublime text gang

west raptor
#

node cli gang

slender mountain
#

ye sublime text

late hill
#

intellij sipp

slender mountain
#

ew why would you use notepad PES_CringeGrin

unique nimbus
#

Gotta write it in nano

#

smh

valid frigate
#

jetbrains gang

sudden geyser
#

no we're cheap

unique nimbus
#

Jetbrains Premium is free

#

with Student

valid frigate
#

writing a guide on how to get it right now

sudden geyser
#

Pretty sure there are official instructions already

ornate wedge
#

Fellas, any idea on how to display the status "Bot is typing..." on python?
I only have this:

async def Hey(ctx):
    async with ctx.typing():
        await time.sleep(5)
        await ctx.send ("?")```
modest maple
#

Can you even do that?

#

Never heard of a bot being able Todo it

valid frigate
#

bots can

unique nimbus
#

yes

modest maple
#

OOoO

#

Why would u want that tho? XD

unique nimbus
#

To make it seem your bot is working

#

when it is dying

sudden geyser
#

at the cost of another request blobpirate

unique nimbus
#

yes

sudden geyser
#

or if your bot's slow

earnest phoenix
valid frigate
#

ew

#

reminder that this isnt off topic

earnest phoenix
#

oh whoops

ornate wedge
#

I made it

#

It was really easy in the end

modest maple
#

Fair enough

ornate wedge
#
async def Hi(ctx):
    async with ctx.typing():
        await asyncio.sleep(5)
    await ctx.send ("?")```
#

I only had to type asyncio.sleep(seconds):

modest maple
#

Oh wow it is just typing

#

Fair enough

ornate wedge
#

Hope this is useful for those who are trying to implement this option to their bots

#

Now back to work

modest maple
#

It's a cute lil feature

ornate wedge
#

Indeed, especially for the Q/A

amber fractal
#

Idk why people would slow their bot down to make it seem like it's typing.

sudden geyser
#

As in the bot's slow, so it sends a typing signal to say, "I'm working". Just an example case.

#

An example is @earnest phoenix

amber fractal
#

I'm saying it's just pretty pointless really.

sudden geyser
#

I know, it was just an example.

slender thistle
#

@ornate wedge you always want to use anything async in an async code

earnest phoenix
#
 if (message.content.startsWith('~edit'))
 {
 var messageID = message.content.split(" ")[1];
 var editedmessage = message.content.split(" ").slice(2).join(" ");
 var embed = JSON.parse(editedmessage)
 
 message.channel.fetchMessage(messageID)
 
 .then(message => {
 message.edit({embed});
 });
 }
});```

Hi this my embed edit message that worked out, but I noticed that the embed will go away after some hours, how do i prevent this?
#

How do i make the bot to delete the embed but not the message? message.delete() and then edit the message to send a new embed

swift topaz
#

after four months of not touching my code, I get this error always without consistency. sometimes even before the bot can run, sometimes, after the bot runs. help?

earnest phoenix
#

Sound like a firewall or proxy issue

swift topaz
#

ohh I see. Maybe because I'm at work rn haha thanks!

grizzled raven
#

for whatever reason, i randomly get an error, message.content.startsWith is not a function

valid frigate
#

content is undefined probably

grizzled raven
#

well i made it return when message.content is falsy and it still occurs

valid frigate
#

well

#

whatever it is, content is not a string

#

if it doesnt have a startsWith function on it, it's some other primitive type or null

late hill
#

Some bots use the typing thing when a command is executed that requires some time to process

#

This way users know it's busy

#

And not just dead

green kestrel
#

hmm

#

if i allow server owners/admins to add custom scripts to the bot and those custom scripts may allow the bot to do a at-everyone or at-here on that server, this isnt an issue, is it, if thats something that the owner decides to do? After all, they could do that themselves anyway with a simple message.

slender thistle
#

Would making a loop be possible in custom scripts?

#

Because ateveryone loops...

#

I'd really advise against making custom scripts public

restive furnace
#

If you would do custom scripts chance for pwners, they might can destroy ur bot globally.

#

they can eg. easily get ur bot token by prefixcommand client.token

green kestrel
#

no, they cant

#

๐Ÿ™‚

#

i factored this in, its a javascript virtual machine within a C++ bot, not just an eval

#

the way i see it, the server admin is being given enough rope to hang themselves, the api calls i give them only work within the guild where the event is triggered

#

so yes they could loop and spam a bunch of at-everyone to their own server, but not someone elses, and worse case scenario they piss off their own users

#

even then, the loop is limited in speed to the discord rate limit

slender thistle
#

I mean your bot would be blamed

#

Because users /shrug

restive furnace
#

if they get access to do custom scripts, then they can do anything??

topaz fjord
#

yes

#

@restive furnace

narrow knot
#

LF bot developer (high level), to make a job for $15.
for more info PM me.

amber fractal
green kestrel
#

@restive furnace anything? really? ๐Ÿ˜› anyone would think i didnt put any thought into this. ๐Ÿ˜„

#

its live now, if anyone wants to give it a go. i welcome anyone who manages to find any issues to report them back to me so i can improve it ๐Ÿ™‚

mossy vine
#

yeah i highly doubt a regular user of your bot would understand any of this ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

Yeah, things like custom commands in other bots are insanely simple or have a UI of sorts

#

You cant expect the users of your bot to always be insanely knowledgeable

green kestrel
#

yup ๐Ÿ™‚

#

i dont have time to create a visual language like with botblocks, nor is that my intent

#

its for people who know "a bit of" javascript, or can hack and copy and paste to get by

#

the system is very forgiving, especially compared to full blown node and djs

#

but not for complete newbies, no

#

if youre curious you can get to the functions via the bots dashboard

#

What will probably happen is over time people will share scripts, more technical users will give them to less techie ones

restive furnace
sudden geyser
#

yes

restive furnace
#

kk so its disc api or d.js v12?

earnest phoenix
#

discord updated

restive furnace
#

kk

green kestrel
#

-rwxr-xr-x 1 sporks sporks 69M Nov 13 15:05 bot
lol 69mb bot executable, ouch.

earnest phoenix
#

!bots

valid frigate
#

bud my jar is 13mb lmao

#

that honestly seems like an outlandish size for an executable

earnest phoenix
#

its normal for frameworks like .net core

#

java nasty

#

you can pack up a .net core app to a independent executable

#

meaning it can run without anything additional installed

modest maple
#

Yh

#

Having a exe is very useful

#

Where C languages Excell at really

#

Cuz python for example requires quite alot of work to make a exe

compact oriole
#

same for nodejs

unique nimbus
#

There is stuff like auto-py-to-exe

#

for that

#

to make exe

modest maple
#

Pytoexe doesn't support all the modules

unique nimbus
#

true

modest maple
#

It works

#

But limited

unique nimbus
#

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

modest maple
#

I tend to build a Kivy framework

unique nimbus
#

I don't make an exe normally

modest maple
#

So you turn all of the files in to exe

#

Nah

#

Unless it's supposed to be used on multiple systems that might not have Py installrd

green kestrel
#

its actually a C++ executable

#

with a ton of deps, and some heavyweight static linking

#

that one thats nearly 70mb i mean

#

and yeah its huge

#

i blame header-only libs

#

and -O3

modest maple
#

Meh

#

Everything can theoretically become a exe

silver rapids
#

Can a mod from here dm me

#

receving some weird dm's

amber fractal
#

You can dm a mod.

silver rapids
#

yeah, and hoping that one of th 10 i ping has time ๐Ÿ˜›

valid frigate
restive furnace
#

Soo is it possible nodejs to exe?

#

(but i dont rly need it cuz i use linux mostly anyways)

valid frigate
#

honestly you shouldnt really need to but i guess you can?

earnest phoenix
#

it's always suggested to compile your app rather than run a debug build of it

#

Hi, in discord.net, is there a more efficient way to delete a message after a certain amount of time rather than delaying the whole task?

This is the code at the moment:

var msg = await Context.Channel.SendMessageAsync("Yikes");
await Task.Delay(15000);
await msg .DeleteAsync();
#

well no

#

you can offload it to another thread if you don't want it to block the command

quartz kindle
#

are there no timers in py?

modest maple
#

There are

warm cloud
#

of course there are

modest maple
#

You need to make a async background task

warm cloud
#

or use ext.tasks

modest maple
#

Cuz you can't make a new thread using async without alot of hassle

slender thistle
#

If you just wanna sleep for X, two ways

warm cloud
#

(that's async, we dropped support for that in april)

slender thistle
#

fi you want a loop, two ways too

modest maple
#

No

#

Python still uses asyncio

warm cloud
#

okay then say asyncio

modest maple
#

That still will not work with a new thread

#

Hence why

#

In the docs

#

It says

#

Background tasks r a thing

warm cloud
#

as you have stated

vital lark
#

@quartz kindle that's C#

#

not Python

modest maple
#

ProxiPi

compact oriole
#

ProxiPi

warm cloud
#

ye

#

we'll go with dat

spark star
#

I'm making an API that allows peeps to get anime pictures for their bots, but need a name, so here: React with ๐Ÿ‡ฆ for ProxiPI, ๐Ÿ‡ง for ProxPI, ๐Ÿ‡จ for PIroxy, and ๐Ÿ‡ฉ for API

#

Yeetus

#

2 votes, seems very good lmao

modest maple
#

3*

spark star
#

Lmao

#

Ok, thanks for the help naming it guys lmao

restive furnace
#

@earnest phoenix debug?? nodejs doesnt have actually any debug build expect u can put debug mode on some modules

spark star
#

Starting the project now! It's in python and being made with flask

prisma lion
#

hey,
well im tryin to make my bot auto coins drop system can be switched like
//enable coin drop status
//disable coin drop status

anyone can help please?
||discord.js||

unique nimbus
#

Use a database for each server to log the drop system to on or off

#

then check if its on it will enable the coin drop

compact oriole
#

^

unique nimbus
#

if its off it will disable

compact oriole
#

pretty much that

prisma lion
#

oh k

compact oriole
#

i would recommend firebase

prisma lion
#

u mean host for both?.. xd?

twilit rapids
#

You can create a simple map and store it. Example:

{id: "123456789123456789", mode: "off/on"}
prisma lion
#

ooo

vital lark
#

memory storage (maps, arrays) is a bad practice if ur bot is gonna be bigger

compact oriole
#

then theres crashes and such

#

databases are a fullproof solution

prisma lion
#

...

#

ok how to make one

#

or buy.

vital lark
#

it's recommended to use rethinkdb, MongoDB, or sql-based

compact oriole
#

firebase is rly cheap

prisma lion
#

how much?

vital lark
#

but mongo is free

prisma lion
#

well i search the best

vital lark
#

and easy to install on vps

prisma lion
#

i mean no tons of crash

compact oriole
#

well firebase is free

#

and then it scales up really well

#

50000 reads a day

prisma lion
#

ooo

compact oriole
#

20k writes

#

backed by google

#

multiregion

prisma lion
#

omg

#

ill try to do it

#

xD

compact oriole
#

good luck ;D

prisma lion
#

ty

blissful scaffold
#

I use SQLite, it works fine if you don't write too often to the DB

#

From experience I learned that trying to write to the DB 5 times per second is too much ๐Ÿ˜„

quartz kindle
#

which sqlite driver/lib did you use?

#

and also how did you make those writes?

#

because

SQLite will easily do 50,000 or more INSERT statements per second on an average desktop computer. But it will only do a few dozen transactions per second

grizzled raven
#

wait whats the difference again?

#

i mean

quartz kindle
#

a transaction involves waiting for data to be written to disk

#

inserts are loaded into memory before they are written

blissful scaffold
#

I did 1 write, then a commit, then another write and so on.
I did change it now to group all the writes together before writing it to the DB

#

don't try to commit every single write action if you do a ton of them ๐Ÿ˜„

#

I should probably have been more clear and said 5 transactions/commits per second instead of writes

topaz fjord
#

Firebase costs doesn't it?

restive furnace
#

It doesnt, but its pretty hard so ill recommend who didnt use any dbs other than json or no any, use these to write and read the db

Keyv

Sequelize

Choose wich want but sequelize is just like sql v2

#

and keyv is easier

#

than sequelize

#

(i use sequelize)

#

@topaz fjord

quartz kindle
#

depends on your use case

#

keyv is only for key-value storage, if you need tables/documents/other complex storages, then you need something else

#

also neither keyv nor sequelize are actual databases

#

they are just abstraction layers

modest maple
#

im guessing this is under development

#

dont by any chance know how to change keyboard language

#

my UK keyboard has turned american

#

-_-

unique nimbus
#

It is in Settings

modest maple
#

where

unique nimbus
#

What keyboard are you using

mossy vine
#

find keyboard settings in your os

#

change layout there

queen canopy
#

.

twilit rapids
#

-dotpost @queen canopy

gilded plankBOT
#

@queen canopy

Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.

queen canopy
#

I nead bot

summer torrent
#

what

lunar crystal
summer torrent
#

message.guild

#

what is guild.size?

lunar crystal
#

The number of guild where my bot is

summer torrent
#

<Client>.guilds.size

modest maple
wooden lance
#

btw, would be a good idea to use .toLowerCase(), @lunar crystal

barren moss
#

Where can I submit for they to add my bot?

sudden geyser
barren moss
#

kk

#

ty bro

minor stratus
#

I'm a bot dev, how do I get the role.

summer torrent
#

If your bot will be approved, you will get the Bot Developer role

modest maple
#

@unkempt root you have to be certified to use JS on the long description

unkempt root
#

oh, how do i get certification? does my bot have to be added to DBL? because it's not approved yet ._.
ping me

vital lark
#

@unkempt root u need to send a physical letter to Oliy since the online applications are frozen with no ETA planned.

modest maple
#

And it's gotta meet all requirements

#

Which are high

#

Mostly

unkempt root
#

oof ok

#

so no fetching from website, got it lmao

blissful scaffold
#

You can use iframes i think

#

make an iframe that just shows your website and you can do anything you want

#

@unkempt root

unkempt root
limber plinth
#

How do you get the total count of shards created?

west raptor
#

if djs

#

@limber plinth what library?

limber plinth
#

Djs

indigo flax
#

My friend is trying to make it's stats Playing !help | Watching (number) users

#

He uses java

#

isnt it

#

"Playing !help | Watching " + client.getUsers().length + " users."

dusky marsh
#

Add sharding?

#

It is pretty self-explanatory.

earnest phoenix
#

Read the docs for sharding

#

For your library

valid frigate
#

congrats on hitting 2.5k guilds first of all

#

as he said, now is the time to start sharding your bot

compact oriole
#

tf is sharding

#

it looks hard xd

restive furnace
#

@compact oriole umm how its hard if u did dashboard and etc. i think thats harder

#

cuz u just need to use sharding manager

#

and yeg

compact oriole
#

oh yeah, just found a good guide

#

xd

restive furnace
#

discordjs.guide?

#

its rly good guide for sharding

#

xd

restive furnace
#

wait

slender mountain
#

Yea its required when your bot hits 2500 guilds

compact oriole
#

If id knew about that i would have started with it

restive furnace
slender mountain
#

Nah you dont generally start with it

restive furnace
#

thats better guide

#

@compact oriole

compact oriole
#

kk

valid frigate
#

you can start sharding any time you want

compact oriole
#

well, as my bot has like 5 guilds i dont need it lol

#

but good to know

valid frigate
#

in fact it's probably best to work around it whenever you start a new project tbh

restive furnace
#

ye but maybe fist code some other functions

slender mountain
#

It's not that hard to implement so eh

valid frigate
#

whenever is a good time

high anchor
#

hello

#

i have a question about Discord.js

compact oriole
#

mayby when it has 1500 guilds then you should do sharding

high anchor
#

Manager.on('message', function(shard,message) {}) i know how to do the opposite

restive furnace
#

manager.on

#

idk

high anchor
#

that's for a shard broadcasting to the manager

#

the documentation provides a message for sending a message from the manager to each shard

#

method for*

#

would it be client.shard.on('message', function(msg){}) for the event listener in the subprocess

broken jay
#

Huh this difficul discord.js. I like python, due this have AutoShardedBot

high anchor
#

sharding isn't hard

#

I just have a multi-server channel feature (messages are sent by webhook on both servers in a specific channel)

#

and since sharding splits the guilds i need my shard manager to handle that

broken jay
#

But... in js you must change some code when you start using sharding, correct?

slender thistle
#

I heard discord.py AutoShardedBot will break at some point

high anchor
#

well sure, but it's hardly any work

slender thistle
#

remember saying someone it broke on 50k guilds k3llyShrug

broken jay
#

Huh

#

first let's reach this

slender thistle
#

True

high anchor
#

broadcasting directly to all other shards from the shard itself works

#

problem solved

earnest phoenix
#

hoi a question about message collector

   message.channel.awaitMessages(response => response.content === "uwu", {   max: 1,
        time: 30000,
        errors: ['time'],
      })```

How do I make the `awaitMessages` to accept any kind of message and not just `uwu` (Like any text they want to type)
late hill
#

By not copying code and understanding what you're doing

#

The function you're passing to it acts as a filter

#

true -> collect
false -> don't collect

#

so if you want it to collect everything, what do you think the filter should look like

modest maple
earnest phoenix
#

I just delete the === "uwu"

#

after staring at the codes for some hours

#

pogey i finally solve something by myself, thanks for being strict to meh

slender mountain
#

Quick question, I am using createReactionCollector for embed pages, and right now it doesn't time out, so the bot is constantly listening for the reactions. Is this considered API abuse?

#

I'll probably have it time out if nobody reacts after a certain amount of time anyway, but I was just curious

modest maple
#

Well not rlly?

#

As long as it's not in a loop constantly pinging to check

#

If it's just like on the reaction

#

It should be okay

#

Otherwise things like reaction roles would be considered abuse

slender mountain
#

True yeaok

#

thanks

modest schooner
#

can anyone help me with sharding my python bot?

raven torrent
#

Sure

modest maple
#

You rlly don't need to shard unless your servers are near 2000

#

And you can get a autosharding system with d.py

modest schooner
#

i am over 2500

raven torrent
#

@modest schooner When you setup your bot

#

And put the prefix

#

as parameter

modest schooner
#

like he wont even launch, i left the problem off for months because i was busy with exams

raven torrent
#

replace your the name with AutoShardedBot

modest maple
#

It's cuz Ur at the guild max

#

For one shard

raven torrent
#
bot = AutoShardedBot(description="a description", command_prefix="!", shard_id=1, shard_count=5)

# shard_id = where to start
# shard_count = amount of shards for your bot
modest schooner
#

"NameError: name 'AutoShardedBot' is not defined' do i need to import some modules? sorry if im being silly here like i havnet touched python for months

modest maple
#

Have u got snippet of code

modest schooner
#

``@client.event
async def on_message(message):
# we do not want the bot to reply to itself
if message.author == client.user:
return
if message.author.id == elise:
print(message.content)
return

if message.content.startswith('hewwo') or message.content.startswith('HEWWO') or message.content.startswith('howdy'):
    msg = 'Hello {0.author.mention}'.format(message)
    await client.send_message(message.channel, msg)

if 'what the hell' in message.content:
    msg = 'https://www.youtube.com/watch?v=oZTbnoSFgMU'.format(message)
    await client.send_message(message.channel, msg)
``
#

like this?

modest maple
#

Ah

#

Ur using client event not bot

#

Client event is when any user sends a message or does somthing

#

You might need to switch to bot

raven torrent
#

you need to import AutoShardedBot

#

as simple as that

#
from discord.ext.commands import AutoShardedBot

client= AutoShardedBot(description="a description", command_prefix="!", shard_id=1, shard_count=5)
#

also

#

to improve your code

modest maple
#

I don't think client uses a set prefix?

raven torrent
#

instead of that

if message.content.startswith('hewwo') or message.content.startswith('HEWWO') or message.content.startswith('howdy'):

put that

if message.content.lower().startswith('hewwo'):
#

it will convert the message to lowercase

#

so that if someone sends "HeWwO" it will still work

modest schooner
#

yeah i probably shouldve done that a long time ag huh

raven torrent
#
from discord.ext.commands import AutoShardedBot

client= AutoShardedBot(description="a description", command_prefix="!", shard_id=1, shard_count=5)
modest schooner
#

thanks i shall make my bot aps insensitive

raven torrent
#

this should work fine

modest schooner
#

should i remove 'from discord.ext.commands import bot' ?

#

oh heck i meant to

#

from discord.ext.commands import bot

raven torrent
#

Yes since you won't use it anymore

#

The only thing you'll need to change is when u initialize the "client" or "bot" variable

#

In my bot it's "client"

#

if u need further help just ask

modest schooner
#

will do thanks

raven torrent
#

Otherwise send me a dm

modest schooner
#

wait oh god i posted my token in that wait

#

discord.errors.ConnectionClosed: WebSocket connection is closed: code = 4011 (private use), reason = Sharding required.

raven torrent
#

show the actual code where you initialize the bot

modest schooner
#

i changed it to this ``import os
import discord
from discord.ext.commands import bot
from discord.ext.commands import AutoShardedBot

from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio
import random
import time
from datetime import datetime, timedelta, tzinfo
from pytz import timezone
import pytz
import datetime
with open("prefix.data") as prefixf:
prefix = prefixf.readline()
Client = discord.Client()
bot = AutoShardedBot(description="a description", command_prefix="!", shard_id=1, shard_count=5)
with open("token.data") as tokenf:
token = tokenf.readline()
TOKEN = 'XXXXXXXXXX'
client = discord.Client()``

restive furnace
#

please use ``` instead of `

modest schooner
#

``?

#

``import os
import discord
from discord.ext.commands import bot
from discord.ext.commands import AutoShardedBot

from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio
import random
import time
from datetime import datetime, timedelta, tzinfo
from pytz import timezone
import pytz
import datetime
with open("prefix.data") as prefixf:
prefix = prefixf.readline()
Client = discord.Client()
client = commands.Bot(command_prefix = prefix)
with open("token.data") as tokenf:
token = tokenf.readline()
TOKEN = 'XXXXXXXXXX'
client = discord.Client()``

raven torrent
#

see

#

You put

#

client = commands.Bot(...)

#

You should put

restive furnace
#
import discord
from discord.ext.commands import bot
from discord.ext.commands import AutoShardedBot

from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio
import random
import time
from datetime import datetime, timedelta, tzinfo
from pytz import timezone
import pytz
import datetime
with open("prefix.data") as prefixf:
    prefix = prefixf.readline()
Client = discord.Client()
client = commands.Bot(command_prefix = prefix)
with open("token.data") as tokenf:
    token = tokenf.readline()
TOKEN = 'XXXXXXXXXX'
client = discord.Client()```
raven torrent
#

client = AutoShardedBot (description="desc", command_prefix="!", shard_count=5)

lean pike
#

Guys I Need Reply Code and Embed

raven torrent
#

@restive furnace stop sending random stuff

modest schooner
#

b

raven torrent
#

Should I code the sample for you?

earnest phoenix
#

don't spoonfeed

green kestrel
#

hmm. i should define a global constant in my bot's vm called client.token, as a string, with the value https://www.google.com/search?q=token&source=lnms&tbm=isch
... just to mess with hackers that think i was that dumb ๐Ÿ™‚

modest schooner
#

yeah

#

i mean

#

yeah dont spoonfeed

#

heck

#
import discord
from discord.ext.commands import bot
from discord.ext.commands import AutoShardedBot

from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio
import random
import time
from datetime import datetime, timedelta, tzinfo
from pytz import timezone
import pytz
import datetime
with open("prefix.data") as prefixf:
    prefix = prefixf.readline()
Client = discord.Client()
client = AutoShardedBot (description="desc", command_prefix="!", shard_count=5)
with open("token.data") as tokenf:
    token = tokenf.readline()
TOKEN = 'XXXXXXXXXX'
client = discord.Client()
startup_extensions = ("Music.py")
bot = commands.Bot("?")
mommywords = ("Oh shit oh fuck looks like something gone wrong with the message to accompany your anime mom.")
ronpatext = ("Error 404, text not assigned yet.")

class Main_Commands():
        def __init__(self, bot):
         self.bot = bot```
green kestrel
#

so if someone tries to make a javascript in my control panel that does something like: create_message(CHANNEL_ID, client.token) it gives them an image search for fairground tokens ๐Ÿ˜„

raven torrent
#
import os
import discord
from discord.ext.commands import bot
from discord.ext.commands import AutoShardedBot

from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio
import random
import time
from datetime import datetime, timedelta, tzinfo
from pytz import timezone
import pytz
import datetime
with open("prefix.data") as prefixf:
    prefix = prefixf.readline()
Client = discord.Client()
client = AutoShardedBot (description="desc", command_prefix=prefix, shard_count=5)
with open("token.data") as tokenf:
    token = tokenf.readline()
TOKEN = 'XXXXXXXXXX'
startup_extensions = ("Music.py")
mommywords = ("Oh shit oh fuck looks like something gone wrong with the message to accompany your anime mom.")
ronpatext = ("Error 404, text not assigned yet.")

class Main_Commands():
        def __init__(self, bot):
         self.bot = bot
#

should be better

restive furnace
#

So it doesnt rly affect anything if u login the bot and change client.token value?

green kestrel
#

@restive furnace are you asking me, or someone else?

restive furnace
#

anyone

#

but maybe y

green kestrel
#

hmm, i'd say it doesnt matter until the next reconnection

restive furnace
#

k

green kestrel
#

but ive never tried it

modest schooner
#

as much as i appreciate your help i still get the ```discord.errors.ConnectionClosed: WebSocket connection is closed: code = 4011 (private use), reason = Sharding required.

slender thistle
#

Why would you import bot when you use AutoShardedBot

#

It's Bot, not bot

modest schooner
#

File "C:\Users\soyou\Desktop\komaeda\bot.py", line 79, in on_message await client.send_message(message.channel,msg) AttributeError: 'AutoShardedBot' object has no attribute 'send_message'

#

tbhe bot has actually launched now though so hmm

raven torrent
#

have you migrated to 1.x?

#

Since now it's

#

message.channel.send("message here")

#

no longer

#

bot.send_message(message.channel, "mesage here")

modest schooner
#

he hasnt been updated in months, i had exams. guess i'll go through and change it

raven torrent
#

Well then

#

You need to change a lot of things

modest schooner
#

thanks for the documentation, i think i'll leave you alone for nwo!

#

thanks for all the help

raven torrent
#

It will take some time ;)

lean pike
summer torrent
#

Show full error

#

Only english

raven torrent
#

^^

modest schooner
#
    abc.Messageable.typing()
TypeError: typing() missing 1 required positional argument: 'self'```
#

what's the easist way with discord.py to send a typing status... like apparently i should repalce Client.send_typing with abc.Messageable.trigger_typing() but i cant seem to get it to work

#

nvm i fixed it

restive furnace
#

python is hard

#

cuz

#

some thibgs u need to do _ instead of .

modest schooner
#

is there a way to stop my client from sending ```File "C:\Users\soyou\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\http.py", line 218, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 FORBIDDEN (error code: 50001): Missing Access
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\soyou\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "C:\Users\soyou\Desktop\komaeda\bot.py", line 59, in on_message
async with abc.Messageable.typing(message.channel):
File "C:\Users\soyou\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\context_managers.py", line 63, in aenter
await channel._state.http.send_typing(channel.id)
File "C:\Users\soyou\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\http.py", line 218, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 FORBIDDEN (error code: 50001): Missing Access

#

like. when forbidden is raised i dont want the cmd.exe running my bot.py to tell me it has been

mossy vine
#

check for permissions first

#

idk how to do it in d.py

modest maple
#

put it in try: except

#

if it cant send a message cuz missing perms

#

tell it to DM the person who called the command

#

and sya

#

say*

#

oi oi im missing perms

#

op?help

#

wont chat

trim saddle
#

@modest schooner personally i'd just put

if isinstance(err, discord.errors.Forbidden):
    pass

under on_command_error

#

also use

async with ctx.typing():
    # do things here
solar wraith
#

okay my bot runs fine but wont execute commands i have the command handler set up it throws no exceptions and does not do anything im not even sure it receives the command

#

what am i doing wrong

#

am i doing it wrong in the module or in the main code?

#

and can i get a pointer to where i need to look?

modest maple
#

well im going off cuz its not throwing errors:

is it caps sensitive or no etc... if it is caps sensitive then it will only respond and trigger to the EXACT command as given in the command

If it is not caps sensitive then make sure your commands take that into account, e.g if you turn every message into upper case make sure its looking for a command all in uppercase

solar wraith
#

(language is C#

modest maple
#

makes no diffrence

#

Caps can change everything

solar wraith
#

hmm

#

did you look at my code :3

modest maple
#

yh

solar wraith
#

so caps

#

but

#

where

modest maple
#

well

solar wraith
modest maple
#

your command yh

#

is writen

solar wraith
#

ping -T

#

?

modest maple
#

like Ping

solar wraith
#

ah

modest maple
#

if it converts to upper or lower

#

it would be doing is "PING -T" == "Ping -T"

#

which would return false

solar wraith
#

Ping -T wont work

modest maple
#

are you the 'Owner'

#

and are you entering exactly Ping -T

solar wraith
#

yes

modest maple
#

and no other text manipulation is happening to that string as its processed

solar wraith
#

wait

#

no

#

i am not

#

xD

#

i am mod

#

but i have owner rank

modest maple
#

are you admin; its hard to tell if Owner is the actual owner of guild or admin

solar wraith
#

[RequireOwner] to [RequireAdministrator]

#

yes owner rank is not owner of guild

modest maple
#

or if its only for you to use set it so it only looks for your UserID

solar wraith
#

ah

#

so little hint

#

user=408264651025940490?

#

or

#

not

#

;-;

modest maple
#

i think? C# isnt my main language

#

but if thats how you compare vars then yes

solar wraith
#

no actually not

modest maple
#

but then you also should remember to pre check / make sure when it compares the variables that They are both the same data type

#

as str(123) != int(123)

solar wraith
#

hmmm

#

i have [requireowner]

#

perhaps there is a selected switch for this

modest maple
#

well look at le docs and see what else you can have in there

solar wraith
#

yees

#

you mean something like this?

earnest phoenix
#

When i replace Custom Status to ร–zel Durum its saying
TypeError: user.presence.game.replace is not a function
But this code working in eval command

solar wraith
#

python?

modest maple
#

@earnest phoenix u dont replace it just tell it to set it again

#

and Eric im not sure

#

have a play with it

earnest phoenix
#

js

modest maple
#

if it doesnt work try requireadministrator

earnest phoenix
#

?

modest maple
#

that was at eric dw

#

shino i think it is .change_presence

earnest phoenix
#

Hmm i will try

#

Oh I fixed.

#

game.name

solar wraith
#

wait... [requireOwner] has tooltip: Requires the command to be invoked by the owner of the bot.

glacial mango
#

Does anyone know how to shuffle a youtube playlist?
I use ffmpeg, ytdl-core, javascript

solar wraith
#

well fuck

#

i cant figure out how to make my user owner of bot and allow execution of a special command

earnest phoenix
#

what

#

just remove the precondition if you don't want it there?

lavish shuttle
#

@glacial mango is it in an array, object, map, which is the variable with the playlist information stored in?

glacial mango
#

All the songs from the playlist are added to the queue

#

@lavish shuttle ^^

twilit rapids
#

But what is the queue? Is it an object? An array?

glacial mango
#

it's like this
**1.** [Halsey - Without Me](https://www.youtube.com/watch?v=ZAfAud_M_mg) **2.** [Post Malone - Better Now](https://www.youtube.com/watch?v=UYwF-jdcVjY) **3.** [benny blanco, Halsey & Khalid โ€“ Eastside (official video)](https://www.youtube.com/watch?v=56WBK4ZK_cw)

twilit rapids
#

Uhm

#

Can you show me the code where you store all the tracks?

glacial mango
#
audio.queue[targetServer.id] && audio.queue[targetServer.id].map(el => el[2]);```
west raptor
#

so it's an array

solar wraith
#

(ignore the extension is CS)

small prairie
#

How to edit role colours using discord.js??

west raptor
small prairie
#

Thanks

solar wraith
#

;-;

earnest phoenix
solar wraith
#

the command

#

when ever i execute ping -T

#

it..

#

does this:

earnest phoenix
#

log the result ExecuteAsync returns

glacial mango
#

If a string = Hello! I am hungry
how do I get all characters before the ! ?

earnest phoenix
#

split by ! and get the first item out of the returned array

glacial mango
#

How do I do that?

loud salmon
#

check your language docs for splitting strings

#

@modest maple spoonfeed

modest maple
#

in python it is .split()

#

and yh yh ik spider

loud salmon
modest maple
#

xD

loud salmon
#

seriously though

#

pls try and ease on the spoonfeeding

#

smh

modest maple
#

yh ik, altho if its in python its the first thing u search up if you do splitting a string in python... If you dont know how tosplit a string you're gonna have more issues than the split command

digital beacon
#

Hello! I am looking for a bot that works like a time card system. If an individual were to type a command such as "clock-in", the bot would start logging their time. When the command "clock-out" is used, the bot would then record the total time and log it into a spreadsheet.

Does anyone know of a bot with this type of feature? Any help would be greatly appreciated!

short siren
#

I don't think this is the right channel if you are looking for a bot.

digital beacon
#

Sorry, I just joined this server. Where should I ask?

slender thistle
#

Eh, I doubt this server will help much

#

since it's just a server for a public bot list

digital beacon
#

Well that's a bummer. Thanks anyways

slender thistle
#

You might be able to find a bot like that on https://top.gg but other than that, no luck I believe

loud salmon
#

-hardrequest @digital beacon

gilded plankBOT
#

@digital beacon

You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.

tight ferry
#

Making a Bot Builder that has premade commands and features (like economy). Basically, you choose your commands and features, the bot will compile everything into the commands.json file and send it for download

#

What you guys think so far ?

lean pike
#

Hi Guys

cloud bloom
#

looks cool @tight ferry

tight ferry
#

thank you ๐Ÿ˜„

lean pike
#

I need Help

tight ferry
#

with?

cloud bloom
#

on what?

lean pike
#

I programed the embed reply code and the code after approx hour did not work

#

Pls whit is error

modest maple
#

code?

#

what language

cloud bloom
#

send the error message

modest maple
#

ya need to give us a lil more than just after hr dont work

slender thistle
digital beacon
#

Thank you Spider

late hill
#

nice idea @tight ferry

but using json files for dynamic data megu

tight ferry
#

I know, it's not ideally what most go for, just easy

#

And it integrates with my main bot files nicely

scenic kelp
#

How would you run the built thing? I'm assuming you just put it with another file and run the main bot file?

tight ferry
#

The entirety of the bot is already made, it's a matter of choosing which commands to put in with the rest of the files.

#

Plug and play

#

So yes, put it in with the other files and run the bot file

modest maple
#

could that potentially get abused in some way

tight ferry
#

How do you mean ??

modest maple
#

potentially you could just spam the bot with changing commands over and over until somthing breaks or crashes

#

unless theres a time out]

scenic kelp
#

Nah each user would have their own bot instance

tight ferry
#

^^^

scenic kelp
#

as far as I understand it

tight ferry
#

The main bot is open source

#

The commands are what this bot compiles for them

scenic kelp
#

so the json doesn't actually have any code, it just acts as a config?

#

it'd be a neat idea to make it fully modular and have a plugin marketplace on the bot builder bot

tight ferry
#

It has code, and I was thinking about having it be modular. But that would mean I would need to start over

#

Well I am off to bed (8 AM)

small prairie
#

Is there uh function idk to get message link Discord.js??

#

@tight ferry Looks awesome fam

sudden geyser
#

There's a URL property for a message

modest maple
#

You can probably find out if you go to the Docs

small prairie
#

<message>.url?

west spoke
#

yes

small prairie
#

Yeah just thought this would be easier

#

I keep this there

sudden geyser
#

it won't directly say like that most of the time

small prairie
#

just in case.....

sudden geyser
#

it's better to click on the class you want then look through its props on the sidebar

small prairie
#

Thanks For The Tip!

#

Thanks For Fast Reply too!

west spoke
#

I mean

#

It's just messages/<channel>/<id>

#

I believe

modest maple
#

yh

slender thistle
#

https://discordapp.com/channels/<guild>/<channel>/<message>

west spoke
#

^ty

knotty oracle
#

Please i need command auttaja bot and how to set up

modest maple
#

not a support server for auttaja bot

sudden geyser
amber nebula
#

Howdy Folks. Just curious if anyone knows of a Bot that can check Unity Asset store order numbers. Seen a few on servers, but not sure if they are custom built. If there are none, I may look into making one but thought I would ask rather than re-invent the wheel.

modest maple
#

hard request tho

slender thistle
#

I doubt any of us would know. Try searching on https://top.gg/ and if there's nothing, you might be lucky

loud salmon
#

-hardrequest @amber nebula

gilded plankBOT
#

@amber nebula

You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.

blissful scaffold
#

If you have seen the bot on some servers then look up the bot name on bot websites and see if it's there

amber nebula
#

ok cool. I did not see anything, but some of the descriptions on features arre sorta lacking lol

loud salmon
#

yea

modest maple
#

anyone here know clojure?

lunar crystal
slender thistle
#

Because Discord

lunar crystal
#

I can't change it ? Because on the discord.js guide the text was larger than that ^^

slender thistle
#

If you can get Discord to change it, sure

#

The screenshots are from older versions of Discord

cedar brook
#

If I want to connect discord:

lunar crystal
#

Ah ok lol thank u ^^

#

And for making an hypertext it's (text) [link] ?

sudden geyser
#

text when you send it in an embed or webhook

lunar crystal
#

Oki thank u ^^

topaz sphinx
#

whats the absolute best way to store and monitor server count with shards

#

im thinking of updating every shard id with the server count every x minutes in my database

hollow granite
#

Can someone help me with this? I am getting an error where my bot crashes and deletes the data it has stored is a .json file. I am running the bot off a Raspberry Pi 3 Model B if it helps. It gives me this:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - Javascript heap out of memory Aborted

modest maple
#

FATAL ERROR

#

well have you tried reading the error

#

as it does give a very good idea to what the issue is

hollow granite
#

I know its out of memory, but im asking how i could fix it.

modest maple
#

Get a better system with more RAM

hollow granite
#

oof

modest maple
#

The PI just doesnt have enough for your program to run

#

and PI's cant have more memory (RAM) added

unique nimbus
#

Or its a Memory Leak

modest maple
#

maybe but its still pushing the PI if its any medium sized bot

unique nimbus
#

Depends on Guides

modest maple
#

and the code

unique nimbus
#

yes

modest maple
#

some processes and modules take more RAM than others

sudden geyser
#

It could also be something that's using a lot of memory

#

an easy way is running an infinite loop

modest maple
#

any DB system that e.g prefix's will use RAM

#

cuz cache

#

R PI 4 would solve the issue tbf you get 4 times the RAM and more cpu power

#

but depends idk how much optimising you can do to ur code

valid frigate
#

nope

#

it's not that his system is bad, discord bots can probably run anywhere

#

id assume it's a memory leak

blissful scaffold
#

it depends on what the bot does, most bots can run anywhere but not all bots

valid frigate
#

ehhh idk about writing to json but maybe it got deadlocked and didnt know what to do

#

regardless it's probably faulty code

modest maple
#

At some point 1GB just isn't enough ram

hearty tangle
#

Are there any existing bots designed to do the same functions as https://github.com/aetheryx/tweetcord, but on a smaller -- user-hosted -- scale (as to keep it within twitter's free 'premium sandbox' designation)? https://blog.twitter.com/developer/en_us/topics/tools/2018/enabling-all-developers-to-build-on-the-account-activity-api.html

Today weโ€™re excited to announce the Account Activity API is now generally available to all developers through our developer portal.

modest maple
#

Maybe

loud salmon
#

erm

modest maple
#

Hard request

loud salmon
#

-hardrequest @hearty tangle

gilded plankBOT
#

@hearty tangle

You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.

loud salmon
#

yep

blissful scaffold
#

One of my bots interacts with twitter, it isn't hard to implement once you know how to make a bot

#

just find a good twitter api library

hearty tangle
#

From what I can tell, twitter only has a single free api and from that, I can't find much in terms of documentation

blissful scaffold
#

My bots are made in Java, Twitter4J is pretty good for Java

#

dont know about any JS libs

valid frigate
#

npm has a lot of libraries for everything

#

it's just a matter of rsearching

hearty tangle
#

Does it have the ability to send tweets from an account though?
I thought there was only a singular, official, and poorly documented api for that...

#

(My main goal is being able to type something in a discord channel and have a twitter page tweet whatever I just typed).

blissful scaffold
#

there seems to be a ton of documentation for twitter

hearty tangle
#

ah. I must have been looking in the wrong place

blissful scaffold
#

and if you sign up for a free developer account then your twitter bots can do everything you want

tight mountain
#

is there a good way to make the prefix of my bot not case-sensitive? my prefix is "hey vector" and I want people to be able to say "Hey Vector" or "Hey vector", etc

earnest phoenix
#
var message = "Hello World";
if(message.toLowerCase().includes("hello".toLowerCase()){
 message.react("๐Ÿ‘")
}```
#

@tight mountain hope this can help you out

#
//SHOP

const table2 = sql.prepare("SELECT count(*) FROM sqlite_master WHERE type='table' AND name = 'shop';").get();
if (!table2['count(*)']) {
  // create the damn table
  sql.prepare("CREATE TABLE shop (id INTEGER, role TEXT, guild TEXT, itemname TEXT, desc TEXT, price INTEGER);").run();
  // Ensure that the "id" row is always unique and indexed.
  sql.pragma("asynchronous = 1");
  sql.pragma("journal_mode = wal"); //journal_mode for an in-memory database 
}

// And then we have two prepared statements to get and set the profile data.
client.setShop= sql.prepare("INSERT INTO shop (id, role, guild, itemname, desc, price) VALUES (@id, @role, @guild, @itemname, @desc, @price);");
client.getShop = sql.prepare("SELECT * FROM shop WHERE guild = ?");
client.user.setActivity("Getting Updated..Under Development!"); 
});```

Hi this a snippet of my SQL DB for `shop` system in my bot. And yes, I do steal the codes from some idiots guide because am still noob at better-sqlite3

For the `id` one I want to make it that each time there's a new records the `id` will be plus by 1. It's like a list la 

Should I use `  sql.prepare("CREATE UNIQUE INDEX idx_shop_id ON shop (id);").run();` or something else?
#

eh nvm im dum got it solved

sudden geyser
#

You mean case-intensive (btw example should be message.content.toLowerCase()...).

slender thistle
#

message.toLowerCase().includes("hello".toLowerCase()
is there a valid point in using .toLowerCase on a string you are SURE that will be all-lowercase

limber plinth
#

Help

#

Every time I start my bot (shard file), I get Error 401: Unaithorized

#

Thats the log

#
const { ShardingManager } = require("discord.js");
const { get_Date } = require("./functions.js");
const apitoken = *Removed due to privacy*
const shards = new ShardingManager("./alaia.js", {
    token: apitoken,
    totalShards: "auto",
});

shards.spawn().catch(err => console.log(err));

shards.on("shardCreate", shard => {
    console.log(`[${get_Date(new Date())}] Launched shard ${shard.id}`)
});
#

Welp just fixed it
I added an amount on spawn()

small prairie
#

LMfao

silver rapids
#

Message.channel.members is often undefined. Any reason for this?
I use it to see if my bot has the permission to post in that channel

modest maple
#

id advise going back through all your code and make sure your varibles are the same name

#

remember caps and no caps count as completely different variables to programming languages

silver rapids
#

@modest maple was that a reply on my question? ๐Ÿ˜›

modest maple
#

yh

silver rapids
#

well, i only use it in one place

#

and my IDE prevents stuff like that

#
const me = msg.channel.members.get(bot.user.id);
if(!me.permissionsIn(msg.channel.id).has('SEND_MESSAGES')) return;
sudden geyser
#

@silver rapids I think you're looking for the guild members and not channel members as that doesn't exist apparently it exists?

silver rapids
#

it works though :p

#

and by looking for guild members, i can't fetch the permissions for that channel

#

well. it works for 99% of the time. It's rare but sometimes i receive that members is undefined

#

and this code gets executed with each command

west raptor
silver rapids
#

yes, but i need to check if i have permission to post in the channel that triggers it

#

by checking on guild it always returns true

west raptor
#

permissionsIn is doing that, is it not?

silver rapids
#

ah crap i see ๐Ÿ˜›

#

thanks ๐Ÿ˜„

#

i need sleep

sudden geyser
#

Ah, apparently it exists now. I didn't even know that. facepalm

Do you mean the members property is sometimes undefined (throwing a TypeError), or the me variable is undefined? I believe it'd be safer to use message.channel.permissionsFor then passing a guild member resolvable (it can be undefined if the member doesn't exist) to check its permissions (then .has("SEND_MESSAGES")).

#

or that as well

silver rapids
#

yeah members is sometimes undefined. But it isn't a problem as i catch the exceptions

#

was just wondering why it is undefined sometimes

quartz kindle
#

the only way for it to be undefined is if the message is from a dm

#

but then guild itself would be undefined as well

silver rapids
#

ooh, so people are DMing the bot? ๐Ÿ˜›

#

thanks for clarrifying it!

digital sparrow
#

What is shard? how to use this?

earnest phoenix
#

library?

earnest phoenix
earnest phoenix
#

Does anyone here know how to code in Python?

loud salmon
#

@earnest phoenix i meant ask the question you had with python here :p

earnest phoenix
#

That was the question

#

I can't code in Python

compact oriole
earnest phoenix
#

Ummmm thanks?

static nexus
#

A- WATCH ABOVE.B-use codecademy's free trial

#

if it takes 4 hours, you can learn fully blown python in 7 days

crystal salmon
#

@earnest phoenix learn how to code first

static nexus
#

@earnest phoenix Look, I'm gonna tell you this and only this. Use books and codecademy. They will help you better that you can think

loud salmon
#

oh uhhh this isnt really a place to find colaborators

#

especially if you dont know the language

#

there is a reason people dont look for "idea guys" mmulu

earnest phoenix
#

Thanks for the info?

loud salmon
#

np bb

compact oriole
#

If i edit my bot, does that reset the bots queue place?

loud salmon
#

no @compact oriole

compact oriole
#

Gud xd

compact oriole
#

@spare goblet You doing work tf

loud salmon
#

why ping her for no reason

#

smfh

compact oriole
#

sorry...

#

just wanted to give respect

earnest phoenix
lunar crystal
#
    console.log(`Je peux afficher les ${client.ping}`)
  });

  client.on('message', message => {
    if (message.content === prefix +'ping')
    message.reply(`**:ping_pong: Pong ! ${Client.pings}** ` )
  });```
#

The bot answer by ๐Ÿ“ Pong ! undefined

compact oriole
#

Client should be client

#

${client.pings}

#

i think

unique nimbus
#

ping

#

no pings

#

thonk

earnest phoenix
#

@lunar crystal please client and noy Client if you have define client

west raptor
#

Client#pings exists

#

Iirc

earnest phoenix
#

Not *

west raptor
#

It returns an array

#

Most people just average it out

amber fractal
#

.ping does that for you

#

It calls the pings array then reduces

west raptor
#

Oh I didn't know that

quartz kindle
amber fractal
#

I think, I could be wrong

quartz kindle
#

it literally says it does

amber fractal
#

I haven't looked at the docs in forever lol

#

I havent made a bot in forever

#

Sad

west raptor
#

Who looks at the documentation for ping

#

Tho

quartz kindle
#

i always open the docs when people ask questions, because i dont remember everything in there lul

grizzled raven
#

its under client lol

#

you might just come across it

quartz kindle
#

sometimes i have the docs open in multiple tabs

#

for no reason

earnest phoenix
#

Lol

lunar crystal
west raptor
#

Well you're calling pings

grizzled raven
#

not ping

earnest phoenix
#

@lunar crystal just return message.reply(your response)

#
 client.on('ready', () => {
    console.log(`Je peux afficher les ${client.ping}`)
  });

  client.on('message', message => {
    if (message.content === prefix +'ping')
    return message.reply(`**๐Ÿ“ Pong ! ${client.pings}** ` )
  });
grizzled raven
#

but 559 ping though

earnest phoenix
#

Bad connection

#

๐Ÿค“

grizzled raven
#

also

#

client.ping**

#

its easier for him

earnest phoenix
#

Yes

lunar crystal
earnest phoenix
#

But he can make a client.pings/3

lunar crystal
#

Ok thank u @earnest phoenix

earnest phoenix
#

Np

grizzled raven
#

doesnt work like that

#

lll

#

lol

#

[....] / 3?

earnest phoenix
#

this is an example x)

grizzled raven
#

๐Ÿ‘€

quartz kindle
#

eval(client.pings.join('+'))/3

#

xD

patent prism
grizzled raven
#

woah

patent prism
#

Why not just add them normally without the need for eval

quartz kindle
#

thats the joke

patent prism
#

Ah

#

I see now

grizzled raven
#

wakt

#

that eval wouldnt even work anyway xd

earnest phoenix
#

๐Ÿ‘€

patent prism
quartz kindle
#
client.pings.reduce((c,p) => {
    for(let i = 0; i < p; i++) {
        c++
    }
    return c
},0)/3```
#

lmao

patent prism
#

lol

earnest phoenix
#

Bruh

lunar crystal
#

lol

normal frost
#

!rank

#

!ะฐะฒะฐั‚ะฐั€

mossy vine
vital lark
#

that name tho

unique nimbus
#

smh

late hill
#

On a global economy based bot how would you go about guild specific rankings?

#

I can't rly know who's in the guild without tracking it so like

#

Seems like I'd have to fetch all guild members which seems very stupid

#

Or I'd have to keep track of what guilds the user is in by updating that in my DB each time it changes, but that could possibly be wrong if the bot was down while they joined/left so seems like even then I'd still have to fetch all at times to make sure that it's actually right

#

Maybe I'm missing something here but to me it rly seems like these kind of leaderboards would be incredibly inefficient for large servers / not reliable as in some users might be missing (if I don't fetch all)

unique nimbus
#

Fetch Guild members who uses your bot

late hill
#

I don't think you understand my problem

#

I have my database with tons of users
I have a discord guild with a bunch of cached users and a ton of uncached users

#

what i do

#

I can't fetch the guild members that use the bot without knowing who those members are

earnest phoenix
#

bitwise operations

#

oh

#

ok

stray wasp
#

yeah sorry mate

#

I got it

#
const permissions = 2147483647;
console.log(permissions);
if((permissions & 0x8) == 0x8){
  console.log('contains');
}
lunar crystal
late hill
#

yes

#

read the error

#

and look at line 140

mossy vine
#

client has no property called guild

unreal cliff
#

^

#

i think its message.guild

summer torrent
#

@lunar crystal message.guild.owner

lunar crystal
#

Thank u ^^

late hill
#

@stray wasp pretty sure you can just if (permissions & 0x8)

stray wasp
#

oh really

late hill
#

As the result would either be 8 or 0

#

0 would be seen as false and 8 as true

#

So your second check isn't needed

stray wasp
#

oh ok thank you

static nexus
#

What's the permission id for banning and kicking members

#

wait nvm

digital sparrow
#

What is shard? discord.js

unique nimbus
#

Sharding shouldn't be a priority until your bot reaches like 1k servers

#

However sharding is basically running the same instances again

static nexus
#

Is there a way to post a message's data which is in one discord server to another discord server

#

E.G-I wanna order something

#

sb!order pizza

#

and it logs only the text bit and an invite

knotty steeple
#

its only when ur at exactly 2.5k servers

valid frigate
#

in kotlin is there a substantial difference between contains and containsKey when using both methods on a HashMap?

#

literally

knotty steeple
#

its recommended at 1k

unique nimbus
#

Read docs

static nexus
#

i have

#

i don't get it

knotty steeple
#

all a

#

delivery

#

order

#

bot thing

static nexus
#

yes

#

so like so

knotty steeple
#

is just some random person coming to ur server and saying "heres a thing"

#

just

static nexus
#

Mhm

knotty steeple
#

log a invite link

static nexus
#

yes how do we do that

knotty steeple
#

you see

#

i dont python

static nexus
#

ok

knotty steeple
#

docs help

#

search for invite

#

or link

static nexus
#

Nvm i got it

#

now all i gotta do is find how to log it

unique nimbus
#

channel

#

idk

knotty steeple
#

post in a channel

#

the link

#

that works if you want multiple "employees"

#

@static nexus make sure to state u generate invite links to use to join a server

#

if not ur breaking tos

static nexus
#

i will

knotty steeple
#

cool