Services

Client

Client

getGuild


General

getGuild returns the guild's information.


Usage

Client:getGuild()
Returns: <Guild> guild


Limitations

See discordGuild GET.


Example

print(Client:getGuild().name)

Client

addGuildMember


General

addGuildMember adds a member to the guild using OAuth. It can receive options to arrange the user's abilities in the guild.

Please note that the member also has to be logged into Okwo.


Usage

Client:addGuildMember(<string> userId, <array> options)
Returns: <Member> member

Options should be structured this way:
- <string> accessToken - OAuth user token
- (string) nick - user's nick
- (array) roles - user's roles
- (boolean) mute - if user should be muted
- (boolean) deaf - if user should be deafened


Limitations

See discordGuild PATCH.


Example

print(Client:addMember("545345435234543", {accessToken = "cfsdjgcir4cdsgfg"}).displayName)

Client

fetchGuildAuditLogs

General

fetchGuildAuditLogs fetches the guild's audit logs.


Usage

Client:fetchGuildAuditLogs()
Returns: <array> data

Data array contains AuditLog objects inside.


Limitations

See discordGuild PATCH.


Example

for name,value in pairs(Client:fetchGuildAuditLogs()) do
	print(name,value)
	for name2,value2 in pairs(value) do
		print(name2,value2)
	end
end

Client

fetchGuildBans


General

fetchGuildBans fetches the guild's bans.


Usage

Client:fetchGuildBans()
Returns: <array> data

Data array contains User objects inside.


Limitations

See discordGuild PATCH.


Example

local usersBanned = {}
for id in pairs(Client:fetchGuildBans()) do
	table.insert(usersBanned, id)
end

print(#usersBanned)

Client

sendMessage


General

sendMessage sends a message or an embed to a text channel in the guild.


Usage

Client:sendMessage(<string> channelId, <string> content, (array / Embed / Attachment) options)
Returns: <Message> message

You have to provide either content, attachment or embed. Blank message results in error.


Limitations

See discordMessage POST.


Example

Client:sendMessage("493672466544197633", "Hello there!", Embed.new():addField("Test name", "Test value"))

Client

setCommandEvent


General

setCommandEvent is a method defining a function, which will be called after a command is executed in your Discord guild.


Usage

Client:setCommandEvent(<number> interval, (string) commandName, <function> callback, (number) channelId)
Returns: <Connection> commandConnection

The callback function should use these arguments:
<array> arguments, <Message> message, <number> timestamp

The function is called by the gameCommand.

It is a singleton function. It won't run on all the server - just a single one to avoid function event fired multiple times.


Limitations

See getActionEvent.


Example

function handleTestCommand(args, cmd)
	return Client:editMessage(cmd.confirmation.channel.id, cmd.confirmation.id, "Successfully fetched the message!");
end

Client:setCommandEvent(5, "Test", handleTestCommand) 

Client

sendSector


General

sendSector sends a singleton request to the sector service (for example other place) and returns the requets information.


Usage

Client:sendSector(<string> sectorName, <string> functionName, (ANY) data)
Returns: <SectorRequest> sectorRequest

The callback can be specified with setSectorFunction.


Limitations

See action POST.


Example

Client:setSectorFunction(5, "TrainingGame", "GetData", function(data)
	return {
		success = false;
		message = "Method not setupped yet";
		userId = data.userId;
	}
end, true)

-- CALLING

print(game.HttpService:JSONEncode(
	Client:sendSector("TrainingGame", "GetData", {userId = 21735007}):getResult()
))

Client

getSector


General

getSector returns executed functions in each sector. Works as singleton.


Usage

Client:getSector(<number> interval, <string> sectorName)
Returns: <HttpEvent> httpEvent

It is a singleton function. It won't run on all the server - just a single one to avoid function event fired multiple times.


Limitations

See action GET and POST.


Example

See sendSector.

Client

setSectorFunction


General

setSectorFunction setups a service, which lets you bind a function to a sector (sector can be an unique server or similiar) to return a singleton result.


Usage

Client:setSectorFunction(<number> interval, <string> sectorName, (string) functionName, <function> callback, <boolean> returnEnabled)
Returns: <Connection> sectorConnection

The callback function should use these arguments:
<string> functionName, <ANY> data

The function is called by the sendSector.

It is a singleton function. It won't run on all the server - just a single one to avoid function event fired multiple times.


Limitations

See getSector.


Example

See sendSector.

Client

sendShared


General

sendShared sends a shared service request to every server connected to the token.


Usage

Client:sendShared(<string> sharedName, (ANY) data)
Returns: <boolean> success

The callback can be specified with setSharedEvent.

It is a shared service - it will run on every server connected to the token.


Limitations

See action POST.


Example

Client:setSharedEvent(5, "ShutdownEvent", function(name, data, date)
	print("Shutdown attempted")
	print("Name: ", name)
	print("Data: ", data)
	print("Date: ", date)
end)

Client:sendShared("ShutdownEvent", true)

Client

setSharedEvent


General

setSharedEvent is a method defining a shared service event. It is supposed to receive requests sent across all games.


Usage

Client:setSharedEvent(<number> interval, <string> sharedName, <function> callback)
Returns: <Connection> sharedConnection

The callback function should use these arguments:
<string> name, <ANY> data, <number> date

The event is fired with sendShared.

It is a shared service - it will run on every server connected to the token.


Limitations

See getActionEvent.


Example

See sendShared.

Client

setClockEvent


General

setClockEvent is a method that runs a singleton (cross-server) event every selected period of the time.


Usage

Client:setClockEvent(<number> interval, <string> clockName, (number) clockInterval, <function> callback)
Returns: <HttpEvent> clockEvent

The callback function should use these arguments:
<string> clockName

It is a singleton function. It won't run on all the servers - just a single one to avoid function event fired multiple times.


Limitations

See getActionEvent.


Example

Client:setClockEvent(5, "TestClock", 60000, function(name)
	print("Clock ran ", name, tick())
end)

Client

getActionEvent


General

getActionEvent is a method handling the most of the main services.


Usage

Client:getActionEvent(<number> interval, <string> clockName, (number) clockInterval, <function> callback)
Returns: <HttpEvent> actionEvent

The callback function should use these arguments:
<string> actionType, <array> action, <number> id


Limitations

See action GET.


Example

Command's usage is mainly framework of the module. It is not supposed to be used in your own scripts.

Client

getChannel


General

getChannel returns a Discord channel from the connected guild by the given ID.


Usage

Client:getChannel(<string> channelId)
Returns: <Channel> channel


Limitations

See discordChannel GET.


Example

print(Client:getChannel("521329297428840448") ~= nil)

Client

unBanUser


General

unBanUser unbans a certain user by their userID. Reason can be specified.


Usage

Client:unBanUser(<string> userId, (string) reason)
Returns: <User> user


Limitations

See discordGuild PATCH.


Example

print(Client:unBanUser("287873849738002434", "That was a test").username)

Client

pruneGuildMembers


General

pruneGuildMembers kicks the members who were inactive for a certain time and had not been assigned any roles.


Usage

Client:pruneGuildMembers(<number> days, (boolean) dry, (string) reason)
Returns: <User> user

Set the dry to true, if you want to check how much people would have been kicked (without kicking them).


Limitations

See discordGuild PATCH.


Example

print(Client:pruneGuildMembers(1, true, "TEST"))

Client

setGuildAfkChannel


General

setGuildAfkChannel sets the guild's AFK (Away From Keyboard) voice channel.


Usage

Client:setGuildAfkChannel(<string> afkChannelId, (string) reason)
Returns: <Guild> guild


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildAfkChannel('561553820367454219', 'New afk channel :D').afkChannel.name)

Client

setGuildAfkTimeout


General

setGuildAfkTimeout sets the guild's voice AFK timeout.


Usage

Client:setGuildAfkTimeout(<number> afkTimeout, (string) reason)
Returns: <Guild> guild


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildAfkTimeout(30 * 60, '30 minute timeout').afkTimeout)

Client

setGuildDefaultMessageNotifications


General

setGuildDefaultMessageNotifications sets the default message notifications for the guild.


Usage

Client:setGuildDefaultMessageNotifications(<string / number> defaultMessageNotifications, (string) reason)
Returns: <Guild> guild

defaultMessageNotifications may be:
- MENTIONS
- ALL


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildDefaultMessageNotifications('MENTIONS', 'Changed the default notifications!').defaultMessageNotifications)

Client

setGuildExplicitContentFilter


General

setGuildExplictContentFilter sets the messages filtering option.


Usage

Client:setGuildExplicitContentFilter(<number> explicitContentFilter, (string) reason)
Returns: <Guild> guild

explicitContentFilter may be:
- 0 - Don't scan any messages
- 1 - Scan messages from members without any role
- 2 - Scan messages from everybody


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildExplicitContentFilter(1, "TESTING :)").explicitContentFilter)

Client

setGuildIcon


General

setGuildIcon sets a new icon for the guild.


Usage

Client:setGuildIcon(<string> iconUrl, (string) reason)
Returns: <Guild> guild

iconUrl must be a link in an image format, such as JPEG, JPG, PNG.


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildIcon('https://0q0.eu/img/okwoteam.png', 'new icon :D').iconURL)

Client

setGuildName


General

setGuildName sets a new name for the guild.


Usage

Client:setGuildName(<string> name, (string) reason)
Returns: <Guild> guild


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildName("Okwo Test", "Testing the new game!").name)

Client

setGuildRegion


General

setGuildRegoin sets a new server region for the guild.


Usage

Client:setGuildRegion(<string> region, (string) reason)
Returns: <Guild> guild


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildRegion("japan", "Testing the new region!").region)

Client

setGuildSplash


General

setGuildSplash sets a new custom invite link to the guild. This method only works in guilds owned by Discord partners.


Usage

Client:setGuildSplash(<string> splashUrl, (string) reason)
Returns: <Guild> guild


Limitations

See discordGuild PATCH.

Client

setGuildSystemChannel


General

setGuildSystemChannel sets a new system channel for the guild.


Usage

Client:setGuildSystemChannel(<string> systemChannelId, (string) reason)
Returns: <Guild> guild


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildSystemChannel("521329297428840448", "New system channel").systemChannel.name)

Client

setGuildVerificationLevel


General

setGuildVerificationLevel sets a new verification level for the guild.


Usage

Client:setGuildVerificationLevel(<number> verificationLevel, (string) reason)
Returns: <Guild> guild

verificationLevel may be:
- 0 - None, no restrictions.
- 1 - Low, members must have a verified email on their Discord account.
- 2 - Medium, members must be registered on Discord for more than 5 minutes, with the previous restrictions.
- 3 - High, members must have joined the guild for more than 10 minutes, with the previous restrictions.
- 4 - Extreme, members must have a verified phone on their Discord account, with the previous restrictions.


Limitations

See discordGuild PATCH.


Example

print(Client:setGuildVerificationLevel(1, "New verification level").verificationLevel)

Client

editGuild


General

editGuild edits the guild.


Usage

Client:setGuildVerificationLevel(<array> data, (string) reason)
Returns: <Guild> guild

data may be:
- (string) name
- (string) region
- (number) verificationLevel
- (number) explicitContentFilter
- (string) afkChannel
- (string) systemChannel
- (number) afkTimeout
- (string) icon
- (string) splash

Icon must be the source of an image, it CANNOT be an URL like in the setGuildIcon.


Limitations

See discordGuild PATCH.


Example

local editor = Client:editGuild({region = "singapore"}, "testing!")
print(editor.region)

editGuild.PNG

Client

fetchGuildVanityCode


General

fetchGuildVanityCode fetches the vanity code (custom invite link code) of the guild. Only works in guilds that are owned by Discord partners.


Usage

Client:fetchGuildVanityCode()
Returns: <string> vanityCode


Limitations

See discordGuild PATCH.

 

Client

getDate


General

getDate gets the current time and date.


Usage

Client:getDate()
Returns: <Array> date

Date contains as shown in the example:
- (number) miliseconds
- (number) seconds
- (number) minutes
- (number) hour
- (number) day
- (number) weekday
- (number) month
- (number) year
- (number) timestamp
- (string) locale
- (string) localedate
- (string) localetime


Limitations

Global limit 5 requests per minute.


Example

for name, value in pairs(Client:getDate()) do
	print(name, value)
end

getDate_1.png

Client

getUserByRobloxId


General

getUserByRobloxId returns a user's Discord ID linked to the given Roblox account.


Usage

Client:getUserByRobloxId(<string> userId)
Returns: <string> DiscordId

The UserId entered must be linked to a discord account, and their Roblox account must be valid. Otherwise, the method will return nil.


Limitations

Global limit 75 requests per minute.


Example

print(Client:getUserByRobloxId("75661526"))

getUserByRobloxId.png

Client

getUserRobloxId


General

getUserRobloxId returns the user's Roblox ID linked to the given Discord account.


Usage

Client:getUserRobloxId(<string> DiscordId)
Returns: <string> userId

The DiscordId entered must be linked to a Roblox account, and Discord account must be valid. Otherwise, the method will return nil.


Limitations

Global limit 75 requests per minute.


Example

print(Client:getUserRobloxId("186185101112115201"))

getUserRobloxId.png

Client

fetchChannelWebhooks


General

fetchChannelWebhooks returns a list of requested channels webhooks.


Usage

Client:fetchChannelWebhooks(<string> channelId)
Returns: <array> Data

Function returns an array containing Webhook objects.
If there are no webhooks in the guild, this will return an empty table.


Limitations

See discordChannel PATCH.


Example

for name,value in pairs(Client:fetchChannelWebhooks("567855043739516928")) do
	print(name,value)
	for name2,value2 in pairs(value) do
		print(name2,value2)
	end
end

fetchChannelWebhooks.png

Client

fetchGuildVoiceRegions


General

fetchGuildVoiceRegions fetches the voice regions available for the guild.


Usage

Client:fetchGuildVoiceRegions()
Returns: <array> data

Data array contains VoiceRegion objects inside.


Limitations

See discordGuild PATCH.


Example

local voiceRegions = {}
for id in pairs(Client:fetchGuildVoiceRegions()) do
	table.insert(voiceRegions, id)
end
print(#voiceRegions)

Client

setLinkEvent

General

setLinkEvent setups a link event. It will do whatever the callback function does when the link executes.


Usage

Client:setLinkEvent(<number> interval, <string> linkName, <function> callback)
Returns: <Connection> linkConnection

The callback function should use these arguments:
<arraydata, <number> date

This event is fired by triggering the website. Please generate a link beforehand, it can be generated using generateLink.

This is a singleton function, it won't run on all the servers - just a single one to avoid function event fired multiple times.


Limitations

See getLink.


Example

Client:setLinkEvent(5, "welcome", function(data)
	print("Welcome ", data.member.displayName)
end)

setLinkEvent.PNG

Client

generateLink

General

generateLink generates a link to the Okwo website, it can be paired with setLinkEvent to bring a connection between the website and the game.


Usage

Client:generateLink(<string> linkName)
Returns: <string> link


Limitations

None.


Example

print(Client:generateLink("linkGen"))

generateLink.PNG

Client

getLink


General

getLink returns executed links. Works as a singleton.


Usage

Client:getLink(<number> interval, <string> linkName)
Returns: <HttpEvent> httpEvent

It is a singleton function. It won't run on all the server - just a single one to avoid function event fired multiple times.


Limitations

See action GET.


Example

See setLinkEvent.

Client

createChannel

General

createChannel creates a new channel in the guild.


Usage

Client:createChannel(<string> name, (array) options)
Returns: <Channel> channel

Options may contain:
(string) type - Type of the channel.
(string) name - The name of the channel.
(number) position - The position visible to the user
(string) topic - The topic of the channel, use only when the type of channel is text.
(boolean) nsfw - The NSFW setting for the channel, use only when the type of channel is text.
(number) bitrate - The bitrate of the voice channel.
(number) userLimit - The maximum amount of users to contain in a voice channel.
(string) parent - The ID of the parent category channel.
(array) permissionOverwrites - The permission to overwrite, see permissionOverwrites.
(number) rateLimitPerUser - Sets the slowmode message limit in the text channel.


Limitations

See discordChannel POST.


Example

local channel = Client:createChannel("TestChannel", { type = "text" })
print(channel.name)

createChannel.PNG

Client

getChannels

General

getChannels returns the data of all channels in a guild, in ascending or descending order.


Usage

Client:getChannels((number) chunkID, (boolean) ascending)
Returns: <array> channels

Returned array contains Channel objects.


Limitations

See discordChannel GET.


Example

for _, channel in pairs(Client:getChannels()) do
	print(channel.name)
end

getChannels.PNG

Client

sortChannels

General

sortChannels returns all the channels in a guild, but by the given property. Like with the getChannels, the output can be sorted in ascending or descending order.


Usage

Client:sortChannels(<string> property, (number) chunkID, (boolean) ascending)
Returns: <array> channels

Returned array contains Channel objects.


Limitations

See discordChannel GET.


Example

for _, channel in pairs(Client:sortChannels("lastMessageID")) do
	print(channel.name)
end

sortChannels.PNG

Client

fetchGuildWebhooks


General

fetchGuildWebhooks returns a list of requested guild webhooks.


Usage

Client:fetchChannelWebhooks()
Returns: <array> data

Data array contains Webhook objects inside.
If there are no webhooks in the guild, this will return an empty table.


Limitations

See discordGuild PATCH.


Example

for name,value in pairs(Client:fetchGuildWebhooks()) do
	print(name,value)
	for name2,value2 in pairs(value) do
		print(name2,value2)
	end
end

Client

isMemberMentionedInMessage


General

isMemberMentionedInMessage checks if a certain member is mentioned in a specific message by their IDs.


Usage

Client:isMemberMentionedInMessage(<string> channeld, <string> messageId, <string> memberId)
Returns: <boolean> data


Limitations

See discordMessage PATCH.


Example

print(Client:isMemberMentionedInMessage("569166849099694093", "569406593251409970", "499076419498803200"))

Client

isMentionedInMessage


General

isMentionedInMessage checks if a certain channel / user / role is mentioned in a specific message by their IDs. 


Usage

Client:isMentionedInMessage(<string> channeld, <string> messageId, <string> dataId)
Returns: <boolean> data


Limitations

See discordMessage PATCH.


Example

In this example, this method checks a channel.

print(Client:isMentionedInMessage("569166849099694093", "569429011143327744", "569128269312557088"))

Client

pinMessage


General

pinMessage pins a message to the channel by its ID.


Usage

Client:pinMessage(<string> channeld, <string> messageId)
Returns: <Message> Message


Limitations

See discordMessage PATCH.


Example

local pinner = Client:pinMessage("569166849099694093", "569409759179177994")

print(pinner.content)

Client

reactMessage

General

reactMessage reacts to a message with a particular emoji in a channel by their IDs.


Usage

Client:reactMessage(<string> channeld, <string> messageId, <string> emoji)
Returns: <Reaction> Reaction


Limitations

See discordMessage PATCH.


Example

local emojiadder = Client:reactMessage("569166849099694093", "569412027672428554", "😂")

print(emojiadder.count)

Client

fetchMessageReactions


General

fetchMessageReactions fetches all the reactions in a message.


Usage

Client:fetchMessageReactions(<string> channelId, <string> messageId, <string> reaction, (number) limit, (array) options)
Returns: <array> data

Data array contains Reaction objects inside.
If there are no reactions in the message, this will return an empty table.

Options is an array, it may contain:
(string) before - Users with lower ID than....
(string) after - Users with higher ID than...


Limitations

See discordMessage PATCH.


Example

local message = Client:getMessage("493672466544197633", "569464667869544448")

for reactionId, reaction in pairs(message.reactions) do
    for _, user in pairs(Client:fetchMessageReactions("493672466544197633", "569464667869544448", reactionId)) do
        print(user.username)
    end
end

 

Client

deleteMessageReaction


General

deleteMessageReaction deletes a reaction from a message, no matter how many members have reacted using the corresponding emoji.


Usage

Client:deleteMessageReaction(<string> channelId, <string> messageId, <string> reaction, (string) user)
Returns: <array> data

Data array contains Reaction objects inside.
If there are no reactions in the message, this will return an empty table.


Limitations

See discordMessage PATCH.


Example

local message = Client:getMessage("493672466544197633", "569466540043534347")

for reactionId, reaction in pairs(message.reactions) do
    print(Client:deleteMessageReaction("493672466544197633", "569466540043534347", reactionId, '244728151693983744'))
end

 

Client

unPinMessage


General

unPinMessage unpins a message from the channel by their IDs.


Usage

Client:unPinMessage(<string> channeld, <string> messageId)
Returns: <Message> Message


Limitations

See discordMessage PATCH.


Example

local unpinner = Client:unPinMessage("569166849099694093", "569438635338891274")
wait(2)
print(unpinner.pinned)

Client

getMessage


General

getMessage retrieves a message that was sent in a channel.


Usage

Client:getMessage(<string> channelId, <string> messageId)
Returns: <Message> message


Limitations

See discordMessage GET.


Example

local getMsg = Client:getMessage("569166849099694093", "569409759179177994")
print(getMsg.content)

 

 

Client

deleteMessage


General

deleteMessage deletes a message that is sent in a channel.


Usage

Client:deleteMessage(<string> channelId, <string> messageId)
Returns: <Message> Message


Limitations

See discordMessage DELETE.


Example

print(Client:deleteMessage("569166849099694093", "569432303126970378"))

Client

clearMessageReactions


General

clearMessageReactions deletes all the reactions from a message that is sent in a channel.


Usage

Client:clearMessageReactions(<string> channelId, <string> messageId)
Returns: <boolean> success


Limitations

See discordMessage PATCH.


Example

This example checks if the message still has any reactions after clearing them using this method.

local message = Client:clearMessageReactions("493672466544197633", "569451989465825280")

local count = 0
for _ in pairs(message.reactions) do
    count = count + 1
end
print(count)

Client

fetchChannelPinnedMessages


General

fetchChannelPinnedMessages returns a list of pinned messages from the requested channel.


Usage

Client:fetchChannelPinnedMessages (<string> channelId)
Returns: <array> Data

If the channelId is invalid, this will return nil.
If there are no pinned messages in the channel, this will return an empty table.


Limitations

See discordChannel PATCH.


Example

for name,value in pairs(Client:fetchChannelPinnedMessages("569166849099694093")) do
	print(name,value)
	for name2,value2 in pairs(value) do
		print(name2,value2)
	end
end

Client

cloneChannel


General

cloneChannel clones an existing text / voice / category channel in the guild.


Usage

Client:cloneChannel(<string> channelId, (string) name, (boolean) withPermissions, (boolean) withTopic, (string) reason)
Returns: <Channel> Channel


Limitations

See discordChannel PATCH.


Example

local cloneChannel = Client:cloneChannel("569166849099694093", "testchannel2", true, true, "Cloning a channel!")
print (cloneChannel.name)

Client

editMessage


General

editMessage edits a specific message in a text channel.


Usage

Client:sendMessage(<string> channelId, <string> content, (array / Embed / Attachment) options)
Returns: <Message> message


Limitations

See discordMessage PATCH.


Example

local sendMsg = Client:sendMessage("569166849099694093", "Testy testy not edited!")
print(sendMsg.content)
wait(2)
local editMsg = Client:editMessage("569166849099694093", sendMsg.id, "Testy testy edited!")
print(editMsg.content)

Client

getSingleton


General

getSingleton returns executed singletons. Works cross-server if the same name has been assigned.


Usage

Client:getLink(<number> interval, <string> signletonName)
Returns: <HttpEvent> httpEvent

It is a shared function. It works cross-server if the same name is assigned.


Limitations

See action GET.


Example

See setSingletonEvent.

Client

setSingletonEvent


General

setSingletonEvent is a method defining a singleton service event. It is supposed to receive requests sent across all games.


Usage

Client:setSingletonEvent(<number> interval, <string> singletonName, <function> callback)
Returns: <Connection> singletonConnection

The callback function should use these arguments:
<ANY> data, <number> date

The event is fired with sendSingleton.

It is a shared service - it will run on every server connected to the token and assigned the same name.


Limitations

See getSingleton.


Example

See sendSingleton.

Client

sendSingleton


General

sendSingleton sends a singleton service request to every server connected to the token with the same name. Only the first sent singleton within a minute will be received by the event.


Usage

Client:sendSingleton(<string> singletonName, (ANY) data)
Returns: <boolean> success

The callback can be specified with setSingletonEvent.

It is a shared service - it will run on every server connected to the token which is assigned the same singleton name.


Limitations

See action POST.


Example

Client:setSingletonEvent(5, "hello", function(singleton, date)
	print(singleton, date)
end)

print("1st received:", Client:sendSingleton("hello", "Is anyone there?"))
wait(5)
print("2nd received:", Client:sendSingleton("hello", "HELLO! PLEASE ANSWER"))
wait(90)
print("3rd received:", Client:sendSingleton("hello", "ANSWER ASAP"))

Client

createChannelInvite


General

createChannelInvite creates a new guild invite with the given landing channel where new members would see when they first join the guild.


Usage

Client:createChannelInvite(<string> channelId, (array) options, (string) reason)
Returns: <Invite> Invite

Options may contain the following:
(boolean) temporary - Controls whether members who joined using the invite shall be kicked after 24 hours if they have not been assigned a role.
(number) maxAge - Controls how long the invite should last. (in seconds, enter 0 if for forever)
(number) maxUses - Controls the maximum amount of uses.
(boolean) unique - Controls whether the invite should be a new one, or an existing one with similar settings.


Limitations

See discordChannel PATCH.


Example

local invite = Client:createChannelInvite("569166849099694093")
print(invite.code)

 

Client

createChannelWebhook


General

createChannelWebhook creates a new webhook that can send messages in the given channel.


Usage

Client:createChannelWebhook (<string> channelId, <string> name, (string) avatar, (string) reason)
Returns: <Webhook> Webhook


Limitations

See discordChannel PATCH.


Example

print(Client:createChannelWebhook("569166849099694093", "Testing").id)

Client

fetchChannelInvites

General

fetchChannelInvites fetches all the guild invites that have the same landing channel.


Usage

Client:fetchChannelInvites(<string> channelId)
Returns: <array> data

Data array contains Invite objects inside.
If there are no invites in the channel, this will return an empty table.


Limitations

See discordChannel PATCH.


Example

for name,value in pairs(Client:fetchChannelInvites("569166849099694093")) do
	print(name,value)
	for name2,value2 in pairs(value) do
		print(name2,value2)
	end
end

Client

deleteChannelInvite


General

deleteChannelInvite deletes an invite from a channel by the given invite code.


Usage

Client:deleteChannelInvite(<string> channelId, <string> invite, (string) reason)
Returns: <Invite> invite

Invite (in the argument) is the code of the invite. Insert the code only, otherwise this will return an error.


Limitations

See discordChannel PATCH.


Example

local deleter = Client:deleteChannelInvite("574945471760695315", "npQNVZ")
print(deleter.uses)

 

Client

lockChannelPermissions


General

lockChannelPermissions syncs the given text/voice channel's permissions with its parent category.


Usage

Client:lockChannelPermissions(<string> channelId)
Returns: <Channel> Channel


Limitations

See discordChannel PATCH.


Example

local locker = Client:lockChannelPermissions("574945471760695315")
print(locker.parent.manageable)

Client

getChannelMemberPermissions


General

getChannelMemberPermissions returns a specific member's permissions in a given channel.


Usage

Client:getChannelMemberPermissions(<string> channelId, <string> memberId)
Returns: <Permissions> Permissions


Limitations

See discordChannel PATCH.


Example

Client

overwriteChannelPermissions


General

overwriteChannelPermissions overwrites a channel's permissions for a user / role.


Usage

Client:overwriteChannelPermissions(<string> channelId, <string> objectId, <array> options, (string) reason)
Returns: <Channel> Channel

The array of options should have indexes of permission names, with one value of either:
- true (enabled)
- null (unset)
- false (disabled)

ObjectId should be a user or role ID. If the given string is not one, the execution will return an error.


Limitations

See discordChannel PATCH.


Example

local overwriter = Client:overwriteChannelPermissions(
    "574945471760695315", 
    "244728151693983744", 
    {
		--enabled things
    	["VIEW_CHANNEL"] = true,
    	["SEND_MESSAGES"] = true,
    	["EMBED_LINKS"] = true,
    	["ATTACH_FILES"] = true,

		--disabled things
    	["SEND_TTS_MESSAGES"] = false,
    	["MANAGE_MESSAGES"] = false,
    	["READ_MESSAGE_HISTORY"] = false,
    	["MENTION_EVERYONE"] = false
    }
)
print(overwriter.permissionOverwrites["244728151693983744"] ~= nil)

 

 

 

 

Webhook

Webhook

sendMessage


General

sendMessage is a method letting you send a message or embed to the channel with the webhook.


Usage

Webhook:sendMessage(<string> content, (array / Embed / Attachment) options)
Returns: <Message> message

You have to provide either content, attachment or embed. Blank message results in error.


Limitations

Upgrade Type Limit ( per 1s )
STANDARD (0) 30

 


Example

Webhook:sendMessage("Hello there!", Embed.new():addField("Test name", "Test value"))
Webhook

edit


General

edit is a method which lets you edit your webhook's name and avatar.


Usage

Webhook:edit(<string> name, (string) avatarUrl)
Returns: <Webhook> webhook

Using non-URL string in avatar will result in error.


Limitations

Upgrade Type Limit ( per 1s )
STANDARD (0) 1

 


Example

Webhook:edit("Mark", "https://0q0.eu/img/okwo.png")
Webhook

delete


General

delete is a method removing the webhook.


Usage

Webhook:delete(<string> reason)
Returns: <boolean> success

This action is irreversible!


Limitations

Upgrade Type Limit ( per 1s )
STANDARD (0) 1

 


Example

Webhook:delete("Webhook is no longer needed!")

Webhook Tutorial


Client is much more advanced tool with more possibilities! We recommend it much.
But if it's still not what you are looking for, feel free to use our Webhook offer.

Have you ever wondered if Okwo supports Webhooks? Yes, it does! And so we support pretty much features with that!

Client Tutorial

WIP