Skip to content

Commit

Permalink
Dysnomia port (#12)
Browse files Browse the repository at this point in the history
* fix(voice): re-add receive listener on connect (abalabahaha#1332)

* fix(getAllUsers): request presences if intent is enabled (abalabahaha#1378)

* chore(Base): document props, static methods (abalabahaha#1380)

* fix(Guild#editCommandPermissions): fix alias typo (abalabahaha#1350)

* fix(getGuildAuditLog): cache users & threads earlier (abalabahaha#1367)

* fix(messageUpdate): fix oldMessage#mentions type (abalabahaha#1377)

* fix(joinVoiceChannel): skip permission check if Member uncached (abalabahaha#1383)

Co-authored-by: Donovan Daniels <[email protected]>

* fix(ShardManager): refactor concurrency check, add option (abalabahaha#1382)

* fix(createRole): split options into separate overloads (abalabahaha#1376)

* feat(getGuildBans): support pagination (abalabahaha#1363)

Co-authored-by: abalabahaha <[email protected]>

* feat(editChannelPositions): add support for endpoint (abalabahaha#1328)

Co-authored-by: bsian03 <[email protected]>
Co-authored-by: abalabahaha <[email protected]>

* fix(editChannel): fix `videoQualityMode` & add `permissionOverwrites` (abalabahaha#1319)

* feat(connect): add token check (abalabahaha#1283)

* feat(Client): allow custom numbers in intents option (abalabahaha#1388)

Co-authored-by: Donovan Daniels <[email protected]>
Co-authored-by: abalabahaha <[email protected]>

* feat(interactions): Add support for appPermissions (abalabahaha#1394)

* fix(Client): remove optional chaining from 05a932a

* 0.17.1

* chore: bump dev version to 0.17.2-dev

* feat(Member): Add dynamicAvatarURL (abalabahaha#1411)

* feat(permissions): Slash Permissions v2 (PR 1372)

* Attachment type (PR 1358)

* Remove all user account features (PR 1338)

* refactor(interactions): Interactions Refactor (PR 1309)

* feat(interactions): Support Modals (PR 1404)

* Use process warnings for deprecations (PR 1276)

* Guild Scheduled Events (PR 1275)

* Follow http/https redirects when playing song (PR 494)

* Return void on 204 (PR 1021)

* Allow configuring RequestHandler to use HTTP instead of HTTPS (PR 1193)

* Standardized parsing errors (PR 1227)

* feat(gateway): Use New Resume URL (PR 1410)

* refactor: remove StoreChannels (PR 1405)

* feat(bans): Seconds Support (PR 1397)

* feat(AutoModeration): Support Auto Moderation (PR 1390)

* feat(options): Gateway Options (PR 1384)

* refactor: Overall Consistency Fixes & Minor Feature Additions (PR 1379)

* fix(CommandClient): await permission checks (PR 1414)

* feat: API v10 (PR 1371)

* chore: rebrand to Project Dysnomia

* lint

* fix: use ./* for exports

* chore: rename forgotten references to Eris (#2)

For the time being, until I figure out what to do with references to Eris' website, appropriate links in code/Discord's API docs have been linked.

* chore: remove deprecated/dead code (#3)

* feat: entity select types (#4)

* chore(examples/intent): fix import typo (#6)

* chore: update example in README.md (#7)

* feat: modern file uploading (#5)

* fixup(Client): oops :( make _processAttachments return the expected structure (#8)

Also do not pass empty file arrays (triggers data being sent over as multipart data)

* feat(automoderation): support new trigger metadata (#9)

* support new trigger metadata types

* update trigger type constants

* deprecate camel-cased trigger metadata, use raw metadata instead

* feat(Constants): add ACTIVE_DEVELOPER user flag (#10)

* feat: forum support (#1)

I believe this should be enough to ensure full forum support. Although, some things might've been missed out by accident.

* Attachment#proxyUrl -> Attachment#proxyURL (#11)

* fix(Client): do not send the file buffer twice (#13)

* feat(Guild): automatically populate events on GUILD_CREATE (#12)

* feat(ForumChannel): `default_forum_layout` (#14)

* chore: update dev dependencies and lint (#15)

* chore: remove editGuildVanity (abalabahaha#18)

* Removed editGuildVanity

The vanity endpoint was disabled for bots

```
{
    "message": "Bots cannot use this endpoint",
    "code": 20001
}
```

* remove Guild#editVanity

* update TSDs appropriately

Co-authored-by: Lars_und_so <[email protected]>

* feat(ApplicationCommand): support NSFW commands (#16)

* docs: document audit log after parameter (abalabahaha#20)

ref: discord/discord-api-docs@38f01b0

* fix(Constants): wrong ACTIVE_DEVELOPER bit (╯°□°)╯︵ ┻━┻ (abalabahaha#23)

* feat: add new message types (abalabahaha#22)

* feat: add new message types

currently won't apply any transformations to message content, as I don't know how the messages look like.

ref: discord/discord-api-docs@e9711be
ref: discord/discord-api-docs@83f6c85

* don't do anything special to the messages right now

* feat: add GIF as a supported sticker format (abalabahaha#24)

ref: discord/discord-api-docs@5214f12

* feat: linked roles (abalabahaha#19)

* add role connection verification url into OAuthAppInfo

* Add Client#{edit,get}RoleConnectionMetadata

Interface may be subject to change

* add guild connection role tag

* add role connection metadata type enum

* add types

* feat(ThreadChannel): thread member pagination (abalabahaha#25)

* feat(ThreadChannel): allow fetching more details about thread members

* feat(ThreadChannel): add singular thread member fetching

* remove redundant parameter

* member data from THREAD_MEMBERS_UPDATE is sent in the member field

* handle the guild not being cached accordingly

* consistently transform options in getThreadMember

* feat: role subscriptions (abalabahaha#21)

* basic role subscription implementation

* add role subscription data to Message object

see API docs PR 5828

* align guild features with API docs

* remove TODO comment

roleSubscriptionData will be kept as a camelCased object

* fix(ThreadMember): missing Member import (abalabahaha#27)

* feat(Client): add threadID support to editWebhookMessage (abalabahaha#28)

* fix(Client): add threadID support to editWebhookMessage

* reword doc for threadID

* add threadID doc to Message#editWebhook

* update ts definitions

* fix(ShardManager): correctly emit warning on invalid intent (abalabahaha#29)

* fix(ForumChannel): document and handle nullability of certain fields

---------

Co-authored-by: Jim Chen <[email protected]>
Co-authored-by: EXPLOSION <[email protected]>
Co-authored-by: Erin <[email protected]>
Co-authored-by: Chris <[email protected]>
Co-authored-by: Donovan Daniels <[email protected]>
Co-authored-by: abal <[email protected]>
Co-authored-by: HeadTriXz <[email protected]>
Co-authored-by: Carlos Lima <[email protected]>
Co-authored-by: bsian03 <[email protected]>
Co-authored-by: isaiah <[email protected]>
Co-authored-by: Catboy <[email protected]>
Co-authored-by: HcgRandon <[email protected]>
Co-authored-by: F Robinson <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: Loliticos <[email protected]>
Co-authored-by: macdja38 <[email protected]>
Co-authored-by: Thijs Molendijk <[email protected]>
Co-authored-by: LJNeon <[email protected]>
Co-authored-by: yalpha <[email protected]>
Co-authored-by: TTtie <[email protected]>
Co-authored-by: Sham <[email protected]>
Co-authored-by: Lars_und_so <[email protected]>
Co-authored-by: Cynthia Foxwell <[email protected]>
Co-authored-by: Snazzah <[email protected]>
  • Loading branch information
1 parent fa4f23c commit ca160c2
Show file tree
Hide file tree
Showing 68 changed files with 5,364 additions and 4,872 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Thanks for considering contributing!

A few rules of thumb:
- Code contributions should match the existing code style. `npm run lint:js` and `npm run lint:ts` could help you check
- Discuss additions/changes with us [on Discord](https://abal.moe/Eris/invite) before working on them
- Discuss additions/changes with us [on Discord](https://discord.gg/2uUvgJzgCE) before working on them
- Check the dev branch to make sure someone hasn't worked on the same thing already
- Pull requests should point to the dev branch, not master
- Pull requests should point to the dev branch.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2016-2021 abalabahaha
Copyright (c) 2022- Project Dysnomia Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
Eris [![NPM version](https://img.shields.io/npm/v/eris.svg?style=flat-square&color=informational)](https://npmjs.com/package/eris)
Project Dysnomia
====

A Node.js wrapper for interfacing with Discord.
A fork of [Eris](https://github.com/abalabahaha/eris), a Node.js wrapper for interfacing with Discord, focused on keeping up with the latest Discord API changes.

Installing
----------

You will need NodeJS 10.4+. If you need voice support you will also need Python 2.7 and a C++ compiler. Refer to [the Getting Started section of the docs](https://abal.moe/Eris/docs) for more details.
You will need NodeJS 10.4+. Voice support requires [additional software](https://github.com/nodejs/node-gyp#installation).

```
npm install --no-optional eris
npm install --no-optional @projectdysnomia/dysnomia
```

If you'd like to install the development versions of the library, use the following command instead:
```
npm install --no-optional github:projectdysnomia/dysnomia#dev
```

If you need voice support, remove the `--no-optional`.
Expand All @@ -18,13 +23,15 @@ Ping Pong Example
-----------------

```js
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN", {
intents: [
"guildMessages"
]
const bot = new Dysnomia("Bot TOKEN", {
gateway: {
intents: [
"guildMessages"
]
}
});

bot.on("ready", () => { // When the bot is ready
Expand All @@ -48,15 +55,14 @@ bot.on("messageCreate", (msg) => { // When a message is created
bot.connect(); // Get the bot to connect to Discord
```

More examples can be found in [the examples folder](https://github.com/abalabahaha/eris/tree/master/examples).
More examples can be found in [the examples folder](https://github.com/projectdysnomia/dysnomia/tree/master/examples).

Useful Links
------------

- [The website](https://abal.moe/Eris/) has more details and documentation.
- [The official Eris server](https://abal.moe/Eris/invite) is the best place to get support.
- [The GitHub repo](https://github.com/abalabahaha/eris) is where development primarily happens.
- [The NPM package webpage](https://npmjs.com/package/eris) is, well, the webpage for the NPM package.
- [The official Project Dysnomia server](https://discord.gg/2uUvgJzgCE) is the best place to get support.
- [The GitHub repo](https://github.com/projectdysnomia/dysnomia) is where development primarily happens.
- [The NPM package webpage](https://npmjs.com/package/@projectdysnomia/dysnomia) is, well, the webpage for the NPM package.

License
-------
Expand Down
15 changes: 7 additions & 8 deletions esm.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Eris from "./index.js";
import Dysnomia from "./index.js";

export default function(token, options) {
return new Eris.Client(token, options);
return new Dysnomia.Client(token, options);
}

export const {
ApplicationCommand,
Attachment,
AutocompleteInteraction,
Base,
Bucket,
Call,
CategoryChannel,
Channel,
Client,
Expand All @@ -21,16 +22,17 @@ export const {
DiscordHTTPError,
DiscordRESTError,
ExtendedUser,
GroupChannel,
Guild,
GuildChannel,
GuildIntegration,
GuildPreview,
GuildScheduledEvent,
GuildTemplate,
Interaction,
Invite,
Member,
Message,
ModalSubmitInteraction,
NewsChannel,
NewsThreadChannel,
Permission,
Expand All @@ -39,25 +41,22 @@ export const {
PrivateChannel,
PrivateThreadChannel,
PublicThreadChannel,
Relationship,
RequestHandler,
Role,
SequentialBucket,
Shard,
SharedStream,
StageChannel,
StageInstance,
StoreChannel,
TextChannel,
TextVoiceChannel,
ThreadChannel,
ThreadMember,
UnavailableGuild,
UnknownInteraction,
User,
VERSION,
VoiceChannel,
VoiceConnection,
VoiceConnectionManager,
VoiceState
} = Eris;
} = Dysnomia;
14 changes: 7 additions & 7 deletions examples/applicationCommands.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

const Constants = Eris.Constants;
const Constants = Dysnomia.Constants;

// Replace TOKEN with your bot account's token
const bot = new Eris("BOT TOKEN", {
intents: [] //No intents are needed for interactions, but you still need to specify either an empty array or 0
const bot = new Dysnomia("BOT TOKEN", {
gateway: {
intents: [] //No intents are needed for interactions, but you still need to specify either an empty array or 0
}
});

bot.on("ready", async () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"

//Note: You should use guild commands to test, as they update instantly. Global commands can take up to an hour to update.

const commands = await bot.getCommands();

if(!commands.length) {
Expand Down Expand Up @@ -80,7 +80,7 @@ bot.on("error", (err) => {
});

bot.on("interactionCreate", (interaction) => {
if(interaction instanceof Eris.CommandInteraction) {
if(interaction instanceof Dysnomia.CommandInteraction) {
switch(interaction.data.name) {
case "test_edit_command":
interaction.createMessage("interaction recieved");
Expand Down
6 changes: 3 additions & 3 deletions examples/basicCommands.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris.CommandClient("Bot TOKEN", {}, {
description: "A test bot made with Eris",
const bot = new Dysnomia.CommandClient("Bot TOKEN", {}, {
description: "A test bot made with Dysnomia",
owner: "somebody",
prefix: "!"
});
Expand Down
12 changes: 7 additions & 5 deletions examples/components.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

const Constants = Eris.Constants;
const Constants = Dysnomia.Constants;

// Replace TOKEN with your bot account's token
const bot = new Eris("BOT TOKEN", {
intents: ["guildMessages"]
const bot = new Dysnomia("BOT TOKEN", {
gateway: {
intents: ["guildMessages"]
}
});

bot.on("ready", async () => { // When the bot is ready
Expand Down Expand Up @@ -71,7 +73,7 @@ bot.on("messageCreate", (msg) => { // When a message is created
});

bot.on("interactionCreate", (interaction) => {
if(interaction instanceof Eris.ComponentInteraction) {
if(interaction instanceof Dysnomia.ComponentInteraction) {
return interaction.createMessage({
content: "Interaction Recieved",
flags: 64
Expand Down
6 changes: 3 additions & 3 deletions examples/embed.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN");
const bot = new Dysnomia("Bot TOKEN");

bot.on("ready", () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"
Expand Down Expand Up @@ -35,7 +35,7 @@ bot.on("messageCreate", (msg) => { // When a message is created
}
],
footer: { // Footer text
text: "Created with Eris."
text: "Created with Dysnomia."
}
}]
});
Expand Down
14 changes: 8 additions & 6 deletions examples/intent.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN", {
intents: [
"guilds",
"guildMessages"
]
const bot = new Dysnomia("Bot TOKEN", {
gateway: {
intents: [
"guilds",
"guildMessages"
]
}
});

bot.on("ready", () => { // When the bot is ready
Expand Down
4 changes: 2 additions & 2 deletions examples/pingpong.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN");
const bot = new Dysnomia("Bot TOKEN");

bot.on("ready", () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"
Expand Down
4 changes: 2 additions & 2 deletions examples/playFile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN");
const bot = new Dysnomia("Bot TOKEN");

const playCommand = "!play";

Expand Down
6 changes: 3 additions & 3 deletions examples/reactionButtons.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris.CommandClient("Bot TOKEN", {}, {
description: "A test bot made with Eris",
const bot = new Dysnomia.CommandClient("Bot TOKEN", {}, {
description: "A test bot made with Dysnomia",
owner: "somebody",
prefix: "!"
});
Expand Down
16 changes: 9 additions & 7 deletions examples/sharding.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const Eris = require("eris");
const Dysnomia = require("@projectdysnomia/dysnomia");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN", {
firstShardID: 0,
lastShardID: 15,
maxShards: 16,
getAllUsers: false,
intents: ["guilds", "guildMembers", "guildPresences"]
const bot = new Dysnomia("Bot TOKEN", {
gateway: {
firstShardID: 0,
lastShardID: 15,
maxShards: 16,
getAllUsers: false,
intents: ["guilds", "guildMembers", "guildPresences"]
}
});

bot.on("ready", () => { // When the bot is ready
Expand Down
Loading

0 comments on commit ca160c2

Please sign in to comment.