#development

1 messages ยท Page 666 of 1

amber fractal
#

ik

maiden mauve
#

sounds like you've narrowed it down to finding out why your variable isn't populated

inner jewel
#

concat doesn't modify the array

#

it returns a new one

maiden mauve
#

which can be diagnosed

amber fractal
#

@inner jewel thanks

inner jewel
#
> const a = []
undefined
> a.concat(1)
[ 1 ]
> a
[]
> const b = a.concat(1)
undefined
> b
[ 1 ]```
#

if you want to modify it, use push

maiden mauve
#

what is the correct word the definition of a collection of objects?

#

const objects = { obj1: {... }, obj:2 {... } .... };

#

the nested objects are "objects" but the definition is also technically "the object"

quartz kindle
#

multidimensional object? nested object? idk

#

the "correct" term is simply an object

maiden mauve
#

hm

#

question based off the ethics of playing with 2 objects that share common identities:

#

ie, a "store object" with properties of price and a "use object" with properties of functional use

#

if object1[input] exists, then objectA.object2[input].function();

#

where object1 is locally defined, and objectA is a database object

#

but [input] being an identically named object

#

the condition of course being if object1[input] exists, then objectA.object2[input] must exist because they are both defined

maiden mauve
#

hold on, let me google it

#

nope

compact mauve
#

So for one of my bots in discord.py 0.16.12 (I would update it but that would require a whole rewrite which I can't do at the moment), when I restart the bot it needs to be able to see when people add reactions to messages that previously existed (as in messages that existed before the restart) even though the deque for client.messages is emptied after every restart afaik. When I tried to append a message to the client.messages deque, some error came up:
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 248, in parse_message_update
message = self._get_message(data.get('id'))
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in _get_message
return utils.find(lambda m: m.id == msg_id, self.messages)
File "/usr/local/lib/python3.5/dist-packages/discord/utils.py", line 167, in find
if predicate(element):
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in <lambda>
return utils.find(lambda m: m.id == msg_id, self.messages)
This is only part of the error, as the whole thing is too big to send in this message, but I can't figure out how to fix this so that I can append messages to client.messages so that the event on_reaction_add(reaction, user) is able to trigger.

#

Does anyone have any ideas how to fix the error?

west spoke
#

@compact mauve you would have to store each message ID into a cache/database

compact mauve
#

oh

#

do you know where the message ID would go within the database?

#

I've tried appending the message ID to the deque also

#

I have the message object, where I can do message.id to get the ID if I need, plus I have a database to store it in, but I don't see how that'd help. The client.messages thing stores a deque of Messages, not message IDs.

wheat carbon
#

What are webhooks?

west spoke
#

something far too complex for you apparently

compact mauve
#

?

hollow saddle
#

@wheat carbon Webhooks are a way for one application to communicate with another application

#

basically

wheat carbon
#

Oh ok

#

So that's how I could make a discord bot record minecraft chat

#

Right?

hollow saddle
#

I'm not sure but I doubt it

wheat carbon
#

Ok

hollow saddle
#

You'd probably need an api for that

wheat carbon
#

What's an API?

hollow saddle
#

or some type of capture software integration

wheat carbon
#

Oh

#

What I basically mean is not really record

#

Just say minecraft chat in a discord channel

hollow saddle
#

oh

#

Hmm i'm not sure

west spoke
#

@wheat carbon there are plugins for that

#

You just put your token into the file.

wheat carbon
#

Ok

#

Thanks

west spoke
#

I used to do it

wheat carbon
#

What plugins work for PE if you know any @west spokem

#

?

west spoke
#

ooh that's a tricky one

#

I'm talking about java

#

You might have to create one yourself

wheat carbon
#

Ok

#

Thanks for the information!

quick pier
#

Hello

#

Why my bot is not added in list yet

amber fractal
outer niche
#

await client.change_presence(game=discord.Game(name='test'))

sudden geyser
#

have you considered defining it

outer niche
#

no

sudden geyser
#

then do that

outer niche
#

Hold on wait I thought I did

sinful lotus
#

if the error says you didnt

#

it means you didnt

outer niche
#

Well ummmmm

#

Guess I'm about to figure out how to

#

await 'client'.change_presence(game=discord.Game(name='test'))

#

is that right

sudden geyser
#

Search how to define variables correctly

outer niche
#

Ok

outer niche
#

Somehow I am not defining this right and I do not know what to do

await 'client'.change_presence(game=discord.Game(name='test'))

indigo geyser
#

I am making a command sor see guild roles, I know If I do guild.roles it send I'd and name, If I want only the name I have to take all roles and take the name of them, I made this:

guild = ctx.guild
	
	roles = await guild.roles()
	
	for guild.role in roles:
		
		role = guild.role.name
``` I think this is wrong and can someone help me pls?
#

@outer niche client = discord.Client()

outer niche
#

So put that in for where the client goes

indigo geyser
#

Or if you need commands client = commands.Bot(command_prefix='your prefix')

#

@outer niche put it here

import discord

client = discord.Client()
outer niche
#

import discord
from discord.ext import commands
import asyncio

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
await 'client'.change_presence(game=discord.Game(name='test'))
print('the bot is ready!')
print(bot.user.name)
print(bot.user.id)

bot.run

#

That is what I have

indigo geyser
#

How do you think you can change the client presence if you defined bot?

outer niche
#

So I need to go get the client from the application

indigo geyser
#

No!

#

@outer niche, it's bot, not client, you defined bot

#

bot.change_presence

#
import discord 
from discord.ext import commands
import asyncio

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
    await bot.change_presence(game=discord.Game(name='test'))
    print('the bot is ready!')
    print(bot.user.name)
    print(bot.user.id)

bot.run()
#

@outer niche

outer niche
#

await bot.change_presence(game=discord.Game(name='test'))

indigo geyser
#

@outer niche yes

#

No.

outer niche
#

Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "C:\Users\culan\Desktop\py\echo.py", line 9, in on_ready
await bot.change_presence(game=discord.Game(name='test'))
TypeError: change_presence() got an unexpected keyword argument 'game'

indigo geyser
#

Yes

#

Because

#

It's presence(activity=discord.Game(name='Test')

#

You didn't put activity

outer niche
#

But now it is shooting out a new error message

indigo geyser
#

Send it

outer niche
#

Oo

indigo geyser
#

And send the code

outer niche
#

Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "C:\Users\culan\Desktop\py\echo.py", line 9, in on_ready
await bot.change_presence(game=discord.Game(name='test'))
TypeError: change_presence() got an unexpected keyword argument 'game'

#

import discord
from discord.ext import commands
import asyncio

bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
await bot.change_presence(game=discord.Game(name='test'))
print('the bot is ready!')
print(bot.user.name)
print(bot.user.id)

bot.run

indigo geyser
#

YOU DIDN'T PUT ACTIVITY

#

@outer niche read that

outer niche
#

Ok

#

Got it thank you

indigo geyser
topaz raven
#

When will my bot be accepted?

twilit rapids
#

It can take up to a week

topaz raven
#

ok

#

thanks

twilit rapids
#

๐Ÿ‘

topaz raven
#

๐Ÿ‘

outer niche
#

@fast tundra.command(pass_context = True)
async def warnings(ctx,user:discord.User):
for current_user in report['users']:
if user.name == current_user['name']:
await client.say(f"{user.name} has been reported {len(current_user['reasons'])} times : {','.join(current_user['reasons'])}")
break
else:
await client.say(f"{user.name} has never been reported")
await ctx.send(embed=embed)

#

This command is not being found

cursive dagger
#

@outer niche can we see more code?

#

Remove your support link

outer niche
#

import discord
from discord.ext import commands
import asyncio

bot = commands.Bot(command_prefix='!')
bot.remove_command('help')

@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Game(name='!help'))
print('the bot is ready!')
print(bot.user.name)
print(bot.user.id)

@bot.command(pass_context=True)
async def help(ctx):
author = ctx.message.author

embed = discord.Embed(
    colour = discord.Colour.orange()
    )

embed.set_author(name='Help')
embed.add_field(name='!help',value='This menu',inline=False)
embed.add_field(name='!support',value='support discord',inline=False)
embed.add_field(name='!ban',value='coming soon',inline=False)
embed.add_field(name='!kick',value='coming soon',inline=False)
embed.add_field(name='!warn',value='coming soon',inline=False)

@bot.command(pass_context = True)
async def warnings(ctx,user:discord.User):
for current_user in report['users']:
if user.name == current_user['name']:
await client.say(f"{user.name} has been reported {len(current_user['reasons'])} times : {','.join(current_user['reasons'])}")
break
else:
await client.say(f"{user.name} has never been reported")

#

thar

cursive dagger
#

Link is still in chat

twilit rapids
#

Please use codeblocks

outer niche
#

idk how to

twilit rapids
#

Without <>

outer niche
#

'''import discord
from discord.ext import commands
import asyncio

bot = commands.Bot(command_prefix='!')
bot.remove_command('help')

@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Game(name='!help'))
print('the bot is ready!')
print(bot.user.name)
print(bot.user.id)

@bot.command(pass_context=True)
async def help(ctx):
author = ctx.message.author

embed = discord.Embed(
    colour = discord.Colour.orange()
    )

embed.set_author(name='Help')
embed.add_field(name='!help',value='This menu',inline=False)
embed.add_field(name='!support',value='support discord',inline=False)
embed.add_field(name='!ban',value='coming soon',inline=False)
embed.add_field(name='!kick',value='coming soon',inline=False)
embed.add_field(name='!warn',value='coming soon',inline=False)

@bot.command(pass_context=True)
async def support(ctx):
author = ctx.message.author

embed = discord.Embed(
    colour = discord.Colour.orange()
    )

embed.set_author(name='support discord')
embed.add_field(name='!support',value=,inline=False)
await ctx.send(embed=embed)

@bot.command(pass_context = True)
async def warnings(ctx,user:discord.User):
for current_user in report['users']:
if user.name == current_user['name']:
await client.say(f"{user.name} has been reported {len(current_user['reasons'])} times : {','.join(current_user['reasons'])}")
break
else:
await client.say(f"{user.name} has never been reported")'''

twilit rapids
#

You use '''

zealous veldt
#

watfuck is happening here

twilit rapids
#

Use 3 times `

#

not '

zealous veldt
#

\```

outer niche
#
from discord.ext import commands
import asyncio

bot = commands.Bot(command_prefix='!')
bot.remove_command('help')

@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Game(name='!help'))
    print('the bot is ready!')
    print(bot.user.name)
    print(bot.user.id)

@bot.command(pass_context=True)
async def help(ctx):
    author = ctx.message.author

    embed = discord.Embed(
        colour = discord.Colour.orange()
        )

    embed.set_author(name='Help')
    embed.add_field(name='!help',value='This menu',inline=False)
    embed.add_field(name='!support',value='support discord',inline=False)
    embed.add_field(name='!ban',value='coming soon',inline=False)
    embed.add_field(name='!kick',value='coming soon',inline=False)
    embed.add_field(name='!warn',value='coming soon',inline=False)


@bot.command(pass_context=True)
async def support(ctx):
    author = ctx.message.author

    embed = discord.Embed(
        colour = discord.Colour.orange()
        )

    embed.set_author(name='support discord')
    embed.add_field(name='!support',value=,inline=False)
    await ctx.send(embed=embed)


@bot.command(pass_context = True)
async def warnings(ctx,user:discord.User):
  for current_user in report['users']:
    if user.name == current_user['name']:
      await client.say(f"{user.name} has been reported {len(current_user['reasons'])} times : {','.join(current_user['reasons'])}")
      break
  else:
    await client.say(f"{user.name} has never been reported")```
twilit rapids
#

Ok so what's not working/erroring

cursive dagger
#

Command isnt found

#

Also what d.py version are you using?

outer niche
#
async def warnings(ctx,user:discord.User):
  for current_user in report['users']:
    if user.name == current_user['name']:
      await client.say(f"{user.name} has been reported {len(current_user['reasons'])} times : {','.join(current_user['reasons'])}")
      break
  else:
    await client.say(f"{user.name} has never been reported")```
#

@cursive dagger I don't know you were like the 15th million person asking me that today and I do not know how to check

cursive dagger
#

Open cmd

#

python -m discord --version

outer niche
#

Do I put it in regular python or IDLE

cursive dagger
#

None. Just CMD

outer niche
#

Wtf is cmd

small prairie
#

OOF

#

@outer niche you on windows or mac??

cursive dagger
#

Your on win right?

outer niche
#

Windows

small prairie
#

10?

cursive dagger
#

Sigh

outer niche
#

10

small prairie
#

lmao how di dhe even made bot without knowing cmd

#

see that cortana searh bar??

#

search cmd there

cursive dagger
#

Press the windows button, then type cmd then enter

small prairie
#

there will be command prompt

#

thingy

#

click it

outer niche
#

Command prompt

small prairie
#

YES

#

THAT IS cmd

outer niche
#

Ok

cursive dagger
#

So type python -m discord --version

#

On there

#

*in

small prairie
#

python -m discord --version

slender thistle
small prairie
#

oh yeah

#

i think so

cursive dagger
#

Oswald its 2 versions of d.py

outer niche
small prairie
#

latest then

slender thistle
#

2 versions? Hol up

small prairie
#

welp i off

outer niche
#

Now what can I do about my problem

cursive dagger
#

Change all your code to rewrite?

#

Cause your using a async tutorial on discord.py rewrite

outer niche
#

How do I change it to rewrite

slender thistle
#

Migrate manually

#

Read the documentation, see what changed

outer niche
#

Documentation?

slender thistle
earnest phoenix
#

๐Ÿคฆ

outer niche
low wasp
#

awate....

outer niche
#

i am blind

low wasp
#

We all are sometimes

outer niche
#

I did check the spelling on this one and it is spelled right

low wasp
#

Ur missing a ) on member.kick

outer niche
#

Like I said I'm blind

#

Especially at 2:40 a.m.

low wasp
#

Lol

outer niche
#

Either I need to go to sleep or I'm just playing out dumb now

#
async def kick(ctx, member : discord.Member, reason=None):
    await member.kick(reason=reason)
    await ctx.send(embed=embed)```
#

Not finding command

cursive dagger
#

sigh are you sure its not finding the command? Any output in the console?

outer niche
slender thistle
#

command()

#

Parentheses matter last time I heard

outer niche
cursive dagger
#

You just sent the command wrong in discord

earnest phoenix
#

you can't code whether you're tired or not because you're diving into using d.py without knowing the py part of it

tight heath
#

@outer niche then don't lul

outer niche
#

@cursive dagger I did type it in right

#

Once I'm done with this command I'm done

cursive dagger
#

what did you type as the command in discord?

outer niche
#

!unban

cursive dagger
#

Then that obviously isnt gonna work

#

you need to specify a member as you did in your code

outer niche
#

Nope didn't work

trail dagger
#

You need to specify user and reason

#

!ban @JustEmil#2642 LOL and the user has to be in that guild

slender thistle
#

reason isn't necessary

trail dagger
#

true

slender thistle
#

since they default it to None

trail dagger
#

yea i saw the =None now

#

@outer niche what is the last error you got?

outer niche
#

Also reasons not necessary it is set to none

#

I don't get it it says not defined but I defined it

#

!unban Mudae#0807

#

Idk what to do at this point

slender thistle
#

What is banned_users

#

Send your code

outer niche
#
async def unban(ctx, *,member):
    baned_users = await ctx.guild.bans()
    member_name, member_discriminator = member.split('#')

    for ban_entry in banned_users:
        user = ban_entry.user

        if (user.name, user.discriminater) == (member_name, member_discriminater):
            await ctx.guild.unban(user)
            await ctx.send(f'Unbanned {user.name}#{user.mention}')```
slender thistle
#

I see defined baned_users but not a defined banned_users

outer niche
#

??

#

oo

patent prism
#

Whole traceback?

outer niche
#

Idk

trail dagger
quartz kindle
#

add display:none to #bot-details-page .shapes-1

trail dagger
#

okey i did it

#

Forget it, i just fix that shit when the bot gets approved

cursive dagger
#

did you just remove the vote and donate buttons ๐Ÿ˜ฆ

trail dagger
#

The bot isnt approved yet

earnest phoenix
#

Hi guys have some 404 error page on my discord Server entry on your website . Oswald ( your Moderator ) have try to fix it but doesent work. can some other from your staff help me to fix the Problem ?

trail dagger
#

@cursive dagger Do you know anything about css?

cursive dagger
#

Yes but im not a expert

trail dagger
#

You know how to make the bot image card thing to float

cursive dagger
#

Like animation? Or just a shadow so it looks 3d?

trail dagger
#

animation

cursive dagger
trail dagger
#

Look in ur dms i will send you a link to someone elses bot page so you know what i meant

quartz kindle
#

use keyframe animations

pseudo parcel
#

(node:4352) DeprecationWarning: ClientUser#setGame: use ClientUser#setActivity i
nstead what is this error

#

my bot is works but thats always showns

earnest phoenix
#

have you tried reading the error

indigo geyser
#

@outer niche that Lucas' Tutorial is wrong

#

I use this

@teo.command()@commands.has_permissions(administrator=True, ban_members=True)async def unban(ctx, *, member): bans = await ctx.guild.bans() for ban_entry in bans: user = ban_entry.user await ctx.guild.unban(user) emb = discord.Embed(title='Unbanned!', description=f'{user.mention} has been unbanned!', colour = 0xfff157) await ctx.send(embed=emb) return
#

Oof

grave pecan
#

Quick question, would running two instances of the bot on two different machines require anything other than sharding it correctly and connecting the databases?

quartz kindle
#

not that i know of

#

as long as you shard correctly with the correct shard IDs, it should work

slender thistle
#
  bans = await ctx.guild.bans()
  
  for ban_entry in bans:

    user = ban_entry.user
    
    await ctx.guild.unban(user)

So we just unbanning everyone?

hushed zodiac
stray garnet
#

`app/index.js:263:11 PM

bot.commands.set(props.help.name, props);3:11 PM

^3:11 PM

3:11 PM

TypeError: Cannot read property 'name' of undefined3:11 PM

Jump to

at jsfile.forEach (/app/index.js:26:37)3:11 PM

at Array.forEach (<anonymous>)3:11 PM

Jump to

at fs.readdir (/app/index.js:23:12)3:11 PM

at FSReqWrap.args [as oncomplete] (fs.js:140:20)`

Error at my Log

quartz kindle
hushed zodiac
#

okey thankyou

quartz kindle
#

@stray garnet you error is Cannot read property 'name' of undefined in index.js line 26

#

you're trying to get a name of something that doesnt exist

stray garnet
#

Oh thx

split hazel
#

What would be the best method of making a small giveaway "timer" that edits every once a while? My current one is basically 3 intervals. One updates embed every 10 seconds if time remaining is less than 1 minute and etc for rest. But it isnt proving to be very stable. Any ideas for a better version for my rewrite?

abstract crow
#

What do you guys use? Gitlab or Github? And why

winged thorn
#

I use gitlab

#

Cause I prefer it's implementation of ci

#

And prefer the UI in general

abstract crow
#

I like the UI too, but I want to upload my public projects and github just seems way more popular

#

Like "link me ur github project" type of thingy

winged thorn
#

I don't really find that. Usually it's "do you have a link to your repo" or something along those lines. Have not experienced any backlash or anything from not using github

abstract crow
#

What do you use as a program for gitlab? I used to use github and then I just switched to use gitkraken as a desktop client

outer niche
#

what did i di worng

slender thistle
#

Might gib som code yo know

winged thorn
#

I don't use a desktop client

#

I just do all my git stuff with command line

abstract crow
#

According to Wikipedia, GitLab has 100,000 users (March 2017) and is used by enterprises such as IBM, Sony, and NASA.
Overall, 26 million people and 1.5 million organizations created 67 million repositories on GitHub in 2017.

#

So I feel like github would be easier to grow on

winged thorn
#

I don't think you shod be aiming to use a website such as github or gitlab to grow, they are merely functional websites allowing remote access to your code

abstract crow
#

Yeah but people post their projects for others to use

winged thorn
#

Even so, neither website's intended purpose is to aid the Dev in becoming better known

earnest phoenix
#

github is a lot more student friendly

winged thorn
#

How so?

topaz fjord
#

I don't like the gitlab ui

winged thorn
#

Same

#

Wait

#

No I don't like the GitHub one

topaz fjord
#

I prefer the gh one

#

with dark reader

earnest phoenix
#

github offers their student pack to students with an edu email, you get a lot of useful stuff in that pack for hosting, domains, web hosting etc.

#

you also get pro for linking an edu email

topaz fjord
#

I feel like gitlab is more useful for companies

#

Than regular users

earnest phoenix
#

agreed

winged thorn
#

wHaT abOuT BitBUckEt

topaz fjord
#

Still for Enterprise

earnest phoenix
#

You are html to my css

topaz fjord
#

nah I'm good

compact mauve
#

So for one of my bots in discord.py 0.16.12 (I would update it but that would require a whole rewrite which I can't do at the moment), when I restart the bot it needs to be able to see when people add reactions to messages that previously existed (as in messages that existed before the restart) even though the deque for client.messages is emptied after every restart afaik. When I tried to append a message to the client.messages deque, some error came up:
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 248, in parse_message_update
message = self._get_message(data.get('id'))
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in _get_message
return utils.find(lambda m: m.id == msg_id, self.messages)
File "/usr/local/lib/python3.5/dist-packages/discord/utils.py", line 167, in find
if predicate(element):
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in <lambda>
return utils.find(lambda m: m.id == msg_id, self.messages)
This is only part of the error, as the whole thing is too big to send in this message, but I can't figure out how to fix this so that I can append messages to client.messages so that the event on_reaction_add(reaction, user) is able to trigger.
Does anyone have any ideas how to fix the error? I asked this last night but the response was quite unclear

#

This is a snippet of code that I think is causing the problems:
. @asyncio.coroutine def on_reaction_add(self, reaction, user): for member in dbconn.db["Player"].find(): loaded_member = jsonpickle.decode(member['data']) player = players.find_player(loaded_member.id) for message in player.reaction_messages: message_2 = message[0] reaction_channel = util.get_client(message_2.server[0]).get_channel(message_2.channel.id) message_1 = util.get_client(message_2.server[0]).get_message(reaction_channel, message_2.id) if message_1 is not None and not message_1 in self.messages and isinstance(message_1, discord.message.Message): self.messages.append(message_1)
Self refers to the client

#

It seems to be the last two lines that are causing the problems

#

What I think is the problem is this part:
and not message_1 in self.messages
but if it is, then I can't think of a solution

winged thorn
#

What's wrong with it

#

Errors? Anything?

outer niche
#

File "C:\Users\culan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: not enough values to unpack (expected 2, got 1

grave pecan
#

making a bot to check if another bot is online and if itโ€™s not then making that bot automatically start another bot because you donโ€™t know what else to do

abstract crow
#

What SSH clients do you guys all use?

mossy vine
#

$ ssh

earnest phoenix
#

putty on windows

abstract crow
#

And what the hell happened with the code above

outer niche
#

I'm not unbanning a bot tho

abstract crow
#

PLEASE use a bin

mossy vine
#

code blocks are good enough imo

earnest phoenix
#

they clutter the chat a lot

#

i personally dislike having to scroll the chat back and forth to read and troubleshoot and write a reply

#

we get it, you get an error, you don't have to post it for the third time

slender thistle
#

I'm gonna question presence of discriminater in that code

earnest phoenix
#

!

#

!developers

outer niche
#

It's what I was told to put their

earnest phoenix
#

!help

winged thorn
#

Imagine comparing name and discrim when you could just compare ids

earnest phoenix
#

they absolutely have no idea what they're doing regardless of that

outer niche
#

So put ID instead

slender thistle
#

Let's not use common prefixes, especially outside of #commands @earnest phoenix

#

Make it accept ID, culanndog

earnest phoenix
#

ok

slender thistle
#

I remember there being one function especially to see if someone was banned

#

Guild.fetch_ban, great

outer niche
#
async def unban(ctx, *,member):
    banned_users = await ctx.guild.bans()
    member_name, member_discriminator = member.split('#')

    for ban_entry in banned_users:
        user = ban_entry.user

        if (user.name, user.id) == (member_name, member_id):
            await ctx.guild.unban(user)
            await ctx.send(f'Unbanned {user.name}#{user.mention}')
          
            ```
slender thistle
#

What is member_idยฟ

outer niche
#

I give up on this command

slender thistle
#

The issue becomes your laziness then

outer niche
#

No

winged thorn
#

This is simple python

#

If you can't do this you need to learn python again

#

How are you going to compare something against a variable that hasn't been defined

earnest phoenix
#

they didn't know how to open a py file the other day

winged thorn
#

I saw

earnest phoenix
#

i always preach that if you can't do logical problem solving, programming isn't for you

indigo geyser
#

@outer niche member_discriminator, not ID

outer niche
#

i got it

maiden mauve
#

the problem with "learning to make a bot" is

#

you invite many people with zero experience and give them an environment with defined variables

#

so they learn that "some things can be used" and "some things I have to make"

#

they miss the lesson on what is and why

#

generally they don't understand what the library is giving them, and don't understand why copy pasta works or doesn't

halcyon nymph
#

@outer niche also, look at the error youโ€™re getting, in python theyโ€™re really helpful to what you need to fix

outer niche
#

ok

maiden mauve
#

im guessing in py lib "ctx" is the client?

indigo geyser
#

No @maiden mauve

#

Is context

maiden mauve
#

message.content ?

indigo geyser
#

Yes

maiden mauve
#

ah

#

weird acronym lol

indigo geyser
grave pecan
#

ive never used a linux vps, are there any guides on how to install discord.js and then how to put files into it?

earnest phoenix
#

you generally shouldn't run debugging versions on a prod machine

amber fractal
#

@grave pecan this can depend on the linux system and asking are there any guides here slows you down when google is much faster

tight heath
#

step 1

#
  • do not ever use dd
slender thistle
#

@maiden mauve in the py lib, ctx is commands.Context, something what you could call a little modification of Message but for commands extension

maiden mauve
#

Ah, was just curious because all I've used is nodejs

slender thistle
#

It can also be a Messageable by itself, so you can do ctx.send instead of ctx.channel.send

maiden mauve
#

It looked very similar to message object

slender thistle
#

It's basically a shortcut for Message + some other things

maiden mauve
#

And python uses indents for code blocks?

slender thistle
#

Yea

#

Instead of "wrap-it-all-with-{}" it's "MOVE-IT-EVEN-MORE-TO-THE-RIGHT-AFTER-A-COLON-OR-IT-WILL-NOT-WORK" kinda thing

topaz fjord
#

lmao

#

@tight heath dd is kool

tight heath
#

deletedisk

maiden mauve
#

kinda makes sense

#

maybe the guy who wrote it thought "everyone should do this anyhow"

grave pecan
#

I figured it out. Linux runs so much smoother than windows lol

amber fractal
#

For some things

opaque eagle
#
await Promise.all(['โœ…', '๐Ÿšซ'].map(confirm.react));``````
Promise {
  <rejected> TypeError: Cannot read property 'client' of undefined
      at react (/Users/sinistrecyborg/Projects/bot/node_modules/discord.js/src/structures/Message.js:430:18)
      at Array.map (<anonymous>)
      at _dddโ€anonymous.exec (/Users/sinistrecyborg/Projects/bot/commands/request.js:20:39)
      at processTicksAndRejections (internal/process/task_queues.js:85:5)
}```
#

Why does that happen?

#

Also confirm is a Message

amber fractal
#

have more code?

#

Wait

#

is that a d.js error?

#

this is undefined in the Message.js structure

#

for some reason

topaz fjord
#

@opaque eagle show more code

abstract crow
#

What do you guys use to get Oauth2 working with Discord? Just the default stuff or any extra node modules

low wasp
#

@abstract crow couldn't get passport.js to work?

abstract crow
#

I gotta read up on it. I didn't know if anyone else used that

low wasp
#

Ah

wooden lance
#

Hi! I keep getting this error when running my discord.js bot:

TypeError: Cannot read property 'hasPermission' of undefined
    at Object.module.exports.run (/root/DiscordBotApp/commands/warn.js:23:14)
    at Client.client.on.err (/root/DiscordBotApp/bot.js:66:17)
    at emitOne (events.js:96:13)
    at Client.emit (events.js:188:7)
    at MessageCreateHandler.handle (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
    at WebSocket.onMessage (/root/DiscordBotApp/node_modules/ws/lib/event-target.js:120:16)
    at emitOne (events.js:96:13)
@wooden lance asked me to run a command that I couldn't find.```
My code: https://pastebin.com/P4K1viSi
Any ideas on how to fix?
tight heath
#

@wooden lance line 23 user is undefined

#

Read the error boi

wooden lance
#

But, it's defined.

#

wait...

#

lol it isn't

#

๐Ÿคฆ

maiden mauve
#

๐Ÿ˜„

indigo geyser
#

Lel

outer niche
mossy vine
#

im not really a python developer, but im 90% sure that has_permissions is not a decorator or whatever python calls that

outer niche
#

Idk I did not create that my friend did

valid frigate
#

your friend should ask for help then Thonk

opaque eagle
#

^

outer niche
#

My friend is not alive anymore
Died 6 months ago stage 4 cancer

broken shale
#

How hard is sharding for d.js ๐Ÿค”

earnest phoenix
#

culanndog3111_gamingToday at 12:23 AM
My friend is not alive anymore
Died 6 months ago stage 4 cancer
summon them from the dead

#

(edited)

outer niche
#

I wish

indigo geyser
#
@client.command()
async def guilds(ctx):
	print(client.guilds) 
``` how can I have only guild names?
earnest phoenix
#

just a PSA, lying about someone dying from cancer is generally not okay and is disrespectful, where are your morals

valid frigate
#

you should need to shard right now, but it requires some changes in your code

#

should not*

#

for example if your bot uses a db, youd have to spawn multiple db clients depending on how many shards you have

abstract crow
#

How do we know he is lying?

indigo geyser
#

@valid frigate thanks

outer niche
#

@earnest phoenix why would I lie about something like that

abstract crow
#

@outer niche Sorry to hear that

earnest phoenix
#

by using common sense, @abstract crow

lost bramble
#

hey boys

valid frigate
#

innocent until proven guilty

#

thats all im saying

#

anyways not to minimod or anything but lets move out of this channel

indigo geyser
#

What is a shard peperepeat

valid frigate
#

an instance of your bot's client

#

multiple shards = multiple clients

broken shale
#

but just wondering how hard is sharding on d.js shouldn't be too hard unless I fuck something up ๐Ÿ˜‚

indigo geyser
#

Mhm......thanks

valid frigate
#

not too hard

outer niche
valid frigate
#

take a look at this

outer niche
#

I know there's something wrong about that but I'm not quite sure

broken shale
#

it's like sub instances if I'm correct

valid frigate
#

try reading the guide

#

it explains sharding somewhat generally

#

but more shards = more memory so you should be prepared for that

broken shale
#

Yeah but if Im using a db such as MongoDB it wouldn't have a problem connecting to it right?

valid frigate
#

i use mongo and i only have 2 shards

indigo geyser
#

@outer niche @commands.has_permissions

valid frigate
#

so it's normally not a problem

broken shale
#

ah okay

outer niche
#

ok thx

valid frigate
#

definitely suggest setting shard count to "auto" though, it will spawn shards as needed

indigo geyser
#

you should need to shard right now, but it requires some changes in your code are you taking with @broken shale?

#

@valid frigate

valid frigate
#

yeah

broken shale
#

What are the major changes though

indigo geyser
#

Ok

valid frigate
#

and to clarify i made a slight typo

#

shouldn't*

broken shale
#

I don't use py sorry

outer niche
#

The command is not found

indigo geyser
#

What command

outer niche
indigo geyser
#

Thanks, Im gonna try it

#

Idk why sorry

outer niche
#

Ok

abstract crow
#

Showing the whole code would be easier...

#

Hastebin etc

outer niche
indigo geyser
#

@abstract crow no, AttributeError, that is for the current guild

#

like ctx.guild

#

@outer niche you did not put a @bot.command()

#

In warn

#

And everyone can purge messages

maiden mauve
#

There is a lot of documentation on pushing a delay into a promise rather than just using a ES6 Timeout block, any particular added security going that route?

#

I haven't had that method fail me

outer niche
earnest phoenix
#

have you tried reading the error

outer niche
#

Yes

#

Still confused I did not write the code

maiden mauve
#

so you want someone to fix someone elses code so it will run for you

abstract crow
#

Well the code is neat and clean so you need to learn Python

maiden mauve
#

๐Ÿ˜

broken shale
#

it says client isn't defined

#

Idek python but can read the error xd

abstract crow
#

And I don't know Python, but I am pretty sure client.say isn't actually a thing

broken shale
#

^ aka why client is throwing an err?

earnest phoenix
#

you're not supposed to use client in the first place

abstract crow
#

^^

#

If I recall correctly it is ctx.send or ctx.reply something like that

broken shale
#

Problem solved โœ…

earnest phoenix
#

i dont even know how client.say(string) would even work

abstract crow
#

^

#

What server, what channel, etc

earnest phoenix
#

exactly

broken shale
#

client.say isnt even a thing in d.js xd

#

I dont think it's a thing in any wrapper

outer niche
#

You're right it should be user: send

broken shale
#

ctx.send

abstract crow
#

Sighs

outer niche
#

ctx.send invalid syntax

abstract crow
#

Ok. Here's what I want YOU to do. Google stuff first. Take some tutorials and lessons online. Read the docs

earnest phoenix
#

discord.py docs go in detail about how commands work

abstract crow
#

This has been going on for about 12 hours now of you just not reading

broken shale
#

Theres also a py server where to get additional help on

abstract crow
#

-_-

#

You've got to be kidding me.

#

Read the docs

outer niche
#

Sorry I did not mean to put that in here

slim heart
#

how can i convert all the default emojis to their names? so like โญ=> "star"

abstract crow
#

Good question

slim heart
mossy vine
#

just map all emojis by unicode and readable name and then use that?

slim heart
#

you know how many emojis there are...

mossy vine
#

pretty hacky solution, theres probably better

#

yes

slim heart
#

way too many lmao?

mossy vine
#

basically

maiden mauve
#

what do you mean by convert

#

you could break every message down and search for ": string :"

#

then if its found, remove the colons

slim heart
#

thats, not how that works lol

broken shale
#

like this

slim heart
#

dw i found a lib for it

broken shale
#

why need a lib instead of few lines of code

#

โ“

slim heart
#

its not, a, few lines of code

#

you do all realize that the unicode emojis are unicode not :string:

broken shale
#

then just create a generator and read it from an arr

slim heart
#

im using a lib

#

called emojilib

broken shale
#

js?

slim heart
#

yes

inner jewel
#

unicode is a bitch

broken shale
#

lol

inner jewel
#

so using a lib that deals with all the bullshit of unicode isn't a bad idea

#

and when you get to surrogate pairs it gets even more annoying

maiden mauve
#

had no idea emojis were so complicated

#

lol

mossy vine
#

my number 1 rule when it comes to unicode: let someone else deal with it

slim heart
#

and im done thats actually a lot easier than i thought lol

compact mauve
#

So for one of my bots in discord.py 0.16.12 (I would update it but that would require a whole rewrite which I can't do at the moment), when I restart the bot it needs to be able to see when people add reactions to messages that previously existed (as in messages that existed before the restart) even though the deque for client.messages is emptied after every restart afaik. When I tried to append a message to the client.messages deque, some error came up:
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 248, in parse_message_update
message = self._get_message(data.get('id'))
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in _get_message
return utils.find(lambda m: m.id == msg_id, self.messages)
File "/usr/local/lib/python3.5/dist-packages/discord/utils.py", line 167, in find
if predicate(element):
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in <lambda>
return utils.find(lambda m: m.id == msg_id, self.messages)
This is only part of the error, as the whole thing is too big to send in this message, but I can't figure out how to fix this so that I can append messages to client.messages so that the event on_reaction_add(reaction, user) is able to trigger.
Does anyone have any ideas how to fix the error? I asked this last night but the response was quite unclear

#

This is a snippet of code that I think is causing the problems:
. @asyncio.coroutine def on_reaction_add(self, reaction, user): for member in dbconn.db["Player"].find(): loaded_member = jsonpickle.decode(member['data']) player = players.find_player(loaded_member.id) for message in player.reaction_messages: message_2 = message[0] reaction_channel = util.get_client(message_2.server[0]).get_channel(message_2.channel.id) message_1 = util.get_client(message_2.server[0]).get_message(reaction_channel, message_2.id) if message_1 is not None and not message_1 in self.messages and isinstance(message_1, discord.message.Message): self.messages.append(message_1)
(Self refers to the client)

#

I've asked this twice but I only received one answer, and that answer was unclear and the answerer wouldn't clarify anything

winged thorn
#

so uh my code doesn't work but it should be working so now i'm angery

sudden geyser
#

Is there an error

#

Just saying "it doesn't work" isn't really helpful

opaque eagle
#

@winged thorn explain

winged thorn
#

no error

opaque eagle
#

What language? What library? What does ur code look like?

#

We're blind here

winged thorn
#

I figured it out so dw anymore but

opaque eagle
#

ok

winged thorn
#

i was angery

grave pecan
#

npm WARN prism-media@1.0.2 requires a peer of ffmpeg-binaries@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN prism-media@1.0.2 requires a peer of ffmpeg-static@^2.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN prism-media@1.0.2 requires a peer of node-opus@^0.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN prism-media@1.0.2 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of bufferutil@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.5.1 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.

#

when doing npm install discord.js

opaque eagle
#

dw

amber fractal
#

They are optional

#

Read the docs

earnest phoenix
#

@calm crown

wooden lance
#

yeah, you can ignore those.

compact mauve
#

so uh does anyone have an answer for my inquiry

wheat jolt
earnest phoenix
#

what's the issue? Seems to be ok

wheat jolt
#

@wheat jolt help

#

like this?

#

@woven sundial

#

then put a space after lol

#

show me your code

#

where you define the prefix

#
"@stark sage ",
"a!"
]```
#

use this

#

Because you said you want to be @wheat jolt[SPACE]help

#

yes

#

try it

#

@woven sundial lmk if it works

#

if not, I think I know why

lusty dew
#

What if the bot has a nickname? @wheat jolt

wheat jolt
#

his id is the same

lusty dew
#

That wouldn't work if the bot had a nickname set in the server

#

When a nickname is set the mention is different

wheat jolt
#

when you mention someone, the bot reads this: <@HIS ID>

lusty dew
#

No

wheat jolt
#

No, it's not

#

look

#

I'll do this: \@Alex T.js#0001

#

@wheat jolt

slender thistle
#

That's without nickname

#

@slender thistle

#

Huh

wheat jolt
#

if I would change my nickname

#

that ID would be the same

lusty dew
#

Discord.changed it i think

slender thistle
#

Yes but the mention not

wheat jolt
#

yes

#

but the bot reads <@ID>

slender thistle
#

Fuckery of Discord libs ngl

wheat jolt
#

not @tribal haven

lusty dew
#

Used to be a ! in the mention if there was a nick set

wheat jolt
#

he put that too

#

the !

fast wagon
#

hoi

lusty dew
#

Uhm don't think that's how it works?

#

Idk though

twilit rapids
#

Members can't be bots, users can, so use the user object instead if the member object

buoyant pollen
#

i dont use NSFW command

winged thorn
#

the bot isn't going to answer you lol

#

ask a mod

buoyant pollen
#

i know, just mad

winged thorn
#

have you tried seeing if it can return anything nsfw

#

safesearch isn't 100% reliable

stray garnet
#
const botconfig = require("../botconfig.json");
const ownerID = botconfig.owner;

module.exports.run = async (bot, message, args) => {
    let bug = args[0];
    if(!bug) return message.channel.send("You must Provide a Bug!");
    const embed = new Discord.RichEmbed()
    .setAuthor("Bug Report!")
    .addField(`Von`, message.author.tag)
    .addField(`Bug`, bug)
    bot.users.get(`${ownerID}`).send(embed)


}
module.exports.help = {
  name: "bugreport",
  aliases: []
}```

The Bot don't sends me an Private Message when i type for example `n!bug Test`
wheat jolt
#

please

deft bough
#

hmm

#

i cant

#

anyone else havy any ideas?

#

I dont know how to make my bot ban people

winged thorn
#

@deft bough what library

deft bough
#

discord.js

#

or what ver

#

discord.api?

#

the discord one what ever it is called @winged thorn

winged thorn
#

read that

deft bough
#

I have

winged thorn
#

that tells you how to ban

deft bough
#

i have read it

#

but it always says guild is not defined or message is not defined

winged thorn
#

so define the guild?

fast wagon
#

well you didnt define the stuff

deft bough
#

idk how

#

the kick works fine

fast wagon
#

can u get le awesome green role while im still developing my bot

winged thorn
#

no

#

well

fast wagon
#

damn

winged thorn
#

yes but no

fast wagon
#

ummm what does that mean

slender thistle
#

You need to have at least one bot approved

winged thorn
#

if it is good enough to get approved then you get the green role

fast wagon
#

maybe i can upload my meme bot :3

deft bough
#

how do i define message or define guild

fast wagon
#

by learning javascript

winged thorn
#

member has a guild attribute

#

imagine that

deft bough
#

hmm yes the floor here is made out of floor @fast wagon

fast wagon
#

<member>.guild

deft bough
#

ok

fast wagon
#

how do i be a certified developer for an even more awesome green role

winged thorn
#

have a certified bot

slender thistle
deft bough
#

thank you @winged thorn and @fast wagon

fast wagon
#

Np

#

i don't think I helped that much

#

@slender thistle can my bot have a main purpose and then a bunch of random other commands for fun?

slender thistle
#

No but yes
In other words, yes it can

winged thorn
#

What if it has lots of random functions but they are all executed exceptionally well

slender thistle
#

That's fine

#

For certification it might not

winged thorn
#

hm

#

maybe I'll just make my currency system really good then and everything else is secondary

twin kestrel
#

Hello everyone!
Sorry if annoying. I put them in a situation quickly:
I have a command in which only 2 arguments work. After 20 minutes without getting the command to correct if you enter an argument that is not included in the list (that is, it is not one of the 2 valid arguments).

I use the discord.js library

(I don't know if I explained myself correctly)

fast wagon
#

Soooo do u have code that doesn't work

#

Or do you want to know how to do it

#

You need something to detect which arg is missing, then use a message collector so the person can enter the arg that's missing @twin kestrel

#

C an u change my nickname to "Stoof" @slender thistle

twin kestrel
#

I want to learn to do it

fast wagon
#

Ok

#

I don't know what the command is so I can't make the "something"

twin kestrel
#

It is a configuration command and currently only has 2 languages. So what I want is to correct users when they don't enter a language correctly

fast wagon
#

O

#

So if it detects the language it says do this language?

#

Srry I don't really understand

twin kestrel
#

I mean if it detects the language that if it is valid, it will change the language, but if it is not valid it will not change it

#

Ex: !set lang english > It is a supported language

#

!set lang 432y1kjh > It is not a supported language

fast wagon
#

Do an if() to check if it's a valid language

twin kestrel
#

I already tried it with that and I still can't make it work with the two supported languages

mossy vine
#

yeah thats gonna result in way too many if statements after a while

twin kestrel
#

I just get him to verify 1

mossy vine
#

maybe an array of supported languages and checking if the entered language is in the array?

fast wagon
#

Check if the language is valid, then return and message.reply() if it isn't

#

@mossy vine OwO how do u get a purple role

winged thorn
#

boost server

fast wagon
#

I don't have nitro 3:

mossy vine
#

the role is called Nitro Booster, so its kinda obvious

twin kestrel
#
if(!lang === "spanish" || "english") return;```
mossy vine
#

thats wrong

twin kestrel
#

๐Ÿ˜…

#

That's why I asked for help

mossy vine
#

and when you add more languages it will result in even more mess

twin kestrel
#

That's why I asked for help x2

mossy vine
#

i suggest you create an array of supported languages

#

and use <Array>.includes()

twin kestrel
#

Thanks ๐Ÿ‘

#

It's working

mossy vine
#

nice

wide fjord
#

Guys I nerd help with the rolereaction bot

#

Can someone help me?

slender thistle
#

ily supportserver

covert turtleBOT
#

This server is NOT the support server for ANY bot. You need to click on the "Support Server" button on the bot's page, NOT the "Join Discord" button at the top of DBL.

mossy vine
#

wrong server

fast wagon
slender thistle
#

Auctions

#

ily bids

covert turtleBOT
earnest phoenix
#

K

stray garnet
#

How to check if an Channel is NSFW?

slender thistle
#

Check if channel is NSFW, you mean

stray garnet
#

oh yes

slender thistle
#

What library

stray garnet
#

d.js

slender thistle
#

TextChannel#nsfw

#

Assuming you are using stable version, but it seems to be the same on dev version too Shrug

stray garnet
#

Thanks

fast wagon
#

@slender thistle bids for front page tags?

slender thistle
#

Any

fast wagon
#

okey

lusty dew
#

How do I get all the names of the servers my bot is in?

#

D.js master

#

Nvm

strange gyro
#
client.guilds.forEach((guild) => {
console.log(guild.name)
}```  @lusty dew I think
lusty dew
#

I for it

#

I just did client.guilds.map(i => i.name)

#

Ye

strange gyro
#

@lusty dew so working?

lusty dew
#

Yea now I'm trying to get a channel ID from one of the listed guilds lol

strange gyro
#

easy*

lusty dew
#

Just seeing what's possible

strange gyro
#
client.guilds.forEach((guild) => {
console.log(guild.name + guild.channels.find(ch => ch.type === 'text').first().id)
}``` @lusty dew
#

All good? @lusty dew

sudden geyser
#

syntaxerror

strange gyro
#

why?

sudden geyser
#

Try evaluating it

lusty dew
#

I did

strange gyro
#

what bot can i use to eval()?

lusty dew
#

And even then guild.channela.find isn't a function

#

Or at least that's what my bot returns

#

When I eval it

#

You forgot an ) as well

#
client.guilds.forEach((guild) => {
message.channel.send(guild.name + guild.channels.find(ch => ch.type === 'text').first().id)
})
sudden geyser
#

Even then, you'll still get a typeerror in 99% of situations. Assuming you only want the channel, you could just call <Client>.channels to return a collection (If you're using discord.js)

jaunty stump
#

I could use a little help if anyone is not busy.

sudden geyser
#

what do you need help with

jaunty stump
#

(what I am trying to do)
make a bot for my friend who is an artist.
He asked me to make a bot that can add people to like a waiting queue so he knows who is next in line.
also for a command like <prefix>queue and it will show the list of members in the queue.

The problem I have is..I don't know where to start and I can't find any references anywhere to get an idea.

lusty dew
#

How would you get a channel ID from a specific server though?

#

If you provide a name

sudden geyser
#

The name of a channel? You could try "finding" it.
Ori that's not something we can just "help" you with if it's not like a snippet you're having trouble with

lusty dew
#

No name of guild

jaunty stump
#

I was hoping for a website to go to or somewhere to find atleast something

twilit rapids
#

just use an array

#

you can do everything that you described

#

you can Google "array methods" to learn more about those

jaunty stump
#

Ok.
Thanks

lusty dew
#

@sudden geyser I'm talking about if I provide the guild name

#

How would I get the ID of the first text channel

twilit rapids
#

what do you mean with first, first as position or first as creation date

lusty dew
#

Position

compact mauve
#

So for one of my bots in discord.py 0.16.12 (I would update it but that would require a whole rewrite which I can't do at the moment), when I restart the bot it needs to be able to see when people add reactions to messages that previously existed (as in messages that existed before the restart) even though the deque for client.messages is emptied after every restart afaik. When I tried to append a message to the client.messages deque, some error came up:
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 248, in parse_message_update
message = self._get_message(data.get('id'))
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in _get_message
return utils.find(lambda m: m.id == msg_id, self.messages)
File "/usr/local/lib/python3.5/dist-packages/discord/utils.py", line 167, in find
if predicate(element):
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in <lambda>
return utils.find(lambda m: m.id == msg_id, self.messages)
This is only part of the error, as the whole thing is too big to send in this message, but I can't figure out how to fix this so that I can append messages to client.messages so that the event on_reaction_add(reaction, user) is able to trigger.
Does anyone have any ideas how to fix the error? I asked this last night but the response was quite unclear

#

This is a snippet of code that I think is causing the problems:
. @asyncio.coroutine def on_reaction_add(self, reaction, user): for member in dbconn.db["Player"].find(): loaded_member = jsonpickle.decode(member['data']) player = players.find_player(loaded_member.id) for message in player.reaction_messages: message_2 = message[0] reaction_channel = util.get_client(message_2.server[0]).get_channel(message_2.channel.id) message_1 = util.get_client(message_2.server[0]).get_message(reaction_channel, message_2.id) if message_1 is not None and not message_1 in self.messages and isinstance(message_1, discord.message.Message): self.messages.append(message_1)
(Self refers to the client)

#

can someone please help i've asked like 3 times

slender thistle
#

That traceback isn't helpful lul

compact mauve
#

oh sorry, is there anything that would be helpful

winged thorn
#

The traceback is telling us what happened in the module not what caused it from your code

compact mauve
#

Ok, well the problem seems to be in the last two lines,
if message_1 is not None and not message_1 in self.messages and isinstance(message_1, discord.message.Message):
self.messages.append(message_1)

winged thorn
#

what's self.messages

compact mauve
#

Oh it's the client.messages cache

#

From the docs:
messages
A deque of Message that the client has received from all servers and private messages. The number of messages stored in this deque is controlled by the max_messages parameter.

winged thorn
#

so why are you managing it yourself?

slender thistle
#

discord.message.Message?

#

Look good aight

compact mauve
#

it might just be discord.Message

winged thorn
#

isn't it just discord.Message

slender thistle
#

Not really

#

discord.message.Message is discord.Message returns True

compact mauve
#

I'm appending to it myself because it's emptied whenever the bot restarts, and I need the bot to see on_reaction_add() events for messages sent before a restart

#

I have the message IDs and the message Objects stored with the player that used the command to create them, so I figured if I just appended the discord.Message to the client.messages deque it'd work, but the traceback has something along the lines of AttributeError: 'generator' object has no attribute 'id'

#

And I don't know how it thinks the message object is a generator without the id attribute, as I added the check to make sure the thing it appends is a message object

slender thistle
#

Can you send the full traceback?

winged thorn
#

In a pastebin if it's really huge

compact mauve
#

Oh sure

#

Traceback (most recent call last):
File "run.py", line 307, in run
asyncio.run_coroutine_threadsafe(client.run(bot_key), client.loop)
File "/usr/local/lib/python3.5/dist-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete
return future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/usr/local/lib/python3.5/dist-packages/discord/client.py", line 491, in start
yield from self.connect()
File "/usr/local/lib/python3.5/dist-packages/discord/client.py", line 448, in connect
yield from self.ws.poll_event()
File "/usr/local/lib/python3.5/dist-packages/discord/gateway.py", line 431, in poll_event
yield from self.received_message(msg)
File "/usr/local/lib/python3.5/dist-packages/discord/gateway.py", line 390, in received_message
func(data)
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 248, in parse_message_update
message = self._get_message(data.get('id'))
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in _get_message
return utils.find(lambda m: m.id == msg_id, self.messages)
File "/usr/local/lib/python3.5/dist-packages/discord/utils.py", line 167, in find
if predicate(element):
File "/usr/local/lib/python3.5/dist-packages/discord/state.py", line 153, in <lambda>
return utils.find(lambda m: m.id == msg_id, self.messages)
AttributeError: 'generator' object has no attribute 'id'

#

@slender thistle here, sorry for late response

slender thistle
#

What are message_1 and message_2 Thonkeng

compact mauve
#

oh well message_2 is the discord.message object that I use the id function of to get the actual message's channel and the actual message itself

#

and message_1 is the actual message that I want to append to client.messages

indigo geyser
#
@client.command()
async def join(ctx):
  channel = ctx.author.voice.channel
  await channel.connect() 
``` `OpusNotLoaded` what's Opus?
nova heath
#

I can't npm install canvas

topaz fjord
#

what the error

#

And are you on windows

winged thorn
#

libopus

nova heath
#

yes

indigo geyser
#

no

winged thorn
indigo geyser
#

ok, thanks

winged thorn
#

when you installed it did you do
pip install discord.py

topaz fjord
#

If it doesn't work use option 2

#

you need node-gyp for canvas

indigo geyser
#

@winged thorn i did it

winged thorn
#

I see you're getting help in the discord.py discord

indigo geyser
#

yes

#

i tried everything

stone dust
#

what plat?

indigo geyser
#

macos

stone dust
#

ok uh

#

might have this wrong but

#

try typing this into terminal

indigo geyser
#

ok

stone dust
#

ldconfig -v | grep --color opus

indigo geyser
#

command not found

stone dust
#

drat

#

ok i have no idea

indigo geyser
#

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

stone dust
#

replace ldconfig with pkgutil?

cursive dagger
#

@indigo geyser it says on the docs how to fix it

#

The warning on the voice section

indigo geyser
#

Ok

wheat jolt
#

does someone knows how to put a line break after a caracther limit is reached without breaking the words?
eg:
I have: var string = 'Bob wants to play'
and the caracther limit is 5
the text would turn to:

Bob
wants
to
play
soft cove
#

how do i set my max listeners higher?

#

i forgoteded

broken shale
#

@wheat jolt use \n

#

new line break

wheat jolt
#

Dude

#

I know you can add a line break with \n

#

read what I said

broken shale
#

process.setMaxListeners(number); @soft cove

soft cove
#

thanks

mossy vine
#

@soft cove do you have multiple message listeners?

broken shale
#

^

soft cove
#

oh and how can i see my current max listeners?

broken shale
#

mem leak btw

soft cove
#

for music bot*

#

nvm

#

i got it

cursive gale
#

hey i'm making a message counter bot with quick.db

#

the command allows admins to add messages to themselves or any member but it says .add is not a number

#

can anyone help me with this

opaque eagle
#

How have u defined db

#

Can you show that full file

cursive gale
#

sure

#
const Discord = require('discord.js')
const db = require('quick.db')
const bot = new Discord.Client()

bot.on('ready', async => {
    console.log(`I'm on somehow`)
})

bot.on('message', async message => {
  let args = message.content.slice(1).split(' ')
  const cmd = args.shift().toLowerCase()
    db.add(`messageCount_${message.author.id}`, 1);

if(message.content.startsWith(`-messages`)){

    let member = message.mentions.members.first() || message.author;

    let mdb = await db.fetch(`messageCount_${member.id}`)

    message.channel.send(`Mesages: ${mdb}`)
}
if (message.content === `-ping`) {
    message.channel.send(`Ping: ${bot.ping.toFixed(0)}`)
}
if (message.content.startsWith(`-add-message`)) {

    if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You don't have the permission to do that")
  let user = message.mentions.members.first() || message.author;
  let number = args[1];
    console.log(number)
  db.add(`messageCount_${user.id}`,number)
    message.channel.send("DOne")
}
  
  if (message.content.startsWith(`-reset`)) {
    if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("You don't have the permission to do that")
  let user = message.mentions.members.first() || message.author;
  let number = args[0];
  db.set(`messageCount_${user.id}`, 0)
    message.channel.send("DOne")
}

})```
#

@opaque eagle

#

logging number says it's unindentified

opaque eagle
#

Hmm... what does the error say exactly

cursive gale
opaque eagle
#

It should show a stack trace too...

abstract crow
#

What do you guys think so far? https://vinniehat.tk/ my first ever website published. (Not Finished at all)

cursive gale
opaque eagle
#

It looks pretty good

abstract crow
#

Thanks! Any suggestions?

cursive gale
#

when i logged the number it said unindentified

topaz fjord
#

is it me or are discord image embeds not loading

abstract crow
#

^

cursive gale
#

^

opaque eagle
#

Idk man, go ask the plexi dev server @cursive gale

cursive gale
#

what's that server

opaque eagle
#

How do u turn off dark mode in the site?

cursive gale
#

ohh no

topaz fjord
#

you cant mmlul

mossy vine
#

@abstract crow ๐Ÿ‘ for dark mode
its kinda weird that your discord username appears on the opposite end of the screen making it impossible to copy
these titles should be hyperlinks

opaque eagle
cursive gale
#

can anyone help me here?

mossy vine
#

not many people use quick.db

opaque eagle
#

Yeah the color makes people think those a hyperlinks

topaz fjord
#

because its shit mmLol

opaque eagle
#

So our innate response is to try and click on them

cursive gale
#

hmm

opaque eagle
#

Turtle is right, quick.db is bad and shouldn't be used for any production-ready app

topaz fjord
#

I mean

#

the thing is

#

quick.db is a wrapper around sqlite

cursive gale
#

what db is easy to use and i can use?

topaz fjord
#

just use sqlite

#

sqlite is better than quick.db by far

opaque eagle
#

If you want a similar alternative, I'd suggest keyv... The Discord.js community made a tutorial on using keyv in a discord bot. https://discordjs.guide/keyv/

mossy vine
#

sql requires you to use a whole other language in your project. if you dont wanna deal with that, theres the well supported and highly praised mongodb

topaz fjord
#

keyv looks interesting actually

earnest phoenix
#

I keep getting this error from the dbl api

Error: Server responded with 504
    at get.concat (/app/node_modules/canvas/lib/image.js:56:28)
    at concat (/app/node_modules/simple-get/index.js:89:7)
    at IncomingMessage.<anonymous> (/app/node_modules/simple-concat/index.js:7:13)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at IncomingMessage.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
``` I know it's not my fault as 5xx but how can I filter it out
opaque eagle
#

That looks more like it's from the canvas module, not DBL's API

cursive gale
#

hmm as far as i know

#

it's not registering the number

#

and idk how to fix it

broken shale
#
const dblapi = require('dblapi.js');
const dbl = new dblapi('token')```
right?
peak quail
#

how can i print a hole error ?

opaque eagle
#

hole error?

peak quail
#

like this

#

in a embed

#

oof wrong picture

#

like this ^

broken shale
#

you meant whole error

slender thistle
#

Library

sonic peak
#

you need to write a function for it, but yes, whole error

slender thistle
sonic peak
broken shale
#

d.js you'll need to

sonic peak
#

yep thats what mine is in lmao

broken shale
#

same GWoicKirbLmao

broken shale
#
const dblapi = require('dblapi.js');
const dbl = new dblapi('token')```
Can someone tell me if this is correct?
grave pecan
#

should be

slim heart
#

try it

#

dont ask if its correct, try it first

broken shale
grave pecan
#

lmao. Lemme check smth for you

broken shale
#

okay

#

Im getting unauthorized now

ruby talon
#

@peak quail Just create a variable when your exeption occurs.
Then paste the variable to your message or embed.

try:
    #your code
except Exception as e:
    await ctx.send(f'Error Message:\n`{e}`')
#

Something like that.
But watch out, that uses Exeption, it catches all errors so put your other error catchers before it.

opaque eagle
#

How do I fix an error with Access-Control-Allow-Origin

[Error] Failed to load resource: Origin https://fiddle.jshell.net is not allowed by Access-Control-Allow-Origin. (glen-dragon.glitch.me, line 0)```
tardy notch
#

Am i missing something on updating the server count in the DBL api? i'm sending update requests every 30s but it's still on N/A

opaque eagle
#

Server count should be updated every 30 minutes

tardy notch
#

ah alright

#

and the count on the website updates every 30mins then as well?

opaque eagle
#

The ratelimit for DBL's API generally is 60/min

#

The count on the websites updates every time you update it, and you must update it every 30 mins.

tardy notch
#

well i'm updating every 30s so i'm not hitting the rate limit

#

and it's not updating

#

oh hey you know what

#

nevermind i'm fucking stupid

opaque eagle
#

That line of code shows 1800000 which is 30 minutes in milliseconds ( 1800000 / 1000ms in a sec / 60sec in a min = 30 min)

tardy notch
#

i'm using the java library though and i already have a loop running every 30s anyways so it's easier to add it in there

opaque eagle
#

alright

tardy notch
#

Server count should update instantly you said right?

lost bramble
#

can somebody help me with an issue I'm having

opaque eagle
#

All the y-values seem to be at 0 (the line is right on top of the x-axis)... even though they're not

coral trellis
#

@lost bramble List your issue

lost bramble
#

Essentially, I'm trying to learn bot development

#

I am setting up my tsconfig.json and when I go to my index.ts to try and build it so that it converts to index.js I get an error that says tsc is an unknown command

mossy vine
#

did you install typescript properly?

#

npm i typescript -g iirc

opaque eagle
#

Yeah, you have to install typescript. Any one of the three works tbh: brew install typescript npm i -g typescript yarn global add typescript

lost bramble
#

I've installed typescript numerous times

#

at least I think so

opaque eagle
#

Was it one of those three commands?

#

If not, then no, typescript wasn't installed

lost bramble
#

let me try the middle one

#

I got notice that I update it when I try the method done in the video

#

I tried the middle and I got an error message

amber fractal
#

ok

#

and the error?

lost bramble
#

multiple

amber fractal
#

send a picture?

#

or copy paste the console

lost bramble
#

npm WARN checkPermissions Missing write access to /Users/cnazarko/.npm-packages/lib/node_modules/typescript
npm ERR! path /Users/cnazarko/.npm-packages/lib/node_modules/typescript
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/cnazarko/.npm-packages/lib/node_modules/typescript'
Camerons-MBP:typescriptBot cnazarko$ npm i -g typescript
npm WARN checkPermissions Missing write access to /Users/cnazarko/.npm-packages/lib/node_modules/typescript
npm ERR! path /Users/cnazarko/.npm-packages/lib/node_modules/typescript
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/cnazarko/.npm-packages/lib/node_modules/typescript'
npm ERR! [Error: EACCES: permission denied, access '/Users/cnazarko/.npm-packages/lib/node_modules/typescript'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/Users/cnazarko/.npm-packages/lib/node_modules/typescript'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/cnazarko/.npm-packages/lib/node_modules/typescript'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cnazarko/.npm/_logs/2019-08-04T19_46_13_739Z-debug.log
Camerons-MBP:typescriptBot cnazarko$

copper cradle
#

alright how can I use a json file with python?

#

@lost bramble run it as admin

opaque eagle
#

Try doing sudo npm i -g typescript (you'll have to enter your password)

mossy vine
#

run it as admin

opaque eagle
#

On a side-note, how did you install node.js/npm first?

mossy vine
#

that doesnt look like unix AaAAAAAAAAAAAAaAAAAAAAAAAAaAAAAa

copper cradle
#

ik

lost bramble
#

it's in the console on visual studio

opaque eagle
#

Did you try running it with sudo?

lost bramble
#

one sec

copper cradle
#

@mossy vine I was making what we call a joke

lost bramble
#

oh

#

r/woosh

ruby talon
#

As the error and Cyber say.
Rerun it as Administrator.

opaque eagle
mossy vine
#

@copper cradle WaitWhat

#

i wasnt talking to you at all tho

copper cradle
#

ik

#

I better get out of here

lost bramble
#

This is the result of running as admin

copper cradle
#

hmm

opaque eagle
#

Now try running tsc ... that you initially ran

lost bramble
copper cradle
#

you're not actually installing it

lost bramble
#

what am I doing

copper cradle
#

npm has no write access to /Users/cnazarko/.npm-packages/lib/node_modules/

lost bramble
#

yah, that's what I saw as a solution

copper cradle
#

change the owner of those folders

lost bramble
#

I made a .npm-packages folder earlier for g installations