-
Notifications
You must be signed in to change notification settings - Fork 4
Structures
AdamJames edited this page Feb 26, 2017
·
34 revisions
Note all structures include their original Discord object's attributes if not overwritten.
A base class for structures.
-
update(data)
loops overdata
and sets all keys and their respective values toself
. -
__updated()
used by inheritors to know when their data is updated.
-
parent
a parent structure.
Represents a Discord user.
-
sendMessage(...)
creates a DM channel if not present and calls itssendMessage
method.
-
channel
aChannel
structure representing a DM channel with the user.
Represents a Discord guild.
-
edit({...})
requires an object with any parameter to modify.-
owner
either an int representing an user ID or anUser
structureor setOwner(owner)
. -
name
a string representing new guild's nameor setName(name)
. -
region
a string representing new guild's regionor setRegion(region)
. -
icon
a string representing new guild's iconor setIcon(icon)
. -
splash
a string representing new guild's splashor setSplash(splash)
. -
setAFKchannel(channel)
requires either a channel ID or aChannel
structure. -
setAFKtimeout(timeout)
requires an int in miliseconds.
-
-
delete()
permanently deletes the guild from Discord. Note this is not reversible. -
unban(user)
requires either an user ID or anUser
structure. -
getBans()
requests and returns aCache
object containing all banned users asUser
structures. -
getInvites()
requests and returns aCache
object containing all invites asInvite
structures. -
createRole()
creates a new guild role and returns aRole
structure. -
createChannel({...})
requires an object containing these parametters.-
createTextChannel(name)
creates a text channel. -
createVoiceChannel(name[, bitrate])
creates a voice channel.
-
-
bans
aCache
object containing banned users asUser
structures. -
roles
aCache
object containingRole
structures. -
members
aCache
object containingMember
structures. -
channels
aCache
object containingChannel
structures. -
invites
aCache
object containingInvite
structures. -
owner
anUser
structure representing guild's owner. -
afk_channel
aChannel
structure representing guild's AFK channel, if set. -
embed_channel
aChannel
structure representing guild's embed channel, if set.
Represents a guild role.
-
edit({...})
requires an object containing attributes to change.-
name
a string representing desired new nameor setName(name)
. -
position
an int representing desired new display positionor setPosition(position)
. -
color
an int representing desired rgb coloror setColor(color)
. -
hoist
a bool representing whether should the role be displayed separately in the sidebaror setHoist(hoist)
.
-
-
delete()
deletes the role.
-
permissions
aBitwise
object.
Represents a guild member.
-
edit({...})
requires an object containing attributes to change.-
nick
a string representing member's nickname to setor setNickName(nick)
. -
mute
a bool representing whether the member is mutedor setMuted(mute)
. -
deaf
a bool representing whether the member is deafenedor setDeaf(deaf)
. -
move(channel)
with either an id or aChannel
structure, representing a voice channel to move the member to. -
roles
an array of roles the member is assigned to.
-
-
kick()
kicks the member. -
ban(days)
bans the member,days
represents the number of days to delete messages for. -
setRole(role)
assigns the member aRole
. -
revokeRole(role)
removes the member from aRole
. -
hasPermission(bit)
returns whether the member has given permissionbit
.
-
user
anUser
object representing the member. -
roles
an array containingRole
structures.
Represents a Discord channel/DM. parent
can be an User
or a Server
.
-
edit({...})
requires an object containing attributes to change.-
name
a stringor setName(name)
. -
topic
a stringor setTopic(topic)
. -
bitrate
an intor setBitrate(bitrate)
. -
position
an intor setPosition(position)
. -
setSlots
an intor setSlots(slots)
.
-
-
getHistory(limit[, config])
fetches and returns all messages based on given values and configuration. -
sendMessage(thing)
returns aMessage
structure,thing
may be a string or an object with attributes. -
bulkDelete(array)
bulk-deletes all messages, as structures or IDs, in a given array. -
getInvites()
equivalent to server's but channel-level. -
createInvite([{...}])
returns anInvite
structure, optionally accepts an object with any valid parameter set. -
delete()
permanently deletes the channel.
-
invites
aCache
object containing invites asInvite
structures. -
history
aCache
object of sent messages asMessage
structures. -
is_voice
a bool set to true in case it is a voice channel. -
is_private
a bool set to true in case it is a DM channel. -
overwrites
aCache
object containingOverwrite
objects.
Represents a Discord message.
-
reply(thing)
calls message's parent channel'ssendMessage
method and returns aMessage
structure. -
edit(thing)
changes message's attributes, works the same way assendMessage
. -
react(emoji)
adds a reaction with givenemoji
and returns aReaction
structure. -
delete()
deletes the message.
-
clean
a string with all mentions fixed, i.e. if an user is mentioned their name is shown instead. -
author
anUser
structure representing message's author. -
mentions
an array containing mentioned users asUser
structures. -
mentions.client
a bool representing whether the local client is mentioned.
Represents a reaction to a message. Inherits from Emoji
.
-
clear()
clears a reaction. -
remove([user])
removes a reaction from a givenuser
or local's if not set.
-
users
aCache
object ofUser
structures.
Represents an emoji.
-
url
a link to emoji's image. -
string
a string to be used in messages.
Represents a Discord channel permission overwrite.
-
delete()
deletes the overwrite.
-
deny
aBitwise
object of denied permissions. -
allow
aBitwise
object of allowed permissions.
Represents a Discord channel invite.
-
accept()
accepts the invite. Refer to client'sacceptInvite
method for direct acceptance. -
delete()
deletes the invite.
-
url
a string repesenting a direct link for the invite.
A management class for permissions. parent
should always be an Overwrite
or a Role
object.
-
has(name)
returns a bool representing whether input permission is added. -
add(name)
adds a permission from valid permissions. Also accepts abit
instead. -
remove(name)
removes a permission from valid permissions.
Last revision on 26 Feb. 2017 – satom99