1
0
Fork 0
mirror of https://github.com/1disk/edp445.git synced 2024-08-14 22:47:02 +00:00

Changed alot of things.

This commit is contained in:
koelo 2022-12-03 05:44:44 +00:00
parent a5a0523e5a
commit 3513d5390c
2016 changed files with 336930 additions and 9 deletions

94
node_modules/discord-inline-reply/README.md generated vendored Normal file
View file

@ -0,0 +1,94 @@
<div align="center">
</div>
## Install
```sh
$ npm i inline-reply
```
## Setup
```js
const discord = require('discord.js');
require('discord-inline-reply'); //⚠️ IMPORTANT: put this before your discord.Client()
const client = new discord.Client();
```
<h1>Discord.js</h2>
## Example
```js
const discord = require('discord.js');
require('discord-inline-reply'); //⚠️ IMPORTANT: put this before your discord.Client()
const client = new discord.Client();
client.on('ready', () => {
console.log(client.user.tag)
});
client.on('message', async message => {
if (message.content.startsWith('!reply')) {
message.lineReply('Hey'); //Line (Inline) Reply with mention
message.lineReplyNoMention(`My name is ${client.user.username}`); //Line (Inline) Reply without mention
}
});
client.login('TOKEN');
```
## Preview
</a>
<a href="https://github.com/OmBodkhe1/">
<img align ="left" alt="Om's Github" width="1000px" src ="https://i.imgur.com/5uPSD43.png" />
</a> <br/>
## Embed
```js
if (message.content.startsWith('!reply')) {
let embed = new discord.MessageEmbed()
.setDescription(`Reply to ${message.author}`);
message.lineReply(embed); //Line (Inline) Reply with mention
//or
message.lineReplyNoMention(embed); //Line (Inline) Reply without mention
}
```
## Preview
</a>
<a href="https://github.com/OmBodkhe1/">
<img align ="left" alt="Om's Github" width="1000px" src ="https://i.imgur.com/PpYHaik.png" />
</a> <br/>
<h2 style="display:inline;">Edit</h2> <h4 style="display:inline;">(Async Function)</h4>
```js
if (message.content.startsWith('!ping')) {
let m = await message.lineReply('Ping');
let ping = (m.createdTimestamp - message.createdTimestamp);
m.edit(`${ping}ms`)
}
```
## Command Handler
```js
/**
* No need to define it
* */
module.exports = {
name: 'reply',
category: 'Test',
run: (client, message, args) => {
message.lineReply('This is reply with @mention');
}
}
```
<hr>

75
node_modules/discord-inline-reply/index.js generated vendored Normal file
View file

@ -0,0 +1,75 @@
const { APIMessage, Structures } = require("discord.js");
class Message extends Structures.get("Message") {
async lineReply(content, options) {
let mentionRepliedUser = typeof ((options || content || {}).allowedMentions || {}).repliedUser === "undefined" ? true : ((options || content).allowedMentions).repliedUser;
const apiMessage = content instanceof APIMessage ? content.resolveData() : APIMessage.create(this.channel, content, options).resolveData();
Object.assign(apiMessage.data, { message_reference: { message_id: this.id } });
if (!apiMessage.data.allowed_mentions || Object.keys(apiMessage.data.allowed_mentions).length === 0) {
apiMessage.data.allowed_mentions = {
parse: ["users", "roles", "everyone"]
}
}
if (typeof apiMessage.data.allowed_mentions.replied_user === "undefined") {
Object.assign(apiMessage.data.allowed_mentions, { replied_user: mentionRepliedUser });
}
if (Array.isArray(apiMessage.data.content)) {
return Promise.all(apiMessage.split().map(x => {
x.data.allowed_mentions = apiMessage.data.allowed_mentions;
return x;
}).map(this.lineReply.bind(this)));
}
const { data, files } = await apiMessage.resolveFiles();
return this.client.api.channels[this.channel.id].messages
.post({ data, files })
.then(d => this.client.actions.MessageCreate.handle(d).message);
}
async lineReplyNoMention(content, options) {
/*if (!options) {
options = {
allowedMentions: {
repliedUser: false
}
}
}
if (options.allowedMentions) {
if (options.allowedMentions.repliedUser !== false) {
options.allowedMentions.repliedUser = false;
}
}*/
const apiMessage = content instanceof APIMessage ? content.resolveData() : APIMessage.create(this.channel, content, options).resolveData();
Object.assign(apiMessage.data, { message_reference: { message_id: this.id } });
if (!apiMessage.data.allowed_mentions || Object.keys(apiMessage.data.allowed_mentions).length === 0) {
apiMessage.data.allowed_mentions = {
parse: ["users", "roles", "everyone"]
}
}
Object.assign(apiMessage.data.allowed_mentions, { replied_user: false });
if (Array.isArray(apiMessage.data.content)) {
return Promise.all(apiMessage.split().map(x => {
x.data.allowed_mentions = apiMessage.data.allowed_mentions;
return x;
}).map(this.lineReply.bind(this)));
}
const { data, files } = await apiMessage.resolveFiles();
return this.client.api.channels[this.channel.id].messages
.post({ data, files })
.then(d => this.client.actions.MessageCreate.handle(d).message);
}
}
Structures.extend("Message", () => Message);

19
node_modules/discord-inline-reply/package.json generated vendored Normal file
View file

@ -0,0 +1,19 @@
{
"name": "discord-inline-reply",
"version": "1.0.3",
"description": "An discord.js extension to inline reply messages",
"main": "index.js",
"keywords": [
"discord.js",
"reply",
"messagereply",
"discordmessagereply",
"src",
"ombodkhe15"
],
"author": "Oᴍ | ᴳᴳ#4605",
"license": "MIT",
"dependencies": {
"discord.js": "^12.5.1"
}
}