Commit Graph

51 Commits

Author SHA1 Message Date
ITOH
c91c9d0870 types: remove entire types (#684) 2021-03-23 19:14:26 +04:00
ayntee
6ff4654686 refactor(util): remove chooseRandom() (#682) 2021-03-23 16:47:46 +04:00
ayntee
c1a016ca9f fix(util/collection): .first(), .last(), .random() may return undefined (#680)
* fix(util/collection): .first() may return undefined

* fix(util/collection): .random(), .last() may return undefined
2021-03-23 14:31:29 +04:00
ayntee
5125ffd308 refactor: replace util/cache with cache 2021-03-20 10:06:57 +04:00
ayntee
e9cbbbff7c refactor(helpers): separate functions into files (#667)
* refactor(helpers): separate functions into files

* idk

* idk
2021-03-13 08:10:31 -05:00
ITOH
88ce4da555 fix(utils/permissions): use |= operator for role deny overwrite in calculateChannelOverwrites() (#665) 2021-03-12 15:27:39 +04:00
ITOH
ebbcd762cf feat(util/permissions): improve permission-checking (#381)
* Update permissions.ts

* add(permissions): explaining comments

Since Discord permissions are quiet complex  it is better to have detailed comments explaining everything.

* docs: add better permissions jsdoc comments

* types: add missing errors

* change imports

* we want a string here

* strange commit here

* we need an s in tts

* permissions: update channel permission handling

* permissions: update guild permission handling

* permissions: update member permission handling

* permissions: update message permission handling

* permissions: update webhook permission handling

* fix this buggg

* fix: typo

* better func names

* better description

* permissions(editMember): add permission check if channel_id is provided

* added todo for deaf

* fixxx

* FIIIXXX

* Update permissions.ts

* throwOn to require

* change up review things

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Apply suggestions from code review

Co-authored-by: Ayyan <ayyantee@gmail.com>

* BigInt() to n

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/permissions.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/permissions.ts

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>

* missed this

* Update permissions.ts

* here enum is needed

* use set so errors arenn't strange

* dumb idea

* hasChannelPermissions functions are nice to have

* role to guild

* bugg

* fix(handlers): createGuildChannel check overwrite perms

* remove redundant if check

* fixes

* Update guild.ts

* bettrrrr

* Revert "bettrrrr"

This reverts commit ecbd30e160.

* I hate it

* fix fix

* fixxesss

* this function is better

* oh forgot these

* better I guess

* more functions

* silly me forgot to remove console.logs

* buuuuugs

* small changes

* Update permission.ts

* Update permissions.ts

* Update GUILD_CREATE.ts

* Update channel.ts

* remove this

* suggestions

Co-authored-by: Ayyan <ayyantee@gmail.com>
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2021-03-11 22:33:52 +04:00
ayntee
8654aeded5 refactor: rename controllers to handlers and handlers to helpers (#660)
* refactor: rename controllers to handlers and handlers to helpers

* fmt
2021-03-11 21:41:03 +04:00
ayntee
aaed064709 refactor(controllers): separate controllers into different files (#657)
* refactor(controllers): separate controller into files

* add CHANNEL_UPDATE

* guilds

* interactions

* members

* messages

* finally

* done

* fix ci

* fixes
2021-03-11 20:38:27 +04:00
ayntee
45a3246370 fix(ws/shard): update status update payload (#559)
* fix(ws/shard): update status update payload

* :(

* Update src/types/discord.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* it\'s activitypayload

* Update src/types/discord.ts

* idk

* idk

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
2021-03-08 19:41:20 +04:00
ITOH
25858b3144 feat(util): add camelToSnakeCase() & snakeToCamelCase() (#615)
* feat(util): add to camel/snake case functions

* add tests

* hmm

* add lint ignore comment

Co-authored-by: ayntee <ayyantee@gmail.com>
2021-03-07 18:51:59 +04:00
ayntee
4af6f363f8 feat(handlers/webhook): test slash command name against ^[\w-]{1,32}$ (#613)
* feat(handlers/webhook): test slash command name against ^[\w-]{1,32}$

* Update src/api/handlers/webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/api/handlers/webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/api/handlers/webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* Update src/api/handlers/webhook.ts

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>

* move to constants file

* idk

* idk

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
2021-03-07 18:48:12 +04:00
ayntee
7a52f301b3 fix(util/permissions): move owner check before member cache check (#555) 2021-02-27 23:54:37 +04:00
ayntee
2fc067b26d Revert "feat(handlers): add Membership Screening" (#490)
* Revert "feat(handlers): add Membership Screening (#449)"

This reverts commit 6599636dbc.

* Remove type definitions
2021-01-30 15:23:29 +04:00
ayntee
79089d239b fix(util/permissions): include guild ID while resolving bits (#481)
Closes #480
2021-01-28 13:58:24 +04:00
Ayyan
6599636dbc feat(handlers): add Membership Screening (#449)
* feat(handlers): support membership screening feature

* s
2021-01-26 19:20:06 +04:00
ayntee
683900236f Remove tests 2021-01-26 13:16:53 +04:00
ITOH
95a2b7a74d feat(util): add camelToSnakeCase() & snakeToCamelCase() (#473)
* Update utils.ts

* add tests

* Update utils.test.ts

* void unnecessary

* Apply suggestions from code review

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/utils.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update utils.ts

* remove object test

* some name changes

Co-authored-by: Ayyan <ayyantee@gmail.com>
2021-01-26 12:44:25 +04:00
Ayyan
17959bc1c8 Revert "feat(util): add camelToSnakeCase() & snakeToCamelCase() (#463)" (#469)
This reverts commit 08d685743a.
2021-01-26 10:51:36 +04:00
ITOH
08d685743a feat(util): add camelToSnakeCase() & snakeToCamelCase() (#463)
* Update utils.ts

* add tests

* Update utils.test.ts

* void unnecessary

* Apply suggestions from code review

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/utils.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update utils.ts

* remove object test

* some name changes

Co-authored-by: Ayyan <ayyantee@gmail.com>
2021-01-26 10:45:30 +04:00
ITOH
ce33790d97 fix(util): use custom cache instead of default cache (#461)
* Update permissions.ts

* fixe that
2021-01-25 17:24:33 +04:00
ayntee
e455ba1655 Revert "refactor(util): use getter instead (#432)"
This reverts commit 8d5803c82a.
2021-01-25 15:09:02 +04:00
ITOH
51387c5705 refactor(util): COMMANDS_GUILD_ID constant arg order (#440)
* fmt

* refactor(util): change arg order for COMMANDS_GUILD_ID

* refactor(handlers): change arg order for COMMANDS_GUILD_ID

* feat(handlers): add getSlashCommand function

* Update mod.ts

* remove that
2021-01-24 15:12:40 +04:00
ITOH
c281665961 fix: use applicationID for slash commands instead of botID (#437)
* add(bot): ApplicationID let & setApplicationID function

* fix(controllers): set application id when bot is ready

* refactor(util): rename botID argument to applicationID

* fix(handlers): use applicationID
2021-01-23 23:19:12 +04:00
ITOH
f6f435bb1f feat(handlers): add getAvailableVoiceRegions() (#425)
* add voice endpoint

* feat(handlers): add getVoiceRegions

* Update mod.ts

* remove breaking changes
2021-01-23 23:17:11 +04:00
ITOH
f70a989a21 types: better types (#413)
* Update cache.ts

* Update shard_manager.ts
2021-01-23 23:15:11 +04:00
ITOH
8beb036741 feat(handlers): add getGatewayBot() & getApplicationInformation() (#428)
* feat(handlers): add getGatewayBot()

* refactor(bot): use getGatewayBot() to get gateway data

* feat(handlers): add getApplicationInformation

* add(handlers): getApplicationInformation jsdoc

* Add oauth required types

* create separate file

* delete misc

* OAuthApplication

* forgot to update import

* idk why that was here
2021-01-23 14:51:35 +04:00
Ayyan
8d5803c82a refactor(util): use getter instead (#432) 2021-01-21 22:47:46 +04:00
ITOH
3c93237976 refactor(util): remove GUILD_INTEGRATION_CREATE endpoint (#430) 2021-01-21 21:23:02 +04:00
ITOH
8b663ca4de refactor(util): update endpoints (#383)
* Update constants.ts

* fiiiixxxx

* dupe

* Update src/util/constants.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* USER_DM

* fix this and remove that

* Update src/util/constants.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update constants.ts

* Update src/util/constants.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update src/util/constants.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* need these

* hmm

* rename GUILD_EMBED to GUILD_WIDGET

* idk

* Update src/util/constants.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>

* Update constants.ts

* Update constants.ts

Co-authored-by: Ayyan <ayyantee@gmail.com>
2021-01-17 20:34:34 +04:00
Skillz
be98dcbfa5 fix default avatars 2021-01-14 12:21:46 -05:00
Ayyan
27fb44128f refactor: replace "return await" (#354) 2021-01-09 21:48:02 +04:00
Ayyan
e5a8f3b358 chore: setup "deno lint" (#331)
* chore: setup "deno lint"

* ci(lint): add --unstable flat to lint script

* lint

* lint

* refactor: destructure assignment for Message#guildID

* chore: remove TODO comment

* refactor: remove redundant async

* chore: switch to Deno stable vscode ext

* chore: remove ignore comments

* chore: remove ignore comments

* chore: remove @ts-ignore comment

* fixes

* fixes

* chore: remove deno-lint-ignore comment

* chore: add index signature
2021-01-03 20:12:42 +04:00
ayntee
32c3306bf0 fix: outdated pin & unpin handlers and endpoints 2021-01-02 17:10:18 +04:00
TriForMine
d53725d069 fix: use correct bitwise operator (#302)
* Fix permissions (sorry my ide changed & to &&)

* Change botHasChannelPermissions to async.
This seems to have fixed my issue for my bot

* Remove async for botHasChannelPermissions

* Add async back for botHasChannelPermissions since it doesn't work without it

* Remove async, the issues were something else apparently
2020-12-30 17:35:39 +04:00
TriForMine
484f86638f refactor: resolve async promises, fixed typos, and used inline variable for return (#299)
* Added await in async function, fixed typos and used inline variable for return

* Added await in async function, fixed typos and used inline variable for return

* Revert "Added await in async function, fixed typos and used inline variable for return"

This reverts commit f31caf5d

* Added await in async function, fixed typos and used inline variable for return

* Fixes format

* Fixes format 2

* Fixes format 4475757

* Fixes format 878757854786312378657865785785785785

* Change return to await

* Fixing more issues

* Fixing even more issues

* Fixing even more issues +

* Fixes format
2020-12-30 12:31:11 +04:00
ITOH
abee2e2dee fix: hasChannelPermissions() to use memberIDHasPermission() (#279) 2020-12-27 19:46:11 +04:00
TriForMine
d5c19e50f0 fix: remove extra slash from IMAGE_BASE_URL (#274)
Removed the extra slash at the end since the usage of this variable always add the slash after the constant.
2020-12-27 14:33:37 +04:00
Skillz
189dc150f2 rename to mod.ts 2020-12-26 19:30:32 -05:00
Skillz4Killz
af156b6b25 Merge pull request #262 from discordeno/getters
feat: implement getters
2020-12-26 18:37:55 -05:00
Skillz4Killz
4f12969cd8 fmt 2020-12-26 23:35:58 +00:00
ayntee
2c697a4d2d refactor: add gateway version to constants 2020-12-26 20:01:41 +04:00
ayntee
d793a46497 Merge branch 'next' of https://github.com/discordeno/discordeno into getters 2020-12-26 19:46:17 +04:00
ayntee
64884439db refactor(rest): move user agent to constants 2020-12-26 19:36:08 +04:00
ayntee
8e3fab7411 fix: remove util/cdn export 2020-12-24 17:59:15 +04:00
ayntee
fe43cc8f88 Some updates―renaming interfaces and files 2020-12-23 18:12:12 +04:00
ayntee
321175a72f Revert "chore: verbose imports"
This reverts commit dfe6f371d3.
2020-12-23 11:03:06 +04:00
ayntee
dfe6f371d3 chore: verbose imports 2020-12-22 22:59:09 +04:00
ayntee
7d183b9bef Merge branch 'next' of https://github.com/discordeno/discordeno into getters 2020-12-22 22:06:41 +04:00
Skillz4Killz
19f228c329 feat: slash commands and interactions (#248)
* start slash commands

* lil bit of this

* a little bit of that

* chore: add slash commands' types  (#249)

* Add slash Types

* style: format source files

* interaction create event

* make it a valid controller

* respond to a slash command

* interactions

* shtuff

* gotta get them all

* you gotta hit the bullseye

* you gotta survive

* most important thing i forgot

* please keep this

* more shuttttfgvuasdafwesdvjzdk

* more endpoints

* TYPO

* making that party jam

* this is my jam

* refactor: move slash commands types to webhook.ts (#250)

* Move Types

* Move to webhook.ts types file

* Update webhook.ts

* fix: update ExecuteSlashCommandOptions (#252)

* Move Types

* idk

* Remove Unnecessary Comment

* details

* http side of slash

* Format

* idk

* cleanup

* fmt

* fix imports

* tet

* remove log

* Update interactions.ts

* Update interactions.ts

* Update interactions.ts

* Use tweetnacl_deno for verification

* chore: move tweetnacl import to deps.ts

* Update deps.ts

* deps: use tweetnacl from GitHub

* fix: use serverOptions.slashHexKey

* fix: res -> req

* fix: use TextEncoder

* deps: add std@0.81.0/encoding/hex.ts

* chore: use encode() from std/encoding/hex.ts

* I am using the GitHub online editor pls help

* Update deps.ts

* Update interactions.ts

* Update interactions.ts

* Update interactions.ts

* Update interactions.ts

* fix: respond with 400 if timestamp and signature not present

* style: format files

* refactor!: merge createServer() into startServer()

* style: format files

Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
Co-authored-by: ayntee <ayyantee@gmail.com>
2020-12-22 21:39:01 +04:00