-
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 overdataand sets all keys and their respective values toself. -
__updated()used by inheritors to know when their data is updated.
-
parenta parent structure.
Represents a Discord user.
-
sendMessage(...)creates a DM channel if not present and calls itssendMessagemethod.
-
channelaChannelstructure representing a DM channel with the user.
Represents a Discord guild.
-
edit({...})requires an object with any parameter to modify.-
ownereither an int representing an user ID or anUserstructureor setOwner(owner). -
namea string representing new guild's nameor setName(name). -
regiona string representing new guild's regionor setRegion(region). -
icona string representing new guild's iconor setIcon(icon). -
splasha string representing new guild's splashor setSplash(splash). -
setAFKchannel(channel)requires either a channel ID or aChannelstructure. -
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 anUserstructure. -
getBans()requests and returns aCacheobject containing all banned users asUserstructures. -
getInvites()requests and returns aCacheobject containing all invites asInvitestructures. -
createRole()creates a new guild role and returns aRolestructure. -
createChannel({...})requires an object containing these parametters.-
createTextChannel(name)creates a text channel. -
createVoiceChannel(name[, bitrate])creates a voice channel.
-
-
bansaCacheobject containing banned users asUserstructures. -
rolesaCacheobject containingRolestructures. -
membersaCacheobject containingMemberstructures. -
channelsaCacheobject containingChannelstructures. -
invitesaCacheobject containingInvitestructures. -
owneranUserstructure representing guild's owner. -
afk_channelaChannelstructure representing guild's AFK channel, if set. -
embed_channelaChannelstructure representing guild's embed channel, if set.
Represents a guild role.
-
edit({...})requires an object containing attributes to change.-
namea string representing desired new nameor setName(name). -
positionan int representing desired new display positionor setPosition(position). -
coloran int representing desired rgb coloror setColor(color). -
hoista bool representing whether should the role be displayed separately in the sidebaror setHoist(hoist).
-
-
delete()deletes the role.
-
permissionsaBitwiseobject.
Represents a guild member.
-
edit({...})requires an object containing attributes to change.-
nicka string representing member's nickname to setor setNickName(nick). -
mutea bool representing whether the member is mutedor setMuted(mute). -
deafa bool representing whether the member is deafenedor setDeaf(deaf). -
move(channel)with either an id or aChannelstructure, representing a voice channel to move the member to. -
rolesan array of roles the member is assigned to.
-
-
kick()kicks the member. -
ban(days)bans the member,daysrepresents 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.
-
useranUserobject representing the member. -
rolesan array containingRolestructures.
Represents a Discord channel/DM. parent can be an User or a Server.
-
edit({...})requires an object containing attributes to change.-
namea stringor setName(name). -
topica stringor setTopic(topic). -
bitratean intor setBitrate(bitrate). -
positionan intor setPosition(position). -
setSlotsan intor setSlots(slots).
-
-
getHistory(limit[, config])fetches and returns all messages based on given values and configuration. -
sendMessage(thing)returns aMessagestructure,thingmay 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 anInvitestructure, optionally accepts an object with any valid parameter set. -
delete()permanently deletes the channel.
-
invitesaCacheobject containing invites asInvitestructures. -
historyaCacheobject of sent messages asMessagestructures. -
is_voicea bool set to true in case it is a voice channel. -
is_privatea bool set to true in case it is a DM channel. -
overwritesaCacheobject containingOverwriteobjects.
Represents a Discord message.
-
reply(thing)calls message's parent channel'ssendMessagemethod and returns aMessagestructure. -
edit(thing)changes message's attributes, works the same way assendMessage. -
react(emoji)adds a reaction with givenemojiand returns aReactionstructure. -
delete()deletes the message.
-
cleana string with all mentions fixed, i.e. if an user is mentioned their name is shown instead. -
authoranUserstructure representing message's author. -
mentionsan array containing mentioned users asUserstructures. -
mentions.clienta 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 givenuseror local's if not set.
-
usersaCacheobject ofUserstructures.
Represents an emoji.
-
urla link to emoji's image. -
stringa string to be used in messages.
Represents a Discord channel permission overwrite.
-
delete()deletes the overwrite.
-
denyaBitwiseobject of denied permissions. -
allowaBitwiseobject of allowed permissions.
Represents a Discord channel invite.
-
accept()accepts the invite. Refer to client'sacceptInvitemethod for direct acceptance. -
delete()deletes the invite.
-
urla 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 abitinstead. -
remove(name)removes a permission from valid permissions.
Last revision on 26 Feb. 2017 – satom99