├── .gitignore ├── Examples ├── Basic Commands.swift ├── Buttons.swift ├── Select Menu.swift └── Slash Commands.swift ├── LICENSE ├── Package.resolved ├── Package.swift ├── README.md ├── Sources └── Swiftcord │ ├── Gateway │ ├── EventHandler.swift │ ├── Gateway.swift │ ├── GatewayHandler.swift │ ├── Heartbeat.swift │ ├── ListenerAdapter.swift │ ├── Payload.swift │ ├── Shard.swift │ └── ShardManager.swift │ ├── Rest │ ├── EndpointInfo.swift │ ├── Endpoints.swift │ ├── MultipartBody.swift │ ├── RateLimit.swift │ └── Request.swift │ ├── Swiftcord.swift │ ├── Types │ ├── Activities.swift │ ├── AuditLog.swift │ ├── Channel.swift │ ├── DM.swift │ ├── EmbedBuilder.swift │ ├── Emoji.swift │ ├── GroupDM.swift │ ├── Guild.swift │ ├── GuildCategory.swift │ ├── GuildText.swift │ ├── GuildVoice.swift │ ├── Icon.swift │ ├── Interactions │ │ ├── ActionRow.swift │ │ ├── ApplicationCommands.swift │ │ ├── Button.swift │ │ ├── Component.swift │ │ ├── Events │ │ │ ├── ButtonEvent.swift │ │ │ ├── InteractionEvent.swift │ │ │ ├── InteractionResponse.swift │ │ │ ├── MessageCommandEvent.swift │ │ │ ├── SelectMenuEvent.swift │ │ │ ├── SlashCommandEvent.swift │ │ │ ├── TextInputEvent.swift │ │ │ └── UserCommandEvent.swift │ │ ├── MessageCommand.swift │ │ ├── Modal.swift │ │ ├── SelectMenu.swift │ │ ├── SlashCommands.swift │ │ ├── TextInput.swift │ │ └── UserCommand.swift │ ├── Invite.swift │ ├── Member.swift │ ├── Message.swift │ ├── Options.swift │ ├── Role.swift │ ├── ScheduledEvent.swift │ ├── Snowflake.swift │ ├── Stage.swift │ ├── Sticker.swift │ ├── Thread.swift │ ├── User.swift │ ├── VoiceState.swift │ └── Webhook.swift │ └── Utils │ ├── Bucket.swift │ ├── Enums.swift │ ├── Error.swift │ ├── Imageable.swift │ ├── JSON.swift │ ├── Log.swift │ ├── Updatable.swift │ └── Utils.swift ├── Tests └── SwiftcordTests │ └── SwiftcordTests.swift ├── credits.md ├── docs ├── css │ └── site.css ├── documentation │ └── swiftcord │ │ ├── actionrow │ │ ├── components.html │ │ ├── index.html │ │ ├── init(components:).html │ │ └── type.html │ │ ├── activities │ │ ├── index.html │ │ ├── init(name:type:url:).html │ │ ├── name.html │ │ ├── type.html │ │ └── url.html │ │ ├── activitytype │ │ ├── !=(_:_:).html │ │ ├── competing.html │ │ ├── custom.html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── listening.html │ │ ├── playing.html │ │ ├── rawrepresentable-implementations.html │ │ ├── streaming.html │ │ └── watching.html │ │ ├── applicationchoices │ │ ├── index.html │ │ ├── name.html │ │ └── value.html │ │ ├── applicationcommandoptions │ │ ├── addchoice(name:value:).html │ │ ├── addchoices(choices:).html │ │ ├── autocomplete.html │ │ ├── channeltypes.html │ │ ├── choices.html │ │ ├── description.html │ │ ├── index.html │ │ ├── init(name:description:type:).html │ │ ├── name.html │ │ ├── required.html │ │ ├── setrequired(required:).html │ │ └── type.html │ │ ├── applicationcommandtype │ │ ├── !=(_:_:).html │ │ ├── bool.html │ │ ├── channel.html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── int.html │ │ ├── mentionable.html │ │ ├── number.html │ │ ├── rawrepresentable-implementations.html │ │ ├── role.html │ │ ├── string.html │ │ ├── subcommand.html │ │ ├── subcommandgroup.html │ │ └── user.html │ │ ├── applicationtype │ │ ├── !=(_:_:).html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── messagecommand.html │ │ ├── rawrepresentable-implementations.html │ │ ├── slashcommand.html │ │ └── usercommand.html │ │ ├── attachment │ │ ├── filename.html │ │ ├── height.html │ │ ├── id.html │ │ ├── index.html │ │ ├── proxyurl.html │ │ ├── size.html │ │ ├── url.html │ │ └── width.html │ │ ├── auditlog │ │ ├── entries.html │ │ ├── entry │ │ │ ├── actiontype.html │ │ │ ├── change │ │ │ │ ├── index.html │ │ │ │ ├── key.html │ │ │ │ ├── newvalue.html │ │ │ │ └── oldvalue.html │ │ │ ├── changes.html │ │ │ ├── event │ │ │ │ ├── !=(_:_:).html │ │ │ │ ├── botadd.html │ │ │ │ ├── channelcreate.html │ │ │ │ ├── channeldelete.html │ │ │ │ ├── channeloverwritecreate.html │ │ │ │ ├── channeloverwritedelete.html │ │ │ │ ├── channeloverwriteupdate.html │ │ │ │ ├── channelupdate.html │ │ │ │ ├── emojicreate.html │ │ │ │ ├── emojidelete.html │ │ │ │ ├── emojiupdate.html │ │ │ │ ├── equatable-implementations.html │ │ │ │ ├── guildscheduledeventcreate.html │ │ │ │ ├── guildscheduledeventdelete.html │ │ │ │ ├── guildscheduledeventupdate.html │ │ │ │ ├── guildupdate.html │ │ │ │ ├── hash(into:).html │ │ │ │ ├── hashvalue.html │ │ │ │ ├── index.html │ │ │ │ ├── integrationcreate.html │ │ │ │ ├── integrationdelete.html │ │ │ │ ├── integrationupdate.html │ │ │ │ ├── invitecreate.html │ │ │ │ ├── invitedelete.html │ │ │ │ ├── inviteupdate.html │ │ │ │ ├── memberbanadd.html │ │ │ │ ├── memberbanremove.html │ │ │ │ ├── memberdisconnect.html │ │ │ │ ├── memberkick.html │ │ │ │ ├── membermove.html │ │ │ │ ├── memberprune.html │ │ │ │ ├── memberroleupdate.html │ │ │ │ ├── memberupdate.html │ │ │ │ ├── messagebulkdelete.html │ │ │ │ ├── messagedelete.html │ │ │ │ ├── messagepin.html │ │ │ │ ├── messageunpin.html │ │ │ │ ├── rawrepresentable-implementations.html │ │ │ │ ├── rolecreate.html │ │ │ │ ├── roledelete.html │ │ │ │ ├── roleupdate.html │ │ │ │ ├── stagecreate.html │ │ │ │ ├── stagedelete.html │ │ │ │ ├── stageupdate.html │ │ │ │ ├── stickercreate.html │ │ │ │ ├── stickerdelete.html │ │ │ │ ├── stickerupdate.html │ │ │ │ ├── threadcreate.html │ │ │ │ ├── threaddelete.html │ │ │ │ ├── threadupdate.html │ │ │ │ ├── webhookcreate.html │ │ │ │ ├── webhookdelete.html │ │ │ │ └── webhookupdate.html │ │ │ ├── id.html │ │ │ ├── index.html │ │ │ ├── options.html │ │ │ ├── reason.html │ │ │ ├── targetid.html │ │ │ └── userid.html │ │ ├── guildscheduledevents.html │ │ ├── index.html │ │ ├── threads.html │ │ ├── users.html │ │ └── webhooks.html │ │ ├── button │ │ ├── customid.html │ │ ├── disabled.html │ │ ├── emoji.html │ │ ├── index.html │ │ ├── init(customid:disabled:style:label:emoji:url:).html │ │ ├── label.html │ │ ├── style.html │ │ ├── type.html │ │ └── url.html │ │ ├── buttonbuilder │ │ ├── addcomponent(component:).html │ │ ├── components.html │ │ ├── content.html │ │ ├── embeds.html │ │ ├── index.html │ │ └── init(message:embed:).html │ │ ├── buttoncomponentdata │ │ ├── componenttype.html │ │ ├── customid.html │ │ └── index.html │ │ ├── buttonevent │ │ ├── channelid.html │ │ ├── deferreply(_:).html │ │ ├── delete(_:).html │ │ ├── edit(message:then:).html │ │ ├── editwithbuttons(buttons:then:).html │ │ ├── editwithembeds(embeds:then:).html │ │ ├── editwithselectmenu(menu:then:).html │ │ ├── ephemeral.html │ │ ├── guild.html │ │ ├── index.html │ │ ├── interactionevent-implementations.html │ │ ├── interactionid.html │ │ ├── isdefered.html │ │ ├── member.html │ │ ├── reply(message:then:).html │ │ ├── replybuttons(buttons:then:).html │ │ ├── replyembeds(embeds:then:).html │ │ ├── replyselectmenu(menu:then:).html │ │ ├── selectedbutton.html │ │ ├── setephemeral(isephermeral:).html │ │ ├── swiftcord.html │ │ ├── token.html │ │ └── user.html │ │ ├── buttonstyles │ │ ├── !=(_:_:).html │ │ ├── blurple.html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── green.html │ │ ├── grey.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── rawrepresentable-implementations.html │ │ ├── red.html │ │ └── url.html │ │ ├── channel │ │ ├── delete(then:).html │ │ ├── id.html │ │ ├── index.html │ │ ├── swiftcord.html │ │ └── type.html │ │ ├── channeltype │ │ ├── !=(_:_:).html │ │ ├── dm.html │ │ ├── equatable-implementations.html │ │ ├── groupdm.html │ │ ├── guildcategory.html │ │ ├── guildnews.html │ │ ├── guildnewsthread.html │ │ ├── guildprivatethread.html │ │ ├── guildpublicthread.html │ │ ├── guildstage.html │ │ ├── guildstore.html │ │ ├── guildtext.html │ │ ├── guildvoice.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ └── rawrepresentable-implementations.html │ │ ├── commandable │ │ ├── execute(_:_:).html │ │ ├── index.html │ │ ├── name.html │ │ └── options.html │ │ ├── commandoptions │ │ ├── aliases.html │ │ ├── description.html │ │ ├── index.html │ │ ├── init(aliases:description:iscasesensitive:requirements:).html │ │ ├── iscasesensitive.html │ │ └── requirements.html │ │ ├── commandrequirements │ │ ├── channels.html │ │ ├── guilds.html │ │ ├── index.html │ │ ├── init(channels:guilds:permissions:users:).html │ │ ├── permissions.html │ │ └── users.html │ │ ├── component │ │ ├── index.html │ │ └── type.html │ │ ├── componenttypes │ │ ├── !=(_:_:).html │ │ ├── actionrow.html │ │ ├── button.html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── rawrepresentable-implementations.html │ │ └── selectmenu.html │ │ ├── dm │ │ ├── addreaction(_:to:then:).html │ │ ├── channel-implementations.html │ │ ├── delete(then:).html │ │ ├── deletemessage(_:then:).html │ │ ├── deletemessages(_:then:).html │ │ ├── deletereaction(_:from:by:then:).html │ │ ├── editmessage(_:with:then:).html │ │ ├── getmessage(_:then:).html │ │ ├── getmessages(with:then:).html │ │ ├── getpinnedmessages(then:).html │ │ ├── getreaction(_:from:then:).html │ │ ├── id.html │ │ ├── index.html │ │ ├── lastmessageid.html │ │ ├── pin(_:then:).html │ │ ├── recipient.html │ │ ├── send(_:then:)-1ym1q.html │ │ ├── send(_:then:)-39qc9.html │ │ ├── send(_:then:)-4gome.html │ │ ├── send(_:then:)-7gex2.html │ │ ├── send(_:then:)-97v6d.html │ │ ├── swiftcord.html │ │ ├── textchannel-implementations.html │ │ ├── type.html │ │ └── unpin(_:then:).html │ │ ├── embed │ │ ├── addfield(_:value:isinline:).html │ │ ├── author-swift.property.html │ │ ├── author-swift.struct │ │ │ ├── iconurl.html │ │ │ ├── index.html │ │ │ ├── init(iconurl:name:url:).html │ │ │ ├── name.html │ │ │ └── url.html │ │ ├── color.html │ │ ├── description.html │ │ ├── encode().html │ │ ├── field │ │ │ ├── index.html │ │ │ ├── init(isinline:name:value:).html │ │ │ ├── isinline.html │ │ │ ├── name.html │ │ │ └── value.html │ │ ├── fields.html │ │ ├── footer-swift.property.html │ │ ├── footer-swift.struct │ │ │ ├── iconurl.html │ │ │ ├── index.html │ │ │ ├── init(text:iconurl:proxyiconurl:).html │ │ │ ├── proxyiconurl.html │ │ │ └── text.html │ │ ├── image-swift.property.html │ │ ├── image-swift.struct │ │ │ ├── height.html │ │ │ ├── index.html │ │ │ ├── init(height:proxyurl:url:width:).html │ │ │ ├── proxyurl.html │ │ │ ├── url.html │ │ │ └── width.html │ │ ├── index.html │ │ ├── init().html │ │ ├── provider-swift.property.html │ │ ├── provider-swift.struct │ │ │ ├── index.html │ │ │ ├── init(name:url:).html │ │ │ ├── name.html │ │ │ └── url.html │ │ ├── thumbnail-swift.property.html │ │ ├── thumbnail-swift.struct │ │ │ ├── height.html │ │ │ ├── index.html │ │ │ ├── init(height:proxyurl:url:width:).html │ │ │ ├── proxyurl.html │ │ │ ├── url.html │ │ │ └── width.html │ │ ├── title.html │ │ ├── type.html │ │ ├── url.html │ │ ├── video-swift.property.html │ │ └── video-swift.struct │ │ │ ├── height.html │ │ │ ├── index.html │ │ │ ├── url.html │ │ │ └── width.html │ │ ├── embedbuilder │ │ ├── addfield(_:value:isinline:).html │ │ ├── author-swift.property.html │ │ ├── author-swift.struct │ │ │ ├── iconurl.html │ │ │ ├── index.html │ │ │ ├── init(iconurl:name:url:).html │ │ │ ├── name.html │ │ │ └── url.html │ │ ├── color.html │ │ ├── description.html │ │ ├── field │ │ │ ├── index.html │ │ │ ├── init(name:value:isinline:).html │ │ │ ├── isinline.html │ │ │ ├── name.html │ │ │ └── value.html │ │ ├── fields.html │ │ ├── footer-swift.property.html │ │ ├── footer-swift.struct │ │ │ ├── iconurl.html │ │ │ ├── index.html │ │ │ ├── init(text:iconurl:).html │ │ │ └── text.html │ │ ├── image-swift.property.html │ │ ├── image-swift.struct │ │ │ ├── height.html │ │ │ ├── index.html │ │ │ ├── init(url:height:width:).html │ │ │ ├── url.html │ │ │ └── width.html │ │ ├── index.html │ │ ├── init().html │ │ ├── setauthor(name:url:iconurl:).html │ │ ├── setcolor(color:).html │ │ ├── setdescription(description:).html │ │ ├── setfooter(text:url:).html │ │ ├── setimage(url:height:width:).html │ │ ├── setthumbnail(url:height:width:).html │ │ ├── settitle(title:).html │ │ ├── setvideo(url:height:width:).html │ │ ├── thumbnail-swift.property.html │ │ ├── thumbnail-swift.struct │ │ │ ├── height.html │ │ │ ├── index.html │ │ │ ├── init(url:height:width:).html │ │ │ ├── url.html │ │ │ └── width.html │ │ ├── title.html │ │ ├── type.html │ │ ├── url.html │ │ ├── video-swift.property.html │ │ └── video-swift.struct │ │ │ ├── height.html │ │ │ ├── index.html │ │ │ ├── init(url:height:width:).html │ │ │ ├── url.html │ │ │ └── width.html │ │ ├── emoji │ │ ├── id.html │ │ ├── imageurl(format:).html │ │ ├── index.html │ │ ├── init(_:id:).html │ │ ├── isanimated.html │ │ ├── ismanaged.html │ │ ├── name.html │ │ ├── requirescolons.html │ │ ├── rolesarray.html │ │ └── tag.html │ │ ├── event │ │ ├── !=(_:_:).html │ │ ├── audiodata.html │ │ ├── buttonevent.html │ │ ├── channelcreate.html │ │ ├── channeldelete.html │ │ ├── channelpinsupdate.html │ │ ├── channelupdate.html │ │ ├── connectionclose.html │ │ ├── disconnect.html │ │ ├── equatable-implementations.html │ │ ├── guildavailable.html │ │ ├── guildbanadd.html │ │ ├── guildbanremove.html │ │ ├── guildcreate.html │ │ ├── guilddelete.html │ │ ├── guildemojisupdate.html │ │ ├── guildintegrationsupdate.html │ │ ├── guildmemberadd.html │ │ ├── guildmemberremove.html │ │ ├── guildmemberschunk.html │ │ ├── guildmemberupdate.html │ │ ├── guildrolecreate.html │ │ ├── guildroledelete.html │ │ ├── guildroleupdate.html │ │ ├── guildunavailable.html │ │ ├── guildupdate.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── interaction.html │ │ ├── messagecommandevent.html │ │ ├── messagecreate.html │ │ ├── messagedelete.html │ │ ├── messagedeletebulk.html │ │ ├── messagereactionremoveall.html │ │ ├── messageupdate.html │ │ ├── payload.html │ │ ├── presenceupdate.html │ │ ├── rawrepresentable-implementations.html │ │ ├── reactionadd.html │ │ ├── reactionremove.html │ │ ├── ready.html │ │ ├── resume.html │ │ ├── resumed.html │ │ ├── selectmenuevent.html │ │ ├── shardready.html │ │ ├── slashcommandevent.html │ │ ├── threadcreate.html │ │ ├── threaddelete.html │ │ ├── threadupdate.html │ │ ├── typingstart.html │ │ ├── usercommandevent.html │ │ ├── userupdate.html │ │ ├── voicechanneljoin.html │ │ ├── voicechannelleave.html │ │ ├── voiceserverupdate.html │ │ └── voicestateupdate.html │ │ ├── eventable │ │ ├── emit(_:with:)-27txi.html │ │ ├── emit(_:with:)-72bfs.html │ │ ├── index.html │ │ ├── listeners.html │ │ ├── on(_:do:)-7cw7c.html │ │ └── on(_:do:)-8w6i1.html │ │ ├── fileextension │ │ ├── !=(_:_:).html │ │ ├── equatable-implementations.html │ │ ├── gif.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── jpg.html │ │ ├── png.html │ │ ├── rawrepresentable-implementations.html │ │ └── webp.html │ │ ├── genericcommand │ │ ├── execute(_:_:).html │ │ ├── function.html │ │ ├── index.html │ │ ├── name.html │ │ └── options.html │ │ ├── groupdm │ │ ├── addreaction(_:to:then:).html │ │ ├── channel-implementations.html │ │ ├── delete(then:).html │ │ ├── deletemessage(_:then:).html │ │ ├── deletemessages(_:then:).html │ │ ├── deletereaction(_:from:by:then:).html │ │ ├── editmessage(_:with:then:).html │ │ ├── getmessage(_:then:).html │ │ ├── getmessages(with:then:).html │ │ ├── getpinnedmessages(then:).html │ │ ├── getreaction(_:from:then:).html │ │ ├── id.html │ │ ├── index.html │ │ ├── lastmessageid.html │ │ ├── pin(_:then:).html │ │ ├── recipients.html │ │ ├── send(_:then:)-1j6ip.html │ │ ├── send(_:then:)-3mu58.html │ │ ├── send(_:then:)-6jg3z.html │ │ ├── send(_:then:)-7oxq8.html │ │ ├── send(_:then:)-9cs2g.html │ │ ├── swiftcord.html │ │ ├── textchannel-implementations.html │ │ ├── type.html │ │ └── unpin(_:then:).html │ │ ├── guild │ │ ├── afkchannelid.html │ │ ├── afktimeout.html │ │ ├── ban(_:for:with:then:).html │ │ ├── botmember.html │ │ ├── channels.html │ │ ├── createchannel(with:then:).html │ │ ├── createevent(_:then:).html │ │ ├── createintegration(with:then:).html │ │ ├── createrole(with:then:).html │ │ ├── defaultmessagenotifications.html │ │ ├── delete(then:).html │ │ ├── deleteapplicationcommand(commandid:then:).html │ │ ├── deleteemoji(_:reason:then:).html │ │ ├── deleteintegration(_:then:).html │ │ ├── deleterole(_:then:).html │ │ ├── discoverysplash.html │ │ ├── embedchannelid.html │ │ ├── emojis.html │ │ ├── feature │ │ │ ├── !=(_:_:).html │ │ │ ├── equatable-implementations.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── index.html │ │ │ ├── invitesplash.html │ │ │ ├── rawrepresentable-implementations.html │ │ │ ├── vanityurl.html │ │ │ ├── verified.html │ │ │ └── vipregions.html │ │ ├── features.html │ │ ├── getauditlog(with:then:).html │ │ ├── getbans(then:).html │ │ ├── getembed(then:).html │ │ ├── getemoji(emojiid:then:).html │ │ ├── getemojis(then:).html │ │ ├── getintegrations(then:).html │ │ ├── getinvites(then:).html │ │ ├── getmembers(with:then:).html │ │ ├── getprunecount(for:then:).html │ │ ├── getroles(then:).html │ │ ├── getscheduledevents(then:).html │ │ ├── getsticker(stickerid:then:).html │ │ ├── getstickers(then:).html │ │ ├── getvoiceregions(then:).html │ │ ├── getwebhooks(then:).html │ │ ├── icon.html │ │ ├── id.html │ │ ├── imageurl(format:).html │ │ ├── index.html │ │ ├── isembedenabled.html │ │ ├── islarge.html │ │ ├── iswidgetenabled.html │ │ ├── joinedat.html │ │ ├── kick(_:for:then:).html │ │ ├── membercount.html │ │ ├── members.html │ │ ├── mfalevel-swift.enum │ │ │ ├── !=(_:_:).html │ │ │ ├── elevated.html │ │ │ ├── equatable-implementations.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── index.html │ │ │ ├── none.html │ │ │ └── rawrepresentable-implementations.html │ │ ├── mfalevel-swift.property.html │ │ ├── modify(with:then:).html │ │ ├── modifychannelpositions(with:then:).html │ │ ├── modifyembed(with:then:).html │ │ ├── modifyemoji(emojiid:with:reason:then:).html │ │ ├── modifyintegration(_:with:then:).html │ │ ├── modifymember(_:with:then:).html │ │ ├── modifyrole(_:with:then:).html │ │ ├── modifyrolepositions(with:then:).html │ │ ├── movemember(_:to:then:).html │ │ ├── name.html │ │ ├── ownerid.html │ │ ├── prunemembers(for:then:).html │ │ ├── removetimeoutfromuser(_:then:).html │ │ ├── roles.html │ │ ├── shard.html │ │ ├── splash.html │ │ ├── swiftcord.html │ │ ├── syncintegration(_:then:).html │ │ ├── threads.html │ │ ├── timeoutuser(_:until:reason:then:).html │ │ ├── unbanmember(_:then:).html │ │ ├── uploademoji(name:emoji:roles:then:).html │ │ ├── uploadmessagecommand(commanddata:then:).html │ │ ├── uploadslashcommand(commanddata:then:).html │ │ ├── uploadusercommand(commanddata:then:).html │ │ ├── verificationlevel-swift.enum │ │ │ ├── !=(_:_:).html │ │ │ ├── equatable-implementations.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── high.html │ │ │ ├── index.html │ │ │ ├── low.html │ │ │ ├── medium.html │ │ │ ├── none.html │ │ │ ├── rawrepresentable-implementations.html │ │ │ └── veryhigh.html │ │ ├── verificationlevel-swift.property.html │ │ ├── voicestates.html │ │ └── widgetchannelid.html │ │ ├── guildcategory │ │ ├── category.html │ │ ├── channel-implementations.html │ │ ├── channels.html │ │ ├── delete(then:).html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── name.html │ │ ├── parentid.html │ │ ├── permissionoverwrites.html │ │ ├── position.html │ │ ├── swiftcord.html │ │ └── type.html │ │ ├── guildchannel │ │ ├── category.html │ │ ├── guild.html │ │ ├── index.html │ │ ├── name.html │ │ ├── parentid.html │ │ ├── permissionoverwrites.html │ │ └── position.html │ │ ├── guildtext │ │ ├── addreaction(_:to:then:).html │ │ ├── category.html │ │ ├── channel-implementations.html │ │ ├── createwebhook(with:then:).html │ │ ├── delete(then:).html │ │ ├── deletemessage(_:then:).html │ │ ├── deletemessages(_:then:).html │ │ ├── deletereaction(_:from:by:then:).html │ │ ├── deletereactions(from:then:).html │ │ ├── editmessage(_:with:then:).html │ │ ├── getmessage(_:then:).html │ │ ├── getmessages(with:then:).html │ │ ├── getpinnedmessages(then:).html │ │ ├── getreaction(_:from:then:).html │ │ ├── getwebhooks(then:).html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── isnsfw.html │ │ ├── lastmessageid.html │ │ ├── lastpintimestamp.html │ │ ├── name.html │ │ ├── parentid.html │ │ ├── permissionoverwrites.html │ │ ├── pin(_:then:).html │ │ ├── position.html │ │ ├── send(_:then:)-1taxk.html │ │ ├── send(_:then:)-6474b.html │ │ ├── send(_:then:)-6lqug.html │ │ ├── send(_:then:)-6zf4v.html │ │ ├── send(_:then:)-8u9f9.html │ │ ├── swiftcord.html │ │ ├── textchannel-implementations.html │ │ ├── topic.html │ │ ├── type.html │ │ └── unpin(_:then:).html │ │ ├── guildvoice │ │ ├── bitrate.html │ │ ├── category.html │ │ ├── channel-implementations.html │ │ ├── delete(then:).html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── movemember(_:then:).html │ │ ├── name.html │ │ ├── parentid.html │ │ ├── permissionoverwrites.html │ │ ├── position.html │ │ ├── swiftcord.html │ │ ├── type.html │ │ └── userlimit.html │ │ ├── icon │ │ ├── base64image.html │ │ ├── imagetype.html │ │ ├── index.html │ │ └── init(imagetype:image:).html │ │ ├── imageable │ │ ├── imageurl(format:).html │ │ └── index.html │ │ ├── imagetype │ │ ├── !=(_:_:).html │ │ ├── equatable-implementations.html │ │ ├── gif.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── jpeg.html │ │ ├── png.html │ │ ├── rawrepresentable-implementations.html │ │ └── webp.html │ │ ├── index.html │ │ ├── intents │ │ ├── !=(_:_:).html │ │ ├── directmessages.html │ │ ├── directmessagesreactions.html │ │ ├── directmessagestyping.html │ │ ├── equatable-implementations.html │ │ ├── guildbans.html │ │ ├── guildemojisandstickers.html │ │ ├── guildintegrations.html │ │ ├── guildinvites.html │ │ ├── guildmembers.html │ │ ├── guildmessagereactions.html │ │ ├── guildmessages.html │ │ ├── guildmessagetyping.html │ │ ├── guildpresences.html │ │ ├── guilds.html │ │ ├── guildscheduledevents.html │ │ ├── guildvoicestates.html │ │ ├── guildwebhooks.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ └── rawrepresentable-implementations.html │ │ ├── interactioncallbacktype │ │ ├── !=(_:_:).html │ │ ├── defer.html │ │ ├── defersilently.html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── pong.html │ │ ├── rawrepresentable-implementations.html │ │ ├── sendmessage.html │ │ └── updatemessage.html │ │ ├── interactionevent │ │ ├── deferreply(_:).html │ │ ├── delete(_:).html │ │ ├── edit(message:then:).html │ │ ├── editwithbuttons(buttons:then:).html │ │ ├── editwithembeds(embeds:then:).html │ │ ├── editwithselectmenu(menu:then:).html │ │ ├── ephemeral.html │ │ ├── index.html │ │ ├── interactionid.html │ │ ├── isdefered.html │ │ ├── reply(message:then:).html │ │ ├── replybuttons(buttons:then:).html │ │ ├── replyembeds(embeds:then:).html │ │ ├── replyselectmenu(menu:then:).html │ │ ├── setephemeral(isephermeral:).html │ │ ├── swiftcord.html │ │ └── token.html │ │ ├── invite │ │ ├── channel.html │ │ ├── code.html │ │ ├── guild.html │ │ └── index.html │ │ ├── member │ │ ├── avatar.html │ │ ├── communicationdisableduntil.html │ │ ├── guild.html │ │ ├── haspermission(_:).html │ │ ├── index.html │ │ ├── isdeaf.html │ │ ├── ismuted.html │ │ ├── ispending.html │ │ ├── joinedat.html │ │ ├── nick.html │ │ ├── permissions.html │ │ ├── premiumsince.html │ │ ├── presence.html │ │ ├── roles.html │ │ ├── user.html │ │ └── voicestate.html │ │ ├── message │ │ ├── addreaction(_:then:).html │ │ ├── attachments.html │ │ ├── author.html │ │ ├── channel.html │ │ ├── content.html │ │ ├── delete(then:).html │ │ ├── deletereaction(_:from:then:).html │ │ ├── deletereactions(then:).html │ │ ├── edit(with:then:).html │ │ ├── editedtimestamp.html │ │ ├── embeds.html │ │ ├── flags.html │ │ ├── getreaction(_:then:).html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── iseveryonementioned.html │ │ ├── ispinned.html │ │ ├── istts.html │ │ ├── member.html │ │ ├── mentionedroles.html │ │ ├── mentions.html │ │ ├── nonce.html │ │ ├── pin(then:).html │ │ ├── reactions.html │ │ ├── refrencedmessage.html │ │ ├── reply(with:then:)-42ei2.html │ │ ├── reply(with:then:)-52j8c.html │ │ ├── reply(with:then:)-7cwsq.html │ │ ├── reply(with:then:)-8hgfd.html │ │ ├── reply(with:then:)-9k1ua.html │ │ ├── swiftcord.html │ │ ├── timestamp.html │ │ ├── type-swift.enum │ │ │ ├── !=(_:_:).html │ │ │ ├── call.html │ │ │ ├── channelfollowadd.html │ │ │ ├── channeliconchange.html │ │ │ ├── channelnamechange.html │ │ │ ├── channelpinnedmessage.html │ │ │ ├── chatinputcommand.html │ │ │ ├── contextmenucommand.html │ │ │ ├── default.html │ │ │ ├── equatable-implementations.html │ │ │ ├── guilddiscoverydisqualified.html │ │ │ ├── guilddiscoverygraceperiodfinalwarning.html │ │ │ ├── guilddiscoverygraceperiodinitialwarning.html │ │ │ ├── guilddiscoveryrequalified.html │ │ │ ├── guildinvitereminder.html │ │ │ ├── guildmemberjoin.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── index.html │ │ │ ├── memberboost.html │ │ │ ├── memberboostlvl1.html │ │ │ ├── memberboostlvl2.html │ │ │ ├── memberboostlvl3.html │ │ │ ├── rawrepresentable-implementations.html │ │ │ ├── recipientadd.html │ │ │ ├── recipientremove.html │ │ │ ├── reply.html │ │ │ ├── threadcreated.html │ │ │ └── threadstartermessage.html │ │ ├── type-swift.property.html │ │ └── webhookid.html │ │ ├── messagecommandbuilder │ │ ├── defaultpermission.html │ │ ├── index.html │ │ ├── init(name:).html │ │ ├── name.html │ │ └── type.html │ │ ├── messagecommandevent │ │ ├── channelid.html │ │ ├── deferreply(_:).html │ │ ├── delete(_:).html │ │ ├── edit(message:then:).html │ │ ├── editwithbuttons(buttons:then:).html │ │ ├── editwithembeds(embeds:then:).html │ │ ├── editwithselectmenu(menu:then:).html │ │ ├── ephemeral.html │ │ ├── guild.html │ │ ├── guildid.html │ │ ├── index.html │ │ ├── interactionevent-implementations.html │ │ ├── interactionid.html │ │ ├── isdefered.html │ │ ├── member.html │ │ ├── message.html │ │ ├── name.html │ │ ├── reply(message:then:).html │ │ ├── replybuttons(buttons:then:).html │ │ ├── replyembeds(embeds:then:).html │ │ ├── replyselectmenu(menu:then:).html │ │ ├── setephemeral(isephermeral:).html │ │ ├── swiftcord.html │ │ ├── token.html │ │ └── user.html │ │ ├── overwrite │ │ ├── allow.html │ │ ├── deny.html │ │ ├── id.html │ │ ├── index.html │ │ ├── overwritetype │ │ │ ├── !=(_:_:).html │ │ │ ├── equatable-implementations.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── index.html │ │ │ ├── member.html │ │ │ ├── rawrepresentable-implementations.html │ │ │ └── role.html │ │ └── type.html │ │ ├── permission │ │ ├── !=(_:_:).html │ │ ├── addreactions.html │ │ ├── administrator.html │ │ ├── attachfiles.html │ │ ├── banmembers.html │ │ ├── changenickname.html │ │ ├── connect.html │ │ ├── createinstantinvite.html │ │ ├── deafenmembers.html │ │ ├── embedlinks.html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── kickmembers.html │ │ ├── managechannels.html │ │ ├── manageemojis.html │ │ ├── manageguild.html │ │ ├── managemessages.html │ │ ├── managenicknames.html │ │ ├── manageroles.html │ │ ├── managewebhooks.html │ │ ├── mentioneveryone.html │ │ ├── movemembers.html │ │ ├── mutemembers.html │ │ ├── rawrepresentable-implementations.html │ │ ├── readmessagehistory.html │ │ ├── sendmessages.html │ │ ├── sendttsmessages.html │ │ ├── speak.html │ │ ├── useexternalemojis.html │ │ ├── usevad.html │ │ ├── viewauditlog.html │ │ └── viewchannel.html │ │ ├── presence │ │ ├── game.html │ │ ├── index.html │ │ ├── init(status:playing:).html │ │ └── status.html │ │ ├── requesterror │ │ ├── code.html │ │ ├── customstringconvertible-implementations.html │ │ ├── description.html │ │ ├── error-implementations.html │ │ ├── error.html │ │ ├── index.html │ │ ├── localizeddescription.html │ │ ├── message.html │ │ └── statuscode.html │ │ ├── role │ │ ├── color.html │ │ ├── id.html │ │ ├── index.html │ │ ├── ishoisted.html │ │ ├── ismanaged.html │ │ ├── ismentionable.html │ │ ├── name.html │ │ ├── permissions.html │ │ └── position.html │ │ ├── scheduledevent │ │ ├── channelid.html │ │ ├── creator.html │ │ ├── description.html │ │ ├── entityid.html │ │ ├── entitytype │ │ │ ├── !=(_:_:).html │ │ │ ├── equatable-implementations.html │ │ │ ├── external.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── index.html │ │ │ ├── rawrepresentable-implementations.html │ │ │ ├── stage.html │ │ │ └── voice.html │ │ ├── eventtype.html │ │ ├── id.html │ │ ├── index.html │ │ ├── init(channelid:name:description:location:type:starttime:endtime:).html │ │ ├── location.html │ │ ├── membercount.html │ │ ├── name.html │ │ ├── scheduledendtime.html │ │ ├── scheduledstarttime.html │ │ ├── status-swift.enum │ │ │ ├── !=(_:_:).html │ │ │ ├── active.html │ │ │ ├── canceled.html │ │ │ ├── completed.html │ │ │ ├── equatable-implementations.html │ │ │ ├── hash(into:).html │ │ │ ├── hashvalue.html │ │ │ ├── index.html │ │ │ ├── rawrepresentable-implementations.html │ │ │ └── scheduled.html │ │ └── status-swift.property.html │ │ ├── selectmenu │ │ ├── customid.html │ │ ├── index.html │ │ ├── init(customid:placeholder:options:).html │ │ ├── options.html │ │ ├── placeholder.html │ │ └── type.html │ │ ├── selectmenubuilder │ │ ├── addcomponent(component:).html │ │ ├── components.html │ │ ├── content.html │ │ ├── index.html │ │ └── init(message:).html │ │ ├── selectmenucomponentdata │ │ ├── componenttype.html │ │ ├── customid.html │ │ ├── index.html │ │ └── value.html │ │ ├── selectmenuevent │ │ ├── channelid.html │ │ ├── deferreply(_:).html │ │ ├── delete(_:).html │ │ ├── edit(message:then:).html │ │ ├── editwithbuttons(buttons:then:).html │ │ ├── editwithembeds(embeds:then:).html │ │ ├── editwithselectmenu(menu:then:).html │ │ ├── ephemeral.html │ │ ├── guild.html │ │ ├── index.html │ │ ├── interactionevent-implementations.html │ │ ├── interactionid.html │ │ ├── isdefered.html │ │ ├── member.html │ │ ├── reply(message:then:).html │ │ ├── replybuttons(buttons:then:).html │ │ ├── replyembeds(embeds:then:).html │ │ ├── replyselectmenu(menu:then:).html │ │ ├── selectedvalue.html │ │ ├── setephemeral(isephermeral:).html │ │ ├── swiftcord.html │ │ ├── token.html │ │ └── user.html │ │ ├── selectmenuoptions │ │ ├── description.html │ │ ├── emoji.html │ │ ├── index.html │ │ ├── init(label:value:description:emoji:).html │ │ ├── label.html │ │ └── value.html │ │ ├── shield │ │ ├── commandaliases.html │ │ ├── commands.html │ │ ├── index.html │ │ ├── init(token:swiftcordoptions:shieldoptions:).html │ │ ├── register(_:).html │ │ ├── register(_:with:_:).html │ │ ├── register(_:with:message:).html │ │ ├── shieldoptions.html │ │ └── unregister(_:).html │ │ ├── shieldoptions │ │ ├── index.html │ │ ├── init(prefixes:requirements:willbecasesensitive:willdefaulthelp:willignorebots:).html │ │ ├── prefixes.html │ │ ├── requirements.html │ │ ├── willbecasesensitive.html │ │ ├── willdefaulthelp.html │ │ └── willignorebots.html │ │ ├── slashcommandbuilder │ │ ├── addoption(option:).html │ │ ├── defaultpermission.html │ │ ├── description.html │ │ ├── index.html │ │ ├── init(name:description:).html │ │ ├── name.html │ │ ├── options.html │ │ └── type.html │ │ ├── slashcommandevent │ │ ├── channelid.html │ │ ├── deferreply(_:).html │ │ ├── delete(_:).html │ │ ├── edit(message:then:).html │ │ ├── editwithbuttons(buttons:then:).html │ │ ├── editwithembeds(embeds:then:).html │ │ ├── editwithselectmenu(menu:then:).html │ │ ├── ephemeral.html │ │ ├── getoptionasbool(optionname:).html │ │ ├── getoptionaschannel(optionname:).html │ │ ├── getoptionasdouble(optionname:).html │ │ ├── getoptionasint(optionname:).html │ │ ├── getoptionasmember(optionname:).html │ │ ├── getoptionasrole(optionname:).html │ │ ├── getoptionasstring(optionname:).html │ │ ├── getoptionasuser(optionname:).html │ │ ├── guild.html │ │ ├── index.html │ │ ├── interactionevent-implementations.html │ │ ├── interactionid.html │ │ ├── isdefered.html │ │ ├── member.html │ │ ├── name.html │ │ ├── options.html │ │ ├── reply(message:then:).html │ │ ├── replybuttons(buttons:then:).html │ │ ├── replyembeds(embeds:then:).html │ │ ├── replyselectmenu(menu:then:).html │ │ ├── setephemeral(isephermeral:).html │ │ ├── swiftcord.html │ │ ├── token.html │ │ └── user.html │ │ ├── slashcommandeventoptions │ │ ├── index.html │ │ ├── name.html │ │ ├── type.html │ │ └── value.html │ │ ├── snowflake │ │ ├── !=(_:_:).html │ │ ├── '...(_:)-3w0ig.html │ │ ├── '...(_:)-5zctv.html │ │ ├── '...(_:_:).html │ │ ├── '.._(_:).html │ │ ├── '.._(_:_:).html │ │ ├── -implementations.html │ │ ├── _(_:_:)-1ndpt.html │ │ ├── _(_:_:)-1plx4.html │ │ ├── _=(_:_:)-2wbgt.html │ │ ├── _=(_:_:)-5igch.html │ │ ├── comparable-implementations.html │ │ ├── customstringconvertible-implementations.html │ │ ├── description.html │ │ ├── encode(to:).html │ │ ├── epoch.html │ │ ├── equatable-implementations.html │ │ ├── expressiblebyintegerliteral-implementations.html │ │ ├── fakesnowflake(date:).html │ │ ├── hash(into:).html │ │ ├── hashable-implementations.html │ │ ├── hashvalue-8gymi.html │ │ ├── hashvalue-90cu.html │ │ ├── index.html │ │ ├── init(_:)-3hv6d.html │ │ ├── init(_:)-68ghg.html │ │ ├── init(from:).html │ │ ├── init(integerliteral:).html │ │ ├── init(rawvalue:).html │ │ ├── integerliteraltype.html │ │ ├── numberinprocess.html │ │ ├── processid.html │ │ ├── rawrepresentable-implementations.html │ │ ├── rawvalue-swift.property.html │ │ ├── rawvalue-swift.typealias.html │ │ ├── timestamp.html │ │ └── workerid.html │ │ ├── stage │ │ ├── channelid.html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── isdiscoverydisabled.html │ │ ├── privacylevel.html │ │ ├── swiftcord.html │ │ └── topic.html │ │ ├── stageprivacylevel │ │ ├── !=(_:_:).html │ │ ├── equatable-implementations.html │ │ ├── guildonly.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── public.html │ │ └── rawrepresentable-implementations.html │ │ ├── status │ │ ├── !=(_:_:).html │ │ ├── dnd.html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── idle.html │ │ ├── index.html │ │ ├── invisible.html │ │ ├── offline.html │ │ ├── online.html │ │ └── rawrepresentable-implementations.html │ │ ├── sticker │ │ ├── description.html │ │ ├── format.html │ │ ├── id.html │ │ ├── index.html │ │ ├── isavailable.html │ │ ├── name.html │ │ ├── packid.html │ │ └── type.html │ │ ├── stickerformat │ │ ├── !=(_:_:).html │ │ ├── apng.html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── init(from:).html │ │ ├── lottie.html │ │ ├── png.html │ │ └── rawrepresentable-implementations.html │ │ ├── stickertypes │ │ ├── !=(_:_:).html │ │ ├── encode(to:).html │ │ ├── equatable-implementations.html │ │ ├── guild.html │ │ ├── hash(into:).html │ │ ├── hashvalue.html │ │ ├── index.html │ │ ├── init(from:).html │ │ ├── rawrepresentable-implementations.html │ │ └── standard.html │ │ ├── swiftcord │ │ ├── addreaction(_:to:in:then:).html │ │ ├── ban(_:from:for:with:then:).html │ │ ├── connect().html │ │ ├── createchannel(for:with:then:).html │ │ ├── createguild(with:then:).html │ │ ├── createintegration(for:with:then:).html │ │ ├── createinvite(for:with:then:).html │ │ ├── createrole(for:with:then:).html │ │ ├── createwebhook(for:with:then:).html │ │ ├── deleteapplicationcommand(commandid:then:).html │ │ ├── deletechannel(_:then:).html │ │ ├── deleteguild(_:then:).html │ │ ├── deleteguildemoji(_:emojiid:reason:then:).html │ │ ├── deleteintegration(_:from:then:).html │ │ ├── deleteinvite(_:then:).html │ │ ├── deletemessage(_:from:then:).html │ │ ├── deletemessages(_:from:then:).html │ │ ├── deletepermission(from:with:then:).html │ │ ├── deletereaction(_:from:by:in:then:).html │ │ ├── deletereactions(from:in:then:).html │ │ ├── deleterole(_:from:then:).html │ │ ├── deletewebhook(_:token:then:).html │ │ ├── disconnect().html │ │ ├── dms.html │ │ ├── editmessage(_:with:in:then:).html │ │ ├── editpermissions(_:for:with:then:).html │ │ ├── editstatus(status:activity:).html │ │ ├── emit(_:with:).html │ │ ├── eventable-implementations.html │ │ ├── executeslackwebhook(_:token:with:then:).html │ │ ├── executewebhook(_:token:with:then:).html │ │ ├── getauditlog(from:with:then:).html │ │ ├── getbans(from:then:).html │ │ ├── getchannel(_:rest:then:).html │ │ ├── getchannel(for:).html │ │ ├── getchannelinvites(from:then:).html │ │ ├── getchannels(from:rest:then:).html │ │ ├── getconnections(then:).html │ │ ├── getdm(for:).html │ │ ├── getdm(for:then:).html │ │ ├── getgateway(then:).html │ │ ├── getguild(_:rest:then:).html │ │ ├── getguild(for:).html │ │ ├── getguildembed(from:then:).html │ │ ├── getguildemoji(from:with:then:).html │ │ ├── getguildemojis(from:then:).html │ │ ├── getguildinvites(from:then:).html │ │ ├── getguildsticker(from:stickerid:then:).html │ │ ├── getguildstickers(from:then:).html │ │ ├── getguildwebhooks(from:then:).html │ │ ├── getintegrations(from:then:).html │ │ ├── getinvite(_:then:).html │ │ ├── getmember(_:from:then:).html │ │ ├── getmembers(from:with:then:).html │ │ ├── getmessage(_:from:then:).html │ │ ├── getmessages(from:with:then:).html │ │ ├── getpinnedmessages(from:then:).html │ │ ├── getprunecount(from:for:then:).html │ │ ├── getreaction(_:from:in:then:).html │ │ ├── getroles(from:then:).html │ │ ├── getshard(for:).html │ │ ├── getsticker(stickerid:then:).html │ │ ├── getthreads(for:).html │ │ ├── getuser(_:then:).html │ │ ├── getuserguilds(with:then:).html │ │ ├── getvoiceregions(from:then:).html │ │ ├── getwebhook(_:token:then:).html │ │ ├── getwebhooks(from:then:).html │ │ ├── groups.html │ │ ├── guilds.html │ │ ├── index.html │ │ ├── init(token:options:).html │ │ ├── kick(_:from:for:then:).html │ │ ├── kill(_:).html │ │ ├── leaveguild(_:then:).html │ │ ├── listeners.html │ │ ├── modifychannel(_:with:then:).html │ │ ├── modifychannelpositions(for:with:then:).html │ │ ├── modifyembed(for:with:then:).html │ │ ├── modifyemoji(for:emojiid:with:reason:then:).html │ │ ├── modifyguild(_:with:then:).html │ │ ├── modifyintegration(_:for:with:then:).html │ │ ├── modifymember(_:in:with:for:then:).html │ │ ├── modifyrole(_:for:with:then:).html │ │ ├── modifyrolepositions(for:with:then:).html │ │ ├── modifywebhook(_:token:with:then:).html │ │ ├── movemember(_:in:to:then:).html │ │ ├── on(_:do:).html │ │ ├── pin(_:in:then:).html │ │ ├── prunemembers(in:for:then:).html │ │ ├── readytimestamp.html │ │ ├── removeuser(_:fromgroupdm:then:).html │ │ ├── send(_:to:then:)-1tsgd.html │ │ ├── send(_:to:then:)-2f6es.html │ │ ├── send(_:to:then:)-3g5yf.html │ │ ├── send(_:to:then:)-69802.html │ │ ├── send(_:to:then:)-9cixw.html │ │ ├── setintents(intents:).html │ │ ├── settyping(for:then:).html │ │ ├── setusername(to:then:).html │ │ ├── shardcount.html │ │ ├── spawn(_:).html │ │ ├── syncintegration(_:for:then:).html │ │ ├── unavailableguilds.html │ │ ├── unbanmember(_:from:then:).html │ │ ├── unpin(_:from:then:).html │ │ ├── uploademoji(name:emoji:roles:guildid:then:).html │ │ ├── uploadmessagecommand(commanddata:then:).html │ │ ├── uploadslashcommand(commanddata:then:).html │ │ ├── uploadusercommand(commanddata:then:).html │ │ ├── uptime.html │ │ └── user.html │ │ ├── swiftcordoptions │ │ ├── index.html │ │ ├── init(isbot:isdistributed:willcacheallmembers:willlog:willshard:).html │ │ ├── isbot.html │ │ ├── isdistributed.html │ │ ├── willcacheallmembers.html │ │ ├── willlog.html │ │ └── willshard.html │ │ ├── textchannel │ │ ├── addreaction(_:to:then:).html │ │ ├── deletemessage(_:then:).html │ │ ├── deletemessages(_:then:).html │ │ ├── deletereaction(_:from:by:then:).html │ │ ├── editmessage(_:with:then:).html │ │ ├── getmessage(_:then:).html │ │ ├── getmessages(with:then:).html │ │ ├── getpinnedmessages(then:).html │ │ ├── getreaction(_:from:then:).html │ │ ├── index.html │ │ ├── lastmessageid.html │ │ ├── pin(_:then:).html │ │ ├── send(_:then:)-1urc0.html │ │ ├── send(_:then:)-48nc0.html │ │ ├── send(_:then:)-65yws.html │ │ ├── send(_:then:)-6tls6.html │ │ ├── send(_:then:)-7f0x2.html │ │ └── unpin(_:then:).html │ │ ├── thread │ │ ├── addreaction(_:to:then:).html │ │ ├── archivetimestamp.html │ │ ├── autoarchiveduration.html │ │ ├── category.html │ │ ├── channel-implementations.html │ │ ├── delete(then:).html │ │ ├── deletemessage(_:then:).html │ │ ├── deletemessages(_:then:).html │ │ ├── deletereaction(_:from:by:then:).html │ │ ├── editmessage(_:with:then:).html │ │ ├── getmessage(_:then:).html │ │ ├── getmessages(with:then:).html │ │ ├── getpinnedmessages(then:).html │ │ ├── getreaction(_:from:then:).html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── isarchived.html │ │ ├── islocked.html │ │ ├── lastmessageid.html │ │ ├── membercount.html │ │ ├── messagecount.html │ │ ├── name.html │ │ ├── ownerid.html │ │ ├── parentid.html │ │ ├── permissionoverwrites.html │ │ ├── pin(_:then:).html │ │ ├── position.html │ │ ├── ratelimitperuser.html │ │ ├── send(_:then:)-303xq.html │ │ ├── send(_:then:)-4opmv.html │ │ ├── send(_:then:)-4yyzv.html │ │ ├── send(_:then:)-8bil4.html │ │ ├── send(_:then:)-cycs.html │ │ ├── swiftcord.html │ │ ├── textchannel-implementations.html │ │ ├── type.html │ │ └── unpin(_:then:).html │ │ ├── unavailableguild │ │ ├── id.html │ │ ├── index.html │ │ └── shard.html │ │ ├── user │ │ ├── avatar.html │ │ ├── discriminator.html │ │ ├── email.html │ │ ├── getdm(then:).html │ │ ├── id.html │ │ ├── imageurl(format:).html │ │ ├── index.html │ │ ├── isbot.html │ │ ├── ismfaenabled.html │ │ ├── isverified.html │ │ ├── swiftcord.html │ │ └── username.html │ │ ├── usercommandbuilder │ │ ├── defaultpermission.html │ │ ├── index.html │ │ ├── init(name:).html │ │ ├── name.html │ │ └── type.html │ │ ├── usercommandevent │ │ ├── channelid.html │ │ ├── deferreply(_:).html │ │ ├── delete(_:).html │ │ ├── edit(message:then:).html │ │ ├── editwithbuttons(buttons:then:).html │ │ ├── editwithembeds(embeds:then:).html │ │ ├── editwithselectmenu(menu:then:).html │ │ ├── ephemeral.html │ │ ├── guild.html │ │ ├── guildid.html │ │ ├── index.html │ │ ├── interactionevent-implementations.html │ │ ├── interactionid.html │ │ ├── isdefered.html │ │ ├── member.html │ │ ├── name.html │ │ ├── reply(message:then:).html │ │ ├── replybuttons(buttons:then:).html │ │ ├── replyembeds(embeds:then:).html │ │ ├── replyselectmenu(menu:then:).html │ │ ├── setephemeral(isephermeral:).html │ │ ├── swiftcord.html │ │ ├── targetmember.html │ │ ├── targetuser.html │ │ ├── token.html │ │ └── user.html │ │ ├── userguild │ │ ├── icon.html │ │ ├── id.html │ │ ├── index.html │ │ ├── isowner.html │ │ ├── name.html │ │ └── permissions.html │ │ ├── voicestate │ │ ├── channelid.html │ │ ├── index.html │ │ ├── isdeafend.html │ │ ├── ismuted.html │ │ ├── isselfdeafend.html │ │ ├── isselfmuted.html │ │ ├── issuppressed.html │ │ └── sessionid.html │ │ └── webhook │ │ ├── avatar.html │ │ ├── channel.html │ │ ├── delete(then:).html │ │ ├── execute(with:then:).html │ │ ├── executeslack(with:then:).html │ │ ├── guild.html │ │ ├── id.html │ │ ├── index.html │ │ ├── modify(with:then:).html │ │ ├── name.html │ │ ├── swiftcord.html │ │ ├── token.html │ │ └── user.html ├── favicon.ico ├── favicon.svg ├── img │ ├── added-icon.svg │ ├── deprecated-icon.svg │ └── modified-icon.svg └── index.html └── images ├── step1.png ├── step2.png └── step3.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /*.xcodeproj 4 | /build 5 | /docs/undocumented.json 6 | /docs/docsets 7 | /Tests 8 | .swift-version 9 | .swiftpm -------------------------------------------------------------------------------- /Examples/Basic Commands.swift: -------------------------------------------------------------------------------- 1 | import Swiftcord 2 | 3 | class MessageListener: ListenerAdapter { 4 | override func onMessageCreate(event: Message) async { 5 | if event.content == "+test" { 6 | _ = try! await event.reply(with: "Testing Swiftcord!") 7 | } 8 | } 9 | } 10 | 11 | let bot = Swiftcord(token: "token") 12 | bot.setIntents(intents: .guildMessages) 13 | 14 | let activity = Activities(name: "with Swiftcord", type: .playing) 15 | bot.editStatus(status: .online, activity: activity) 16 | 17 | bot.addListeners(MessageListener()) 18 | 19 | bot.connect() 20 | -------------------------------------------------------------------------------- /Examples/Buttons.swift: -------------------------------------------------------------------------------- 1 | import Swiftcord 2 | 3 | class Buttons: ListenerAdapter { 4 | override func onMessageCreate(event: Message) async { 5 | if event.content == "+button" { 6 | let buttonBuilder = ButtonBuilder(message: "testing buttons with Swiftcord!") 7 | // Emojis are optional. 8 | .addComponent(component: ActionRow(components: Button(customId: "test", style: .green, label: "Button with Emoji", emoji: Emoji("🎟️")))) 9 | // To add another action row, call add component. Remember that Discord allows up to 5 action rows in 1 message 10 | // You can have multiple buttons in 1 action row by making a `Button` struct as many times as needed. 11 | .addComponent(component: ActionRow(components: Button( 12 | customId: "test_2", 13 | style: .blurple, 14 | label: "Blurple Button" 15 | ), 16 | Button( 17 | customId: "test_3", 18 | style: .red, 19 | lable: "Danger!" 20 | ))) 21 | 22 | event.reply(with: buttonBuilder) 23 | } 24 | } 25 | 26 | override func onButtonClickEvent(event: ButtonEvent) async { 27 | // If the command may take a while to complete, we can make the bot display the `is thinking...` text 28 | event.deferReply() 29 | 30 | // If we would like to only allow the user who invoked the command to see the output, we can set ephemeral 31 | event.setEphemeral(true) 32 | 33 | if button.selectedButton.customId == "test" { 34 | try! await event.reply(message: "Test button was clicked!") 35 | } else if button.selectedButton.customId == "test_2" { 36 | try! await event.reply(message: "Blurple button was clicked!") 37 | } else if button.selectedButton.customId == "test_3" { 38 | try! await event.reply(message: "Stranger Danger!") 39 | } 40 | } 41 | } 42 | 43 | let bot = Swiftcord(token: "token") 44 | 45 | bot.setIntents(intents: .guildMessages) 46 | bot.addListeners(Buttons()) 47 | 48 | bot.connect() 49 | -------------------------------------------------------------------------------- /Examples/Select Menu.swift: -------------------------------------------------------------------------------- 1 | import Swiftcord 2 | 3 | class SelectMenuListener: ListenerAdapter { 4 | override func onMessageCreate(event: Message) async { 5 | if event.content == "+menu" { 6 | // You can send multiple Select Menu's by calling .addComponent again. 7 | // customID is the ID for the entire SelectMenu object, while value is the customID for that selection. 8 | let menu = SelectMenuBuilder(message: "Testing Select Menu's in Sword!") 9 | .addComponent(component: ActionRow(components: 10 | SelectMenu( 11 | customId: "test", 12 | placeholder: "Test 1", 13 | options: SelectMenuOptions( 14 | label: "Testing with Sword", 15 | value: "test_section", 16 | description: "We are testing a select menu with Sword")) 17 | ) 18 | ) 19 | 20 | try! await event.reply(with: menu) 21 | } 22 | } 23 | 24 | override func onSelectMenuEvent(event: SelectMenuEvent) { 25 | // If the command may take a while to complete, we can make the bot display the `is thinking...` text 26 | // It returns a ResponseError in the closure which should never really be needed 27 | event.deferReply() 28 | 29 | // If we would like to only allow the user who invoked the command to see the output, we can set ephemeral 30 | event.setEphemeral(true) 31 | 32 | // First we check if the selected option is in the SelectMenu we would like to respond to 33 | if event.selectedValue.customId == "test" { 34 | // Now we check for the actual selected option 35 | if event.selectedValue.value == "test_section" { 36 | try! await event.reply(message: "We interacted with a select menu!") 37 | } 38 | } 39 | } 40 | } 41 | 42 | let bot = Swiftcord(token: "token") 43 | 44 | bot.setIntents(intents: .guildMessages) 45 | bot.addListeners(SelectMenuListener()) 46 | 47 | bot.connect() 48 | -------------------------------------------------------------------------------- /Examples/Slash Commands.swift: -------------------------------------------------------------------------------- 1 | import Swiftcord 2 | 3 | class SlashCommandListener: ListenerAdapter { 4 | override func onSlashCommandEvent(event: SlashCommandEvent) { 5 | if event.name == "test" { 6 | // If the command may take a while to complete, we can make the bot display the `is thinking...` text 7 | // It returns a ResponseError in the closure which should never really be needed 8 | event.deferReply() 9 | 10 | // If we would like to only allow the user who invoked the command to see the output, we can set ephemeral 11 | event.setEphemeral(true) 12 | 13 | // Retriving options is extremely simple! 14 | // For Boolean: event.getOptionAsBool(optionName: "optionName") NOTE: You will need to cast the `Channel` type to the channel type you want. 15 | // For Channels: event.getOptionAsChannel(optionName: "optionName") 16 | // For Double: event.getOptionAsDouble(optionName: "optionName") 17 | // For Integer: event.getOptionAsInt(optionName: "optionName") 18 | // For Member: event.getOptionAsMember(optionName: "optionName") 19 | // For String: event.getOptionAsString(optionName: "optionName") 20 | // For Role: event.getOptionAsRole(optionName: "optionName") 21 | // For User: event.getOptionAsUser(optionName: "optionName") 22 | let selectedUser = event.getOptionAsUser(optionName: "user")!.username! 23 | 24 | // Sending messages are simple as well! 25 | // All InteractionEvent types have the same functions for sending, editing and deleting messages. 26 | // For sending a normal message: event.reply(message: "message") 27 | // For sending an embed(s): event.replyEmbeds(embeds: embedBuilderVar, embedBuilderVar2). You can also pass an `[EmbedBuilder]` type 28 | // For sending a message with buttons: event.replyButtons(buttons: buttonBuilderVar) 29 | // For sending a message with a select menu: event.replySelectMenu(menu: selectMenuBuilderVar) 30 | try! await event.reply(message: "User \(invokedUser) was selected!") 31 | } 32 | } 33 | } 34 | 35 | let bot = Swiftcord(token: "Super secret token here") 36 | 37 | // Create slash command 38 | // NOTE: This creates a guild only slash command. To create a global slash command, call `bot.uploadSlashCommand(commandData: command) 39 | let command = SlashCommandBuilder(name: "test", description: "Testing slash commands in Sword") 40 | .addOption(option: ApplicationCommandOptions(name: "user", description: "User to select", type: .user)) 41 | 42 | bot.guilds[guildId].uploadSlashCommand(commandData: command) 43 | 44 | bot.addListeners(SlashCommandListener()) 45 | 46 | bot.connect() 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alejandro Alonso 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "MimeType", 6 | "repositoryURL": "https://github.com/SketchMaster2001/MimeType.git", 7 | "state": { 8 | "branch": "master", 9 | "revision": "102b3769ea8dc7ed0bd50b932bdd21cd4e89215c", 10 | "version": null 11 | } 12 | }, 13 | { 14 | "package": "swift-log", 15 | "repositoryURL": "https://github.com/apple/swift-log.git", 16 | "state": { 17 | "branch": null, 18 | "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", 19 | "version": "1.4.2" 20 | } 21 | }, 22 | { 23 | "package": "swift-nio", 24 | "repositoryURL": "https://github.com/apple/swift-nio.git", 25 | "state": { 26 | "branch": null, 27 | "revision": "51c3fc2e4a0fcdf4a25089b288dd65b73df1b0ef", 28 | "version": "2.37.0" 29 | } 30 | }, 31 | { 32 | "package": "swift-nio-ssl", 33 | "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", 34 | "state": { 35 | "branch": null, 36 | "revision": "52a486ff6de9bc3e26bf634c5413c41c5fa89ca5", 37 | "version": "2.17.2" 38 | } 39 | }, 40 | { 41 | "package": "websocket-kit", 42 | "repositoryURL": "https://github.com/vapor/websocket-kit", 43 | "state": { 44 | "branch": "main", 45 | "revision": "ff8fbce837ef01a93d49c6fb49a72be0f150dac7", 46 | "version": null 47 | } 48 | } 49 | ] 50 | }, 51 | "version": 1 52 | } 53 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "Swiftcord", 6 | platforms: [.macOS("12") ], 7 | products: [ 8 | .library(name: "Swiftcord", targets: ["Swiftcord"]) 9 | ], 10 | dependencies: [ 11 | // WebSockets for Linux and macOS 12 | .package(url: "https://github.com/vapor/websocket-kit", .branch("main")), 13 | // Logging for Swift 14 | .package(url: "https://github.com/apple/swift-log.git", from: "1.4.2"), 15 | // Library that contains common mimetypes 16 | .package(url: "https://github.com/SketchMaster2001/MimeType.git", .branch("master")) 17 | ], 18 | targets: [ 19 | .target( 20 | name: "Swiftcord", 21 | dependencies: [.product(name: "WebSocketKit", package: "websocket-kit"), .product(name: "Logging", package: "swift-log"), "MimeType"] 22 | ), 23 | .testTarget( 24 | name: "SwiftcordTests", 25 | dependencies: [.target(name: "Swiftcord")] 26 | ) 27 | ] 28 | ) 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://swift.org) 2 | [](https://github.com/Azoy/Sword/releases) 3 | 4 | 5 | 6 | # Swiftcord - A Discord Library for Swift 7 | 8 | ## Requirements 9 | 1. macOS, Linux, iOS, watchOS, tvOS (no voice for iOS, watchOS, or tvOS) 10 | 2. At least Swift 5.3 11 | 12 | ## Adding Sword 13 | ### Swift Package Manager 14 | In order to add Sword as a dependency, you must first create a Swift executable in a designated folder, like so `swift package init --type executable`. Then in the newly created Package.swift, open it and add Sword as a dependency 15 | 16 | ```swift 17 | // swift-tools-version: 5.3 18 | 19 | import PackageDescription 20 | 21 | let package = Package( 22 | name: "yourswiftexecutablehere", 23 | dependencies: [ 24 | .package(url: "https://github.com/SketchMaster2001/Swiftcord", .branch("master")) 25 | ], 26 | targets: [ 27 | .target( 28 | name: "yourswiftexecutablehere", 29 | dependencies: ["Swiftcord"] 30 | ) 31 | ] 32 | ) 33 | ``` 34 | 35 | After that, open Sources/main.swift and remove everything and replace it with the example below. 36 | 37 | ```swift 38 | import Swiftcord 39 | 40 | let bot = Swiftcord(token: "Your bot token here") 41 | 42 | // Set activity if wanted 43 | let activity = Activities(name: "with Swiftcord!", type: .playing) 44 | bot.editStatus(status: .online, activity: activity) 45 | 46 | // Set intents which are required 47 | bot.setIntents(intents: .guildMessages) 48 | 49 | class MyBot: ListenerAdapter { 50 | override func onMessageCreate(event: Message) async { 51 | if msg.content == "!ping" { 52 | try! await msg.reply(with: "Pong!") 53 | } 54 | } 55 | } 56 | 57 | bot.addListeners(MyBot()) 58 | bot.connect() 59 | ``` 60 | For more examples, look in the examples folder or in the Wiki. 61 | 62 | 63 | ## Running the bot (SPM) 64 | First make sure you are in the directory with the `Package.swift` file. To build the executable, run `swift build`. To build the executable and run it immediately, run `swift run` 65 | 66 | ## Running the bot in Xcode (SPM) 67 | To run the bot in Xcode, all you need to do is open the directory the `Package.swift` file is located in Xcode. Click the play button at the top left corner and it will run! 68 | 69 | Then click the play button! 70 | 71 | ## Links 72 | [Documentation](https://sketchmaster2001.github.io/Swiftcord) - Created using Apple [docc](https://github.com/apple/swift-docc) and converted to HTML with [docc2html](https://github.com/DoccZz/docc2html) 73 | 74 | [Swiftcord Discord server](https://discord.gg/cE2Cpn4r9X) 75 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Gateway/GatewayHandler.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GatewayHandler.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | import Foundation 9 | 10 | /// Gateway Handler 11 | extension Shard { 12 | 13 | /** 14 | Handles all gateway events (except op: 0) 15 | - parameter payload: Payload sent with event 16 | */ 17 | func handleGateway(_ payload: Payload) async { 18 | 19 | guard let op = OP(rawValue: payload.op) else { 20 | self.swiftcord.log( 21 | "Received unknown gateway\nOP: \(payload.op)\nData: \(payload.d)" 22 | ) 23 | return 24 | } 25 | 26 | switch op { 27 | 28 | /// OP: 1 29 | case .heartbeat: 30 | self.send(self.heartbeatPayload.encode()) 31 | 32 | /// OP: 11 33 | case .heartbeatACK: 34 | self.heartbeatQueue.sync { self.acksMissed = 0 } 35 | 36 | /// OP: 10 37 | case .hello: 38 | self.heartbeat(at: (payload.d as! [String: Any])["heartbeat_interval"] as! Int) 39 | 40 | guard !self.isReconnecting else { 41 | self.isReconnecting = false 42 | let data: [String: Any] = [ 43 | "token": self.swiftcord.token, 44 | "session_id": self.sessionId!, 45 | "seq": self.lastSeq ?? NSNull() 46 | ] 47 | 48 | let payload = Payload(op: .resume, data: data) 49 | self.send(payload.encode()) 50 | return 51 | } 52 | 53 | self.identify() 54 | 55 | /// OP: 9 56 | case .invalidSession: 57 | self.isReconnecting = payload.d as! Bool 58 | await self.reconnect() 59 | 60 | /// OP: 7 61 | case .reconnect: 62 | self.isReconnecting = true 63 | await self.reconnect() 64 | 65 | /// Others 66 | default: 67 | break 68 | } 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Gateway/Heartbeat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Heartbeat.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Dispatch 11 | 12 | /// <3 13 | extension Gateway { 14 | func heartbeat(at interval: Int) { 15 | guard self.isConnected else { 16 | return 17 | } 18 | 19 | guard self.acksMissed < 3 else { 20 | Task { 21 | self.swiftcord.debug("[Swiftcord] Did not receive ACK from server, reconnecting...") 22 | await self.reconnect() 23 | } 24 | return 25 | } 26 | 27 | self.acksMissed += 1 28 | 29 | self.send(self.heartbeatPayload.encode(), presence: false) 30 | 31 | self.heartbeatQueue.asyncAfter( 32 | deadline: .now() + .milliseconds(interval) 33 | ) { [unowned self] in 34 | self.heartbeat(at: interval) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Gateway/Payload.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Payload.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | /// Payload Type 9 | struct Payload { 10 | 11 | // MARK: Properties 12 | /// OP Code for payload 13 | var op: Int 14 | 15 | /// Data for payload 16 | var d: Any 17 | 18 | /// Sequence number from payload 19 | let s: Int? 20 | 21 | /// Event name from payload 22 | let t: String? 23 | 24 | // MARK: Initializers 25 | /** 26 | Creates a payload from JSON String 27 | - parameter text: JSON String 28 | */ 29 | init(with text: String) { 30 | let data = text.decode() as! [String: Any] 31 | self.op = data["op"] as! Int 32 | self.d = data["d"]! 33 | self.s = data["s"] as? Int 34 | self.t = data["t"] as? String 35 | } 36 | 37 | /** 38 | Creates a payload from either an Array | Dictionary 39 | - parameter op: OP code to dispatch 40 | - parameter data: Either an Array | Dictionary to dispatch under the payload.d 41 | */ 42 | init(op: OP, data: Any) { 43 | self.op = op.rawValue 44 | self.d = data 45 | self.s = nil 46 | self.t = nil 47 | } 48 | 49 | // MARK: Functions 50 | /// Returns self as a String 51 | func encode() -> String { 52 | var payload = ["op": self.op, "d": self.d] 53 | 54 | if self.t != nil { 55 | payload["s"] = self.s! 56 | payload["t"] = self.t! 57 | } 58 | 59 | return payload.encode() 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Gateway/ShardManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ShardManager.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import NIOCore 10 | class ShardManager { 11 | 12 | /// The gateway url to connect to 13 | var gatewayUrl: String? 14 | 15 | /// Array of Shard class 16 | var shards = [Shard]() 17 | 18 | var eventLoopGroup: EventLoopGroup? 19 | 20 | /// Parent Swiftcord class 21 | weak var swiftcord: Swiftcord? 22 | 23 | init(eventLoopGroup: EventLoopGroup?) { 24 | self.eventLoopGroup = eventLoopGroup 25 | } 26 | 27 | /** 28 | Used to create a set amount of shards 29 | - parameter amount: Number of shards to instantiate 30 | */ 31 | func create(_ amount: Int) { 32 | guard self.swiftcord != nil else { return } 33 | guard self.shards.isEmpty else { return } 34 | 35 | for id in 0 ..< amount { 36 | let shard = Shard(self.swiftcord!, id, amount, self.gatewayUrl!, eventLoopGroup: self.eventLoopGroup) 37 | self.shards.append(shard) 38 | Task { 39 | await shard.start() 40 | } 41 | } 42 | } 43 | 44 | /// Disconnects all shards from the gateway 45 | func disconnect() { 46 | guard self.shards.count > 0 else { return } 47 | 48 | for shard in self.shards { 49 | shard.stop() 50 | } 51 | 52 | self.shards.removeAll() 53 | } 54 | 55 | /** 56 | Kills a specific shard from the gateway 57 | - parameter id: Id of the shard to kill 58 | */ 59 | func kill(_ id: Int) { 60 | guard let index = self.shards.firstIndex(where: { $0.id == id }) else { return } 61 | 62 | let shard = self.shards.remove(at: index) 63 | 64 | shard.stop() 65 | } 66 | 67 | /** 68 | Spawns a shard based off id 69 | - parameter id: Id of shard to spawn 70 | */ 71 | func spawn(_ id: Int) { 72 | guard self.swiftcord != nil else { return } 73 | guard self.shards.first(where: { $0.id == id }) == nil else { return } 74 | guard self.gatewayUrl != nil else { return } 75 | 76 | let shard = Shard( 77 | self.swiftcord!, 78 | id, 79 | self.swiftcord!.shardCount, 80 | self.gatewayUrl!, 81 | eventLoopGroup: self.eventLoopGroup 82 | ) 83 | self.shards.append(shard) 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Rest/RateLimit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RateLimit.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Dispatch 11 | 12 | /// Rate Limit 13 | extension Swiftcord { 14 | 15 | /** 16 | Gets the "route" for an HTTP request 17 | 18 | - parameter url: URL to get route from 19 | */ 20 | func getRoute(for url: String) -> String { 21 | 22 | let regex = try! NSRegularExpression( 23 | pattern: "/([a-z-]+)/(?:[0-9]{17,})+?", 24 | options: .caseInsensitive 25 | ) 26 | 27 | let string = NSString(string: url) 28 | let matches = regex.matches( 29 | in: url, 30 | options: [], 31 | range: NSRange(location: 0, length: string.length) 32 | ) 33 | 34 | guard matches.count > 0 else { 35 | return url 36 | } 37 | 38 | var route = "" 39 | 40 | for match in matches { 41 | let miniRoute = string.substring(with: match.range) 42 | var parameters = miniRoute.components(separatedBy: "/") 43 | 44 | parameters.remove(at: 0) 45 | 46 | let parameterId = parameters[1] 47 | parameters[1] = ":id" 48 | 49 | if (parameters[0] == "channels" || parameters[0] == "guilds") 50 | && route.isEmpty { 51 | parameters[1] = parameterId 52 | } 53 | 54 | route += "/" + parameters.joined(separator: "/") 55 | } 56 | 57 | return route 58 | } 59 | 60 | /// Used to un clog the global queue full of requests that woudld've resulted in 429 because of global rate limit 61 | func globalUnlock() { 62 | self.isGloballyLocked = false 63 | for request in self.globalRequestQueue { 64 | request() 65 | } 66 | } 67 | 68 | /** 69 | Handles creating buckets, and making sure the bucket is up to date with the headers 70 | 71 | - parameter headers: The received headers from the request 72 | */ 73 | func handleRateLimitHeaders( 74 | _ limitHeader: Any?, 75 | _ intervalHeader: Any?, 76 | _ date: Double, 77 | _ route: String 78 | ) { 79 | guard let limitHeader = limitHeader, 80 | let intervalHeader = intervalHeader else { 81 | return 82 | } 83 | 84 | let limit = Int(limitHeader as! String)! 85 | let interval = Int(round(Double(intervalHeader as! String)!)) - Int(date) 86 | if self.rateLimits[route] == nil { 87 | let bucket = Bucket( 88 | name: "me.azoy.swiftcord.rest.\(route)", 89 | limit: limit, 90 | interval: interval 91 | ) 92 | bucket.take(1) 93 | 94 | self.rateLimits[route] = bucket 95 | } 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Activities.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Activities.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-16. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct Activities: Encodable { 11 | public let name: String 12 | public let type: Int 13 | public var url: String? 14 | 15 | public init(name: String, type: ActivityType, url: String? = nil) { 16 | self.name = name 17 | self.type = type.rawValue 18 | let isValidURL = validateUrl(url: url) 19 | 20 | if isValidURL { 21 | self.url = url 22 | } else { 23 | self.url = "https://www.twitch.tv/" 24 | } 25 | } 26 | 27 | private func validateUrl(url: String?) -> Bool { 28 | // If URL is nil then we can safely ignore 29 | if url == nil { 30 | return true 31 | } 32 | 33 | if !url!.contains("https://twitch.tv/") || !url!.contains("https://youtube.com/") { 34 | print("[Swiftcord] URL for activities requires either a Twitch or Youtube link. There will be no link to your stream in the RPC section.") 35 | return false 36 | } 37 | 38 | return true 39 | } 40 | } 41 | 42 | public enum ActivityType: Int, Encodable { 43 | case playing 44 | case streaming 45 | case listening 46 | case watching 47 | case custom 48 | case competing 49 | } 50 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/DM.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DMChannel.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// DM Type 10 | public struct DM: TextChannel { 11 | 12 | // MARK: Properties 13 | 14 | /// Parent class 15 | public internal(set) weak var swiftcord: Swiftcord? 16 | 17 | /// ID of DM 18 | public let id: Snowflake 19 | 20 | /// The recipient of this DM 21 | public internal(set) var recipient: User 22 | 23 | /// The last message's ID 24 | public let lastMessageId: Snowflake? 25 | 26 | /// Indicates what kind of channel this is 27 | public let type = ChannelType.dm 28 | 29 | // MARK: Initializer 30 | 31 | /** 32 | Creates a DMChannel struct 33 | 34 | - parameter swiftcord: Parent class 35 | - parameter json: JSON representable as a dictionary 36 | */ 37 | init(_ swiftcord: Swiftcord, _ json: [String: Any]) { 38 | self.swiftcord = swiftcord 39 | 40 | self.id = Snowflake(json["id"])! 41 | 42 | let recipients = json["recipients"] as! [[String: Any]] 43 | self.recipient = User(swiftcord, recipients[0]) 44 | 45 | self.lastMessageId = Snowflake(json["last_message_id"]) 46 | 47 | swiftcord.dms[self.recipient.id] = self 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/GroupDM.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GroupChannel.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// GroupDM Type 10 | public struct GroupDM: TextChannel { 11 | 12 | // MARK: Properties 13 | 14 | /// Parent class 15 | public internal(set) weak var swiftcord: Swiftcord? 16 | 17 | /// ID of DM 18 | public let id: Snowflake 19 | 20 | /// The recipient of this DM 21 | public internal(set) var recipients = [User]() 22 | 23 | /// The last message's ID 24 | public let lastMessageId: Snowflake? 25 | 26 | /// Indicates what kind of channel this is 27 | public let type = ChannelType.groupDM 28 | 29 | // MARK: Initializer 30 | 31 | /** 32 | Creates a GroupChannel struct 33 | 34 | - parameter swiftcord: Parent class 35 | - parameter json: JSON representable as a dictionary 36 | */ 37 | init(_ swiftcord: Swiftcord, _ json: [String: Any]) { 38 | self.swiftcord = swiftcord 39 | 40 | self.id = Snowflake(json["id"])! 41 | 42 | let recipients = json["recipients"] as! [[String: Any]] 43 | for recipient in recipients { 44 | self.recipients.append(User(swiftcord, recipient)) 45 | } 46 | 47 | self.lastMessageId = Snowflake(json["last_message_id"]) 48 | 49 | swiftcord.groups[self.id] = self 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/GuildCategory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Webhook.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// Guild Channel Category Structure 10 | public class GuildCategory: GuildChannel { 11 | 12 | /// Parent class 13 | public weak var swiftcord: Swiftcord? 14 | 15 | /// Channel Category this channel belongs to 16 | public var category: GuildCategory? { 17 | guard let parentId = parentId else { 18 | return nil 19 | } 20 | 21 | return guild?.channels[parentId] as? GuildCategory 22 | } 23 | 24 | /// Collection of channels this category parents mapped by channel id 25 | public internal(set) var channels = [Snowflake: GuildChannel]() 26 | 27 | /// The id of the channel 28 | public let id: Snowflake 29 | 30 | /// Guild this channel belongs to 31 | public var guild: Guild? { 32 | return self.swiftcord?.getGuild(for: id) 33 | } 34 | 35 | /// Name of the channel 36 | public let name: String? 37 | 38 | /// Parent Category ID of this channel 39 | public let parentId: Snowflake? 40 | 41 | /// Collection of overwrites mapped by `OverwriteID` 42 | public internal(set) var permissionOverwrites = [Snowflake: Overwrite]() 43 | 44 | /// Position the channel is in guild 45 | public let position: Int? 46 | 47 | /// Indicates what type of channel this is (.guildCategory) 48 | public let type = ChannelType.guildCategory 49 | 50 | /** 51 | Creates Guild Category structure 52 | 53 | - parameter swiftcord: The parent class 54 | - parameter json: The data to transform to a webhook 55 | */ 56 | init(_ swiftcord: Swiftcord, _ json: [String: Any]) { 57 | self.swiftcord = swiftcord 58 | 59 | self.id = Snowflake(json["id"])! 60 | self.name = json["name"] as? String 61 | self.parentId = Snowflake(json["parent_id"]) 62 | 63 | if let overwrites = json["permission_overwrites"] as? [[String: Any]] { 64 | for overwrite in overwrites { 65 | let overwrite = Overwrite(overwrite) 66 | self.permissionOverwrites[overwrite.id] = overwrite 67 | } 68 | } 69 | 70 | self.position = json["position"] as? Int 71 | 72 | if let guildId = Snowflake(json["guild_id"]) { 73 | swiftcord.guilds[guildId]!.channels[self.id] = self 74 | } 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Icon.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Icon.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2022-01-18. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Represents the base64 encoded image needed to send to Discord for Emojis, Stickers, etc... 11 | public struct Icon { 12 | public let imageType: ImageType 13 | public let base64Image: String 14 | 15 | public init(imageType: ImageType, image: Data) { 16 | self.imageType = imageType 17 | self.base64Image = image.base64EncodedString() 18 | } 19 | 20 | func toDataString() -> String { 21 | return "data:\(self.imageType.rawValue);base64,\(self.base64Image)" 22 | } 23 | } 24 | 25 | public enum ImageType: String { 26 | case jpeg = "image/jpeg" 27 | case png = "image/png" 28 | case webp = "image/webp" 29 | case gif = "image/gif" 30 | } 31 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/ActionRow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ActionRow.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-19. 6 | // 7 | 8 | import Foundation 9 | 10 | /// ActionRow object that can hold any `Component` 11 | public struct ActionRow: Component { 12 | public let type: ComponentTypes 13 | public let components: [T] 14 | 15 | enum CodingKeys: String, CodingKey { 16 | case type 17 | case components 18 | } 19 | 20 | public init(components: T...) { 21 | self.type = .actionRow 22 | self.components = components 23 | } 24 | 25 | func encode(from encoder: Encoder) throws { 26 | var container = encoder.container(keyedBy: CodingKeys.self) 27 | try container.encode(self.type, forKey: .type) 28 | try container.encode(self.components, forKey: .components) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Button.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Button.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-16. 6 | // 7 | 8 | import Foundation 9 | 10 | public class ButtonBuilder: Encodable { 11 | /// Message above the buttons. This is required if not sending an embed 12 | public var content: String? 13 | 14 | /// Embed above the buttons. 15 | public var embeds: [EmbedBuilder]? 16 | 17 | /// The buttons array 18 | public var components: [ActionRow] 19 | 20 | public init(message: String? = nil, embed: EmbedBuilder? = nil) { 21 | self.content = message 22 | self.embeds = [] 23 | 24 | if let embedBuilder = embed { 25 | self.embeds?.append(embedBuilder) 26 | } 27 | 28 | self.components = [] 29 | } 30 | 31 | public func addComponent(component: ActionRow) -> Self { 32 | components.append(component) 33 | return self 34 | } 35 | } 36 | 37 | public enum ButtonStyles: Int, Encodable { 38 | case blurple = 1, grey, green, red, url 39 | } 40 | 41 | public struct Button: Component { 42 | public let type: ComponentTypes 43 | public let customId: String 44 | public let disabled: Bool? 45 | public let style: ButtonStyles 46 | public let label: String 47 | public let emoji: Emoji? 48 | public let url: String? 49 | 50 | public init(customId: String, disabled: Bool? = false, style: ButtonStyles, label: String, emoji: Emoji? = nil, url: String? = nil) { 51 | self.type = .button 52 | self.customId = customId 53 | self.disabled = disabled 54 | self.style = style 55 | self.label = label 56 | self.emoji = emoji 57 | self.url = url 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Component.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Components.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-16. 6 | // 7 | 8 | import Foundation 9 | 10 | public enum ComponentTypes: Int, Encodable { 11 | case actionRow = 1, button, selectMenu, textInput 12 | } 13 | 14 | public protocol Component: Encodable { 15 | var type: ComponentTypes { get } 16 | } 17 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Events/ButtonEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonEvent.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2022-01-04. 6 | // 7 | 8 | import Foundation 9 | 10 | public class ButtonEvent: InteractionEvent { 11 | 12 | public var channelId: Snowflake 13 | 14 | public let interactionId: Snowflake 15 | 16 | public let swiftcord: Swiftcord 17 | 18 | /// Guild object for this channel 19 | public var guild: Guild { 20 | return self.swiftcord.getGuild(for: channelId)! 21 | } 22 | 23 | public let token: String 24 | 25 | public var member: Member? 26 | 27 | public let user: User 28 | 29 | public let selectedButton: ButtonComponentData 30 | 31 | public var ephemeral: Int 32 | 33 | public var isDefered: Bool 34 | 35 | init(_ swiftcord: Swiftcord, data: [String: Any]) { 36 | self.swiftcord = swiftcord 37 | self.token = data["token"] as! String 38 | 39 | self.channelId = Snowflake(data["channel_id"])! 40 | 41 | self.interactionId = Snowflake(data["id"] as! String)! 42 | 43 | let inter = data["data"] as! [String: Any] 44 | let componentData = ButtonComponentData(componentType: inter["component_type"] as! Int, customId: inter["custom_id"] as! String) 45 | self.selectedButton = componentData 46 | 47 | var userJson = data["member"] as! [String: Any] 48 | userJson = userJson["user"] as! [String: Any] 49 | self.user = User(swiftcord, userJson) 50 | 51 | self.ephemeral = 0 52 | self.isDefered = false 53 | 54 | self.member = Member(swiftcord, guild, data["member"] as! [String: Any]) 55 | } 56 | } 57 | 58 | public struct ButtonComponentData { 59 | public let componentType: Int 60 | public let customId: String 61 | } 62 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Events/InteractionResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InteractionResponse.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-18. 6 | // 7 | 8 | import Foundation 9 | 10 | struct InteractionResponse: Encodable { 11 | let type: InteractionCallbackType 12 | let data: InteractionBody? 13 | } 14 | 15 | struct InteractionBody: Encodable { 16 | let content: String? 17 | let embeds: [EmbedBuilder]? 18 | let flags: Int? 19 | let components: [ActionRow]? 20 | var attachments: [AttachmentBuilder]? 21 | 22 | public let customId: String? 23 | public let title: String? 24 | 25 | init(content: String? = nil, flags: Int? = nil, embeds: [EmbedBuilder]? = nil, components: [ActionRow]? = nil, modal: Modal? = nil, attachments: [AttachmentBuilder]? = nil) { 26 | self.content = content 27 | self.flags = flags 28 | self.components = components 29 | self.embeds = embeds 30 | self.customId = modal?.customId 31 | self.title = modal?.title 32 | self.attachments = attachments 33 | 34 | // Fix the attachment builder 35 | if let attachments = self.attachments { 36 | for (i, _) in attachments.enumerated() { 37 | self.attachments![i].id = i 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Events/MessageCommandEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCommandEvent.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-20. 6 | // 7 | 8 | import Foundation 9 | 10 | public class MessageCommandEvent: InteractionEvent { 11 | 12 | public var channelId: Snowflake 13 | 14 | public let interactionId: Snowflake 15 | 16 | public let name: String 17 | 18 | public let swiftcord: Swiftcord 19 | 20 | public let token: String 21 | 22 | public var member: Member? 23 | 24 | public let user: User 25 | 26 | /// Guild object for this channel 27 | public var guild: Guild { 28 | return self.swiftcord.getGuild(for: channelId)! 29 | } 30 | 31 | public let guildId: Snowflake 32 | 33 | public let message: Message 34 | 35 | public var ephemeral: Int 36 | 37 | public var isDefered: Bool 38 | 39 | init(_ swiftcord: Swiftcord, data: [String: Any]) { 40 | self.swiftcord = swiftcord 41 | self.token = data["token"] as! String 42 | 43 | self.channelId = Snowflake(data["channel_id"])! 44 | 45 | self.guildId = Snowflake(data["guild_id"] as! String)! 46 | 47 | var userJson = data["member"] as! [String: Any] 48 | userJson = userJson["user"] as! [String: Any] 49 | self.user = User(swiftcord, userJson) 50 | 51 | self.interactionId = Snowflake(data["id"] as! String)! 52 | let name = data["data"] as! [String: Any] 53 | 54 | self.name = name["name"] as! String 55 | 56 | self.ephemeral = 0 57 | self.isDefered = false 58 | 59 | var message = data["data"] as! [String: Any] 60 | 61 | let targetId = message["target_id"] as! String 62 | 63 | message = message["resolved"] as! [String: Any] 64 | message = message["messages"] as! [String: Any] 65 | message = message[targetId] as! [String: Any] 66 | 67 | self.message = Message(swiftcord, message) 68 | 69 | self.member = Member(swiftcord, guild, data["member"] as! [String: Any]) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Events/SelectMenuEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SelectBoxEvent.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-18. 6 | // 7 | 8 | import Foundation 9 | 10 | public class SelectMenuEvent: InteractionEvent { 11 | 12 | public var channelId: Snowflake 13 | 14 | public let interactionId: Snowflake 15 | 16 | public let swiftcord: Swiftcord 17 | 18 | /// Guild object for this channel 19 | public var guild: Guild? { 20 | return self.swiftcord.getGuild(for: channelId) 21 | } 22 | 23 | public let token: String 24 | 25 | public var member: Member? 26 | 27 | public let user: User 28 | 29 | public let selectedValue: SelectMenuComponentData 30 | 31 | public var ephemeral: Int 32 | 33 | public var isDefered: Bool 34 | 35 | init(_ swiftcord: Swiftcord, data: [String: Any]) { 36 | self.swiftcord = swiftcord 37 | self.token = data["token"] as! String 38 | 39 | self.channelId = Snowflake(data["channel_id"])! 40 | 41 | self.interactionId = Snowflake(data["id"] as! String)! 42 | 43 | let inter = data["data"] as! [String: Any] 44 | let componentData = SelectMenuComponentData(componentType: inter["component_type"] as! Int, customId: inter["custom_id"] as! String, value: (inter["values"] as! [String])[0]) 45 | self.selectedValue = componentData 46 | 47 | var userJson: [String: Any] 48 | if let memberJson = data["member"] as? [String: Any] { 49 | userJson = memberJson["user"] as! [String: Any] 50 | } else { 51 | userJson = data["user"] as! [String: Any] 52 | } 53 | self.user = User(swiftcord, userJson) 54 | 55 | self.ephemeral = 0 56 | self.isDefered = false 57 | 58 | self.member = nil 59 | if let memberData = data["member"] as? [String: Any] { 60 | guard let guild = self.guild else { 61 | return 62 | } 63 | self.member = Member(swiftcord, guild, memberData) 64 | } 65 | } 66 | } 67 | 68 | public struct SelectMenuComponentData { 69 | public let componentType: Int 70 | public let customId: String 71 | public let value: String 72 | } 73 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Events/TextInputEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextInputEvent.swift 3 | // 4 | // 5 | // Created by Noah Pistilli on 2022-03-07. 6 | // 7 | 8 | public class TextInputEvent: InteractionEvent { 9 | 10 | public var channelId: Snowflake 11 | 12 | public let interactionId: Snowflake 13 | 14 | public let swiftcord: Swiftcord 15 | 16 | public let token: String 17 | 18 | public var member: Member? 19 | 20 | public var modalID: String 21 | 22 | public let user: User 23 | 24 | /// Guild object for this channel 25 | public var guild: Guild { 26 | return self.swiftcord.getGuild(for: channelId)! 27 | } 28 | 29 | public let guildId: Snowflake 30 | 31 | public var ephemeral: Int 32 | 33 | public var isDefered: Bool 34 | 35 | public var textInputID: String 36 | 37 | public var value: String 38 | 39 | init(_ swiftcord: Swiftcord, data: [String: Any]) { 40 | self.swiftcord = swiftcord 41 | self.token = data["token"] as! String 42 | 43 | self.channelId = Snowflake(data["channel_id"])! 44 | 45 | self.guildId = Snowflake(data["guild_id"] as! String)! 46 | 47 | var userJson = data["member"] as! [String: Any] 48 | userJson = userJson["user"] as! [String: Any] 49 | self.user = User(swiftcord, userJson) 50 | 51 | self.interactionId = Snowflake(data["id"] as! String)! 52 | let _data = data["data"] as! [String: Any] 53 | 54 | self.ephemeral = 0 55 | self.isDefered = false 56 | 57 | let _textInputData = (_data["components"] as! [Any])[0] as! [String:Any] 58 | let textInputData = (_textInputData["components"] as! [Any])[0] as! [String:Any] 59 | 60 | self.textInputID = textInputData["custom_id"] as! String 61 | self.value = textInputData["value"] as! String 62 | 63 | self.modalID = _data["custom_id"] as! String 64 | 65 | self.member = Member(swiftcord, guild, data["member"] as! [String: Any]) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Events/UserCommandEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UserCommandEvent.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-20. 6 | // 7 | 8 | import Foundation 9 | 10 | public class UserCommandEvent: InteractionEvent { 11 | 12 | public var channelId: Snowflake 13 | 14 | public let interactionId: Snowflake 15 | 16 | public let name: String 17 | 18 | public let swiftcord: Swiftcord 19 | 20 | public let token: String 21 | 22 | /// Guild object for this channel 23 | public var guild: Guild { 24 | return self.swiftcord.getGuild(for: channelId)! 25 | } 26 | 27 | public var member: Member? 28 | 29 | public let user: User 30 | 31 | public var targetMember: Member? 32 | 33 | public let targetUser: User 34 | 35 | public let guildId: Snowflake 36 | 37 | public var ephemeral: Int 38 | 39 | public var isDefered: Bool 40 | 41 | init(_ swiftcord: Swiftcord, data: [String: Any]) { 42 | self.swiftcord = swiftcord 43 | self.token = data["token"] as! String 44 | self.guildId = Snowflake(data["guild_id"] as! String)! 45 | self.channelId = Snowflake(data["channel_id"])! 46 | 47 | var userJson = data["member"] as! [String: Any] 48 | userJson = userJson["user"] as! [String: Any] 49 | self.user = User(swiftcord, userJson) 50 | 51 | self.interactionId = Snowflake(data["id"] as! String)! 52 | let name = data["data"] as! [String: Any] 53 | 54 | self.name = name["name"] as! String 55 | 56 | self.ephemeral = 0 57 | self.isDefered = false 58 | 59 | let message = data["data"] as! [String: Any] 60 | let targetId = message["target_id"] as! String 61 | 62 | let resolved = message["resolved"] as! [String: Any] 63 | let userDict = resolved["users"] as! [String: Any] 64 | 65 | self.targetUser = User(self.swiftcord, userDict[targetId] as! [String: Any]) 66 | 67 | self.member = Member(swiftcord, guild, data["member"] as! [String: Any]) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/MessageCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCommand.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-20. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Structure that defines a message command object we send to Discord 11 | public struct MessageCommandBuilder: Encodable { 12 | public var name: String 13 | public let defaultPermission: Bool 14 | public let type: ApplicationType 15 | 16 | public init(name: String) { 17 | self.name = name 18 | self.defaultPermission = true 19 | self.type = .messageCommand 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/Modal.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Modal.swift 3 | // 4 | // 5 | // Created by Noah Pistilli on 2022-03-03. 6 | // 7 | 8 | public struct ModalBuilder { 9 | public let modal: Modal 10 | public let textInput: TextInput 11 | 12 | public init(modal: Modal, textInput: TextInput) { 13 | self.modal = modal 14 | self.textInput = textInput 15 | } 16 | } 17 | 18 | public struct Modal: Encodable { 19 | public let customId: String 20 | public let title: String 21 | 22 | public init(customId: String, title: String) { 23 | self.customId = customId 24 | self.title = title 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/SelectMenu.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SelectMenu.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-16. 6 | // 7 | 8 | import Foundation 9 | 10 | public class SelectMenuBuilder: Encodable { 11 | public var content: String 12 | public var components: [ActionRow] 13 | 14 | public init(message: String) { 15 | self.content = message 16 | self.components = [] 17 | } 18 | 19 | public func addComponent(component: ActionRow) -> Self { 20 | components.append(component) 21 | return self 22 | } 23 | } 24 | 25 | public struct SelectMenu: Component { 26 | public let type: ComponentTypes 27 | public let customId: String 28 | public let options: [SelectMenuOptions] 29 | public let placeholder: String? 30 | 31 | public init(customId: String, placeholder: String? = nil, options: SelectMenuOptions...) { 32 | self.type = .selectMenu 33 | self.customId = customId 34 | self.placeholder = placeholder 35 | self.options = options 36 | } 37 | } 38 | 39 | public struct SelectMenuOptions: Encodable { 40 | public let label: String 41 | public let value: String 42 | public let description: String? 43 | public let emoji: Emoji? 44 | 45 | public init(label: String, value: String, description: String? = nil, emoji: Emoji? = nil) { 46 | self.label = label 47 | self.value = value 48 | self.description = description 49 | self.emoji = emoji 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/SlashCommands.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SlashCommands.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-17. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Structure that defines a slash command object we send to Discord 11 | public class SlashCommandBuilder: Encodable { 12 | // Use coding keys so we keep snake-case out of our properties. 13 | enum CodingKeys: String, CodingKey { 14 | case defaultMemberPermissions = "default_member_permissions" 15 | case defaultPermission = "default_permission" 16 | case description = "description" 17 | case name = "name" 18 | case options = "options" 19 | case type = "type" 20 | } 21 | 22 | public var name: String 23 | public var description: String 24 | public var options: [ApplicationCommandOptions] 25 | public var defaultMemberPermissions: String? 26 | public let defaultPermission: Bool // Deprecated soon, should use defaultMemberPermissions going forward. 27 | public let type: ApplicationType 28 | 29 | public init(name: String, description: String, defaultMemberPermissions: String? = nil) throws { 30 | guard description.count <= 100 else { 31 | throw ApplicationCommandSetupError.valueTooLong(errorMsg: "Command '\(name)' description is too long (\(description.count) characters, max is 100).") 32 | } 33 | guard name.count <= 32 else { 34 | throw ApplicationCommandSetupError.valueTooLong(errorMsg: "Command '\(name)' name is too long (\(name.count) characters, max is 32).") 35 | } 36 | 37 | self.name = name 38 | self.description = description 39 | self.options = [] 40 | self.defaultPermission = true 41 | self.defaultMemberPermissions = defaultMemberPermissions 42 | self.type = .slashCommand 43 | } 44 | 45 | public func addOption(option: ApplicationCommandOptions) throws -> Self { 46 | guard self.options.count < 25 else { 47 | throw ApplicationCommandSetupError.tooManyElements(errorMsg: "Command '\(self.name)' already has the maximum of 25 options assigned to it. Cannot add option '\(option.name)'.") 48 | } 49 | 50 | self.options.append(option) 51 | return self 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/TextInput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextInput.swift 3 | // 4 | // 5 | // Created by Noah Pistilli on 2022-03-04. 6 | // 7 | 8 | public enum TextInputStyles: Int, Encodable { 9 | /// `short` specifies a single line input. 10 | case short = 1 11 | 12 | /// `paragraph` specifies a multiple line input. 13 | case paragraph 14 | } 15 | 16 | public struct TextInput: Component { 17 | public let type: ComponentTypes 18 | public let customId: String 19 | public let style: TextInputStyles 20 | public let label: String 21 | public let minLength: Int? 22 | public let maxLength: Int? 23 | public let required: Bool? 24 | public let value: String? 25 | public let placeholder: String? 26 | 27 | public init( 28 | customID: String, 29 | style: TextInputStyles, 30 | label: String, 31 | minLength: Int? = nil, 32 | maxLength: Int? = nil, 33 | required: Bool? = nil, 34 | value: String? = nil, 35 | placeholder: String? = nil 36 | ) { 37 | self.type = .textInput 38 | self.customId = customID 39 | self.style = style 40 | self.label = label 41 | self.minLength = minLength 42 | self.maxLength = maxLength 43 | self.required = required 44 | self.value = value 45 | self.placeholder = placeholder 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Interactions/UserCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UserCommand.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2021-12-20. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Structure that defines a user command object we send to Discord 11 | public struct UserCommandBuilder: Encodable { 12 | public var name: String 13 | public let defaultPermission: Bool 14 | public let type: ApplicationType 15 | 16 | public init(name: String) { 17 | self.name = name 18 | self.defaultPermission = true 19 | self.type = .userCommand 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Invite.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Invite.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// Invite structure 10 | public struct Invite { 11 | 12 | // MARK: Properties 13 | 14 | /// Channel who owns this invite 15 | public internal(set) weak var channel: GuildText? 16 | 17 | /// Invite code to join 18 | public let code: String 19 | 20 | /// Guild who owns this invite 21 | public internal(set) weak var guild: Guild? 22 | 23 | // MARK: Initializer 24 | 25 | /** 26 | Creates an Invite structure 27 | 28 | - parameter swiftcord: Used to get references to channel and guild 29 | - parameter json: Dictionary representation of invite json 30 | */ 31 | init(_ swiftcord: Swiftcord, _ json: [String: Any]) { 32 | let guild = swiftcord.guilds[ 33 | Snowflake((json["guild"] as! [String: Any])["id"])! 34 | ] 35 | self.guild = guild 36 | self.channel = guild?.channels[ 37 | Snowflake((json["channel"] as! [String: Any])["id"])! 38 | ] as? GuildText 39 | self.code = json["code"] as! String 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Options.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Options.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// Swiftcord Options structure 10 | public struct SwiftcordOptions { 11 | 12 | // MARK: Properties 13 | 14 | /// Whether or not the application is a bot or oauth bearer 15 | public var isBot = true 16 | 17 | /// Whether or not this bot will distribute it's shards across multiple process/machines 18 | public var isDistributed = false 19 | 20 | /// Whether or not caching offline members is allowed 21 | public var willCacheAllMembers = false 22 | 23 | /// Whether or not the bot will log to console 24 | public var willLog = false 25 | 26 | /// Whether or not to shard this bot 27 | public var willShard = true 28 | 29 | // MARK: Initializer 30 | 31 | /// Creates a default SwiftcordOptions 32 | public init( 33 | isBot: Bool = true, 34 | isDistributed: Bool = false, 35 | willCacheAllMembers: Bool = false, 36 | willLog: Bool = false, 37 | willShard: Bool = true 38 | ) { 39 | self.isBot = isBot 40 | self.isDistributed = isDistributed 41 | self.willCacheAllMembers = willCacheAllMembers 42 | self.willLog = willLog 43 | self.willShard = willShard 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Role.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Role.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// Role Type 10 | public struct Role: Codable { 11 | 12 | // MARK: Properties 13 | 14 | /// Color of role as an Int 15 | public let color: Int 16 | 17 | /// ID of the role 18 | public let id: Snowflake 19 | 20 | /// Whether or not this role is hoisted 21 | public let isHoisted: Bool 22 | 23 | /// Whether or not this role is managed 24 | public let isManaged: Bool 25 | 26 | /// Whether or not this role is mentionable 27 | public let isMentionable: Bool 28 | 29 | /// The name of the role 30 | public let name: String 31 | 32 | /// The permission number for this role 33 | public let permissions: Int 34 | 35 | /// The position for this role 36 | public let position: Int 37 | 38 | // MARK: Initializer 39 | 40 | /** 41 | Creates Role struct 42 | 43 | - parameter json: JSON representable as a dictionary 44 | */ 45 | init(_ json: [String: Any]) { 46 | self.color = json["color"] as! Int 47 | self.isHoisted = json["hoist"] as! Bool 48 | self.id = Snowflake(json["id"])! 49 | self.isManaged = json["managed"] as! Bool 50 | self.isMentionable = json["mentionable"] as! Bool 51 | self.name = json["name"] as! String 52 | self.permissions = Int(json["permissions"] as! String)! 53 | self.position = json["position"] as! Int 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Stage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Stage.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2022-01-09. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Represents a Stage instance inside a Stage Channel 11 | public struct Stage { 12 | /// Main class 13 | public let swiftcord: Swiftcord 14 | 15 | /// ID of the stage channel 16 | public let channelID: Snowflake 17 | 18 | /// Guild this stage instance is from 19 | public var guild: Guild? { 20 | return self.swiftcord.getGuild(for: channelID) 21 | } 22 | 23 | /// ID of the stage instance 24 | public let id: Snowflake 25 | 26 | /// Whether or not Stage Discovery is disabled 27 | public var isDiscoveryDisabled: Bool 28 | 29 | public var privacyLevel: StagePrivacyLevel 30 | 31 | /// Topic of the stage channel 32 | public let topic: String 33 | 34 | init(_ swiftcord: Swiftcord, data: [String: Any]) { 35 | self.swiftcord = swiftcord 36 | 37 | self.channelID = Snowflake(data["channel_id"])! 38 | self.id = Snowflake(data["id"])! 39 | self.isDiscoveryDisabled = data["discoverable_disabled"] as! Bool 40 | self.privacyLevel = StagePrivacyLevel(rawValue: data["privacy_level"] as! Int)! 41 | self.topic = data["topic"] as! String 42 | } 43 | } 44 | 45 | /// Privacy Level of the stage instance 46 | public enum StagePrivacyLevel: Int { 47 | /// Deprecated but the docs still show it 48 | case `public` = 1 49 | 50 | /// Can only be accessed by members of the guild; default 51 | case guildOnly 52 | } 53 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/Sticker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Sticker.swift 3 | // Swiftcord 4 | // 5 | // Created by Noah Pistilli on 2022-01-10. 6 | // 7 | 8 | import Foundation 9 | 10 | /// Structure of a sticker object 11 | public struct Sticker: Codable { 12 | /// Description of the sticker 13 | public let description: String? 14 | 15 | /// ID of the sticker 16 | public let id: Snowflake? 17 | 18 | /// If the sticker is available to use. May be false if the guild has lost boosts 19 | public let isAvailable: Bool? 20 | 21 | /// Name of the sticker 22 | public let name: String 23 | 24 | /// For non-guild stickers, the pack the sticker is from 25 | public let packId: Snowflake? 26 | 27 | /// File format of the sticker 28 | public let format: StickerFormat? 29 | 30 | /// Autocompletion tags for the sticker 31 | public let tags: String? 32 | 33 | /// Type of sticker 34 | public let type: StickerTypes? 35 | 36 | // MARK: Initializer 37 | 38 | /** 39 | Creates a Sticker structure from the gateway response 40 | 41 | - parameter json: JSON representable as a dictionary 42 | */ 43 | init(_ json: [String: Any]) { 44 | self.description = json["description"] as? String 45 | self.id = Snowflake(json["id"]) 46 | self.isAvailable = json["available"] as? Bool 47 | self.name = json["name"] as! String 48 | self.packId = Snowflake(json["pack_id"]) 49 | self.format = StickerFormat(rawValue: json["format_type"] as! Int) 50 | self.tags = json["tags"] as? String 51 | self.type = StickerTypes(rawValue: json["type"] as! Int) 52 | } 53 | 54 | /** 55 | Creates a Sticker structure for uploading or editing 56 | 57 | - parameter name: Name of the sticker 58 | - parameter description: Description of the sticker 59 | - parameter tags: A string formatted like comma-seperated values for autocompletion 60 | */ 61 | public init( 62 | name: String, 63 | description: String, 64 | tags: String 65 | ) { 66 | self.name = name 67 | self.description = description 68 | self.tags = tags 69 | 70 | self.id = nil 71 | self.isAvailable = nil 72 | self.packId = nil 73 | self.format = nil 74 | self.type = nil 75 | } 76 | } 77 | 78 | /// The types of stickers possible 79 | public enum StickerTypes: Int, Codable { 80 | /// An official sticker made by Discord 81 | case standard = 1 82 | 83 | /// Stickers found in a guild 84 | case guild 85 | } 86 | 87 | /// The possible file format for stickers 88 | public enum StickerFormat: Int, Codable { 89 | case png = 1 90 | case apng 91 | case lottie 92 | } 93 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/User.swift: -------------------------------------------------------------------------------- 1 | // 2 | // User.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// User Type 12 | public struct User: Imageable { 13 | 14 | // MARK: Properties 15 | 16 | /// Parent class 17 | public internal(set) weak var swiftcord: Swiftcord? 18 | 19 | /// Avatar hash 20 | public let avatar: String? 21 | 22 | /// Discriminator of user 23 | public let discriminator: String? 24 | 25 | /// Email of user (will probably be empty forever) 26 | public let email: String? 27 | 28 | /// ID of user 29 | public let id: Snowflake 30 | 31 | /// Whether or not this user is a bot 32 | public let isBot: Bool? 33 | 34 | /// Whether of not user has mfa enabled (will probably be empty forever) 35 | public let isMfaEnabled: Bool? 36 | 37 | /// Whether user is verified or not 38 | public let isVerified: Bool? 39 | 40 | /// Username of user 41 | public let username: String? 42 | 43 | // MARK: Initializer 44 | 45 | /** 46 | Creates User struct 47 | 48 | - parameter swiftcord: Parent class to get properties from 49 | - parameter json: JSON to decode into User struct 50 | */ 51 | init(_ swiftcord: Swiftcord, _ json: [String: Any]) { 52 | self.swiftcord = swiftcord 53 | 54 | self.avatar = json["avatar"] as? String 55 | self.discriminator = json["discriminator"] as? String 56 | self.email = json["email"] as? String 57 | self.id = Snowflake(json["id"])! 58 | self.isBot = json["bot"] as? Bool 59 | self.isMfaEnabled = json["mfaEnabled"] as? Bool 60 | self.isVerified = json["verified"] as? Bool 61 | self.username = json["username"] as? String 62 | } 63 | 64 | // MARK: Functions 65 | 66 | /// Gets DM for user 67 | public func getDM() async throws -> DM? { 68 | return try await self.swiftcord?.getDM(for: self.id) 69 | } 70 | 71 | /** 72 | Gets the link of the user's avatar 73 | 74 | - parameter format: File extension of the avatar (default png) 75 | */ 76 | public func imageUrl(format: FileExtension = .png) -> URL? { 77 | guard let avatar = self.avatar else { 78 | guard let discrim = self.discriminator, 79 | let discriminator = Int(discrim) else { 80 | return nil 81 | } 82 | // as of 7/18/20, the CDN domain is still cdn.discordapp.com 83 | return URL(string: "https://cdn.discordapp.com/embed/avatars/\(discriminator % 5).\(format)") 84 | } 85 | 86 | return URL(string: "https://cdn.discordapp.com/avatars/\(self.id)/\(avatar).\(format)") 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Types/VoiceState.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VoiceState.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// Structure with user's voice state info 10 | public struct VoiceState: Decodable { 11 | 12 | // MARK: Properties 13 | 14 | /// The ID of the voice channel 15 | public let channelId: Snowflake 16 | 17 | /// Whether or not the user is server deafend 18 | public let isDeafend: Bool 19 | 20 | /// Whether or not the user is server muted 21 | public let isMuted: Bool 22 | 23 | /// Whether or not the user self deafend themselves 24 | public let isSelfDeafend: Bool 25 | 26 | /// Whether or not the user self muted themselves 27 | public let isSelfMuted: Bool 28 | 29 | /// Whether or not the bot suppressed the user 30 | public let isSuppressed: Bool 31 | 32 | /// The Session ID of the user and voice connection 33 | public let sessionId: String 34 | 35 | // MARK: Initializer 36 | 37 | /** 38 | Cretaes VoiceState structure 39 | 40 | - parameter json: The json data 41 | */ 42 | init(_ json: [String: Any]) { 43 | self.channelId = Snowflake(json["channel_id"])! 44 | self.isDeafend = json["deaf"] as! Bool 45 | self.isMuted = json["mute"] as! Bool 46 | self.isSelfDeafend = json["self_deaf"] as! Bool 47 | self.isSelfMuted = json["self_mute"] as! Bool 48 | self.isSuppressed = json["suppress"] as! Bool 49 | self.sessionId = json["session_id"] as! String 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Utils/Bucket.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bucket.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Dispatch 11 | 12 | /// Rate Limit Thing 13 | class Bucket { 14 | 15 | // MARK: Properties 16 | 17 | /// Dispatch Queue to handle requests 18 | let worker: DispatchQueue 19 | 20 | /// Array of DispatchWorkItems to execute 21 | var queue = [DispatchWorkItem]() 22 | 23 | /// Limit on token count 24 | var limit: Int 25 | 26 | /// Interval at which tokens reset 27 | var interval: Int 28 | 29 | /// Current token count 30 | var tokens: Int 31 | 32 | /// Last reset in terms of Date 33 | var lastReset = Date() 34 | 35 | /// Used for Dispatch, but is basically ^ 36 | var lastResetDispatch = DispatchTime.now() 37 | 38 | // MARK: Initializer 39 | 40 | /** 41 | Creates a bucket 42 | 43 | - parameter name: Name of bucket 44 | - parameter limit: Token limit 45 | - parameter interval: Interval at which tokens reset 46 | */ 47 | init(name: String, limit: Int, interval: Int) { 48 | self.worker = DispatchQueue(label: name, qos: .userInitiated) 49 | self.limit = limit 50 | self.tokens = limit 51 | self.interval = interval 52 | } 53 | 54 | // MARK: Functions 55 | 56 | /// Check for token renewal and amount of tokens in bucket. If there are no more tokens then tell Dispatch to execute this function after deadline 57 | func check() { 58 | let now = Date() 59 | 60 | if now.timeIntervalSince(self.lastReset) > Double(self.interval) { 61 | self.tokens = self.limit 62 | self.lastReset = now 63 | self.lastResetDispatch = DispatchTime.now() 64 | } 65 | 66 | guard self.tokens > 0 else { 67 | self.worker.asyncAfter( 68 | deadline: self.lastResetDispatch + .seconds(self.interval + 1) 69 | ) { 70 | self.check() 71 | } 72 | 73 | return 74 | } 75 | 76 | self.execute() 77 | } 78 | 79 | /// Executes the first DispatchWorkItem in self.queue and removes a token from the bucket. 80 | func execute() { 81 | let item = self.queue.remove(at: 0) 82 | self.tokens -= 1 83 | self.worker.async(execute: item) 84 | } 85 | 86 | /** 87 | Queues the given item 88 | 89 | - parameter item: Code block to execute 90 | */ 91 | func queue(_ item: DispatchWorkItem) { 92 | self.queue.append(item) 93 | self.check() 94 | } 95 | 96 | /** 97 | Used to take x amount of tokens from bucket (initial http request for route) 98 | 99 | - parameter num: Amount of tokens to take 100 | */ 101 | func take(_ num: Int) { 102 | self.tokens -= num 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Utils/Imageable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Imageable.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public protocol Imageable { 12 | /// Returns URL of this type 13 | func imageUrl(format: FileExtension) -> URL? 14 | } 15 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Utils/JSON.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JSON.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | import Foundation 9 | 10 | /// JSON BBY 11 | extension String { 12 | 13 | /// EZPZ String JSON -> Array | Dictionary | Other 14 | func decode() -> Any { 15 | let data = try? JSONSerialization.jsonObject( 16 | with: self.data(using: .utf8)!, 17 | options: .allowFragments 18 | ) 19 | 20 | if let dictionary = data as? [String: Any] { 21 | return dictionary 22 | } 23 | 24 | if let array = data as? [Any] { 25 | return array 26 | } 27 | 28 | return data! 29 | } 30 | 31 | } 32 | 33 | /// Used to add same function to two different types once 34 | protocol JSONEncodable { 35 | func encode() -> String 36 | func createBody() -> Data? 37 | } 38 | 39 | /// Make Dictionary & Array Encaodable 40 | extension Dictionary: JSONEncodable {} 41 | extension Array: JSONEncodable {} 42 | 43 | /// Make Dictionary & Array conform to Encodable 44 | extension JSONEncodable { 45 | 46 | /// Encode Array | Dictionary -> JSON String 47 | func encode() -> String { 48 | let data = try? JSONSerialization.data(withJSONObject: self, options: []) 49 | return String(data: data!, encoding: .utf8)! 50 | } 51 | 52 | /// Create Data from Array | Dictionary to send over HTTP 53 | func createBody() -> Data? { 54 | let json = self.encode() 55 | return json.data(using: .utf8) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Utils/Log.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Log.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Logging 10 | 11 | extension Swiftcord { 12 | 13 | /** 14 | Logs the given message 15 | 16 | - parameter message: Info to output 17 | */ 18 | func log(_ message: Logger.Message) { 19 | self.logger.info(message) 20 | } 21 | 22 | /** 23 | Logs the given warning message 24 | 25 | - parameter message: Warning to output 26 | */ 27 | func warn(_ message: Logger.Message) { 28 | self.logger.warning(message) 29 | } 30 | 31 | /** 32 | Logs the given error message 33 | 34 | - parameter message: Error to output 35 | */ 36 | func error(_ message: Logger.Message) { 37 | self.logger.error(message) 38 | } 39 | 40 | func debug(_ message: Logger.Message) { 41 | self.logger.debug(message) 42 | } 43 | 44 | func trace(_ message: Logger.Message) { 45 | self.logger.trace(message) 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Utils/Updatable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Updatable.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | /// Allows for a class to be updated at runtime 10 | protocol Updatable: AnyObject { 11 | 12 | func update(_ json: [String: Any]) 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Sources/Swiftcord/Utils/Utils.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Utils.swift 3 | // Swiftcord 4 | // 5 | // Created by Alejandro Alonso 6 | // Copyright © 2017 Alejandro Alonso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Date { 12 | 13 | /// Computed variable to get milliseconds since 1970 14 | var milliseconds: Int { 15 | return Int((self.timeIntervalSince1970 * 1000.0).rounded()) 16 | } 17 | 18 | } 19 | 20 | extension String { 21 | 22 | // Cached date formatters so we don't have to keep making new ones 23 | 24 | private static let dateFormatLong: DateFormatter = { 25 | let dateFormat = DateFormatter() 26 | dateFormat.locale = Locale(identifier: "en_US") 27 | dateFormat.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ" 28 | return dateFormat 29 | }() 30 | 31 | private static let dateFormatShort: DateFormatter = { 32 | let dateFormat = DateFormatter() 33 | dateFormat.locale = Locale(identifier: "en_US") 34 | dateFormat.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" 35 | return dateFormat 36 | }() 37 | 38 | private static let dateFormatHTTP: DateFormatter = { 39 | let dateFormat = DateFormatter() 40 | dateFormat.locale = Locale(identifier: "en_US") 41 | dateFormat.dateFormat = "E, dd MMM yyyy HH:mm:ss zzzz" 42 | return dateFormat 43 | }() 44 | 45 | /// Computed property to get date from string 46 | var date: Date { 47 | if let returnDate = String.dateFormatLong.date(from: self) { 48 | return returnDate 49 | } else { 50 | return String.dateFormatShort.date(from: self)! 51 | } 52 | } 53 | 54 | /// Computed property to get date from string (specifically the Date header from requests) 55 | var httpDate: Date { 56 | return String.dateFormatHTTP.date(from: self)! 57 | } 58 | 59 | } 60 | 61 | extension Data { 62 | 63 | /// Function to append data 64 | mutating func append(_ string: String) { 65 | if let data = string.data(using: .utf8) { 66 | append(data) 67 | } 68 | } 69 | 70 | } 71 | 72 | extension Task where Success == Never, Failure == Never { 73 | static func sleep(seconds: Double) async throws { 74 | let duration = UInt64(seconds * 1_000_000_000) 75 | try await Task.sleep(nanoseconds: duration) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Tests/SwiftcordTests/SwiftcordTests.swift: -------------------------------------------------------------------------------- 1 | @testable import Swiftcord 2 | import XCTest 3 | 4 | final class SwiftCordTests: XCTestCase { 5 | class TestMessageSend: ListenerAdapter { 6 | override func onMessageCreate(event: Message) async { 7 | if event.content == "+test" { 8 | let msg = try! await event.reply(with: "Testing Swiftcord!") 9 | // Do whatever you want with the message object 10 | sleep(2) 11 | try! await msg!.delete() 12 | } 13 | } 14 | } 15 | 16 | class TestEmbedSend: ListenerAdapter { 17 | override func onMessageCreate(event: Message) async { 18 | if event.content == "+embed" { 19 | let embed = EmbedBuilder() 20 | .setTitle(title: "Swiftcord Embed") 21 | .setDescription(description: "This embed shows off the embed") 22 | .addField("Field", value: "A field") 23 | .setFooter(text: "Created in Swiftcord") 24 | .setTimestamp() 25 | 26 | let _ = try! await event.reply(with: embed) 27 | // Again, do whatever you want with the message object 28 | } 29 | } 30 | } 31 | 32 | /// Sets up the `Swiftcord` object needed across functions 33 | func setUpBot() -> Swiftcord { 34 | let bot = Swiftcord(token: "") 35 | bot.setIntents(intents: .guildMessages) 36 | 37 | let activity = Activities(name: "WiiLink Championships", type: .competing) 38 | 39 | bot.editStatus(status: .online, activity: activity) 40 | return bot 41 | } 42 | 43 | func testStartBot() { 44 | let bot = self.setUpBot() 45 | 46 | bot.connect() 47 | } 48 | 49 | func testMessageCommand() { 50 | let bot = self.setUpBot() 51 | bot.addListeners(TestMessageSend()) 52 | 53 | bot.connect() 54 | } 55 | 56 | func testSendEmbed() { 57 | let bot = self.setUpBot() 58 | bot.addListeners(TestEmbedSend()) 59 | 60 | bot.connect() 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /credits.md: -------------------------------------------------------------------------------- 1 | It should be known that this is a fork of [Sword](https://github.com/Azoy/Sword). 2 | 3 | This is repository is licenced under the same MIT licence as Sword. The original contributors to Sword are listed below: 4 | 5 | [Azoy](https://github.com/Azoy) 6 | 7 | [tellowkrinkle](https://github.com/tellowkrinkle) 8 | 9 | [liamrosenfeld](https://github.com/liamrosenfeld) 10 | 11 | [nullpixel](https://github.com/nullpixel) 12 | 13 | [clbx](https://github.com/clbx) 14 | 15 | [MrLotU](https://github.com/MrLotU) 16 | 17 | [macdja38](https://github.com/macdja38) 18 | 19 | [loganwright](https://github.com/loganwright) 20 | 21 | Parts of voice handling done with work from Erik Little 22 | 23 | License: 24 | 25 | ``` 26 | The MIT License (MIT) 27 | Copyright (c) 2016 Erik Little 28 | 29 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 30 | documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 31 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 32 | persons to whom the Software is furnished to do so, subject to the following conditions: 33 | 34 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 35 | Software. 36 | 37 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 38 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 39 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 40 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 41 | ``` 42 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/activities/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Activities 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/activities/type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | type| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Activities 41 | 42 | 43 | 44 | 45 | 46 | type 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | type 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let type: Int 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/activities/url.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | url| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Activities 41 | 42 | 43 | 44 | 45 | 46 | url 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | url 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var url: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/attachment/size.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | size| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Attachment 41 | 42 | 43 | 44 | 45 | 46 | size 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | size 62 | 63 | 64 | 65 | 66 | 67 | Size of the file in bytes 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let size: Int 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/button/label.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | label| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Button 41 | 42 | 43 | 44 | 45 | 46 | label 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | label 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let label: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/button/url.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | url| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Button 41 | 42 | 43 | 44 | 45 | 46 | url 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | url 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let url: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embed/color.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | color| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Embed 41 | 42 | 43 | 44 | 45 | 46 | color 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | color 62 | 63 | 64 | 65 | 66 | 67 | Side panel color of embed 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var color: Int? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embed/init().html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | init()| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Embed 41 | 42 | 43 | 44 | 45 | 46 | init() 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Initializer 61 | init() 62 | 63 | 64 | 65 | 66 | 67 | Creates an Embed Structure 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | init() 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embed/title.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | title| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Embed 41 | 42 | 43 | 44 | 45 | 46 | title 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | title 62 | 63 | 64 | 65 | 66 | 67 | Title of the embed 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var title: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embed/type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | type| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Embed 41 | 42 | 43 | 44 | 45 | 46 | type 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | type 62 | 63 | 64 | 65 | 66 | 67 | Type of embed 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let type: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embed/url.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | url| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Embed 41 | 42 | 43 | 44 | 45 | 46 | url 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | url 62 | 63 | 64 | 65 | 66 | 67 | URL of the embed 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var url: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embedbuilder/init().html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | init()| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | EmbedBuilder 41 | 42 | 43 | 44 | 45 | 46 | init() 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Initializer 61 | init() 62 | 63 | 64 | 65 | 66 | 67 | Creates an Embed Structure 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | init() 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/embedbuilder/url.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | url| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | EmbedBuilder 41 | 42 | 43 | 44 | 45 | 46 | url 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | url 62 | 63 | 64 | 65 | 66 | 67 | URL of the embed 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var url: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/emoji/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Emoji 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of the emoji 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/event/resume.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Event.resume| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Event 41 | 42 | 43 | 44 | 45 | 46 | Event.resume 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | Event.resume 62 | 63 | 64 | 65 | 66 | 67 | :nodoc: 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case resume 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/event/resumed.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Event.resumed| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Event 41 | 42 | 43 | 44 | 45 | 46 | Event.resumed 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | Event.resumed 62 | 63 | 64 | 65 | 66 | 67 | :nodoc: 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case resumed 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guild/icon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | icon| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Guild 41 | 42 | 43 | 44 | 45 | 46 | icon 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | icon 62 | 63 | 64 | 65 | 66 | 67 | Icon hash for guild 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var icon: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guild/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Guild 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of the guild 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guild/shard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | shard| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Guild 41 | 42 | 43 | 44 | 45 | 46 | shard 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | shard 62 | 63 | 64 | 65 | 66 | 67 | Shard ID this guild is handled by 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let shard: Int? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guild/splash.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | splash| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Guild 41 | 42 | 43 | 44 | 45 | 46 | splash 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | splash 62 | 63 | 64 | 65 | 66 | 67 | Splash Hash for guild 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var splash: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guildcategory/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | GuildCategory 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of the channel 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guildtext/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | GuildText 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of channel 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var name: String? { get } 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/guildvoice/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | GuildVoice 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of channel 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var name: String? { get } 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/imagetype/gif.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ImageType.gif| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | ImageType 41 | 42 | 43 | 44 | 45 | 46 | ImageType.gif 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | ImageType.gif 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case gif 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/imagetype/png.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ImageType.png| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | ImageType 41 | 42 | 43 | 44 | 45 | 46 | ImageType.png 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | ImageType.png 62 | 63 | 64 | 65 | 66 | 67 | No overview available. 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case png 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/invite/code.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | code| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Invite 41 | 42 | 43 | 44 | 45 | 46 | code 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | code 62 | 63 | 64 | 65 | 66 | 67 | Invite code to join 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let code: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/member/nick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | nick| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Member 41 | 42 | 43 | 44 | 45 | 46 | nick 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | nick 62 | 63 | 64 | 65 | 66 | 67 | Nickname of member 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let nick: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/message/flags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | flags| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Message 41 | 42 | 43 | 44 | 45 | 46 | flags 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | flags 62 | 63 | 64 | 65 | 66 | 67 | Message type flags 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | var flags: Int? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/overwrite/allow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | allow| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Overwrite 41 | 42 | 43 | 44 | 45 | 46 | allow 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | allow 62 | 63 | 64 | 65 | 66 | 67 | Allowed permissions number 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let allow: Int 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/overwrite/deny.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | deny| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Overwrite 41 | 42 | 43 | 44 | 45 | 46 | deny 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | deny 62 | 63 | 64 | 65 | 66 | 67 | Denied permissions number 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let deny: Int 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/requesterror/code.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | code| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | RequestError 41 | 42 | 43 | 44 | 45 | 46 | code 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | code 62 | 63 | 64 | 65 | 66 | 67 | Discord custom error code 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let code: Int 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/role/color.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | color| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Role 41 | 42 | 43 | 44 | 45 | 46 | color 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | color 62 | 63 | 64 | 65 | 66 | 67 | Color of role as an Int 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let color: Int 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/role/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Role 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | The name of the role 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/scheduledevent/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | ScheduledEvent 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of the event 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/stage/topic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | topic| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Stage 41 | 42 | 43 | 44 | 45 | 46 | topic 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | topic 62 | 63 | 64 | 65 | 66 | 67 | Topic of the stage channel 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let topic: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/status/dnd.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Status.dnd| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Status 41 | 42 | 43 | 44 | 45 | 46 | Status.dnd 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | Status.dnd 62 | 63 | 64 | 65 | 66 | 67 | Do not disturb status 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case dnd 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/status/idle.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Status.idle| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Status 41 | 42 | 43 | 44 | 45 | 46 | Status.idle 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | Status.idle 62 | 63 | 64 | 65 | 66 | 67 | Away status 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case idle 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/status/online.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Status.online| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Status 41 | 42 | 43 | 44 | 45 | 46 | Status.online 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Case 61 | Status.online 62 | 63 | 64 | 65 | 66 | 67 | Online status 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | case online 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/sticker/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Sticker 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of the sticker 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/thread/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | Thread 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | Name of the thread 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/user/avatar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | avatar| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | User 41 | 42 | 43 | 44 | 45 | 46 | avatar 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | avatar 62 | 63 | 64 | 65 | 66 | 67 | Avatar hash 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let avatar: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/user/isbot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | isBot| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | User 41 | 42 | 43 | 44 | 45 | 46 | isBot 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | isBot 62 | 63 | 64 | 65 | 66 | 67 | Whether or not this user is a bot 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let isBot: Bool? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/user/username.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | username| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | User 41 | 42 | 43 | 44 | 45 | 46 | username 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | username 62 | 63 | 64 | 65 | 66 | 67 | Username of user 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let username: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/userguild/icon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | icon| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | UserGuild 41 | 42 | 43 | 44 | 45 | 46 | icon 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | icon 62 | 63 | 64 | 65 | 66 | 67 | The icon Base64 string 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let icon: String? 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/documentation/swiftcord/userguild/name.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | name| Documentation 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Documentation 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Swiftcord 34 | 35 | 36 | 37 | 38 | 39 | 40 | UserGuild 41 | 42 | 43 | 44 | 45 | 46 | name 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Instance Property 61 | name 62 | 63 | 64 | 65 | 66 | 67 | The name of the guild 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Declaration 76 | 77 | let name: String 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noahpistilli/Swiftcord/6c29626580bc86cab061fa88a16defb05adda979/docs/favicon.ico -------------------------------------------------------------------------------- /docs/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/img/added-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/img/deprecated-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/img/modified-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /images/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noahpistilli/Swiftcord/6c29626580bc86cab061fa88a16defb05adda979/images/step1.png -------------------------------------------------------------------------------- /images/step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noahpistilli/Swiftcord/6c29626580bc86cab061fa88a16defb05adda979/images/step2.png -------------------------------------------------------------------------------- /images/step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noahpistilli/Swiftcord/6c29626580bc86cab061fa88a16defb05adda979/images/step3.png --------------------------------------------------------------------------------
let name: String
let type: Int
var url: String?
let size: Int
let label: String
let url: String?
var color: Int?
init()
var title: String?
let type: String
case resume
case resumed
var icon: String?
var name: String
let shard: Int?
var splash: String?
let name: String?
var name: String? { get }
case gif
case png
let code: String
let nick: String?
var flags: Int?
let allow: Int
let deny: Int
let code: Int
let color: Int
let topic: String
case dnd
case idle
case online
let avatar: String?
let isBot: Bool?
let username: String?
let icon: String?