Discord
Discord Data Types used in Template Engine.
Guild#
This data type describes all available data about the server.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
name |
String | Name |
iconUrl |
String | Icon URL |
afkTimeout |
Number | AFK timeout for voice channels (in minutes) |
afkChannel |
VoiceChannel | AFK Voice Channel |
memberCount |
Number | Amount of Members |
createdAt |
DateTime | Creation date and time |
owner |
Member | Owner |
selfMember |
Member | Bot's member instance |
boostCount |
Number | Amount of active boosts |
Methods#
getChannel(ID)
#
Returns channel by given id.
Returns: TextChannel, NewsChannel, VoiceChannel, StageChannel, ForumChannel
getMember(ID)
#
getRole(ID)
#
clearAttributes(Key)
#
Clears attributes with specified key for all members.
Warning! Quota
This means that this method can only be invoked 1 times by the same template.
Parameter | Type | Description |
---|---|---|
Key |
String | Attribute key to clear |
Member#
This data type describes all available data about the member and operations over them.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
mention |
String | Mention string |
name |
String | Name |
displayName |
String | Display Name |
nickname |
String | Nickname on the server or original name |
tag |
String | Full tag in the format Nickname#1234 |
bot |
Boolean | true if this member instance is bot |
discriminator |
String | Discriminator (4 digits after #) |
joinedAt |
DateTime | Join date and time |
createdAt |
DateTime | Registration date and time |
status |
String | Status (Online, Idle, DnD, Offline) with emoji icon |
avatarUrl |
String | Avatar URL |
bio |
String | Bio specified in !bio |
rank |
Rank | Ranking data |
roles |
List<Role> | List of assigned roles |
guild |
Guild | Server information |
attributes |
AttributesStorage | Attributes storage |
activities |
List<Activity> | Member activities |
voiceState |
MemberVoiceState | Member voice channel connectivity state |
flags |
List<UserFlag> | Member flags |
Methods#
hasRole(Role)
#
hasRoles(Roles)
#
hasAnyRole(Roles)
#
hasPermission(Name)
#
Checks if member has this permission over all his roles.
Returns: Boolean
Parameter | Type | Description |
---|---|---|
Name |
Permission | Permission to check |
hasPermission(Channel, Name)
#
Checks if member has this permission in the channel specified.
Returns: Boolean
Parameter | Type | Description |
---|---|---|
Channel |
Number, TextChannel | Text channel ID or channel object |
Name |
Permission | Permission to check |
hasFlag(Flag)
#
addRole(Role)
#
addRoles(Roles)
#
addTempRole(Role, RemoveDate)
#
addTempRoles(Roles, RemoveDate)
#
removeRole(Role)
#
removeRoles(Roles)
#
modifyRoles(Add, Remove)
#
modifyNickname(Name)
#
getAttribute(Key)
#
MemberVoiceState#
This data type describes member voice channel connectivity state.
Properties#
Property | Type | Description |
---|---|---|
inChannel |
Boolean | true if this Member is currently in channel |
channel |
VoiceChannel | The current voice channel that the Member is in |
muted |
Boolean | true if whether the Member is muted, either by themselves or by an admin |
selfMuted |
Boolean | true if this Member is muted by themselves |
guildMuted |
Boolean | true if this Member is muted by an admin |
deafened |
Boolean | true if whether the Member is deafened, either by themselves or by an admin |
selfDeafened |
Boolean | true if this Member is deafened by themselves |
guildDeafened |
Boolean | true if this Member is deafened by an admin |
sendingVideo |
Boolean | true if this Member has their camera on |
streaming |
Boolean | true if this Member is currently streaming |
suppressed |
Boolean | true if this Member is suppressed (is in AFK channel or stage listener) |
Methods#
approveSpeaker()
#
declineSpeaker()
#
inviteSpeaker()
#
Activity#
This data type describes member activity status.
Properties#
Property | Type | Description |
---|---|---|
rich |
Boolean | true if this activity is Rich Presence (detailed) |
type |
String | Activity type (STREAMING , LISTENING , WATCHING , CUSTOM_STATUS , COMPETING ) |
emoji |
String | Custom status emoji |
name |
String | Activity name |
url |
String | Activity URL (stream URL) |
startTime |
DateTime | Activity start time |
endTime |
DateTime | Activity end time |
details |
String | Activity details (What the member is currently doing) |
state |
String | Activity state ("Looking to Play", "Playing Solo", "In a Group", etc) |
largeImageUrl |
String | URL of the large activity image |
largeImageText |
String | Text which is displayed when hovering the large image |
smallImageUrl |
String | URL of the small activity image |
smallImageText |
String | Text which is displayed when hovering the small image |
Rank#
This data type describes all available data about the member's rank and operations over them.
Properties#
Property | Type | Description |
---|---|---|
level |
Number | Member level |
remainingExp |
Number | Remaining EXP until next level |
levelExp |
Number | Total EXP required for current level |
levelCurrentExp |
Number | Member's EXP on current level |
totalExp |
Number | Total EXP member earned |
rank |
Number | Member's rank position |
cookies |
Number | Amount of cookies member have |
voiceActivity |
String | Voice Activity duration formatted in text |
voiceActivityMs |
Number | Voice Activity duration in milliseconds |
TextChannel#
This data type describes all available data about the text channel.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
name |
String | Channel name |
type |
String | Channel type |
mention |
String | Mention |
guild |
Guild | Server information |
position |
Number | Position number in channel list (1 is top of the list) |
parent |
Category | Category if exists |
topic |
String | Description (Topic) |
canTalk |
Boolean | true if bot can send messages in this channel |
Methods#
sendMessage(Text)
#
createEmbed()
#
Creates a new Embed builder.
Returns: Embed
NewsChannel#
This data type describes all available data about the announcement channel.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
name |
String | Channel name |
type |
String | Channel type |
mention |
String | Mention |
guild |
Guild | Server information |
position |
Number | Position number in channel list (1 is top of the list) |
parent |
Category | Category if exists |
topic |
String | Description (Topic) |
canTalk |
Boolean | true if bot can send messages in this channel |
Methods#
sendMessage(Text)
#
createEmbed()
#
Creates a new Embed builder.
Returns: Embed
VoiceChannel#
This data type describes all available data about the voice channel.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
name |
String | Channel name |
type |
String | Channel type |
mention |
String | Mention |
guild |
Guild | Server information |
position |
Number | Position number in channel list (1 is top of the list) |
parent |
Category | Category if exists |
bitrate |
Number | Audio Bitrate |
region |
String | Channel Region |
members |
List<Member> | List of members currently connected to this channel |
canTalk |
Boolean | true if bot can send messages in this channel |
userLimit |
Number | Member limit on the channel. 0 is no limit. |
Methods#
sendMessage(Text)
#
createEmbed()
#
Creates a new Embed builder.
Returns: Embed
StageChannel#
This data type describes all available data about the stage channel.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
name |
String | Channel name |
type |
String | Channel type |
mention |
String | Mention |
guild |
Guild | Server information |
position |
Number | Position number in channel list (1 is top of the list) |
parent |
Category | Category if exists |
bitrate |
Number | Audio Bitrate |
region |
String | Channel Region |
members |
List<Member> | List of members currently connected to this channel |
ForumChannel#
This data type describes all available data about the forum channel.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
name |
String | Channel name |
type |
String | Channel type |
mention |
String | Mention |
guild |
Guild | Server information |
position |
Number | Position number in channel list (1 is top of the list) |
parent |
Category | Category if exists |
topic |
String | Description (Topic) |
Thread#
This data type describes all available data about the thread.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
name |
String | Channel name |
type |
String | Channel type |
mention |
String | Mention |
guild |
Guild | Server information |
canTalk |
Boolean | true if bot can send messages in this channel |
archived |
Boolean | true if thread has been archived |
invitable |
Boolean | true if members can invite others |
joined |
Boolean | true if bot has joined |
locked |
Boolean | true if thread is locked |
pinned |
Boolean | true if thread is pinned (forum posts only) |
public |
Boolean | true if thread is public |
owner |
Member | Thread Owner |
memberCount |
Number | The current number of members that have joined this thread (capped at 50) |
messageCount |
Number | The current number of messages present in this thread |
totalMessageCount |
Number | The total number of messages sent in this thread, including all deleted messages |
Methods#
sendMessage(Text)
#
createEmbed()
#
Creates a new Embed builder.
Returns: Embed
Category#
This data type describes all available data about the channel category.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
name |
String | Name |
position |
Number | Position number in channel list (1 is top of the list) |
createdAt |
DateTime | Creation date and time |
guild |
Guild | Server information |
Role#
This data type describes all available data about the role.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
name |
String | Name |
iconUrl |
String | Icon URL |
position |
Number | Position number in role list |
createdAt |
DateTime | Creation date and time |
permissionsRaw |
Number | Permissions in raw numeric representation |
managed |
Boolean | true if this role is managed by some integration |
hoisted |
Boolean | true if this role is displayed separately from online members |
publicRole |
Boolean | true if this is public role (@everyone ) |
color |
String | Color in #RRGGBB format |
guild |
Guild | Server information |
Methods#
hasPermission(Name)
#
Checks if this role has global permission.
Returns: Boolean
Parameter | Type | Description |
---|---|---|
Name |
Permission | Permission to check |
hasPermission(Channel, Name)
#
Checks if this role has permission in channel specified.
Returns: Boolean
Parameter | Type | Description |
---|---|---|
Channel |
Number, TextChannel | Text channel ID or channel object |
Name |
Permission | Permission to check |
Message#
This data type describes all available data about the message in text channel.
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
contentRaw |
String | The raw textual content of this message |
contentDisplay |
String | The textual content of this message in the format that would be shown to the Discord client |
contentStripped |
String | The textual content of this message in the format that would be shown to the Discord client and all the markdown stripped |
jumpUrl |
String | Jump-to URL |
channel |
TextChannel | Channel of this message |
guild |
Guild | Server information |
author |
Member | Message author |
createdAt |
DateTime | Creation date and time |
mentionedMembers |
List<Member> | List of mentioned members |
mentionedChannels |
List<TextChannel> | List of mentioned text channels |
mentionedRoles |
List<Role> | List of mentioned roles |
attachments |
List<Attachment> | List of attachments |
referencedMessage |
Message | Reply message |
Methods#
delete()
#
Deletes this message
Attachment#
This data type describes all available data about the message attachment (video, pictures, files).
Properties#
Property | Type | Description |
---|---|---|
id |
Number | Unique identifier |
createdAt |
DateTime | Creation date and time |
url |
String | URL |
proxyUrl |
String | Proxy URL |
fileName |
String | File name |
size |
Number | File size (bytes) |
height |
Number | Image/Video height. -1 for other file types |
width |
Number | Image/Video width. -1 for other file types |
Embed#
This data type describes the Embed message builder. All the methods returns the same builder it is possible to build a method chains like this:
withTitle('Title').withDescription('Description')
Properties#
Property | Type | Description |
---|---|---|
empty |
Boolean | true if empty |
validLength |
Boolean | true if length is valid to send this message |
length |
Number | Current embed length |
Methods#
withContent(Content)
#
withTitle(Name, URL)
#
withAuthor(Name, URL, IconURL)
#
withDescription(Content)
#
appendDescription(String)
#
withThumbnail(URL)
#
withImage(URL)
#
withColor(Color)
#
Sets Embed border color, this method accepts HEX color string, for example #FF0000 for red (you can remove the #).
https://htmlcolorcodes.com/
Returns: Embed
Parameter | Type | Description |
---|---|---|
Color |
String | Embed border color in HEX format |
addField(Name, Value, IsInline)
#
withFooter(Content, IconURL)
#
addReaction(Emote)
#
Adds a reaction to the resulting message of this embed. Works the same as reaction function.
Returns: Embed
Parameter | Type | Description |
---|---|---|
Emote |
String | Emotion in the following formats:
|
addButton(Style, URL_ID, Label, Emote, UUID, Disabled)
#
Adds a button to the resulting message of this embed. Works the same as button function.
Returns: Embed
Parameter | Type | Description |
---|---|---|
Style |
String | Button style:
|
URL_ID |
String | URL for link button or identifier for other button types |
Label |
String | Button label |
Emote |
String | Emotion in the following formats:
(Optional) |
UUID |
String | UUID of Action to execute (Required for all buttons except link button) |
Disabled |
Boolean | If true , button will be disabled |
withDate(Date)
#
addBlankField(IsInline)
#
clearFields()
#
Clears all the Embed Fields added
Returns: Embed
clear()
#
Clears the whole Embed data.
Returns: Embed
error()
#
Makes this Embed styled as error, sets its color to red with Error title.
Returns: Embed
deleteAfterSec(Seconds)
#
send()
#
update(id)
#
Updates message with Embed by the Message ID given.
Returns true
, if message was successfully updated.
You can only edit bot's messages!
Returns: Boolean
Warning! Quota
This means that this method can only be invoked 23 times by the same template.
Parameter | Type | Description |
---|---|---|
id |
Number | Идентификатор сообщения |
AttributesStorage#
This is dynamic type properties of that are automatically generated based on member's attributes.
Warning
You can only access 5 attributes in single message template.
Attribute#
This data type describes all available data about the member attribute. Attributes are used to store custom data tied to member.
Properties#
Property | Type | Description |
---|---|---|
value |
String | Current value |
updatedAt |
DateTime | Update date and time |
Methods#
update(Value)
#
increment(Number)
#
Increments the attribute for specified amount and returns new value. The counting starts from 0 if current value wasn't a number.
Returns: Number
Warning! Quota
This means that this method can only be invoked 14 times by the same template.
Parameter | Type | Description |
---|---|---|
Number |
Number | Increments a numeric value by a specified number |
decrement(Number)
#
Decrements the attribute for specified amount and returns new value. The counting starts from 0 if current value wasn't a number.
Returns: Number
Warning! Quota
This means that this method can only be invoked 14 times by the same template.
Parameter | Type | Description |
---|---|---|
Number |
Number | Decrements a numeric value by a specified number |
clear()
#
Clears attribute and deletes it from database.
Warning! Quota
This means that this method can only be invoked 1 times by the same template.
Arguments#
This data type describes the custom command arguments and options.
Properties#
Property | Type | Description |
---|---|---|
value |
String | Original message string of command invocation. |
args |
List<String> | List of the arguments extracted from the string and split by whitespace. |
targetMember |
Member |
|
Methods#
get(Position)
#
after(Position)
#
before(Position)
#
range(Start, End)
#
getOption(Name)
#
Returns Slash Command option by name.
Returns: String, Number, Boolean, Member, Role, TextChannel, VoiceChannel, Category, Attachment
Parameter | Type | Description |
---|---|---|
Name |
String | Option name |
getOptionsByType(Type)
#
Returns Slash Command options list by type.
Returns: List<String>, List<Number>, List<Boolean>, List<Member>, List<Role>, List<TextChannel>, List<VoiceChannel>, List<Category>, List<Attachment>
Parameter | Type | Description |
---|---|---|
Type |
String | Option type (STRING , INTEGER , DECIMAL , BOOLEAN , MEMBER , ROLE , CHANNEL , MENTIONABLE , ATTACHMENT ) |
Information
Arguments position starts at 1.
Parameters#
This data type describes parameters related information for custom actions.
Properties#
This data type uses a dynamic properties list depending on what exact parameters were passed into the current action using store
method or run tag.
They are accessible by their name as property name.
Methods#
get(Key)
#
store(Key, Value)
#
Information
You can only pass strings or numbers into parameters.
Warning
Parameters lifecycle is limited to 15 minutes from the moment when they were accessed last time!
Component#
This data type describes components related information for custom actions.
Properties#
Property | Type | Description |
---|---|---|
id |
String | Component identifier |
type |
String | Component type:
|
selectedOptions |
List<String> | List of selected options for selection menu component. |
Modal#
This data type describes modals related information for custom actions.
Properties#
Property | Type | Description |
---|---|---|
values |
Map<String, String> | The map containing component identifiers as keys and their submitted values accordingly |
Permission#
This data type describes all the permission available on the Discord. Pass them as Strings to the methods where they are expected.
Permission | Description |
---|---|
MANAGE_CHANNEL |
Manage Channels |
MANAGE_SERVER |
Manage Server |
VIEW_AUDIT_LOGS |
View Audit Logs |
VIEW_CHANNEL |
View Channel(s) |
VIEW_GUILD_INSIGHTS |
View Server Insights |
MANAGE_ROLES |
Manage Roles |
MANAGE_PERMISSIONS |
Manage Permissions |
MANAGE_WEBHOOKS |
Manage Webhooks |
MANAGE_EMOJIS_AND_STICKERS |
Manage Emojis and Stickers |
MANAGE_EVENTS |
Manage Events |
CREATE_INSTANT_INVITE |
Create Instant Invite |
KICK_MEMBERS |
Kick Members |
BAN_MEMBERS |
Ban Members |
NICKNAME_CHANGE |
Change Nickname |
NICKNAME_MANAGE |
Manage Nicknames |
MODERATE_MEMBERS |
Timeout Members |
MESSAGE_ADD_REACTION |
Add Reactions |
MESSAGE_SEND |
Send Messages |
MESSAGE_TTS |
Send TTS Messages |
MESSAGE_MANAGE |
Manage Messages |
MESSAGE_EMBED_LINKS |
Embed Links |
MESSAGE_ATTACH_FILES |
Attach Files |
MESSAGE_HISTORY |
Read History |
MESSAGE_MENTION_EVERYONE |
Mention Everyone |
MESSAGE_EXT_EMOJI |
Use External Emojis |
USE_APPLICATION_COMMANDS |
Use Application Commands |
MESSAGE_EXT_STICKER |
Use External Stickers |
MANAGE_THREADS |
Manage Threads |
CREATE_PUBLIC_THREADS |
Create Public Threads |
CREATE_PRIVATE_THREADS |
Create Private Threads |
MESSAGE_SEND_IN_THREADS |
Send Messages in Threads |
PRIORITY_SPEAKER |
Priority Speaker |
VOICE_STREAM |
Video |
VOICE_CONNECT |
Connect |
VOICE_SPEAK |
Speak |
VOICE_MUTE_OTHERS |
Mute Members |
VOICE_DEAF_OTHERS |
Deafen Members |
VOICE_MOVE_OTHERS |
Move Members |
VOICE_USE_VAD |
Use Voice Activity |
VOICE_START_ACTIVITIES |
Launch Activities in Voice Channels |
REQUEST_TO_SPEAK |
Request to Speak |
ADMINISTRATOR |
Administrator |
UserFlag#
User Flags. Pass flag names as Strings to the methods where they are expected.
Flag | Description |
---|---|
STAFF |
Discord Employee |
PARTNER |
Partnered Server Owner |
HYPESQUAD |
HypeSquad Events |
BUG_HUNTER_LEVEL_1 |
Bug Hunter Level 1 |
BUG_HUNTER_LEVEL_2 |
Bug Hunter Level 2 |
HYPESQUAD_BRAVERY |
HypeSquad Bravery |
HYPESQUAD_BRILLIANCE |
HypeSquad Brilliance |
HYPESQUAD_BALANCE |
HypeSquad Balance |
EARLY_SUPPORTER |
Early Supporter |
TEAM_USER |
Team User |
VERIFIED_BOT |
Verified Bot |
VERIFIED_DEVELOPER |
Early Verified Bot Developer |
CERTIFIED_MODERATOR |
Discord Certified Moderator |
ACTIVE_DEVELOPER |
Active Developer |