#discord-bots

1 messages ยท Page 580 of 1

boreal ravine
#

replit is slow

loud junco
#

why is the : an error

boreal yarrow
#

what is the extra ( doing

boreal ravine
#

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

loud junco
#

oo

#

sry

#

here we go again

boreal yarrow
slate swan
#

It is only defined in another loop

#

The loop of the @client.event

loud junco
#

do it like this?

slate swan
#

WAIT

loud junco
#

ok

slate swan
#

let me send another example

loud junco
#

imma just copy my whole code to here but its too long

boreal yarrow
#

oh btw this is wrong because discord.Client doesn't have commands

slate swan
#
bot = discord.Client(#all your info)
@bot.event
async def on_message(message) # define this here
boreal yarrow
#

only events

slate swan
#

I mean the settings for the bot like command prefix

boreal yarrow
#

no

loud junco
#

=.=

boreal yarrow
#

discord.Client doesn't support prefix

#

discord.ext.commands.Bot does

loud junco
#

what is happening

slate swan
#

Yeah, I just realized. The convo is getting a bit confusing..

loud junco
#

so what should i do

slate swan
#

Uh, let me post another code.

boreal yarrow
#

just discord.Client() with empty brackets

loud junco
#
async def show_help():
  await message.channel.send('-rpm hunt/mine\n-rpm craft\n-rpm boss/defraid\n-rpm cd\n-rpm p\n-rpm inv')
#

just help me do it im very confused right now

slate swan
#

ctx.send()

#

change message.channel.send() to ctx.send(message)

loud junco
slate swan
#

import discord
import discord.ext.commands

#

Whew! The convo is getting even more confusing!!

loud junco
#

still error btw

#

is this what am i supposed to do

slate swan
#

Sometimes even there is no error, it marks. That is what happens on my side.

#

But it still runs

boreal yarrow
#

no you need to put it inside a command

#

ctx is still not defined....

slate swan
#

@bot.command

loud junco
slate swan
#

@bot.command()
async def do(ctx): #defined here

loud junco
nimble thorn
#

put ctx in the parenthesis, show_help(ctx)

loud junco
#

ok

nimble thorn
#

in the function definition

boreal yarrow
# loud junco

ah, you can pass message into show_help and use message.channel.send

slate swan
#
@bot.command()
async def hei(ctx):
  ctx.send("HE")
loud junco
#

like this?

nimble thorn
#

yes

slate swan
#

Yeah

loud junco
#

ok

#

no more error

boreal yarrow
#

that wont work-

loud junco
#

what have i added actually

boreal yarrow
#
async def show_help(message):
  await message.channel.send(...)

...
  if message.content.startswith("rpm help"):
    await show_help(message)
loud junco
#

still not showing btw

boreal yarrow
nimble thorn
#

oh true...

loud junco
#

what is ctx

boreal yarrow
#

context

loud junco
#

still not working bruhhh

boreal yarrow
loud junco
boreal yarrow
loud junco
#

ok

slate swan
#

no

#

the message is only defined in @client.event

#

not @bot.command()

boreal yarrow
#

he does have a client.event

#

he does not have a bot.command

loud junco
#

alright

#

lemme try

#

its working

#

but idk how someone explain?

slate swan
#

so await show_help(message.content)

boreal yarrow
#

no

slate swan
#

Yes!!!

boreal yarrow
#

dont-

#

it's working rn

slate swan
#

Victory. ๐Ÿฅณ

boreal yarrow
#

@slate swan you don't seem to know his code

slate swan
#

I saw the code image posted on Discord

loud junco
#
async def show_help(message):
  await message.channel.send('-rpm hunt/mine\n-rpm craft\n-rpm boss/defraid\n-rpm cd\n-rpm p\n-rpm inv')

if message.content.startswith('rpm help'):
    await show_help(message)
#

this is working but idk how

#

why (message)

slate swan
#

message = message

loud junco
#

=.=

#

tf

slate swan
#

async def show_help's message is imported from the @quaint axle.event message

slate swan
#

ooff

#

i mentioned a user

boreal yarrow
#

@loud junco in your on_message event you are checking the content of the message. If it starts with rpm help, invokes show_help and puts the message object into the show help function.

show_help then takes the message object, uses the channel.send method and sends the message

slate swan
#

@quaint axle So sorry for mentioning

loud junco
slate swan
#

oh no

dense swallow
#

lol

boreal yarrow
#

-.-

slate swan
#

-.-

loud junco
boreal ravine
#

Pain.

slate swan
#

I understand...

loud junco
#

should i write class below func or func below class

#

how do u guys write it

boreal ravine
#

its all on you

boreal yarrow
#

what class?

dense swallow
#

i guess cog class

loud junco
#

func sure on top of codes

slate swan
boreal ravine
#

a cog isnt a class its a subclassed class

boreal yarrow
#

and a subclassed class is a class

loud junco
slate swan
#

Yes.

slate swan
#

o_o

nimble thorn
#

I am having trouble reverencing the client within a cog

#

how do I send in the fancy boxes?

boreal yarrow
#

lol

dense swallow
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

boreal yarrow
#

there

#

no

nimble thorn
#

ill get there lol

dense swallow
#

lol not apostrophes

boreal yarrow
#

backticks, not quotes

boreal yarrow
boreal ravine
boreal yarrow
#

what

nimble thorn
#

ok

boreal yarrow
#

why is it inside a print

boreal ravine
#

Well I didnt see anything wrong there

nimble thorn
#
class local(commands.Cog):
  def _init_(self,client):
      self.client = client

loud junco
#

its at the left of 1

nimble thorn
#

ok sorry

loud junco
#

`

nimble thorn
#

pretend that didnt happen

boreal ravine
dense swallow
#

seems fine to me

boreal yarrow
dense swallow
#

oh wait yeah

nimble thorn
#

anyways, I have a cog called local, this works fine

boreal ravine
#

what open said

nimble thorn
#

but I am trying to call the client command later within the cog to get user input, for example

nimble thorn
#
 msg = await self.client.wait_for("message", check= ctx.author, timeout = 30)
boreal ravine
#

ah, you have to use commands.command() in classes

boreal yarrow
#

that too

nimble thorn
#

but I am curious how this doesnt work

boreal ravine
boreal yarrow
dense swallow
#

it should be a def function

nimble thorn
#

ok

maiden fable
unkempt canyonBOT
#

class asyncio.Event```
An event object. Not thread-safe.

An asyncio event can be used to notify multiple asyncio tasks that some event has happened.

An Event object manages an internal flag that can be set to *true* with the [`set()`](https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event.set "asyncio.Event.set") method and reset to *false* with the [`clear()`](https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event.clear "asyncio.Event.clear") method. The [`wait()`](https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event.wait "asyncio.Event.wait") method blocks until the flag is set to *true*. The flag is set to *false* initially.

Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This class has been implicitly getting the current running loop since 3.7. See [Whatโ€™s New in 3.10โ€™s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.

Example:
maiden fable
#

This is what it uses...

#

Wait, u wanted to know about wait_for, no?

boreal yarrow
#

That's not the thing

#

wait

nimble thorn
#

yeah

boreal ravine
#

the check isnt like that I said

maiden fable
#

Yea, it uses asyncio.Event

boreal yarrow
#

use

check=lambda m: m.author == ctx.author
maiden fable
#

Yes

boreal yarrow
nimble thorn
#

The bot calls a trivia api, and then prints a question and 4 possible reponses, I want to wait for a reponse from the user and then use that tell them if they are right or not

boreal yarrow
dense swallow
#

!d discord.Client.wait_for

unkempt canyonBOT
#

wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
dense swallow
#

this?

maiden fable
boreal yarrow
boreal ravine
#

what i said

loud junco
#

what happened

dense swallow
loud junco
#

im using replit

boreal yarrow
boreal ravine
dense swallow
slate swan
#

replit should automatically do that tho

boreal yarrow
#

only if there is a requirements.txt right?

loud junco
#

its ok rn

loud junco
dense swallow
slate swan
boreal ravine
#

wtf

white trail
#

xd

boreal yarrow
#

...

#

not funny

loud junco
#

how do i do this to class

 for digit in number:
     print(digit)
boreal ravine
#

make a function and put that in there

loud junco
#

a class?

boreal ravine
#

wait do what to class?

dense swallow
#

in the cmd itself

#

or where u want to put it

loud junco
#

print all of this

nimble thorn
#
msg = await self.client.wait_for("message", check=lambda m: m.author == ctx.author, timeout = 30)
#

so then this should work?

loud junco
#

isit even legal to put class in class ๐Ÿคฃ

boreal ravine
#

yes

loud junco
#

ok then its fine

boreal yarrow
#

yeah although you should be using a dict instead

slate swan
loud junco
boreal ravine
#

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

white trail
#

can some one help me how to create a bot

boreal ravine
boreal yarrow
loud junco
#

it will show the __dict__ thing

boreal yarrow
#

no

boreal ravine
#

Huh

boreal yarrow
#

wtf

loud junco
#

i saw pepo using the dir()

#

so there is another way?

boreal ravine
#

wtf you dont need that to print a dict??

slate swan
boreal yarrow
white trail
#

ok ty

boreal ravine
loud junco
loud junco
nimble thorn
#

Awesome it does now, thanks gamers

boreal ravine
#

when did people do that

loud junco
#

i googled

boreal ravine
#

thats for something else

boreal yarrow
#

dir()??

loud junco
#

with the vars()

boreal yarrow
#

what is all that

#

no

loud junco
#

dir(dict)

#

how do i print then

boreal yarrow
#

thats completely irrelevant-

loud junco
#

hmmm

#

so i change the whole class to a dict?

boreal ravine
#

!e

a = {"a": "b"}
print(dir(a))
unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
loud junco
#

ya

boreal ravine
#

not related at all

loud junco
#

it will show tons of these

boreal ravine
#

why though

loud junco
#

idk

boreal yarrow
#

why do you want to use dir

boreal ravine
#

how dont you know

loud junco
boreal yarrow
#

yeah no please learn basic python

loud junco
#

and it shows me that

boreal yarrow
loud junco
#

but i wanna make it something like for loop

#

auto print

boreal ravine
#

iterate through the dictionary

boreal yarrow
#
for item in my_dict.values():
  print(item)
#

iirc

loud junco
#

oo

#

lemme try

#

opensourze is pro python

nimble thorn
#

There is not a definitive way to embed two full sized images into an embed right, its one image, one thumbail and a footer right?

loud junco
#

so person.age is for class and person['age'] is for dict?

boreal yarrow
#

yes

loud junco
#

alright

#

but i like person.age more ;-; lemme try person['age']

nimble thorn
#

ok thats what I thought I just wanted to make sure, thank you!

undone wyvern
loud junco
#

;-;

#

everything is getting weirder and weirder

boreal yarrow
boreal ravine
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

loud junco
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

loud junco
#

what is this

undone wyvern
loud junco
#

but its weird

boreal ravine
loud junco
#

can i make dict in a dict?

#

ik its weird

boreal yarrow
undone wyvern
# loud junco what is this

It's a link to resources that should help you understand what this code is doing a little better. It might be helpful for you to learn a few things like introductory OOP, data types, etc before jumping into discord.py

boreal yarrow
#

yes please learn the basics

undone wyvern
#

At the end of the day it's up to you, but I would recommend learning a bit more as you will understand your code and your help a little better

loud junco
#
Inv_total = {
  mobdrop = {
    cooked_pogchop = 0
  }

  misc = {
    cobble = 0
  }
  
  illegal = {
    bedrock = 0
  }
}
#

do i did something wrong?

undone wyvern
# boreal yarrow wtf no why

!e sorry I forgot to show you this example. ```py
data = {"key 1":"value 1", "key 2": "value 2"}

print(data.get("key 1"))

unkempt canyonBOT
#

@undone wyvern :white_check_mark: Your eval job has completed with return code 0.

value 1
loud junco
#

oo

#

its :

#

i forgot bruhhh

undone wyvern
#

!e ```py
data = {"key 1":"value 1", "key 2": "value 2"}

print(data.get("key 1") == data["key 1"])

unkempt canyonBOT
#

@undone wyvern :white_check_mark: Your eval job has completed with return code 0.

True
undone wyvern
#

@boreal yarrow ^

loud junco
#

but its weird

#

why dun u type less word

#

what about a dict in a dict

#

can u make an example?

undone wyvern
high pollen
#

how to make a bot dm me when ever it come online??

#

like what to add in the on_ready event? using discord.py

boreal yarrow
undone wyvern
#

Some people prefer one way over the other

#

I know discord.py does, or at least used to use get.

loud junco
#

why dun u just make it show on console

#

its pretty obvious also

high pollen
#

i am using console right now

loud junco
#

my console is rigged just now

high pollen
#

but when i am hosting it, i use replit so i dont check console

loud junco
#

im using incognito's replit

loud junco
#

its just at the right of ur code?

high pollen
#

ye thats y dm

high pollen
loud junco
#

lol

high pollen
#

but would prefer it to dm me

loud junco
#

alright

#

but how do u write a dict in a dict

undone wyvern
#

You should use a task, not on_ready because on ready doesn't always get called.

loud junco
#

someone show me a syntax example?

high pollen
undone wyvern
#

Let me try and find an example of a task for you.

high pollen
#

ok

boreal ravine
unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

{'b': 'c', 'd': {'e': 'f'}}
loud junco
#

its not something like this?

high pollen
boreal ravine
loud junco
#

oof

#

so i cant have more than one name for the dict?

high pollen
boreal ravine
boreal ravine
undone wyvern
high pollen
# boreal ravine meaning?

when i use ^dm @09๐”ค๐”ฅ๐”ฌ๐”ฐ๐”ฑ๐”ฏ๐”ฆ๐”ก๐”ข๐”ฏ#9678 it works. but ^dm 680014609226399878 does not

#

also i dont want the mention part

#

just using ^dm should dm

loud junco
#

u cant have a dict in a dict in a dict?

boreal ravine
loud junco
#

what if i want 2 dict in a dict

high pollen
boreal ravine
undone wyvern
loud junco
#

how

thick sigil
#

it wont works if the user has its dms closed

undone wyvern
#

If that's even a thing anymore

boreal ravine
#

it is

#

!d discord.Object

unkempt canyonBOT
#

class discord.Object(id)```
Represents a generic Discord object.

The purpose of this class is to allow you to create โ€˜miniatureโ€™ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.

There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.

x == y Checks if two objects are equal.

x != y Checks if two objects are not equal.

hash(x) Returns the objectโ€™s hash.
high pollen
loud junco
#
Inv_total = {
  {
    'pogchop' : 0,
    'cooked_pogchop' : 0,
  }
  
  {
    'cobble' : 0,
  }
  
  {
    'bedrock' : 0,
  }
}
high pollen
#

but can u make it without id or mention just ^dm

boreal ravine
undone wyvern
loud junco
thick sigil
#

Why not just using discord.User

#

the lib will fetch the discord user if it doesnt find him in the cache

undone wyvern
high pollen
thick sigil
#

Also as I said it wont work if the dms are closed. Did he mention the error?

boreal ravine
#

nope

undone wyvern
#

Nope

thick sigil
#

Dm yourself?

loud junco
#

;-;

#

looks like python hate json

thick sigil
#

Then make sure ur dms are open and do ctx.author.send()

#

and await it

high pollen
#

ok

#

trying

#

also DMs open

undone wyvern
loud junco
#

oo ok

#

sry

undone wyvern
#

It's fine

#

If you would like, you can ping me in your help channel and I'll come over to help.

boreal ravine
high pollen
#

now when i print ctx.author it shows 09๐”ค๐”ฅ๐”ฌ๐”ฐ๐”ฑ๐”ฏ๐”ฆ๐”ก๐”ข๐”ฏ#9678
and when i try

await user.send("Test")```
It returns a error
#

@thick sigil

boreal ravine
#

u cant send something to a string

#

your supposed to get that user/member object first then use .send()

high pollen
#

.get_user()??

boreal ravine
#

yes

#

!d discord.ext.commands.Bot.get_user

unkempt canyonBOT
high pollen
#

ok

thick sigil
#

i dont get what u are trying to do, why just not using dm command with the user

slate swan
#

Considering you previously got the author, you can simply use ctx.author.send

thick sigil
#

it has already been told

slate swan
#

No it hasn't

slate swan
#

Kayle talked about using get_user, which is not needed

high pollen
thick sigil
#

then use member parameter from the event

high pollen
#

for on ready?

#

that is for on member join

thick sigil
#

on ready u can get user which is you

#

and make it send the message

high pollen
#

how?

slate swan
#

get_user/fetch_user with the id

high pollen
#

ok

high pollen
maiden fable
high pollen
#

Code:-

    async def on_ready(self):
        await self.bot.change_presence(status=discord.Status.idle, activity=discord.Game(f"{prefix}help"))
        print(f"Logged in as {self.bot.user} ({self.bot.user.id})")
        user = discord.ext.commands.Bot.get_user(680014609226399878)
        await user.send("I am online")```
high pollen
maiden fable
#

Oh well

#

U don't know about OOP, I assume?

high pollen
#

nope

boreal ravine
maiden fable
#

!resources please learn more about classes and objects before starting with dpy to get a proper understanding of how the library works then

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

maiden fable
#

Sure

#

!pypi asqlite3

unkempt canyonBOT
maiden fable
#

Use this

tawdry perch
maiden fable
#

!pypi aiosqlite I think it ain't on pypi

unkempt canyonBOT
maiden fable
#

Oh nvm there is

maiden fable
#

Weird... Use aiosqlite then

#

Postgres

slate swan
#

!PyPi psycopg2

unkempt canyonBOT
maiden fable
#

Ah yea that

slate swan
#

Or mongo db , motor module in asynchronous code

urban shell
#

hey guys, can someone help me out, wtv method I try to get the member's info, it always returns None, I've tried guild.get_member(id) as well

   if ">vcpermit" in message.content and message.author.id in self.mv:
            guild = message.guild
            c = str(message.content)
            d = c.replace(">vcpermit <@!", "")
            g = d.replace(">", "")
            h = int(g)
            m = discord.utils.get(guild.members, id=h)
            e = self.mv.index(message.author.id)
            f = self.vi[e]
            vn = discord.utils.get(guild.channels, id=f)
            print(m)
            await vn.set_permissions(m, connect=True)
            s = "<@" + g + "> has been permitted to your VC!"
            await message.channel.send(s)
slate swan
#

do you have member intents on?

#

also , dont use on_message events for commands ,
use discord.ext.commands.Bot

#

god so many variables

boreal ravine
#

learn it first

#

ofc its trash if you dont understand it?

slate swan
#

ye it may be blocking

boreal ravine
slate swan
#

how is that library and this error related?

lament mesa
#

the error is coming from the library

#

And the lib seems pretty dead

#

no commits for the last 15 months

slate swan
#

mhm

lament mesa
#

Maybe use aiosqlite instead

slate swan
#

did you use the exact same code

maiden fable
#

What's :memory: tho

#

Heh

slate swan
maiden fable
#

Ah

#

So u mean cache?

slate swan
#

yea

maiden fable
#

Ah okay

slate swan
#

its suggested to use the aiosqlite wrapper

#

its much easier to use , and maintained

#

you cant , since its meant to use with asyncio

#

if you want to test your sql queries

#

just use sqlite3 ( its inbuilt in python)

boreal ravine
#

hm

urban shell
#

I tried various other methods as well

#

like -
m = bot.get_user(id=h)
m = message.guild.get_member(id)

boreal ravine
#

await it

maiden fable
#

!d object.await

unkempt canyonBOT
#

object.__await__(self)```
Must return an [iterator](https://docs.python.org/3/glossary.html#term-iterator). Should be used to implement [awaitable](https://docs.python.org/3/glossary.html#term-awaitable) objects. For instance, [`asyncio.Future`](https://docs.python.org/3/library/asyncio-future.html#asyncio.Future "asyncio.Future") implements this method to be compatible with the [`await`](https://docs.python.org/3/reference/expressions.html#await) expression.
maiden fable
#

Okay

boreal ravine
#

hm

urban shell
#

nvm, this worked for me-
m = await message.guild.query_members(user_ids=[h]) m = m[0]

#

tysm for your time @slate swan

slate swan
#

just await it

keen talon
#

!src

unkempt canyonBOT
visual island
keen talon
#

there is a lib

#

I forgot the name tho

slate swan
#

aiosqlite

boreal ravine
#

which part

loud junco
#

the second part is an error

#

lemme google for nested dict

#

oo

slate swan
#

You're missing a ,

loud junco
#

need comma after

#

i also saw that

#

thanks for telling

jade tartan
#
async def apply(ctx):
    a_list = []
    submit_channel = client.get_channel(906141169271062578)
    channel = await ctx.author.create_dm()

    def check(m):
        return m.content is not None and m.channel == channel

    for question in q_list:
        sleep(.5)
        await channel.send(question)
        msg = await client.wait_for('message', check=check)
        a_list.append(msg.content)

    submit_wait = True
    while submit_wait:
        await channel.send('End of questions - "submit" to finish')
        msg = await client.wait_for('message', check=check)
        if "submit" in msg.content.lower():
            submit_wait = False
            answers = "\n".join(f'{a}. {b}' for a, b in enumerate(a_list, 1))
            submit_msg = f'Application from {msg.author} \nThe answers are:\n{answers}'
            await submit_channel.send(submit_msg)

am not getting any error but when i do the command its sending me all 3 questions that i have all at once

#

How do i make it send one question at a time

#

?

#

nvm forget it i made it work

#

Hi anyone know how to make a submit button to make it submit an staff application for then review in a particular channel?

#

u can only close an occupied channel @slate swan

slate swan
#

So it prints like this? :

loud junco
#
item = {
  'mobdrop': {
    'pogchop' : 0,
    'eye_of_ender' : 0
  },
  
  'misc':{
    'cobble' : 0,
    'bed' : 0
  },
  
  'illegal': {
    'bedrock' : 0,
    'bedrock_trophy' : 0
  }
}
########################################3
async def show_inv(message):
  await message.channel.send('items')
  for items in item['mobdrop'].values():
    await message.channel.send(items)

  await message.channel.send('misc')
  for items in item['misc'].values():
    await message.channel.send(items)

  await message.channel.send('illegal')
  for items in item['illegal'].values():
    await message.channel.send(items)

##################################################
if message.content.startswith('rpm i'):
        await show_inv(message)
slate swan
#

The answers are:
["Soemth", "D"]

loud junco
#

help

#

its showing tons of 0

#

instead of cobble: 0

slate swan
loud junco
#

rpg

slate swan
#

Ok

loud junco
#

RPMinecraft

#

u wanna try?

jade tartan
#

Hi anyone know how to make a submit button to make it submit an staff application for then review in a particular channel?

loud junco
#

i plan to release 1.0 december 9th

#

now its beta

slate swan
jade tartan
#

I said a button

#

not a command

jade tartan
paper scroll
#

TypeError: 'NoneType' object is not iterable
My Code Goes Like This

@bot.event
async def on_raw_reaction_add(payload):
  guild = discord.utils.find(lambda g: g.id == payload.guild_id, bot.get_guild("829221271568908319"))

  if payload.emoji.name == emoji_thing:
    role = discord.utils.get(guild.roles, name="Communist")

    if role is not None:
      member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
      if member is not None:
          await member.add_roles(role)

(Idk python or discord.py much, just learning)

boreal ravine
#

guild IDs are supposed to be integers not strings

paper scroll
#

oh
my bad

#

still same error

maiden fable
#

@paper scroll code

paper scroll
#
@bot.event
async def on_raw_reaction_add(payload):
  guild = discord.utils.find(lambda g: g.id == payload.guild_id, bot.get_guild(int(829221271568908319)))

  if payload.emoji.name == emoji_thing:
    role = discord.utils.get(guild.roles, name="Communist")

    if role is not None:
      member = discord.utils.find(lambda m: m.id == payload.user_id, guild.members)
      if member is not None:
          await member.add_roles(role)

#

error at 3rd line

maiden fable
#

Ah

#

Why r u using that?

#

Just do guild = bot.get_guild(...)

slate swan
#

Hi evereone how learn make a discord bot with python ???

maiden fable
unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

slate swan
harsh cradle
#

i have a leveling system with Mongo Db and when iam running the project i got error:
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed, Timeout: 30s, Topology Description: <TopologyDescription id: 618523a20690f738c0ef2286, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('DATA BASE LINK,) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>, <ServerDescription ('mydiscorddb-shard-00-01.0ic0k.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>, <ServerDescription ('mydiscorddb-shard-00-02.0ic0k.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>]>

maiden fable
#

?

harsh cradle
#

its fine

boreal ravine
harsh cradle
#

so i dont know how is this work

boreal ravine
#

theres a button

harsh cradle
#

i didnt add any ip i select

#

allow anyone join

rotund nova
#

why error?

slate swan
#

There is no error, your code got executed perfectly fine

#

It did exactly what you wrote

#
  1. Send the avatar url
  2. Send that weird message
boreal ravine
#

he sent the class

rotund nova
slate swan
#

avamember.mention

rotund nova
#

ok thx so much

slate swan
#

!d discord.Member.mention

unkempt canyonBOT
velvet tinsel
#

how do you have a command cooldown for a user (for example, they use ping, and they have to wait, say, 30 seconds to use it again?)

#

ty

loud junco
#
moblist = {
  'mainmob' : {
    'pig' : False,
    'cow' : False,
    'sheep' : False,
    'villager' : False,
    'witherskeleton' : False,
    'blaze' : False,
    'enderman' : False
  },

  'notmainmob' : {
    'angrypig' : False,
    'zombie' : False,
    'angrycow' : False,
    'spider' : False,
    'angrysheep' : False,
    'skeleton' : False,
    'nitwit' : False,
    'pillager' : False,
    'magmacube' : False,
    'zombiepiglin' : False,
    'silverfish' : False
  }
}
############################################################
async def area(message):
  if area == 1:
    moblist['mainmob'] = False
    moblist['notmainmob'] = False
#

will all of them become False again?
if some of them is True

quaint oak
#

is there any good recommendation for a image processing library thats not PIL? I need something that can do text rendering reliably and PIL is just too clunky for that

quaint oak
#

so in that case

loud junco
#

oof

quaint oak
#
moblist = {
  'mainmob' : False,
  'notmainmob' : False,
}
loud junco
#

then how do i make them all to false

slate swan
#

Loop

#

For every key (x) in mainmob loop and change it's value

loud junco
#
for item in moblist['mainmob'].values():
  item = False
for item in moblist['nomainmob'].values():
  item = False
velvet tinsel
#

For the @commands.cooldown(1, 30, commands.BucketType.user), how would I access the retry_after argument in the raise CommandOnCooldown?

slate swan
loud junco
slate swan
loud junco
#

oo

#

alright

slate swan
#

Use an error handler

velvet tinsel
#

yes, but I want to access the retry_after

loud junco
slate swan
velvet tinsel
#

raise CommandOnCooldown(bucket, retry_after)
discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 27.62s

velvet tinsel
loud junco
slate swan
slate swan
loud junco
#

i also need that btw

#

alright

spiral frigate
#

who knows how to set up my welcome message

slate swan
#

Nobody, since you did it

spiral frigate
#

how to make greeting messages.
which can be customized

#

Sorry for English I'm Russian

slate swan
#

Use a database to store the message per guild, then use the on_member_join even to know when a member joins the server

slate swan
spiral frigate
#

and can you recommend some free database

loud junco
#

anyone have tutorial for replit database?

slate swan
#

!pypi asqlite3

unkempt canyonBOT
spiral frigate
loud junco
#

!pypi replit database

unkempt canyonBOT
boreal ravine
#

#bot-commands and replit has a section for it's DB

reef shell
harsh cradle
#

i have a level system made with Mango db and i getting this error when i try it :
raise WriteError(error.get("errmsg"), error.get("code"), error)
pymongo.errors.WriteError: db already exists with different case already have: [Discord] trying to create [discord], full error: {'index': 0, 'code': 13297, 'errmsg': 'db already exists with different case already have: [Discord] trying to create [discord]'}

slate swan
#

Everything is in the error

#

You're trying to create a database that already exists

harsh cradle
#

and add the name of my database

#

what you mean create

slate swan
#

"db already exists with different case already have: [Discord] trying to create [discord]'}

harsh cradle
#

so i have to remove discord

boreal ravine
#

no

gleaming torrent
#

Will it work if I do
random_channel = ["channel1", "channel2"]
await random.choice(random_channel).send?

#

will that send to different channels?

visual island
#

you should have abc.Messageable objects in the list

#

then it will

gleaming torrent
#

ok

spiral frigate
slate swan
lament mesa
#

Use a dictionary

#

Store each prefix by guild id

boreal ravine
cloud dawn
boreal ravine
#

the prefixes are gonna reset everytime the bot restarts

lament mesa
boreal ravine
#

hm

cloud dawn
#

If you want to build a nice cache it's more than just a dict.

spiral frigate
#

what is the difference between sqlite3 and asqlite3

cloud dawn
#

!async

unkempt canyonBOT
#

Concurrency in Python

Python provides the ability to run multiple tasks and coroutines simultaneously with the use of the asyncio library, which is included in the Python standard library.

This works by running these coroutines in an event loop, where the context of the running coroutine switches periodically to allow all other coroutines to run, thus giving the appearance of running at the same time. This is different to using threads or processes in that all code runs in the main process and thread, although it is possible to run coroutines in other threads.

To call an async function we can either await it, or run it in an event loop which we get from asyncio.

To create a coroutine that can be used with asyncio we need to define a function using the async keyword:

async def main():
    await something_awaitable()

Which means we can call await something_awaitable() directly from within the function. If this were a non-async function, it would raise the exception SyntaxError: 'await' outside async function

To run the top level async function from outside the event loop we need to use asyncio.run(), like this:

import asyncio

async def main():
    await something_awaitable()

asyncio.run(main())

Note that in the asyncio.run(), where we appear to be calling main(), this does not execute the code in main. Rather, it creates and returns a new coroutine object (i.e main() is not main()) which is then handled and run by the event loop via asyncio.run().

To learn more about asyncio and its use, see the asyncio documentation.

spiral frigate
#

like it's synchronous, but in fact it's the same in terms of code

cloud dawn
#

Well it is not made by the same person so some things are different.

spiral frigate
#

I just can't find anything on it and the code in the documentation is not robitb

#

writes this

    conn = asqlite3.connect(':memory:')
AttributeError: partially initialized module 'asqlite3' has no attribute 'connect' (most likely due to a circular import)
#

code

import asyncio

import asqlite3

conn = asqlite3.connect(':memory:')

async def connection():
    async with conn:
        await conn.execute("CREATE TABLE table (plate INT)")
        await conn.execute("INSERT INTO table VALUES (5)")
    # connection is automatically closed

loop = asyncio.get_event_loop()
loop.run_until_complete(connection())
maiden fable
#

@spiral frigate asqlite3 is your file name?

spiral frigate
#

python file?

spiral frigate
maiden fable
spiral frigate
#

?

maiden fable
#

Whats your python file name

spiral frigate
#

sqlite3

spiral frigate
maiden fable
#

Idrk tbh, sorry

spiral frigate
maiden fable
#

Oh that's my bad. I meant, I don't really know then, since that error comes when the file name and module names are same...

spiral frigate
maiden fable
#

And it works?

spiral frigate
#

I 'll check it out

#

yes lol that's the problem

slate swan
#

anyone know how to capture which user reacted to my bot's reaction?

surreal sierra
#

hey, Im trying to make a command that creates channels if the channel name doesnt exist already but it doesnt work. Not really sure

this is what I got

# Bot joins server/auto msg
@bot.command()
async def setup(ctx):
    guild = ctx.guild
    for server in bot.guilds:
        if "bot-chat" not in server.channels:
            create_channel = await guild.create_text_channel('bot-chat')
            print(create_channel.id)
        else:
            await ctx.send("there is already a channel in this server with the name 'bot-chat'")
        if "quotes" not in server.channels:
            q_channel = await guild.create_text_channel('quotes')
            print(q_channel.id)
        else:
            await ctx.send("there is already a channel in this server with the name 'quotes'")

it creates the channel but if the channel names already exist and u use the command it will still create a new channel with the same name

spiral frigate
#

for discord, you need to use asqlite3

#

I just can't find any normal info about asqlite3

slate swan
#
await member.ban(delete_messages=False)```
#

is this how u ban members without deleting their messages?

#

!d discord.Member.ban

unkempt canyonBOT
#

await ban(*, delete_message_days=1, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
slate swan
#

nevermind i got it :D

maiden fable
#

Lol cool

slate swan
#

i get error with this

#

how do i capture reaction ??

#

rather with on_raw_reaction_add

#

sorry what?

#

another event

#

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
slate swan
#

This requires Intents.reactions to be enabled. so how do i enable this?

#

it's enabled by default

#

dw about it

#

what did i do wrong then?

#

you used on_reaction_add

#

not on_raw_reaction_add

#

ohhh

#

riight , sorry my bad, totally forgot about it

#

lmk if it works

slate swan
maiden fable
#

Ah

slate swan
#

it only takes payload

#

๐Ÿ˜”

maiden fable
#

there is only payload in raw reaction

#

!d discord.RawReactionActionEvent

unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
slate swan
maiden fable
#

Just sent the docs

slate swan
#

i dont get it

#

what is payload?

#

arg?

#

yes

maiden fable
#
async def on_raw_reaction_add(payload):
    . . . .
slate swan
#

you have two arguments currently

#

you only need one

#

which one should i remove

#

naming don't matter

#

but i need both args?

#

no

maiden fable
#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.

Note

This doesnโ€™t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโ€™s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
maiden fable
#

Use this then haha

slate swan
#

u can use payload.member after

#

and payload.reaction

#

wow thats cooL!

#

lemme try

#

still error๐Ÿ˜

slate swan
#

oh u meant .member not .user

#

still error

#

hm

#

any idea why?

#

thanks for helping tho

#

oh it's payload.emoji

#

i tried that too

#

same error

#

that should work

#

!d discord.RawReactionActionEvent.emoji

unkempt canyonBOT
slate swan
#

it does exist

#

any ideas?

steep cloak
#

RawReactionActionEvent is a global event

#

not a message event

slate swan
#

what?

#

can u explain please?

steep cloak
#

u tried to use in message

#

when usign global events, they can't be used in a message

slate swan
#

this is my code

steep cloak
#

lemesee

slate swan
#

!d discord.RawReactionActionEvent.message_id

unkempt canyonBOT
steep cloak
#

what is payload?

#

can u explain?

slate swan
#

the argument that this event takes

steep cloak
#

ah yea

slate swan
#

an instance of discord.RawReactionActionEvent

steep cloak
#

he's using the global event to edit any message with 3 reactions?

slate swan
#

my original plan was to create a ticket

#

when someone reacts

#

but idk how to do that so

steep cloak
#

create an command to send the message in a channel, and store message id

#

use the global event to check if the id is the same of message

#

and if the reaction is the target reaction

#

then, make your code

slate swan
steep cloak
#

like

#

!createTicketMessage <channel>

output:
bot sends a message in <channel>, stores the bot message, adds the reaction

slate swan
steep cloak
#

global event:
if payload.message.id == <message id>:
if payload.emoji == " emoji ":
print("okay")

slate swan
#

hi is there anyway where I can make it so that my discord bot can show whether a user is on desktop or mobile?

slate swan
#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the memberโ€™s hash.

str(x) Returns the memberโ€™s name with the discriminator.
slate swan
steep cloak
slate swan
#

!d discord.Member.is_on_mobile

unkempt canyonBOT
#

is_on_mobile()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.9)"): A helper function that determines if a member is active on a mobile device.
steep cloak
slate swan
steep cloak
#

returns a bool value <true or false>

slate swan
#

thats the plan

steep cloak
#

and has a web property 1 sec

slate swan
#

oh fr?

#

easy as that

slate swan
#

inside of your event

#

on raw reaction add?

slate swan
#

yes

#

so would I just do if user.mention is_on_mobile:

slate swan
#

so would I just do if user.mention is_on_mobile:
#do thing
else:
#do smthing else

#

if member.is_on_mobile:

#

this func?

#

oh alright

#

user should be a Member instance, it looks like

#

new to this lol

#

object oriented programming knowledge is kind of a requirement

#

||java||

#

exactly

#

i know some java but not much

#

I like C# better

#

i know some c too

#

nothing about c# tho

slate swan
slate swan
#

thanks

#

i cant use message.channel.send here

#

so how do i send messages?

#

id is undefined

#

you have to replace it with your message's id

#

oh so i have to get message id first from first func

#

it says this when im clearly not on mobile

#

don't you have a message that you will keep in a channel

#

you can just right click on it in discord

#

and copy the id

#

scoping in python

#

isnt it specific to !start message?

slate swan
#

my code

#

user can be on web?

slate swan
#

yeah idk how since im not on mobile nor do i have the discord app open on mobile

slate swan
#

in your whole code

#

what you made is called a local variable and it's only usable within one function

waxen granite
#
    if msg.author == 668936262509527081:
        if msg == "https://tenor.com/view/spit-it-out-spit-disgusting-gif-16413711":
            await msg.delete()
            dm = message.author.create_dm()
            await dm.send("https://tenor.com/view/spit-it-out-spit-disgusting-gif-16413711")```
i am trying to delete the msg from the user but this didnt work, something wrong?
shadow wraith
#

whenever i try to del a bot from the developer portal it says invalid factor code because i have 2fa even tho i put the right code

half sun
#

So the bot is on mobile, not you?

slate swan
#

nop

#

ctx.author = command invoker

#

bot.user = the bot's Member instance

half sun
#

Is ctx.message.author not the command invoker?

slate swan
#

same thing

#

except ctx.author takes less memory

slate swan
half sun
#

Ah fair enough. I haven't done discordpy Dev in a long time so forgive me

#

5 months now actually :/

slate swan
#

ctx.author -> take ctx then take the author

#

ctx.message.author -> take ctx, then take the message of it, then take the author

#

what is ctx?

#

discord.ext.commands.Context instance

#

meaning it's the whole context

#

!d discord.ext.commands.Context

unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
slate swan
#

umm

#

it has... many attributes

#

its a variable?

#

you can use every object as variables

#

true

#

well anyway how do get message id?

#

not locally

#

store the variable

slate swan
#

no, globally

#

search in google

#

?

#

umm

#

i'll google

#

not sure about that way

#

yeah shows syntax error

velvet tinsel
#

How to use error handler

slate swan
#

no syntax error now

velvet tinsel
#

๐Ÿ˜ฆ

slate swan
velvet tinsel
slate swan
#

Yo I wana fetch my own id and give my self a role with a bot can someone explain how the fetch method works

#

is it like bot.fetch(userid)?

slate swan
velvet tinsel
unkempt canyonBOT
#
Huh? No.

No documentation found for the requested symbol.

velvet tinsel
#

Wait

#

Here is your answer

slate swan
#

Thanks

velvet tinsel
#

Does anyone know how to make an error handler

slate swan
#

Using the member to fetch

waxen granite
#

TypeError: can't send non-None value to a just-started coroutine what is this error

reef shell
#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.
slate swan
velvet tinsel
waxen granite
waxen granite
#

File "D:\Discord Bot\GitHub\ecrpgbot1v2.0\main.py", line 96, in on_message await dm.send("https://tenor.com/view/spit-it-out-spit-disgusting-gif-16413711") TypeError: can't send non-None value to a just-started coroutine

velvet tinsel
#

There should be something like a line 42 or something

waxen granite
#

edited

velvet tinsel
#

Check if itโ€™s on the line

slate swan
velvet tinsel
#

Yes

#

What I was gonna ask

waxen granite
#

if message.author.id == 305573693134733313: if "https://tenor.com" in msg or "tenor" in msg: await message.delete() dm = message.author.create_dm() await dm.send("https://tenor.com/view/spit-it-out-spit-disgusting-gif-16413711")

#

in on_message event

boreal ravine
#

why do you need to create a DM?

waxen granite
#

msg = message.content.lower()

velvet tinsel
#

You can just do message.send

#

Whatever it is

#

!d discord.Member.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
waxen granite
#

message.author.send u mean?

velvet tinsel
#

Yeah, I canโ€™t remember everything

boreal ravine
velvet tinsel
#

Sweet.

slate swan
#

hey i want to create a new ticket , how can i?

#

using my bot

velvet tinsel
boreal ravine
boreal ravine
velvet tinsel
slate swan
#

u know , a new temporary channel

velvet tinsel
#

Thread?

#

You mean?

slate swan
#

just for mods to talk privately with user when they have a problem

slate swan
velvet tinsel
#

A DM?

slate swan
unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a โ€˜secretโ€™ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
slate swan
#

a temp channel

#

and the overwrites is the only complicated thing

velvet tinsel
#

Wait, a small question, how does stuff like #help-cake work?

slate swan
#

god level code

#

lol

velvet tinsel
#

If you think about it itโ€™s simple tho

#

I just thought about it

slate swan
#

maybe

velvet tinsel
#

Itโ€™s just switching channeled around categories

#

And muting a dormant channel

#

And closes it when they use !solved

boreal ravine
velvet tinsel
#

And pinning messages

boreal ravine
#

lmfao

slate swan
#

it's actually not hard if you can make it

slate swan
slate swan
#

๐Ÿ‘€

coral flame
#

im trying to use the logging module to try and make my console look a little bit more clean, but if i reload a cog that uses logging, it will cause each info and warn etc to print multiple times, any help?

manic wing
#

or silence the print's

#

idk whats printing and why its printing, but if you want it to not print...don't print it

coral flame
#

thats not the issue, it will print multiple times if i reload the cog. The more times i reload it, the more times it prints

#
    @commands.command()
    async def test2(self, ctx):
        self.log.info('Test Message')

Output:
  2021-11-05 16:48:59 | Idea | INFO | Test Message
  2021-11-05 16:48:59 | Idea | INFO | Test Message
#

thats after i reloaded it once

manic wing
#

hate to be annoying; don't log it

#

or log it somewhere else

slate swan
#

you probably have 2 instances of the code running

#

innit

coral flame
#

i don't

slate swan
#

how do i get guild name?

#

to create channel

coral flame
#

ctx.guild

slate swan
#

where do i get ctx

#

๐Ÿฅฒ

coral flame
#

what do you mean?

#

are you using a command?

slate swan
#

you aren't using commands

#

use commands instead of doing everything in on_message

#

thats a great idea

#

but i want to create channel when user adds reaction

#

so i dont think i have an option?

coral flame
#

iirc you can get the reaction message, and then the guild from that

slate swan
#

how?

#

payload.guild?

#

or something

coral flame
#

yeah, using payload.guild_id, you can get the guild id, and then find the guild using that

slate swan
#

i have to use guild id?

#

not guild?

coral flame
#

or, if you are not in a dm channel, payload.member.guild

coral flame
#

inside dm channels, there is no such thing as a Member

#

so if it is a guild, you can get the guild using payload.member.guild

slate swan
#

hm

#

never thought of that

#

hey

spiral frigate
#

and for the discord, you need to use a mongodb asynchronous motor

slate swan
#

so this responds to itself

#

when it starts, adds reaction, then reacts to those reactions

echo wasp
#

how do you setup a py await user.send('example') mine i made doesn't work