diff options
| author | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
| commit | bb511abc03bb66848947e37a999502b813c77269 (patch) | |
| tree | 612c010fc8317e1cdf11471a18aad0270819d33e /src/models | |
| parent | fix: if clear amount equal or over 100, round down to 99 (diff) | |
| download | dep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz dep-core-bb511abc03bb66848947e37a999502b813c77269.zip | |
goodbye old uwufier :cry:
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/Client.ts | 26 | ||||
| -rw-r--r-- | src/models/Command.ts | 19 | ||||
| -rw-r--r-- | src/models/FanArt.ts | 13 | ||||
| -rw-r--r-- | src/models/MemePoster.ts | 39 | ||||
| -rw-r--r-- | src/models/MusicGuild.ts | 16 | ||||
| -rw-r--r-- | src/models/Verify.ts | 11 | ||||
| -rw-r--r-- | src/models/commands/AutoReply.ts | 17 | ||||
| -rw-r--r-- | src/models/commands/ImgurAlbum.ts | 43 | ||||
| -rw-r--r-- | src/models/commands/Subreddit.ts | 78 | ||||
| -rw-r--r-- | src/models/darling.ts | 11 | ||||
| -rw-r--r-- | src/models/goodbye.ts | 13 | ||||
| -rw-r--r-- | src/models/welcome.ts | 13 |
12 files changed, 0 insertions, 299 deletions
diff --git a/src/models/Client.ts b/src/models/Client.ts deleted file mode 100644 index c24bcd9..0000000 --- a/src/models/Client.ts +++ /dev/null @@ -1,26 +0,0 @@ -// import { CommandoClient } from 'discord.js-commando'; -// import { WebhookClient } from 'discord.js'; -// import Collection from '@discordjs/collection'; -// import winston from 'winston'; -// const PokemonStore = require('./pokemon/PokemonStore'); -// import MemePoster from './MemePoster.js' -// const { UWUFIER_WEBHOOK_ID, UWUFIER_WEBHOOK_TOKEN } = process.env; - -// module.exports = class UwufierClient extends CommandoClient { -// constructor(options) { -// super(options); - -// this.logger = winston.createLogger({ -// transports: [new winston.transports.Console()], -// format: winston.format.combine( -// winston.format.timestamp({ format: 'MM/DD/YYYY HH:mm:ss' }), -// winston.format.printf(log => `[${log.timestamp}] [${log.level.toUpperCase()}]: ${log.message}`) -// ) -// }); -// this.webhook = new WebhookClient(UWUFIER_WEBHOOK_ID, UWUFIER_WEBHOOK_TOKEN, { disableEveryone: true }); -// this.pokemon = new PokemonStore(); -// this.memePoster = new MemePoster(this); -// this.games = new Collection(); -// this.phone = new Collection(); -// } -// };
\ No newline at end of file diff --git a/src/models/Command.ts b/src/models/Command.ts deleted file mode 100644 index b3fdea9..0000000 --- a/src/models/Command.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Command, CommandoClient, CommandInfo } from 'discord.js-commando'; - -module.exports = class UwufierCommand extends Command { - credit: any; - constructor(client: CommandoClient, info: CommandInfo) { - super(client, info); - - this.argsSingleQuotes = info.argsSingleQuotes || false; - this.throttling = info.throttling || { usages: 1, duration: 2 }; - // TODO: - // @ts-ignore - this.credit = info.credit || []; - this.credit.push({ - name: 'Sin', - url: 'https://github.com/8cy', - reason: 'Code' - }); - } -}
\ No newline at end of file diff --git a/src/models/FanArt.ts b/src/models/FanArt.ts deleted file mode 100644 index 56f63c9..0000000 --- a/src/models/FanArt.ts +++ /dev/null @@ -1,13 +0,0 @@ -import mongo from 'mongoose'; -const fanArtSchema = new mongo.Schema({ - _id: mongo.Schema.Types.ObjectId, - username: String, - userID: String, - guildname: String, - guildID: String, - channelname: String, - channelID: String, - time: String -}); - -export = mongo.model('FanArt', fanArtSchema)
\ No newline at end of file diff --git a/src/models/MemePoster.ts b/src/models/MemePoster.ts deleted file mode 100644 index 27ff726..0000000 --- a/src/models/MemePoster.ts +++ /dev/null @@ -1,39 +0,0 @@ -// const { POSTER_ID, POSTER_TOKEN, POSTER_TIME } = process.env; -// import request from 'node-superfetch'; -// import { embedURL } from '../utils/Util.js'; -// import subreddits from '../assets/json/meme.json' -// const types = ['image', 'rich:video']; - -// module.exports = class MemePoster { -// constructor(client) { -// Object.defineProperty(this, 'client', { value: client }); - -// this.id = POSTER_ID; -// this.token = POSTER_TOKEN; -// this.time = Number.parseFloat(POSTER_TIME) || 3.6e+6; -// } -// async post() { -// try { -// const subreddit = subreddits[Math.floor(Math.random() * subreddits.length)]; -// const post = await this.fetchMeme(subreddit); -// if (!post) return; -// const url = embedURL(post.title, `<https://www.reddit.com${post.permalink}>`); -// await request -// .post(`https://discordapp.com/api/webhooks/${this.id}/${this.token}`) -// .send({ content: `**r/${subreddit}** ${url}\n${post.url}` }); -// } catch (err) { -// this.client.logger.error(err); -// } -// } -// async fetchMeme(subreddit) { -// const { body } = await request -// .get(`https://www.reddit.com/r/${subreddit}/hot.json`) -// .query({ limit: 100 }); -// const posts = body.data.children.filter(post => { -// if (!post.data) return false; -// return types.includes(post.data.post_hint) && post.data.url && post.data.title && !post.data.over_18; -// }); -// if (!posts.length) return null; -// return posts[Math.floor(Math.random() * posts.length)].data; -// } -// };
\ No newline at end of file diff --git a/src/models/MusicGuild.ts b/src/models/MusicGuild.ts deleted file mode 100644 index 7486cf6..0000000 --- a/src/models/MusicGuild.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Structures, Client } from 'discord.js'; -export = Structures.extend('Guild', Guild => { - class MusicGuild extends Guild { - musicData: { queue: []; isPlaying: boolean; volume: number; songDispatcher: any; }; - constructor(client: Client, data: object) { - super(client, data); - this.musicData = { - queue: [], - isPlaying: false, - volume: 1, - songDispatcher: null - }; - } - } - return MusicGuild; -});
\ No newline at end of file diff --git a/src/models/Verify.ts b/src/models/Verify.ts deleted file mode 100644 index 17da445..0000000 --- a/src/models/Verify.ts +++ /dev/null @@ -1,11 +0,0 @@ -import mongo from 'mongoose'; -const verifySchema = new mongo.Schema({ - _id: mongo.Schema.Types.ObjectId, - username: String, - userID: String, - status: Boolean, - key: String, - time: String -}); - -export = mongo.model('Verify', verifySchema)
\ No newline at end of file diff --git a/src/models/commands/AutoReply.ts b/src/models/commands/AutoReply.ts deleted file mode 100644 index fbc7e46..0000000 --- a/src/models/commands/AutoReply.ts +++ /dev/null @@ -1,17 +0,0 @@ -// import Command from '../Command.js' - -// module.exports = class AutoReplyCommand extends Command { -// constructor(client, info) { -// super(client, info); - -// this.reply = info.reply || false; -// } - -// run(msg, args, fromPattern) { -// return this.reply ? msg.reply(this.generateText(fromPattern)) : msg.say(this.generateText(fromPattern)); -// } - -// generateText() { -// throw new Error('The generateText method is required.'); -// } -// };
\ No newline at end of file diff --git a/src/models/commands/ImgurAlbum.ts b/src/models/commands/ImgurAlbum.ts deleted file mode 100644 index 199c2a6..0000000 --- a/src/models/commands/ImgurAlbum.ts +++ /dev/null @@ -1,43 +0,0 @@ -// import request from 'node-superfetch'; -// import Command from '../Command.js' -// const { IMGUR_KEY } = process.env; - -// module.exports = class ImgurAlbumCommand extends Command { -// constructor(client, info) { -// super(client, info); - -// this.albumID = info.albumID; -// this.cache = null; -// this.credit.push({ -// name: 'Imgur', -// url: 'https://imgur.com/', -// reason: 'API', -// reasonURL: 'https://apidocs.imgur.com/' -// }); -// } - -// async run(msg, { user }) { -// try { -// const image = await this.random(); -// if (!image) return msg.reply('This album has no images...'); -// return msg.say(this.generateText(msg, user), { files: [image] }); -// } catch (err) { -// return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); -// } -// } - -// generateText() { -// throw new Error('The generateText method is required.'); -// } - -// async random() { -// if (this.cache) return this.cache[Math.floor(Math.random() * this.cache.length)]; -// const { body } = await request -// .get(`https://api.imgur.com/3/album/${this.albumID}`) -// .set({ Authorization: `Client-ID ${IMGUR_KEY}` }); -// if (!body.data.images.length) return null; -// this.cache = body.data.images.map(image => image.link); -// setTimeout(() => { this.cache = null; }, 3.6e+6); -// return body.data.images[Math.floor(Math.random() * body.data.images.length)].link; -// } -// };
\ No newline at end of file diff --git a/src/models/commands/Subreddit.ts b/src/models/commands/Subreddit.ts deleted file mode 100644 index ea6a9fa..0000000 --- a/src/models/commands/Subreddit.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { CommandoMessage } from 'discord.js-commando'; -const Command = require('../Command.js') -import request from 'node-superfetch' -//@ts-ignore no @types for this package -import emoji from 'emoji-random' - -module.exports = class SubredditCommand extends Command { - subreddit: any; - postType: any[] | null; - getIcon: boolean; - credit: any; - constructor(client: any, info: { subreddit: any; postType: any; getIcon: boolean; }) { - super(client, info); - - this.subreddit = info.subreddit; - this.postType = info.postType ? Array.isArray(info.postType) ? info.postType : [info.postType] : null; - this.getIcon = info.getIcon || false; - this.credit.push({ - name: 'Reddit', - url: 'https://www.reddit.com/', - reason: 'API', - reasonURL: 'https://www.reddit.com/dev/api/' - }); - } - - async run(msg: CommandoMessage, { subreddit }: any, fromPattern: any) { - if (fromPattern) subreddit = msg.patternMatches[1]; - if (!subreddit) subreddit = typeof this.subreddit === 'function' ? this.subreddit() : this.subreddit; - try { - //@ts-ignore no idea why this isnt in the commando libs - const post = await this.random(subreddit, msg.channel.nsfw); - if (!post) return msg.reply('Could not find any results. ' + emoji.random()); - // TODO: - //@ts-ignore - return msg.say(this.generateText(post.post, post.origin, post.icon)); - } catch (err) { - if (err.status === 403) return msg.reply('This subreddit is private. ' + emoji.random()); - if (err.status === 404) return msg.reply('Could not find any results. ' + emoji.random()); - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } - - generateText() { - throw new Error('The generateText method is required.'); - } - - async random(subreddit: any, nsfw: any) { - let icon = null; - const { body } = await request - .get(`https://www.reddit.com/r/${subreddit}/hot.json`) - // TODO: - //@ts-ignore - .query({ limit: 100 }); - //@ts-ignore yes it does - if (!body.data.children.length) return null; - //@ts-ignore yes it does - const posts = body.data.children.filter(post => { - if (!post.data) return false; - if (!nsfw && post.data.over_18) return false; - return (this.postType ? this.postType.includes(post.data.post_hint) : true) && post.data.url && post.data.title; - }); - if (!posts.length) return null; - if (this.getIcon) icon = await this.fetchIcon(subreddit); - return { - origin: subreddit, - post: posts[Math.floor(Math.random() * posts.length)].data, - icon - }; - } - - async fetchIcon(subreddit: any) { - const { body } = await request.get(`https://www.reddit.com/r/${subreddit}/about.json`); - //@ts-ignore yes it does - if (!body.data.icon_img && !body.data.community_icon) return 'https://i.imgur.com/DSBOK0P.png'; - //@ts-ignore yes it does - return body.data.icon_img || body.data.community_icon; - } -};
\ No newline at end of file diff --git a/src/models/darling.ts b/src/models/darling.ts deleted file mode 100644 index 48cb665..0000000 --- a/src/models/darling.ts +++ /dev/null @@ -1,11 +0,0 @@ -import mongo from 'mongoose'; -const darlingSchema = new mongo.Schema({ - _id: mongo.Schema.Types.ObjectId, - username: String, - userID: String, - guildname: String, - guildID: String, - time: String -}); - -export = mongo.model('Darling', darlingSchema)
\ No newline at end of file diff --git a/src/models/goodbye.ts b/src/models/goodbye.ts deleted file mode 100644 index c650ef9..0000000 --- a/src/models/goodbye.ts +++ /dev/null @@ -1,13 +0,0 @@ -import mongo from 'mongoose'; -const goodbyeSchema = new mongo.Schema({ - _id: mongo.Schema.Types.ObjectId, - username: String, - userID: String, - guildname: String, - guildID: String, - channelname: String, - channelID: String, - time: String -}); - -export = mongo.model('Goodbye', goodbyeSchema)
\ No newline at end of file diff --git a/src/models/welcome.ts b/src/models/welcome.ts deleted file mode 100644 index 29700fc..0000000 --- a/src/models/welcome.ts +++ /dev/null @@ -1,13 +0,0 @@ -import mongo from 'mongoose'; -const welcomeSchema = new mongo.Schema({ - _id: mongo.Schema.Types.ObjectId, - username: String, - userID: String, - guildname: String, - guildID: String, - channelname: String, - channelID: String, - time: String -}); - -export = mongo.model('Welcome', welcomeSchema)
\ No newline at end of file |