Piscord Objects

Bot

class piscord.Bot_Element(bot_element, bot)

Represent the Bot

user: User
The user corresponding to the bot (name, id, avatar)
guilds: Guild
List of guilds where the bot is
relationships:
List of relationships of the bot (useless for real bot)
private_channels: Channel
List of private channels of the bot
presences:
Not implemented : Presences of the users
voices:
List of Voice connexion of the bot
create_guild(**kwargs)

Create a guild channel, with parameters. Parameters : https://discord.com/developers/docs/resources/guild#create-guild

Return Guild

edit(**modifs)

Modify bot user, with parameters. Parameters : https://discord.com/developers/docs/resources/user#modify-current-user

Guild

class piscord.Guild(guild, bot)

Represent a discord server

id:
ID of the Guild
name:
Name of the Guild
icon:
The icon (image show on the guilds menu) of the Guild
splash:
The background invite image of the Guild
discovery_splash:
The background invite image of the Guild in discovery tab
owner:
If the user is the owner of the guild (see : https://discord.com/developers/docs/resources/user#get-current-user-guilds)
owner_id:
If owner is not specified, the owner id of the Guild
permissions:
The permissions in Guild for the user (see : https://discord.com/developers/docs/resources/user#get-current-user-guilds)
region:
Not implemented : Voice region of the guild
afk_channel_id:
The id of the afk voice channel
afk_timeout:
The time before an inactive user is sent to the afk voice channel
embed_enabled:
If the server widget is enabled (deprecated, replaced with widget_enabled)
embed_channel_id:
The channel id where the widget generate an invite (deprecated, replaced with widget_channel_id)
verification_level:
The level of verification of the server
  • 0 : Unrestricted
  • 1 : Need email verified
  • 2 : Register longer than 5 minutes
  • 3 : In the guild longer than 10 minutes
  • 4 : Require verified phone number
default_message_notifications:
The level of messages notification by default
  • 0 : All messages
  • 1 : Mentions Only
explicit_content_filter:
Filter for nsfw content (image)
  • 0 : No filter
  • 1 : Filter just for roleless members
  • 2 : All members
roles: Role
List of Guild roles
emojis: Emoji
List of Guild emojis
features:
Not implemented
mfa_level:
If the guild requiere MFA
  • 0 : No
  • 1 : Yes
application_id:
If a bot created the server, the id of its application
widget_enabled:
If the server widget is enabled
widget_channel_id:
The channel id where the widget generate an invite
system_channel_id:
The id of channel system messages (boost, welcome)
system_channel_flags:
A integer representing the system messages enable
0 : All system messages 1 : Boost notification messages 2 : Welcome messages 3 : No system messages
rules_channel_id:
The id of rules channel for public guilds
joined_at:
The timestamp of guild creation
large:
If the guild is considered a large guild
unavailable:
If the guild is unavaible
member_count:
The number of guild members
voice_states:
Not implemented
members: Member
List of guild members
channels: Channel
List of guild channels
presences:
Not implemented
max_presences:
Max number of presence for the guild, 25000 by default
max_members:
Max number of members for the guild
max_video_channel_users:
Max number of users in a video channel
vanity_url_code:
Custom url for discord parteners and guild level 3
description:
Guild description in discover tab
banner:
Banner of the guild
premium_tier:
The level of server boosting:
  • 0 : Level 0
  • 1 : Level 1
  • 2 : Level 2
  • 3 : Level 3
premium_subscription_count:
The number of guild nitro boosts
preferred_locale:
The preferred locale of a public guild (for discovery tab)
public_updates_channel_id:
The staff channel for Discord notices of a public guild
approximate_member_count:
The approximate number of guild members
approximate_presence_count:
The approximate number of connected guild members
count_prune(days=7, include_roles=[])

Count the number of users will be pruned if you start a prune

days:
The number of days the user need to be inactive to be counted
include_roles:
The roles to be considered to prune (by default, a user with a role can’t be pruned)
create_channel(**kwargs)

Create a guild channel, with parameters. Parameters : https://discord.com/developers/docs/resources/guild#create-guild-channel

Return Channel

create_role(**kwargs)

Create a guild role, with parameters. Parameters : https://discord.com/developers/docs/resources/guild#create-guild-role

Return Role

delete()

Delete permanently the guild. The bot must be the owner

edit(**modifs)

Modify guild, with parameters. Parameters : https://discord.com/developers/docs/resources/guild#modify-guild

get_ban(user_id)

returns a specific Ban using the id of the banned user

get_bans()

Return a list of Ban of the guild

get_channels()

Return a list of Channel of the guild (deprecated, use Guild.channels)

get_invites()

Return a list of Invite of the guild

get_member(user_id)

returns a specific Member using their id

get_members(limit=100, after=0)

Return a list of Member of the guild (deprecated, use Guild.members)

get_roles()

Return a list of Role of the guild (deprecated, use Guild.roles)

get_webhooks()

Return a list of Webhook of the guild

prune(days=7, include_roles=[])

Prune inactive members (kick)

days:
The number of days the user need to be inactive to be counted
include_roles:
The roles to be considered to prune (by default, a user with a role can’t be pruned)

Channel

class piscord.Channel(channel, bot, guild=None)

Represent a discord channel

id:
ID of the Channel
type:
The type of the channel
0 : Text channel of a Guild 1 : DM channel 2 : Voice channel of a Guild 3 : DM group channel 4 : Category 5 : News channel 6 : Store channel
guild_id:
The guild id of the channel (if is not a dm channel)
position:
The channel position in the guild channels
permission_overwrites:
The permissions for members and roles in the channel
name:
Name of the channel
topic:
The channel topic
nsfw:
If the channel is or not a nsfw channel
last_message_id:
The id of the last channel message
bitrate:
The bitrate of the channel (if this is a voice channel)
user_limit:
The limit of users in the channel (if this is a voice channel)
rate_limit_per_user:
The time between two messages, in seconds
recipients: User
The DM group users
icon:
The icon of the DM group
owner_id:
The id of the DM group owner
application_id:
If a bot created the DM group, the id of its application
parent_id:
If the channel is in a category, the category id
last_pin_timestamp:
timestamp when the last pinned message was pinned
invites: Invite
List of channel invites
mention:
The mention of the channel
guild: Guild
The guild of the channel
bulk_delete(messages_ids)

Delete multiple messages

messages_ids:

The ids of the message to delete

Max : 100

create_invite(**kwargs)

Create a guild invite for the channel, with parameters Parameters : https://discord.com/developers/docs/resources/channel#create-channel-invite

Return Invite

create_webhook(name, avatar=None)

Create a webhook for the channel

name:
The name of the webhook
avatar:
The avatar image data (see : https://discord.com/developers/docs/reference#image-data) of the webhook

Return Webhook

edit(**modifs)

Modify channels, with parameters. Parameters : https://discord.com/developers/docs/resources/channel#modify-channel

get_invites()

Get list of invites of the channel

Return List of Invite

get_message(message_id)

Get specific message of the channel with it id

Return Message

get_messages(limit=50, before=None, after=None)

Get list of messages in the channel

limit:
The max number of messages return (max : 100)
before:
ID of a message : Retrieves messages that are before the message
after:
ID of a message : Retrieves messages that are after the message

Return List of Message

get_webhooks()

Get list of webhooks of the channel

Return List of Webhook

purge(max, before=None, after=None)

Delete messages from a channels

max:

The number of messages to delete

Max : 100

before:
The messages before a message id
after:
The messages after a message id
send(content=None, files=None, **kwargs)

Send a message in the channels, with parameters. Parameters : https://discord.com/developers/docs/resources/channel#create-message

By default, when not kwarg specified, arg is the content.

Use send(files=[“name_1”,”name_2”]) to send files by their names

Use send(files=[[b”data_2”,”title_1”],[b”data_2”,”title_2”]]) to send files by their data

Return Message

typing()

Send a “typing” event in the channel (‘bot typing…’) until the bot sends a message

Message

class piscord.Message(message, bot)

Represent a message send in a channel by a user

id:
ID of the message
channel_id:
ID of the channel where the message is
guild_id:
ID of the guild where the message is (if is not a DM)
author: User or Member
A user object of the author. If the channel is not a DM, this is a member object
content:
The content of the message
timestamp:
The timestamp when the message was sent
edited_timestamp:
The timestamp when the message was edited
tts:
If the message was a TTS message
mention_everyone:
If the message mention everyone
mentions: User
List of users mentionned in the message
mention_roles: Role
List of roles mentionned in the message
mention_channels: Channel

List of channels mentionned in the message

(incomplete object, see : https://discord.com/developers/docs/resources/channel#channel-mention-object)

attachments: Attachement
List of attachments of the message
embeds: Embed
If the message have embeds, list of embeds in the message
reactions: Reaction
List of reactions of the message
nonce:
Nonce of the message
pinned:
If the message is pinned
webhook_id:
Webhood id if the message was generated by a webhook
type:
The type of message
  • 0 : A normal message
  • 1 : A DM group member add
  • 2 : A DM group member remove
  • 3 : A DM call start
  • 4 : A change of DM group channel name
  • 5 : A change of DM group channel icon
  • 6 : A channel pin
  • 7 : A guild member arrival
  • 8 : A guild boost
  • 9 : A guild boost tier 1
  • 10 : A guild boost tier 2
  • 11 : A guild boost tier 3
  • 12 : A channel follow add
  • 13 : A guild discovery disqualified
  • 14 : A guild discovery requalified
activity:
Not implemented
application:
Not implemented
message_reference:
Not implemented
flags:
Message flags (see : https://discord.com/developers/docs/resources/channel#message-object-message-flags)
guild: Guild
The guild where the message was sent (if is not in DM)
channel: Channel
The channel where the message was sent
add_reaction(reaction)

Add the reaction in the message

reaction:
A emoji.react string
delete()

Delete the message

delete_reaction(reaction, user_id=None)

If user_id is specified, delete the reaction of a specific user, else, delete all the reactions corresponding to the reaction in argument

delete_reactions()

Delete all reactions on the message

delete_self_reaction(reaction)

Delete its own reaction

edit(**modifs)

Modify channels, with parameters. Parameters : https://discord.com/developers/docs/resources/channel#edit-message

User

class piscord.User(user, bot)

Represent a user of discord

id:
ID of the user
name:
Username of the user
discriminator:
Discriminator of the user
avatar:
Avatar link of the user (discord cdn)
bot:
If the user is a bot
system:
If the user is a Official Discord System user
mfa_enabled:
If the user has two factor authentification enabled
locale:
The discord language of the user
verified:
If the user email is verified
email:
The email of the user
flags:
The user flags (see: https://discord.com/developers/docs/resources/user#user-object-user-flags)
premium_type:
The nitro level of the user
  • 0 : No nitro
  • 1 : Basic nitro
  • 2 : Nitro boost
public_flags:
The public flags of the user (see : https://discord.com/developers/docs/resources/user#user-object-user-flags)
mention:
The mention of the user
dm: Channel
The DM channel of the user

Member

class piscord.Member(member, bot)

Member object is a supplement of the User class for guild members

A member is associated with a guild

It have most often the same basic attribute of User

nick:
The username of member in the guild
roles: Role
List of member roles in the guild if the user if the guild is in the bot cache
roles_id:
List of the roles id
hoisted_role:
Not implemented
joined_at:
Timestamp when member join the guild
premium_since:
Timestamp when member starting boost the server
deaf:
If the member is deafened in voice channels
mute:
If the member is muted in voice channels
guild_id:
ID of the guild of the member
guild: Guild
The guild where the member is
add_role(role)

Add a role to the guild member

role: Role
A guild role object
ban(reason=None)

Ban the guild member

edit(**modifs)

Modify member, with parameters. Parameters : https://discord.com/developers/docs/resources/guild#modify-guild-member

kick()

Kick the guild member

remove_role(role)

Remove a role to the guild member

role: Role
A guild role object

Reaction

class piscord.Reaction(reaction, message)

Represent a reaction on a message

count:
The number of times this emoji was added
me:
If the user reacted with this emoji
emoji: Emoji
The emoji of the reaction
message:
The message of the reaction

Emoji

class piscord.Emoji(emoji)

Represent a Emoji

id:
ID of the Emoji
name:
The name of the emoji
roles: Role
Roles this emoji is whitelisted to
user: User
User that created this emoji
require_colons:
If the emoji must be wrapped in colons
managed:
If emoji is managed
animated:
If the emoji is animated
available:
If the emoji can be used

Role

class piscord.Role(role, bot)

Represent a Emoji

id:
ID of the Emoji
name:
The name of the emoji
color:
Decimal value of the color
hoist:
If the role is pinned in the user listing
position:
Position of role in roles list
permissions:
Value of role permissions
managed:
If role is managed
mentionable:
If the role can be mentionned
guild_id:
The id of the role guild
mention:
The mention of the role
guild:
The role guild
delete()

Remove the role

edit(**modifs)

Modify role, with parameters. Parameters : https://discord.com/developers/docs/resources/guild#modify-guild-role

Attachment

class piscord.Attachment(attachment={})

Represent a message attachment, contain file

id:
ID of the attachment
filename:
The name of the attachment file
size:
The size of the attachment, in bytes
url:
Url for get the file
proxy_url:
Same than url, but proxied
height:
Height of the image attachment (if this is an image)
width:
Width of the image attachment (if this is an image)

Allowed_Mentions

class piscord.Allowed_Mentions(mentions={})

Represent the mentions allowed for message sending

parse:
List of the mentions types allowed
  • “roles” : mentions of roles
  • “users” : mentions of users
  • “everyone” : mentions @everyone and @here
roles:
List of id of whitelist roles mentions
users:
List of id of whitelist users mentions

Embed

class piscord.Embed(embed={})

Represent a message Embed

Params when you send a Embed: https://discord.com/developers/docs/resources/channel#create-message-params

title:

The title of the embed

Max : 256 characters

type:

Type of embed

Embed types should be considered deprecated and might be removed

  • “rich” : Generic Embed
  • “image” : Image Embed
  • “video” : Video Embed
  • “gifv” : Animated gif image Embed rendered as a video Embed
  • “article” : Article Embed
  • “link” : Link Embed
description:

The description of the embed

Max : 2048 characters

url:
Url of the Embed
timestamp:
Timestamp of Embed content
color:
Decimal value of the Embed color
footer: Embed_Footer
The footer of the Embed
image: Embed_Image
The image of the Embed
thumbnail: Embed_Image
The thumbnail of the Embed
video: Embed_Image
The video of the Embed
provider: Embed_Provider
The provider of the Embed
author: Embed_Author
The author informations of the Embed
fields: Embed_Field

List of Embed fields

Max : 25

add_field(**kwargs)

Used to add a field on the Embed

Return the field

Embed_Field

class piscord.Embed_Field(field)

Represent a Embed Field

name:

The title of the field

Max : 256 characters

value:

The description of the field

Max : 1024 characters

inline:
If the Embed is inline

Embed_Image

class piscord.Embed_Image(image)

Represent a Embed Image, Embed Thumbnail and Embed Video

url:
The url of the image/video
proxy_url:
Same than url, but proxied. Video Dmbed does not have this attribute
height:
The height of the image
width:
The width of the image

Embed_Provider

class piscord.Embed_Provider(provider)

Represent a Embed Provider

name:
The provider name
url:
The provider url

Embed_Author

class piscord.Embed_Author(author)

Represent a Embed Author

name:

Name of the author field

Max : 256 characters

url:
Url of the author field
icon_url:
Url of the icon of the author field
proxy_icon_url:
same than icon_url, but proxied

Invite

class piscord.Invite(invite, bot)

Represent a guild invite

code:
The code of the invite (For example, code U9X7XzP corresponding to invitation https://discord.gg/U9X7XzP)
guild: Guild
A partial guild object : The guild of the invite
channel: Channel
A partial channel object : The channel of the invite
inviter: User
The user who created the invite
target_user: User
The target user for the invite
target_user_type:
The type of user target for the invite
1 : Stream
approximate_presence_count:
The approximate number of connected users in the guild
approximate_member_count:
The approximate number of users in the guild
url:
The url of the invite
uses:
The number of invite uses
max_uses:
The number of max invite uses
max_age:
The time before invite is automatically deleted
temporary:
If the invite give temporary membership
created_at:
Timestamp when the invite was created
delete()

Delete the invite

Ban

class piscord.Ban(ban, bot)

Represent a guild ban

reason:
The reason of the ban
user: User
The banned user
pardon(guild_id)

Unban the user

Overwrite

class piscord.Overwrite(overwrite, bot, channel_id)

Represent a Overwrite

id:
ID of the Overwrite
type:
The type of the Overwite
  • “role” : A role Overwrite
  • “member” : A member Overwrite
allow:
Permissions allow by Overwrite
deny:
Permissions deny by Overwrite
delete()

Delete overwrite

edit(**modifs)

Modify overwrite, with parameters. Parameters : https://discord.com/developers/docs/resources/channel#edit-channel-permissions

Webhook

class piscord.Webhook(webhook, bot, channel=None)

Represent a channel Webhook

id:
ID of the webhook
type:
The type of the webhook
  • 0 : Incoming webhook
  • 1 : Channel following webhook
guild_id:
The id of the webhook guild
channel_id:
The id of the webhook channel
user: User
The user who created the webhook
name:
The name of the webhook
avatar:
The avatar link of the webhook
token:
The webhook secure token (For Incoming Webhooks)
channel: Channel
The channel of the webhook
guild:
The guild of the webhook
delete()

Delete the webhook

edit(**modifs)

Modify webhook, with parameters. Parameters : https://discord.com/developers/docs/resources/webhook#modify-webhook

send(content=None, files=None, **kwargs)

Send a message with webhook :

This is like message sending in channel