How do I get pin messages in discord.py

dapsjj 注册会员
2023-01-25 13:34

You will want to retrieve all the pins of a channel using channel.pins(), as seen in the code below. This will give you a list of messages, assuming the channel has pins.

pins = await ctx.channel.pins() # a list of all the channel's pins
await ctx.send(pins[0]) # sends all the information in the channel's first pin
await ctx.send(pins[0].content) # sends the content of the message. 
                                # An error will occur if there is no message content


About the Author

Question Info

Publish Time
2023-01-25 13:34
Update Time
2023-01-25 13:34

Related Question