-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
class fastcord.Fastcord(token, verbose=False)
Used to create a Fastcord instance to interact with the Discord API
-
token (str)
The Discord application token. -
verbose [Optional] (bool)
Defaults toFalse
. When set toTrue
, the application will log all messages sent by the websocket.
token
(str)
The current bot token.
verbose
(bool)
Whether or not the application should log all the messages sent by the websocket.
ws
(websocket.WebSocketApp)
The websocket that is used to communicate with the Discord gateway.
run()
Starts the websocket.
change_presence(presence)
Changes the bots presence. Used to change the bot's status and/or activity.
-
Arguments
-
presence (fastcord.Presence)
The presence that should be changed to.
-
presence (fastcord.Presence)
change_activity(activity)
Changes the bots activity.
-
Arguments
-
activity (fastcord.Activity)
The activity that should be changed to.
-
activity (fastcord.Activity)
get_user(user_id)
(fastcord.User)
Gets a Discord user by their ID.
-
Arguments
-
user_id (int)
The users ID.
-
user_id (int)
get_guild(guild_id)
(fastcord.Guild)
Gets a Discord guild by its ID.
-
Arguments
-
guild_id (int)
The guilds ID.
-
guild_id (int)
get_channel(channel_id)
(fastcord.Channel)
Gets a Discord channel by its ID.
-
Arguments
-
channel_id (int)
The channels ID.
-
channel_id (int)
How to use events:
import fastcord
bot = fastcord.Fastcord(TOKEN)
@bot.on_event(EVENT_TYPE)
def on_some_event(ARGS?):
# do something
bot.run()
message
Called when a message is sent.
-
Arguments
- (fastcord.Message)
The message.
- (fastcord.Message)
ready
Called when the bot is ready.
Note: Discord objects SHOULD NOT be created manually! (except for Activity, Presence and Embed)
class fastcord.Activity(name=None, _type=None, fastcord=None, obj=None)
- name (str) The activity's name.
-
_type (fastcord.ActivityType)
The activity's type. Can be one of the following:
fastcord.ActivityType.GAME
fastcord.ActivityType.STREAMING
fastcord.ActivityType.LISTENING
fastcord.ActivityType.CUSTOM
-
fastcord (fastcord.Fastcord)
The Fastcord instance. When set to
None
a new object for creating a custom Activity will be made instead. -
obj (dict)
The activity JSON object. When set to
None
a new object for creating a custom Activity will be made instead.
activity
(dict)
The activity's JSON object.
_name
(str)
The activity's name.
_type
(fastcord.ActivityType)
The activity's type.
_url
(str)
The activity's URL. Only applies to Streaming
type activities.
name(name)
Sets the Activity's name.
-
Arguments
-
name
(str) The new activity's name.
-
type(activity_type)
Sets the Activity's type.
-
Arguments
-
activity_type
(fastcord.ActivityType) The new activity's type. Can be one of the following:
fastcord.ActivityType.GAME
fastcord.ActivityType.STREAMING
fastcord.ActivityType.LISTENING
fastcord.ActivityType.CUSTOM
-
url(url)
Sets the activity's URL. Only applies to Streaming
type activities.
-
Arguments
-
url
(str) The new activity's URL.
-
class fastcord.Attachment(fastcord, obj)
- fastcord (fastcord.Fastcord) The Fastcord instance.
- obj (dict) The attachment JSON object.
id
(int)
The attachment's id.
name
(str)
The attachment's name.
url
(str)
The attachment's URL.
class fastcord.Channel(fastcord, obj)
- fastcord (fastcord.Fastcord) The Fastcord instance.
- obj (dict) The channel JSON object.
id
(int)
The channel's id.
type
(fastcord.ChannelType)
The channel's type.
nsfw
(bool)
Whether or not that channel is marked as NSFW.
name
(str)
The channel's name.
slowmode
(int)
The amount of time in seconds a user has to wait before sending another message to the channel.
owner
(fastcord.User)
The owner of the DM. Only applies to DM
type channels.
guild
(fastcord.Guild)
The guild to which this channel belongs to.
send(content=None, embed=None, file=None, filename="file")
Send a message to the channel.
-
Arguments
-
content
(str) The message contents. Defaults toNone
. -
embed
(embed) The embed that should be sent with the message. Defaults toNone
. -
file
(bytearray) The file that should be sent with the message. Defaults toNone
. -
filename
(str) The file name. Should be changed with the appropriate extension for the file changed. Defaults tofile
.
-
class fastcord.Embed(fastcord=None, obj=None)
-
fastcord (fastcord.Fastcord)
The Fastcord instance. When set to
None
a new object for creating a custom Embed will be made instead. -
obj (dict)
The embed JSON object. When set to
None
a new object for creating a custom Embed will be made instead.