#development

1 messages Β· Page 471 of 1

earnest phoenix
#

No

#

On the developer page of discord

wicked latch
earnest phoenix
#

No

wicked latch
earnest phoenix
#

Only the code needs the token

#

Running the code with the bot's user token will make it online of that bot account

wicked latch
earnest phoenix
#

T h e f u c k ?

wicked latch
#

That's my question

earnest phoenix
#

I don't really know

#

of where you can find it

sick iron
#

I don't think you can get it yet.. you don't have the developer role. So your bot isn't officially on the list?

earnest phoenix
#

I was wondering how to get the developer role anyway

wicked latch
#

@sick iron it's basically on pending so the moderator have to review it in order to get the token ?

sick iron
#

I believe so

wicked latch
#

Ok ty, i'll wait πŸ˜ƒ

earnest phoenix
#

How do you call to a function that’s in a different file using JavaScript?

uncut slate
earnest phoenix
#

Cheers

#

So once I required the file that the function is in, would I do
β€˜β€™β€™js
requiredFile.function()
β€˜β€™β€™

#

Sorry I’m on phone. Backtocks arebt a thing on iPhone lol

#

Backticks*

uncut slate
#

main file:

require('./file.js').someFunction();

file.js:

exports.someFunction = function someFunction () {
  return 'no';
}
#

is an example

#

different ways to do it though

earnest phoenix
#

Ah, I see

knotty steeple
#

like:

module.exports = {
    someFunction: function() {
        return 'no'
    }
}
ivory venture
#

%alia

rustic axle
#
[debug] left-channel
[debug] joined-channel
[debug] stopped-and-left```
hmmm
earnest phoenix
#

??

#

I was summoned

rustic axle
#

no

earnest phoenix
#

@earnest phoenix
function.js

module.exports = async () => {
  ...
};

main.js

const function = require('./function');

I do it like so, if you still need it

#

I managed to figure it out now lmao. Thanks tho

#

Oh, I see...

#

sorry for my english

#

i using google translator

rustic axle
#

@earnest phoenix if you told us the programming language someone might be able to help you

earnest phoenix
#

Python

ruby dust
#

how do you react to a message with a custom emoji?

earnest phoenix
#

<a:{name}:{id}> Like this?

ruby dust
#

I mean react, not mention it

earnest phoenix
#

await ctx.message.add_reaction(emoji="πŸ•")

#

try this

ruby dust
#

custom emoji

earnest phoenix
#

ohh

#

wait

#

u can copy custom emoji and paste it, no?

ruby dust
#

again... custom emoji... it's not a unicode

#

it's literally an uploaded image that is resized to fit in text

earnest phoenix
#
async def on_message(message):
    # we do not want the bot to reply to itself
    if message.author == bot.user:
        return
    if ':EmojiName:' in message.content:
        emoji = get(bot.get_all_emojis(), name='EmojiName')
        await bot.add_reaction(message, emoji)```
#

?

ruby dust
#

I'm on rewrite

earnest phoenix
#

oh

#

sooo

#
async def on_member_join(member):

    with open('users.json', 'r') as f:
        users = json.load(f)
        
    await update_data(users, member)
        
    with open('users.json', 'w') as f:
        json.dump(users, f)
    
@bot.event
async def on_message(message):

    with open('users.json', 'r') as f:
        users = json.load(f)
    
    await update_data(users, message.author)
    await add_experience(users, message.author, 5)
    await level_up(users, message.author, message.channel)
    
    
    with open('users.json', 'w') as f:
        json.dump(users, f)
        
async def update_data(users, user):
    if not user.id in users:
        users[user.id] = {}
        users[user.id]['experience'] = 0
        users[user.id]['level'] = 1
        
async def add_experience(users, user, exp):
    users[user.id]['experience'] += exp
    
async def level_up(users, user, channel):
    experience = users[user.id]['experience']
    lvl_start = users[user.id]['level']
    lvl_end = int(experience ** (1/4))
    
    if lvl_start < lvl_end:
        embed=discord.Embed(title="LEVEL UP!", description="{} has leveled up to level {}".format(user.mention, lvl_end), color=0x00ff00)
        embed.set_thumbnail(url=user.avatar_url)
        await bot.send_message(channel, embed=embed)
        users[user.id]['level'] = lvl_end```

Why when I add this piece of code, the command does not work for me, and the bot does not respond to my commands
#

Python

fierce thorn
#

When you have 1 bot.on('message', and you get this error (node:12600) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit

earnest phoenix
#

Is this where I can ask for help in using the Discord API?

bright spear
#

yes

earnest phoenix
#

How can I look up the name of the game that a user is playing using Discord API?

I am trying to learn how to make a bot and this little feature is kinda the core of the functionality I am trying to build

bright spear
#

what lib

earnest phoenix
#

I should mention I don't know jack-***t about how bots work in Discord. I just wanted to learn how to build one, so I went and opened the Discord API documentation to find what I needed

bright spear
#

uh

#

use a library in the language of your choice

#

dont directly make requests, that'll be a pain to do anything

#

what language do you use?

earnest phoenix
#

Does C++ qualify?

inner jewel
#

you can't even get presence with (http) requests

#

you need to connect to the gateway and use events

earnest phoenix
#

I am fine with JS too

#

@inner jewel Okay I will keep these names in mind

quartz kindle
#

for js check out this

bright spear
#

well you can use either discord.js or eris

topaz fjord
#

d.js is noob friendly

earnest phoenix
#

Thanks! But does the Api allow getting the name of the game the user is playing?

bright spear
#

yes

quartz kindle
#
Properties
.game
The game that the user is playing

Type: ?Game
.status
The status of the presence:

online - user is online
offline - user is offline or invisible
idle - user is AFK
dnd - user is in Do not Disturb
Type: string```
earnest phoenix
#

Thanks, I will look up discord.js and get going

bright spear
#

πŸ‘€ looks like .game was changed to .activity in master

quartz kindle
#

true

rustic axle
#

for discord.js .setPresence is preferred but .activity is accepted

bright spear
#

@rustic axle they want to read it

#

not set it

subtle merlin
#

is there a way to get the a guild object from a guild id in discordpy? (rewrite branch)

#

basically i have the id, but not the actual guild object and want to get the guild object πŸ€”

#

specifically this is through an on_raw_reaction_add() event

#

in a cog

#

ok well that issue is solved

sick cloud
#

little css question i guess, i'm using a forEach to push cards with bot info to a page, but there can only be 4 cards per "row". how do i add a new row every 4 items listed?

and this is how its structured:

        <div class="row">
            <div class="column 25">
                <div class="card">
                    <p>hello</p>
                    <a class="button button-clear" href="#">View Bot</a>
                </div>
            </div>
        </div>
#

i can easily forEach them, but splitting the rows and columns is hard

quartz kindle
#

is this regardless of screen size?

#

both small and big screens should have 4 per row?

#

can i see your foreach?

slow elk
#

I might need some help with the discord.js Discord.Shard() thing. I specify a path to the ShardingManager, as a string, and I get the following as an error:

path.js:28

    throw new TypeError('Path must be a string. Received ' + inspect(path));

    ^


TypeError: Path must be a string. Received undefined

    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1174:7)
    at Shard.spawn (/rbd/pnpm-volume/b1008a1b-84fd-432e-b3ef-6bbc83b270b2/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/sharding/Shard.js:72:43)
    at new Shard (/rbd/pnpm-volume/b1008a1b-84fd-432e-b3ef-6bbc83b270b2/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/sharding/Shard.js:61:10)
at Object.<anonymous> (/app/server.js:21:15)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)

Is there any way to avoid this error or is this an unavoidable bug?

#

I specified the Shard as followed:

const shard = new Discord.Shard("./shards.js", 0);

I might just be stupid

sick cloud
#

nvm, got it @quartz kindle

#

made a chunk/cluster system

quartz kindle
#

πŸ‘

ruby dust
#

@subtle merlin <client>.get_guild(id)

pale marsh
#

@ruby dust may I ask what IDE you use for python?

subtle merlin
#

yeah, i didnt have a client object, but its all good now

ruby dust
#

Sublime text

pale marsh
#

That's an editor though πŸ€”

#

Hmm

#

I'm using PyCharm and it just doesn't suggest correct types, so autocomplete gets fucked

ruby dust
#

People say it's bad cause they never tried it, it's actually not meant to be free but it is as free as WinRAR apparently bloblul

quartz kindle
#

^

inner jewel
#

and it's not electron

quartz kindle
#

sublime has an open api which can run node, meaning it has plugins that can do basically anything

pale marsh
#

So sublime text > pycharm?

#

I can show you what my issue with pycharm is exactly

ruby dust
#

I mean, sublime does give you correct autocompletes, and in python it does actually try to give you correct indentations all the time

pale marsh
#

That's pretty much why I hate pycharm

ruby dust
#

Yeah, sublime may only be a text editor, but it manage to be better than most of those IDEs

pale marsh
#

Because I'm not familiar with the discord.py lib at all, and I'm someone who has been using Visual Studio for 7 years and so dependent on intellisense to figure out the architecture of a lot of libs

#

So it's a bit frustrating for me

ruby dust
#

It's what I'd call being simplistic better that hassling yourself with fancy unnecessary stuff

pale marsh
#

I really hope sublime doesn't have that problem

quartz kindle
#

idk about py, but for js and php sublime is pretty awesome

ruby dust
#

It's same with py

quartz kindle
#

not only it autocompletes correctly based on context, it also remembers things like objects, variables and functions you typed once, and adds them to the autocomplete menu

ruby dust
#

Just so you know, ignore any popups that try to sell you a sublime license bloblul

quartz kindle
#

but the best thing in my opinion is the automation plugins, such as auto upload on save, and auto compile/minify on save

pale marsh
#

Installing right now

#

Uh

#

It looks empty af lol

ruby dust
#

Yeah it's very simplistic

#

You're just not used to it

quartz kindle
#

first of all you need to install package control

#

then you can install a dedicated plugin for python

#

of which there are many

ruby dust
#

Well I do everything without any plugins

#

So you don't need anything if you don't want anything

quartz kindle
#

this one looks nice for python

pale marsh
#

So if I need to test my file I have to save and run it in an external terminal every time?

uneven lava
#

any libs support bots receiving guild video yet

slow elk
#

Anyone here who knows discord.js' Discord.Shard() property? I need to know how to define the ShardingManager

simple bramble
#

can i get a html markdown reference sheet

quartz kindle
#

@pale marsh if you dont use plugins, yes

pale marsh
#

What plugins should I add? πŸ€”

#

I added anaconda

quartz kindle
#

check the ones i mentioned above

pale marsh
#

Why does python have to be such a pain

brittle loom
#

whats the best css framework html

pale marsh
#

Why am I even bothering to learn python. I already know C#

prime cliff
#

Pythonk

pale marsh
#

Ikr?

quartz kindle
#

what do you mean "css framework html"?

brittle loom
#

etc

#

bootstrap

frail harness
#

you could use Pycharm Community

#

which is a lot more less barebones

#

@pale marsh

pale marsh
#

@frail harness check up there a bit. I'm having a problem with pycharm

#

I've sent an image above

frail harness
#

Ah

#

Ic

pale marsh
#

Do you know if there's a solution for it?

fervent oyster
#

I'm trying to get the number of messages read, and the number of commands used up onto my website, I got stumpted and now I'm here, both the bot and the website are running on nodejs, is there a not extremely complicated way to do this?

quartz kindle
#

@brittle loom there is no "best", depends on what you need. i personally dont use any

brittle loom
#

oh ok

frail harness
#

nope idk

quartz kindle
#

but if you want to learn more about them, take a look at react, vue, angular, etc

pale marsh
#

@fervent oyster count the number of commands, and say every x command executed you push that number to a database

#

And pull it on the website I guess 🀷

fervent oyster
#

Ok

gilded blaze
#

Anyone know a good JSON exporter for Prometheus? I found some, but couldn't get any of them to work.

inner jewel
#

prometheus doesn't use json Thonk

gilded blaze
#

I mean something to interpret JSON data and make it readable for Prometheus.

earnest phoenix
#

is it bad skysilk ip banned me

west raptor
#

http://prntscr.com/kn78ts js newGuildSendChannel.send({embed: { title: `Joined the guild: ${guild.name}`, fields: [ { name: 'Owner', value: `${guild.owner.tag}` }, { name: 'Member Count', value: `${guild.memberCount}` }, { name: 'Roles', value: `${guild.roles.array().join('\n')}` } ]

Lightshot

Captured with Lightshot

earnest phoenix
#

Prometheus sounds like a lego admin

#

not going to lie

quartz kindle
#

i dont know if template literals are accepted there. besides, you dont actually need them @west raptor

#
{
              name: 'Owner',
              value: guild.owner.tag
            },
            {
              name: 'Member Count',
              value: guild.memberCount
            },
            {
              name: 'Roles',
              value: guild.roles.array().join('\n')
            }```
west raptor
#

alright

smoky spire
#

You can also just use richembeds and make your life a whole lot easier

quartz kindle
#

object literals are easier for me lmao

earnest phoenix
#

does anyone remember what's the difference between Missing Permissions and Missing Access when reacting to a message? thonking is it that the bot no longer can see / find that said message?

warm halo
bright spear
#

include more details like

  • your code
  • what lang
  • what lib
warm halo
#

lang node.js

#

lib discord.js

#

the code of music bot

#

lot of my friends got this thing, and couldn't be fixed

bright spear
#

i mean actually send the code that has the error

topaz fjord
#

code?

warm halo
#

owhh

#

i didn't know from where he is

#

cuz the logs clear

topaz fjord
#

what command does it come from

warm halo
#

for sure in bot.js

#

\and i didn't know what should i do right now

sick cloud
#

file is empty

#

why isnt that obvious

vernal basin
#

my friend just told me about a bot that can create bots

#

is that even allowed

earnest phoenix
#

Kinda bot not weally

vernal basin
#

?

#

since only users can create bots

#

which means that a bot creating a bot would be a self-bot right

#

so thats not allowed

smoky spire
#

Do you mean webhooks? They can have different names and avatars and look like bots

loud salmon
#

how would that even work @vernal basin

sacred veldt
#

im trying to make a game and an Economy bot

#

hello

earnest phoenix
#

bot.on('guildRemove', guild => {
is guildRemove right it dont send a the message but ive made sure its been told to be sent

jagged plume
#

its guildDelete

#

opposite to guildCreate

#

@earnest phoenix

earnest phoenix
slender thistle
#

Get Sublime or something to help you not get that error in the future.

#

The error is self-explanatory. You are indenting with tabs and spaces. Python doesn't like that.

earnest phoenix
#

well i solved that

#

but it doesnt seem to repeat the song

slender thistle
#

Is .repeat() even a thing, I wonder

earnest phoenix
#

if thats notepad++ go View->Show Symbol->Show White Space and Tab
to distinguish them

slender thistle
earnest phoenix
#

or you can replace space with tabs

#

well

#

thats all my code

#

for repeat it does reply but it doesnt repeat the song and there is no error to be found

thin rivet
#
C:\Users\kevlar\Desktop\TicketBoot\node_modules\integer>if not defined npm_confi
g_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-life
cycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else
 (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-
gyp.js" rebuild )
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_m
ain.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 98, in Load
    generator.CalculateVariables(default_variables, params)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\generator\msvs.py", line 1916, in CalculateVariables
    generator_flags.get('msvs_version', 'auto'))
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
    versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)```
#

Anyone can help me here?

#

I am getting this error

#

when i am installing an npm package, e.g Quick.db or Enmap

slow elk
#

Okie. Different time, let's try again. Anyone know how to define the ShardingManager in the Discord.Shard() property?

I put a string that points to the file handling the shards and it doesn't seem to see it as a string.

#

I've never worked with Shards before either, that's also a problem lol

thin rivet
#

dang i thought you will help lol

#

what library

slow elk
#

discord.js

thin rivet
#

there is an example

#

try to check, discordjs.guide

#

or anidiots.guide

slow elk
#

That only covers the ShardingManager.

sick cloud
wide ruin
#

Discord.js- can you say "if (message.aurhor has helper role);"

slow elk
#

Yes, that's possible

sick cloud
#

but thats not how you run it

slow elk
#

Nope

sick cloud
#
if (msg.member.roles.has(HelperRole)) ...```
#

HelperRole = a role object from the guild

wide ruin
#

How would you add a const to it

#

What would it need to say

#

To define helper role @sick cloud

slow elk
#
var helper = message.guild.roles.find("name", "Helper")

if(message.member.roles.has(helperRole)) {
    message.channel.send(`${message.author.username} has the Helper role`);
} else {
    message.channel.send(`${message.author.username} does not have the Helper role.`);
}
#

Sorry it took a while

wide ruin
#

Np

#

I've screenshotted it

slow elk
#

Okie

wide ruin
#

If a bot is private

#

Can only I add itt

#

It*

slow elk
#

Yes. When a bot is set to Private, only you can add it :3

wide ruin
#

Thanks

sick cloud
#

no

#

var helper = message.guild.roles.find("name", "Helper") is depreciated

slow elk
#

Oh?

sick cloud
#

1: use let or const instead of var

#

2: .find needs a function now ie. r => r.name === "Helper"

slow elk
#

The website doesn't show anything deprecated for .roles.find()

#

Β―_(ツ)_/Β―

#

Luca, how well are you with discord.js sharding?

sick cloud
#

they forgot to change it probs lmao

#

thattonybo

slow elk
#

Aight. Is it okay if I call you Tony?

sick cloud
#

yeah

slow elk
#

Okie

#

How well do you know discord.js sharding?

sick cloud
#

i've never touched it

slow elk
#

Dangit

sick cloud
#

never owned a bot that needs sharding ._.

slow elk
#

I want to learn it and test it a bit on @wet hull for when one of my bots hit 2.5K servers. And besides, if Nerdcore Radio hits 2.4K servers before @small moth, it's already prepared to shard itself.

earnest phoenix
#

i think v12 has internal sharding now which is nice, so you shouldnt really have to do anything

sick cloud
#

honestly, you don't need to shard until you hit 2.5k, but i'd suggest not worrying until 1.5k or until your performance starts dropping from resource use

#

yea i heard internal sucks tho

earnest phoenix
#

well it sucks eventually no matter what

#

single threaded nodejs mmLol

#

eris clustering awesmart

#

internal and external to get a good balance

slow elk
#

To be honest, I'm one of those people who'd rather be prepared instead of wait. I simply want to know how to define the ShardingManager in the Discord.Shard() property, I asked it about 3 or 4 times now and I keep getting ignored lol

earnest phoenix
#

(node:6579) DeprecationWarning: Collection#find: pass a function instead

(node:6579) DeprecationWarning: Collection#find: pass a function instead

(node:6579) DeprecationWarning: Collection#find: pass a function instead

(node:6579) DeprecationWarning: Collection#find: pass a function instead

(node:6579) DeprecationWarning: Collection#find: pass a function instead

in console my bot does this spam. (about 50 times - 100 times)
how can i fix this error?
so, my bot is does this spam infinity.

sick cloud
#

smh cant you just read up

#

@earnest phoenix 2: .find needs a function now ie. r => r.name === "Helper"

earnest phoenix
#

ok

bright spear
#

@earnest phoenix pretty sure internal sharding is only on the internal-sharding branch

earnest phoenix
#

ah ok

earnest phoenix
#

(node:1644) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 guildCreate listeners added. Use emitter.setMaxListeners() to increase limit

(node:1644) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 guildMemberAdd listeners added. Use emitter.setMaxListeners() to increase limit

(node:1644) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 messageDelete listeners added. Use emitter.setMaxListeners() to increase limit```
#

what's this error?

restive silo
#

which d.js version do you use

earnest phoenix
#

v11.4.2

restive silo
#

do you use awaitMessages often?

#

πŸ‘€

teal moon
earnest phoenix
#

@restive silo no

#

do you have multiple message listeners, or are you perhaps creating one every message/in a command?

#

GWfroggyZoomeyes jeez thats alot of events you have too many listeners for actually

earnest phoenix
#

This wouldn't work would it

    let guild = msg.guild
    let embed = new Discord.RichEmbed()
    .setColor("GREEN")
    .setTitle("Now showing the users online and there statuses.")
    .addField("Online", `${msg.guild.members.filter('avalible')}`)
    .addField("Do not disturb", `${msg.guild.members.filter('dnd')}`)
    .addField("Idle", `${msg.guild.members.filter('idle')}`)
    .addField("Offline/Invisible", `${msg.guild.members.filter('unavlible')}`)
    .addField("Member count", `${guild.memberCount}`)
    msg.channel.send({embed})
  },```
it also says 
```UnhandledPromiseRejectionWarning: TypeError: fn is not a function``` ?
austere sedge
#

I want a short Invite Link

#

i need help

#

for example

#

Invite Link:

Discordapp/invite/botblablablabla

#

i want that Discord App thing

#

to be shorter

#

like 'Click Here'

night imp
#

you can make a rich embed

#

with a link going there

earnest phoenix
#

@earnest phoenix No, because you are using .filter() wrong. check docs, it takes a callback function as argument

#

i got it working now

#

go into testing 1

#

@earnest phoenix

#

ah k

earnest phoenix
#

if (message.content.startsWith(client.msgs[message.guild.id].message + 'ping')) {
message.channel.sendMessage('Pong! Your ping is ' + ${Date.now() - message.createdTimestamp} + ' ms');
}
the client.msgs[message.guild.id].message is equals ! why when i !ping is not working

lament meteor
#
  1. why is the name of the thing u use to keep ur stuff under client.msgs then it is .message not .prefix
earnest phoenix
#

becousse this - if (message.content.startsWith(prefix + "prefix")) {
var editedmessage = message.content.slice(7);
client.msgs[message.guild.id] = {
message: editedmessage
}
fs.writeFile("./msgs.json", JSON.stringify(client.msgs, null, 4), err => {
if (err) throw err;
message.channel.send('Written.');
});
}

#

@lament meteor help?

lament meteor
#

ah.. dont use json dbs pls

earnest phoenix
#

so what to use?

lament meteor
#

there is a lot of choices

warm mantle
#

Hmm, what are the limits of a json database?

lament meteor
#

mongodb, rethinkdb, sqlite

#

@warm mantle there isnt iirc but it isnt smart at all to use a json db

warm mantle
#

Ah all right.

quartz kindle
#

the limits of a json db is that it doesnt have any built in data buffer protection

#

meaning any crash or process.end during writing will destroy your json file

#

also, it its read directly form disk, it costs a lot resources from disk I/O operations

#

what databases do that make them so much better, is that they introduce safe buffers and only read/write to disk when absolutely necessary, thus making operations fast and secure, with minimal disk I/O operations

frank harness
#

I use JSON databases

quartz kindle
#

i use json too, its not bad to use it, you just need to keep in mind its limitations and work around them

frank harness
#

I wouldn't see any limitations in using it, especially for small key/value entries

topaz fjord
#

I use mongo

frank harness
#

The overhead other storage providers provide isn't worth the performance gains you get in most applications, unless for some reason you're attempting to write Shakespeare's entire work into it

topaz fjord
#

Does about 7 read/writes per second count as writing Shakespeares work to a db

earnest phoenix
#

guys y u violent?

frank harness
#

Depends on whether or not you have the I/O Capacity vs the Memory cap and CPU cycles

#

No lol

#

If I where violent

#

PLANE TXT FILES WITH COMMA NOTATION

#

That's violent

quartz kindle
#

in most cases, disk is the main performance bottleneck, unless you're using raid-0 nvme ssds or ramdisks

#

hence why its often best practice to use memory as much as possible

frank harness
#

Sure but do you really need to waste memory resources if you're just changing true to false every half a second

#

I know this is a bad example because why would you but you get me

quartz kindle
#

i'd rather use memory than disk I/O anytime

#

i still use json, but what i do is that i read the entire json file into a js object on startup, and only write back to it when needed

#

so my disk operations are basically only 1 read, and a write every now and then depending on usage

simple bramble
gilded blaze
#

Don't log it.

west raptor
#

^

topaz fjord
#

lmfao

#

it's true tho

simple bramble
#

How would I do it

quartz kindle
#

why are you listening to all events lmao

simple bramble
#

idk

quartz kindle
#

show code

simple bramble
#
        {
            Console.WriteLine($"{DateTime.Now} from {Message.Source} : {Message.Message} ''");
        }```
quartz kindle
#

idk what language is this, but i dont think the problem is in this code

simple bramble
#

c#

#

i also have Client.Log += Client_Log; a little bit above

quartz kindle
#

which library?

simple bramble
#

.net

topaz fjord
#

Stop writing console.write??

simple bramble
#

There’s only one console.writeline

topaz fjord
#

did you try the code without it

simple bramble
#

No

#

But it’s giving me an error

#

And without the whole line nothing shows up on the console

quartz kindle
#

show the main code

simple bramble
#

you mean the whole code

quartz kindle
#

this part

#
{
    var client = new DiscordSocketClient();

    client.Log += Log;

    string token = "abcdefg..."; // Remember to keep this private!
    await client.LoginAsync(TokenType.Bot, token);
    await client.StartAsync();

    // Block this task until the program is closed.
    await Task.Delay(-1);
}```
simple bramble
#

1 second

quartz kindle
#

also

#

Since we want to listen for new messages, the event to hook in to is MessageReceived.

simple bramble
#
        {
            Client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel = LogSeverity.Debug
            });

            Commands = new CommandService(new CommandServiceConfig
            {
                CaseSensitiveCommands = true,
                DefaultRunMode = RunMode.Async,
                LogLevel = LogSeverity.Debug
            });

            Client.MessageReceived += Client_MessageRecieved;
            await Commands.AddModulesAsync(Assembly.GetEntryAssembly());

            Client.Ready += Client_Ready;
            Client.Log += Client_Log;

           <token part>
            using (var ReadToken = new StreamReader(Stream))
            {
                Token = ReadToken.ReadToEnd();
            }

            await Client.LoginAsync(TokenType.Bot, Token);
            await Client.StartAsync();

            await Task.Delay(-1);
        }```
quartz kindle
#

wait

#

i have no idea what this does, but try removing this

#

LogLevel = LogSeverity.Debug

simple bramble
#
8/27/2018 10:17:34 AM from Gateway : Connecting ''
8/27/2018 10:17:35 AM from Gateway : Connected ''
8/27/2018 10:17:36 AM from Gateway : Ready ''``` this is the only 4 things that show up now
quartz kindle
#

alright, then that was your problem

simple bramble
#

Nothing else should show?

#

Like when I get connected to a new server that studf

quartz kindle
#

you need to code that yourself

#

like the one you did above for logging messages

#

you have to log new servers, etc

simple bramble
#

Hmm ok

earnest phoenix
#

I implement the DiscordBots widgets like this into my docs website:

<a href="https://discordbots.org/bot/349966335352242187">
  <img src="https://discordbots.org/api/widget/status/349966335352242187.svg" media="only screen and (max-device-width: 768px)"/>
</a>

I have three of those widgets. In total they take about 1 MB to download. Usually that's not a problem, but I also offer a mobile version and there I hide them. Unfortunately they are still getting loaded.
How can I prevent those widgets from being loaded on a mobile version?

#

I already tried the media="only screen and (max-device-width: 768px)", but that does pretty much nothing.

#

@earnest phoenix put the media query on the a tag. media is not an attribute for img, and without it, that link would be invisible anyway.

#

Thanks, I'll try that :)

open basin
#

Can anyone help me

#

with my python code

slender thistle
#

If you mind telling us what the issue is.

open basin
#

well i have a past bin of the code

#

can i dm you

slender thistle
#

Sure.

earnest phoenix
#

ApophisToday at 8:42 PM
if (message.content.startsWith(client.msgs[message.guild.id].message + 'ping')) {
message.channel.sendMessage('Pong! Your ping is ' +${Date.now() - message.createdTimestamp}+ ' ms');
}
what is wrong with that code?
the client.msgs[message.guild.id].message is equals = ?
Jason DeruloToday at 8:46 PM
whats the error
ApophisToday at 8:47 PM
there is no error @earnest phoenix Derulo(edited)
TehiToday at 8:48 PM
what is this client.msgs[message.guild.id].message
and why is it
and when is it
ApophisToday at 8:49 PM
it equals ! i check it by this code :
let nprefix = client.msgs[message.guild.id].message;
if (message.content.startsWith(prefix + 'checkprefix')) {
message.channel.send(nprefix + " is the current prefix");

}

TehiToday at 8:51 PM
what
ApophisToday at 8:51 PM
it equals !
TehiToday at 8:52 PM
whats the difference between nprefix and prefix
ApophisToday at 8:52 PM
prefix equals ?
but nprefix is dynamic

#

helpme

#

yes

smoky spire
#

Geez that is hard to read

earnest phoenix
#

sorry mate

#

basicllay how can i make custom prefix

#

by json

smoky spire
#

Don’t use json, use a db

earnest phoenix
#

i dont want to

smoky spire
#

Why

earnest phoenix
#

bcs i want to learn json

#

the more you know bro

#

{"a":"b"} theres ur json bro

#

now go use a db

#

but how can use it with custom prefixes

#

store a prefix as column in table with (guild_id, prefix) POGGERS

#

done

#

{
"408336105172369410": {
"message": "!"
}
}

#

message = prefix btw

open basin
#

wow

earnest phoenix
west raptor
#

i still dont know how to make dbs because im dumb

topaz fjord
#

you dont make a db

west raptor
#

use*

#

my bad

craggy roost
#
(node:9316) UnhandledPromiseRejectionWarning: DiscordAPIError: You can only bulk delete messages that are under 14 days old.```

How can I fix this?
west raptor
#

you cant

craggy roost
#

Hmm.

#

But because of this, the bot is not approved.

west raptor
#

what

#

discord will only allow you to delete up to 14 days worth of messages

craggy roost
#

did not clear after using command. So it is not confirmed that the command is not used.

west raptor
#

what

craggy roost
#

I tried it too. It does not delete posts 14 days ago. Can not I do that now?

west raptor
#

um

#

what

topaz fjord
#

discord doesnt let you bulk delete messages that are older than 14 days

#

the only way to delete messages 14 days or older is to delete one by one

west raptor
#

^

craggy roost
#

But how?

west raptor
#

what...?

craggy roost
#

What what?

#

Please help

west raptor
#

huh

honest minnow
#

@craggy roost you should be able to filter the creation date

craggy roost
#

.bulkDelete(5,true) ?

honest minnow
#

bulkdelete deletes all messages that are 2 weeks old or younger

#

given the filterOld parameter is true (the second value

#

so TextChannel#bulkDelete(5, true); should only delete the messages of the 5 that are 2 weeks old or younger

craggy roost
#

Hmm.

#

I understand.

#

Thank you.

honest minnow
#

no probs

#

Always here to help

#

If you need more help just dm me

craggy roost
#

Ok. Thank you bro.

honest minnow
#

no probs

#

sis btw ^^

#

I made @earnest phoenix in Java and @wooden obsidian in JavaScript btw

#

Poppi took me around 4 weeks and challengebot was my first bot in js (15h works time approximately)

#

I'm a fast learner ^^

craggy roost
#

πŸ˜ƒ

knotty steeple
#

does anyone know how the message constructor works on discord.js

tulip snow
knotty steeple
#

idk

#

maybe say what is causing it?

bright spear
#

@tulip snow ur probably making some http request with the wrong token

tulip snow
#

Okay it was that thanks

gilded blaze
#

@knotty steeple you can look at the source

knotty steeple
#

oh ok

viscid falcon
#

In d.js, Ik there's a limit for massdelete, what's the max?

sick cloud
#

100

#

tho its a discord api limit

inner jewel
#

100/request

sick cloud
#

2 - 100 iirc

#

yeah

viscid falcon
#

Thanks

#

I need to actually be a bot dev and fix bugs but it's kinda annoying tbh

#

Like I wish I could be a bad one but no

#

I had to make a bot and have it be successful

earnest phoenix
#

How can I have it notify when someone uploads video?

viscid falcon
#

You have a specific lib or api in mind?

earnest phoenix
#

discord.js @viscid falcon

viscid falcon
#

i meant for youtube

earnest phoenix
#

ah some specific channel you say?

viscid falcon
#

No

earnest phoenix
#

API I have the one from YouTube v3

topaz fjord
#

to notify when someone uploads you can use a webhook and ifttt

earnest phoenix
#

how?

earnest phoenix
#

I want people to be able to put !setupdatevideo (channel) (youtuber)

#

@topaz fjord

viscid falcon
#

for help with the reminder part this bot has a remind command that you might be able to take the frame work from https://github.com/Novuh-Bot/Custodian

#

and then i bet that tutorial he gave u would work for the video part

sick cloud
#

take

#

oh yeah its ok to steal bot code

#

also thats an actual reminder @viscid falcon

#

not a yt upload watcher

viscid falcon
#

oh rtue

#

im tired srry

sick cloud
#

the youtube api for stream/video notifs uses pubsubhub @earnest phoenix

#

so you need that iirc

viscid falcon
#

lol, idk what i was thinking

sick cloud
#

google it

viscid falcon
#

idk where i thought time from

vernal basin
#

@loud salmon basically they told me they had the bots click links and stuff

viscid falcon
#

i keep getting a bunch of errors when i try to install ffmpeg-binaries, any ideas why?

#

and not the noraml this requires so in so errors

west raptor
#

just get normal ffmpeg

#

its an annoying process but its worth it

viscid falcon
#

how would i do that, is there a command line command?

topaz fjord
#

ffmpeg binaries installs fine on linux

viscid falcon
#

idk which part of the error i need to give u guys, theres a lot

boreal acorn
topaz fjord
#

did you add ffmpeg into ur path

boreal acorn
#

yup

viscid falcon
#

how do u do that

topaz fjord
#

@viscid falcon are u on linux

boreal acorn
#

and if i do ffmpeg in cmd it works for me but still error

viscid falcon
#

kinda, if you have ever used a raspberry pi im on their fork oh it

#

but bassicly linux

#

cpmmands work the same

topaz fjord
boreal acorn
#

do you know how to help me jason?

viscid falcon
#

installing rn, no errors so far

#

ok installed no errors

#

time to reboot bot and see if it worked

#

looks like it kinda worked but to diffrent errors

#

thanks though

boreal acorn
#

i still do not know how to fix mine its weird

viscid falcon
#

whats ur os, if linux, maybe try the link above, worked for me

boreal acorn
#

im windows

viscid falcon
#

oh rip srry

boreal acorn
#

ye

viscid falcon
#

i dont really install dependancies on windows srry

boreal acorn
#

i use linux to host my stuff but i like to test on my windows pc first

#

still same error if anyone can help that would be nice

rich sail
#

@radiant current

boreal acorn
#

did it i needed to reboot

viscid falcon
#

hey for somereason on my music command, when i do connection.playArbitraryInput(the video url, not actually whats here) it doesnt play any audio

#

any suggestions?

#

d.js

sick cloud
#

you need ytdl

#

read the voice example on the d.js docs

viscid falcon
#

k thanks

#

doesnt even mention it

sick cloud
#

what

#

it does mention it

viscid falcon
#

i honestly dont see where

sick cloud
#

oh

#

im looking at master

viscid falcon
#

that guide didnt work

#

so any idea

earnest phoenix
#

const Discord = require("discord.js");
const bot = new Discord.Client()
const DBL = require("dblapi.js");
const dbl = new DBL("X", bot);

module.exports.run = (bot, message, args) => {
let user = message.mentions.members.first()
dbl.getBot(user.id).then(bot => {
const embed = new Discord.RichEmbed()
.setTitle("Discord Bots Stats")
.addField("id", bot.id)
.addField("username", bot.username+"#"+bot.discriminator)
.addField("lib", bot.lib)
.addField("prefix", bot.prefix)
.addField("tags", bot.tags)
.addField("owners", bot.owners)
.addField("upvotes", bot.points)
message.channel.send(embed)
});
}

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

#

why its not working? the token Censored

misty lagoon
#

module is not declared

earnest phoenix
#

What it means?

misty lagoon
#

oh wait

earnest phoenix
#

The second programmer of the bot has already fixed the problem

misty lagoon
#

i think it’s something in the 6th line

#

ok

bright spear
#

@earnest phoenix btw, please paste code in code blocks (```)

earnest phoenix
#

ok

deep tendon
#

Does eris have some nice selfbot interaction?

serene cobalt
#

I hope this is a troll

deep tendon
#

I mean interactions like jlin a server an so on

#

I tried discord.js it just unverifies my ccount

#

Fuking crappy shit

serene cobalt
#

Yes

#

it unverified your account

#

Wanna know why?

deep tendon
#

Y

serene cobalt
#

S e l f b o t s a r e a g a i n s t T O S

deep tendon
#

Is unverifyig acc by disvord ir

serene cobalt
#

What

deep tendon
#

Or library way

#

Does the code unverify or discord detects u

serene cobalt
#

Discord

deep tendon
#

Im thinking of finding a good programmed selfbot to add ppl and join servers

serene cobalt
#

Yeah that's big tos oof

deep tendon
#

So i can annoy em lol

serene cobalt
#

maybe you should ask in discord's api server

#

how to make one

deep tendon
#

k

#

Can u tell me invite of tht server

serene cobalt
#

discord-api

#

use that as code

#

ye

deep tendon
#

Like tht

serene cobalt
#

Yes

deep tendon
#

k

serene cobalt
#

I just said that

deep tendon
#

k will do

earnest phoenix
#

Not sure if this is an appropriate place to put this

#

But if anyone is interested, drop a DM please

deep tendon
#

Ads or what?

#

Let me read the tweet

earnest phoenix
#

I'm part of a campaign, we've got a bot idea that we want to bring to life and we're looking for someone to help

spiral estuary
#

Jea!

worn hull
#

Bot limited to 1 server but cant change it

rustic axle
#

Do you have a whitelist, blacklist or what

neat falcon
#

how do i use discord.Color in embeds in discord.py rewrite?

earnest phoenix
neat falcon
#

what

#

im py nub

#

string does the big oof

earnest phoenix
#

just make an object with the color consts

#

and attach it to ur bot or something

neat falcon
#

oh

#

thank

#

ok im going back to lurking since i succ at the python

earnest phoenix
#

i mean

neat falcon
#

fuck now remove_command doesn't work notlikemiyafast

#

brb going back to discord.js

earnest phoenix
#

eris awesmart

neat falcon
#

yes

knotty steeple
#

@neat falcon how it not work Thonk

neat falcon
#

idfk

#
def setup(bot):
    bot.remove_command('help')``` i follow auguwu instructions and it still not work and auguwu is offline ![angrybear](https://cdn.discordapp.com/emojis/476420114674221056.webp?size=128 "angrybear")
knotty steeple
#

oof that should work

neat falcon
#

yes

#

Oh for fucks sake

#

tiredboye did a mistake

#

changed test prefix and was using production lul

knotty steeple
#

lmao

ruby talon
#

Hey, I'm using the discord.py libary.
I'm having problems with this code:

@bot.command(pass_context=True)
async def pm(ctx, user: discord.Member):
    await bot.send_message(user, ctx)
west raptor
#

error?

ruby talon
#

Oh

#

Leave it

#

tf

#

Oh

#

no

#

oops

#

I get this:

<discord.ext.commands.context.Context object at 0x000001F34F9CC278>

But as message.
It doesn't give me an error.

frail harness
#

await user.send(message)

solid cliff
#

You are sending the ctx object to the user

ruby talon
#

oOPS

#

Ty, I'm working on it now πŸ˜„

vestal moth
#

Anyone else getting this error? HTTPException: Internal Server Error (status code: 500): {"error":"Oops, I think a bad happened, I'm trying again just hang in there"} Traceback (most recent call last): File "/root/BrooklynMusic/modules/dbl.py", line 25, in update_stats await self.dblpy.post_server_count() File "/usr/local/lib/python3.6/dist-packages/dbl/client.py", line 100, in post_server_count await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no) File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 189, in post_server_count await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload) File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 164, in request raise HTTPException(resp, data) dbl.errors.HTTPException: Internal Server Error (status code: 500): {"error":"Oops, I think a bad happened, I'm trying again just hang in there"}

knotty steeple
earnest phoenix
#

hello

knotty steeple
#

yes what do you need

ruby talon
#

Hey, My pm thingie code works but it only takes the first word, does anyone know to fix this?

#

code:

@bot.command(pass_context=True)
async def pm(ctx, user: discord.Member, context):
    await bot.send_message(user, context)
#

Python lib.

knotty steeple
#

add a *, before context

vestal moth
#

Oh hell no.

ruby talon
#

'k.

vestal moth
#

Don't do that.

ruby talon
#

Ok.

knotty steeple
#

Β―_(ツ)_/Β―

#

i dont do py much but it works for me xd

ruby talon
#

So what do I need to do then?

knotty steeple
#

@vestal moth if ur saying dont do that what to do then

vestal moth
#

str: content

knotty steeple
#

oh

#

k

vestal moth
#
@bot.command(pass_context=True)
async def pm(ctx, user: discord.Member, str: context):
    await bot.send_message(user, context)```
ruby talon
#

❀

vestal moth
#

Should work.

ruby talon
#
NameError: name 'context' is not defined
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002CB2D56AEF0>
#

@vestal moth

#

Sorry If I'm dumb, I'm in the early stages.

vestal moth
knotty steeple
#

context: str does this work xd

vestal moth
#

I'm dumb.

knotty steeple
#

lol

ruby talon
#

@knotty steeple It doesn't give me an error.

vestal moth
#

That's what I meant to type lmfao.

ruby talon
#

But It only sends the first word.

knotty steeple
#

what doesnt give an error

ruby talon
#

So its the same as the previous code.

knotty steeple
#

do the thing i told you to do

ruby talon
#

The console

#

xD

vestal moth
#
@bot.command(pass_context=True)
async def pm(ctx, user: discord.Member, context: str):
    await bot.send_message(user, context)```
ruby talon
#

Yes

knotty steeple
#

wait whats pass_context

vestal moth
#

He's using master d.py I'm pretty sure.

#

Not rewrite.

#

@ruby talon Or are you using rewrite?

ruby talon
#

No.

vestal moth
#

Ok yea that's what I thought.

knotty steeple
#

oh ok

ruby talon
#

idk lol

knotty steeple
#

well i use rewrite so idk

vestal moth
#

So he has to pass pass_context if he defines ctx.

ruby talon
#

I just did pip discord.Py thingie and I'm coding in python

#

so

#

xD

vestal moth
#

Yea I use rewrite too.

silent sand
ruby talon
earnest phoenix
ruby talon
#

so none knows how2 fix?

#

😒

vestal moth
#

@ruby talon Did you try what I gave you?

ruby talon
#

Yes.

vestal moth
#
@bot.command(pass_context=True)
async def pm(ctx, user: discord.Member, context: str):
    await bot.send_message(user, context)```
ruby talon
#

Doesn't work.

#

First word only

vestal moth
#

I made a typo.

#

Fuck.

#

You might have to do this.

#
@bot.command(pass_context=True)
async def pm(ctx, user: discord.Member, *, context: str):
    await bot.send_message(user, context)```
ruby talon
#

Testing it ........

#

Works

#

ty much love ❀

vestal moth
#

Eeek

ruby talon
#

xD

vestal moth
#

This is why I went to rewrite.

slender thistle
#

What does rewrite have to do with rest consuming???

topaz fjord
#

idk

slender thistle
#

Nothing.

wide ruin
#
        { 
           module.exports.run = (bot, message) => {
  
          const pinged = new Discord.RichEmbed()
          .setTitle("Pong")
          .setDescription(":ping_pong:")
          .setColor(0x0000ff)
          .setAuthor(`Ponged at ${message.author.tag}` `${message.author.displayAvatarURL}`)
          message.channel.send(pinged)
           }
        
        }```
#

the bot doesnt respond

#

why?

#

discord.js lib

slender thistle
#

I n d e n t a t i o n i s s u e?

wide ruin
#
        { 
           module.exports.run = (bot, message) => {
  
          const pinged = new Discord.RichEmbed()
           .setTitle("Pong")
           .setDescription(":ping_pong:")
           .setColor(0x0000ff)
           .setAuthor(`Ponged at ${message.author.tag}` `${message.author.displayAvatarURL}`)
          message.channel.send(pinged)
           }
        
        }```
#

better?

earnest phoenix
#

indentation in js LUL

wide ruin
#

how should it be indented?

earnest phoenix
#

why is ping in parentheses

wide ruin
#

idkk

#

removed them

earnest phoenix
#

also why are you exporting on run

#

what is goin on GWfroggyBlobSweat

wide ruin
#

can you just help

earnest phoenix
#

lmao.

#

export the command as a module

#

a different file

#

the require it

#

remove parenthesis around ping

#

and when the if statement is true, execute the command.

#

right now you are just exporting the command

#

in the command handler which makes 0 sense

#

pretty obvs why it aint working lul

wide ruin
#
        { 
           
  
          const pinged = new Discord.RichEmbed()
           .setTitle("Pong")
           .setDescription(":ping_pong:")
           .setColor(0x0000ff)
           .setAuthor(`Ponged at ${message.author.tag}` `${message.author.displayAvatarURL}`)
          message.channel.send(pinged)
           
        
        }```
earnest phoenix
#

or that if you prefer not to make it a module blobshrug

wide ruin
#

i just want the main code to be in one file

earnest phoenix
#

bad practice

#

hard to maintain

wide ruin
#

i cant get command handlers to work

earnest phoenix
#

commands folder with each file

require them all and attach to object or put in map

when command executes, check if the key in object or map exists

if so, run the cmd

wide ruin
#

please can you wuickly enable server dms

#

quickly*

#

@earnest phoenix

earnest phoenix
#

they r on

wide ruin
#

Your message could not be delivered because you don't share a server with the recipient or you disabled direct messages on your shared server, recipient is only accepting direct messages from friends, or you were blocked by the recipient.

#

@earnest phoenix

earnest phoenix
#

enable dms

earnest phoenix
#
@bot.command(pass_context=True)
async def changeprefix(ctx,str):
    str = str
    if ctx.message.author.server_permissions.manage_server:

        bot = commands.Bot(command_prefix=str)
        embed = discord.Embed(title="Changed prefix.", description=":white_check_mark: I have changed the prefix to: {}".format(str), color=0x77B255)
        await bot.say (embed=embed)
    else:
        embed = discord.Embed(title="Oh no!", description=":no_entry: You don't have permissions to use this command...", color=0xe74c3c)
        await bot.say (embed=embed)
#

Not changing prefix..?

#

401 - unauthorized

ruby dust
rustic axle
#

Idk

neat falcon
rustic axle
#

Not fluent in what ever that lang is

earnest phoenix
#

Deivedux if you can show me how to do it properly I'd be grateful.

west raptor
#

you are changing the global prefix first of all

earnest phoenix
#

Oh, lmao.

#

How would I make it a guild prefix?

topaz fjord
#

You would need a db

west raptor
#

^

earnest phoenix
#

smh how would I do a db

#

lmao

rustic axle
#

store it in json

earnest phoenix
#

json is shit

topaz fjord
#

db equals database

earnest phoenix
#

i know

#

but how would i do that in python

ruby dust
#

store a prefix into some data storage, then in on_message check the message content starts with the said config, if so process commands afterwards

earnest phoenix
#

sorry, i'm pretty new, trying to figure it all out

topaz fjord
#

Google is a very helpful tool

earnest phoenix
#

^ I tried google already

#

but i'll search for a database thing

ruby dust
#

either way you won't be using the commands extension if you want per-server prefix

slender thistle
#

Can't you do

bot = commands.Bot(command_prefix=get_prefix)

def get_prefix(bot, message):
    if message.guild: # server prefix
        return ('?', '!')
    else:
        return 'p!'

?

ruby dust
#

commands.Bot defines a global prefix, discord.py library is not made to maintain per-server prefixes mostly because it doesn't have it's own data storage to save that config

slender thistle
#

Wait fuck it shouldn't be a coroutine.

ruby dust
#

so you'll be using on_message for pretty much everything

earnest phoenix
#

fuck it, they can deal with it being ;; as a prefix

slender thistle
#

Am I being ignored?

earnest phoenix
#

no

#

yes

#

maybe

#
@bot.command(pass_context=True)
async def info(ctx, user: discord.Member):
    embed = discord.Embed(title="User Info", description="The user's username is: **{}**\nThe user's status is **{}**".format(user.name).format(user.status), color=0x234D87)
    await bot.say (embed=embed)```
#

"tuple index is out of range"

slender thistle
#

Why do you use .format twice???

earnest phoenix
#

because idk how i could do it all in once

#

i'm new to python

#

lmao

slender thistle
#

.format(1, 2)

solid cliff
#

"{}, {}".format("a", "b")

#

oof

earnest phoenix
#

oh, okay

#

thanks guys

slender thistle
#

Starting to make a bot while not knowing basic Python is...

#

a really bad idea.

earnest phoenix
#

i know basic python*

#

i've been using tutorials and stuff

#

and it worked πŸ˜„

slender thistle
#

Not knowing how .format works, eh.

knotty steeple
#

im a js kiddie and i know basic py and stuff like that mmLol

harsh zenith
#

Just use python 3.6 and use f strings...

earnest phoenix
slender thistle
#

The event that is being called when the user joins server?

earnest phoenix
#

No, when the bot joins the server

#

i see it's discord.on_server_join but how would I implement it

#

?

steel drum
#

as you would handle any other event

slender thistle
#
async def on_server_join(server):
    print("Joined {}!".format(server))
earnest phoenix
#

so @bot.event
async def discord.on_server_join():
embed = discord.Embed(title="hi")

slender thistle
#

Yeah, don't forget the indenation as well. :^)

earnest phoenix
#

yeah of course

#

i was just typing it

#

on here

#

not in vs

#

:)*

#

@slender thistle

#

Help

#

lmao

slender thistle
#

Yes hello I'm here. :^)

earnest phoenix
#

InvalidArgument: Destination must be Channel, PrivateChannel, User, or Object

#

Recieved NoneType

slender thistle
#

Send code kthx. :^)

ruby talon
#

@earnest phoenix for your info command, you know you can do embed.add_field right?

earnest phoenix
#

Yes, I prefer adding new lines.

ruby talon
#

πŸ˜‰

earnest phoenix
#

thanks though

thorn vault
#

whoever codes in .js dm me

wide ruin
#

if(!message.member.hasPermission("KICK_MEMBERS")) return ("Sorry, Insufficient Permissions")

#

i dont have permissions, but it didnt say anything

knotty steeple
#

because you didnt make it say anything

west raptor
#
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("Sorry, Insufficient Permissions")```
knotty steeple
#

did you ever try message.channel.send?

west raptor
#

depends on what message is defined as tho

knotty steeple
#

message

wide ruin
#

if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("Sorry, Insufficient Permissions") is the line now

west raptor
#

yes

wide ruin
#

how did you colour it?

knotty steeple
#

```js
// code
```

west raptor
#

^

wide ruin
#

js if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("Sorry, Insufficient Permissions")

#
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("Sorry, Insufficient Permissions")
#

ah

#

thanks

west raptor
#

np

knotty steeple
#

yeet

#

basic code GWfroggyWeSmart

junior bobcat
#

bot.users.get(id).username
whats the right way ?

knotty steeple
#

yes

junior bobcat
#

no, I mean, this doesnt work

#

and I wanted the right way to get username of a user

#

with his id

frigid bone
#

Share the whole code and explain the issue/error you got, if any, in more detail AkaShrug

junior bobcat
#

when I wrote bot.users.get(id).username, it error me on "cannot read property username of undefined"

frigid bone
#

That means the user you're trying to access is not cached. Try client.fetchUser(id) instead

#

assuming you're using discord.js

#

meh I don't have :readthedocs: emote

loud helm
#

can i do a function that if someone votes the bot does an action?

frigid bone
#

Votes?

loud helm
#

yea on the list

frigid bone
#

I'm not sure I understand how this "voting" works hmm

loud helm
frigid bone
#

ohh

slender thistle
#

.hasVoted()

frigid bone
#

yeah, you can

loud helm
#

alright thanks

frigid bone
knotty steeple
loud helm
#

oops okay thanks

viscid falcon
#

Any ideas why my bots YouTube command is laggy, my max internet speed is 100mb and my server is a raspberry pi 3

#

If i upgraded my server would that help

#

Srry for typos, I'm on mobile rn

#

Or would my internet be too bad

west raptor
#

wdym by 'slow'?

viscid falcon
#

Like very choppy to the point i can't even understand it

west raptor
#

so the audio is choppy?

viscid falcon
#

Yeah

west raptor
#

can you invite to a server so i can see for myself? it might be on your end

#

dm it

#

to me

viscid falcon
#

I'm kinda a school rn but do _music (YouTube vid)

#

Oh wait my bot crashed

#

Nvm

west raptor
#

oof

viscid falcon
#

Can I pm later

west raptor
#

ye

viscid falcon
#

Like in 3ish hours

west raptor
#

sure, thats fine

viscid falcon
#

Thanks

west raptor
#

np

brazen shadow
#

Anyone speak spanish?

#

Alguien habla espanol?

wide shale
#

No

brazen shadow
#

oh man

#

Someone help me, how I do a different configuration for each server

knotty steeple
#

database

brazen shadow
#

What?

knotty steeple
#

use a database

viscid falcon
#

Like sequalize or whatever it's called

knotty steeple
#

sequalize isnt a database

viscid falcon
#

Oh

earnest phoenix
#

Can someone teach me how to make a ticket system in discord.py?

viscid falcon
#

Ticket system?

brazen shadow
#

For support

#

Right?

earnest phoenix
#

such as people who have suggestions, support problems, etc, and then it will mention a moderator

brazen shadow
#

Like @restive grotto

earnest phoenix
#

and the moderator will then respond

#

yes.

#

one second, I have to update discord.

viscid falcon
#

It would just be sending the arguments of the command to a specific channel with the username Then?

brazen shadow
#

Anyone can help me with this

knotty steeple
#

i already said what you need

earnest phoenix
#

Sort of, @viscid falcon

brazen shadow
#

But what databse?

knotty steeple
#

sqlite

#

mongodb

brazen shadow
#

How i use a database?

earnest phoenix
#

I need help on making a bot such as @earnest phoenix, @restive grotto

#

etc

knotty steeple
#

google

#

it

#

most things you need are on google

viscid falcon
#

Like would it report it to a server

#

The*

earnest phoenix
#

It would report it as an embed to a specific channel.

viscid falcon
#

Not a

#

So like on a a bot support server or report it on the server the command is from?

brazen shadow
#

I can use a Microsoft Access Database?

earnest phoenix
#

It will report it on the same server, just in a different channel in the server.

knotty steeple
#

@brazen shadow use one of what i said

#

sqlite, mongodb, mysql, rethinkdb (tho i think its very bad)

earnest phoenix
#

And honestly, I'm fine with any programming method for it but I'd prefer it to be python as I'm much better and more fluent in python than anything else.

knotty steeple
#

and yet you use format twice

earnest phoenix
#

shh

#

πŸ˜‚

knotty steeple
earnest phoenix
#

Samurai can you help?

knotty steeple
#

no i dont do much py

earnest phoenix
#

Shit, what are you most fluent in?

knotty steeple
#

javascript (node.js)

viscid falcon
#

Same

earnest phoenix
#

Alright, I'm fine either way. πŸ˜„

#

Now to watch a tutorial to make my bot play songs

viscid falcon
#

But search the servers channel collection for a channel with the name you want, then have it send a message to that channel

knotty steeple
#

i dont think you have collections in py

viscid falcon
#

So in java script it would be something like (This is prob wrong btw) message.guild.channels.find("channelname").send("hi") idk about python though

#

I just learned js cause it's easy

ruby talon
slender thistle
#

Do you Python

ruby talon
#

Yes.

knotty steeple
#

lmao