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 | |
| 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:
353 files changed, 5157 insertions, 10770 deletions
@@ -4,4 +4,5 @@ package-lock.json .vs .idea .eclipse -dist/
\ No newline at end of file +dist/ +yarn.lock
\ No newline at end of file @@ -1,12 +0,0 @@ -SRC: - Commands: - [ ] Bot Command Group - [ ] Fun Command Group - Voice Command Group: - [ ] abee - [ ] itemshop - [ ] minecraft - [ ] play - - Utils: - [ ] Util.ts
\ No newline at end of file diff --git a/aki-web.code-workspace b/aki-web.code-workspace new file mode 100644 index 0000000..d13faf8 --- /dev/null +++ b/aki-web.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "client" + }, + { + "path": "server" + } + ] +}
\ No newline at end of file diff --git a/client/.env b/client/.env new file mode 100644 index 0000000..8114acd --- /dev/null +++ b/client/.env @@ -0,0 +1 @@ +REACT_APP_AUTHORIZATION=rex-1337
\ No newline at end of file diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..4d29575 --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/client/README.md b/client/README.md new file mode 100644 index 0000000..9c40dcd --- /dev/null +++ b/client/README.md @@ -0,0 +1,68 @@ +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `yarn start` + +Runs the app in the development mode.<br /> +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.<br /> +You will also see any lint errors in the console. + +### `yarn test` + +Launches the test runner in the interactive watch mode.<br /> +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `yarn build` + +Builds the app for production to the `build` folder.<br /> +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.<br /> +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting + +### Analyzing the Bundle Size + +This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size + +### Making a Progressive Web App + +This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app + +### Advanced Configuration + +This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration + +### Deployment + +This section has moved here: https://facebook.github.io/create-react-app/docs/deployment + +### `yarn build` fails to minify + +This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..2cd171f --- /dev/null +++ b/client/package.json @@ -0,0 +1,38 @@ +{ + "name": "client", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^7.1.2", + "mdbreact": "^4.27.0", + "node-fetch": "^2.6.0", + "prop-types": "^15.7.2", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-router-dom": "^5.2.0", + "react-scripts": "3.4.1" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/client/public/favicon.ico b/client/public/favicon.ico Binary files differnew file mode 100644 index 0000000..bcd5dfd --- /dev/null +++ b/client/public/favicon.ico diff --git a/client/public/index.html b/client/public/index.html new file mode 100644 index 0000000..51da5d4 --- /dev/null +++ b/client/public/index.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8" /> + <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="theme-color" content="#000000" /> + <meta + name="description" + content="Web site created using create-react-app" + /> + <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> + <!-- + manifest.json provides metadata used when your web app is installed on a + user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ + --> + <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> + <!-- + Notice the use of %PUBLIC_URL% in the tags above. + It will be replaced with the URL of the `public` folder during the build. + Only files inside the `public` folder can be referenced from the HTML. + + Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will + work correctly both with client-side routing and a non-root public URL. + Learn how to configure a non-root public URL by running `npm run build`. + --> + <title>Aki Dashboard</title> + </head> + <body> + <noscript>You need to enable JavaScript to run this app.</noscript> + <div id="root"></div> + <!-- + This HTML file is a template. + If you open it directly in the browser, you will see an empty page. + + You can add webfonts, meta tags, or analytics to this file. + The build step will place the bundled scripts into the <body> tag. + + To begin the development, run `npm start` or `yarn start`. + To create a production bundle, use `npm run build` or `yarn build`. + --> + </body> +</html> diff --git a/client/public/manifest.json b/client/public/manifest.json new file mode 100644 index 0000000..c963f8a --- /dev/null +++ b/client/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "Aki Dashboard", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/client/public/robots.txt b/client/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/client/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/client/src/components/App.js b/client/src/components/App.js new file mode 100644 index 0000000..270e199 --- /dev/null +++ b/client/src/components/App.js @@ -0,0 +1,61 @@ +import React, { Component } from 'react'; +import { BrowserRouter as Router, Route } from 'react-router-dom'; +import fetch from 'node-fetch'; + +import NavigationBar from './navigation/NavigationBar'; +import ServerSelection from '../pages/ServerSelection'; +import ManageServer from '../pages/ManageServer'; + +export default class App extends Component { + state = { + loading: true, + user: null + } + + componentDidMount() { + fetch('http://localhost:8088/oauth/details', { + credentials: 'include' + }) + .then(res => res.json()) + .then(res => { + if (!res) return this.setState({ loading: false }); + this.setState({ + loading: false, + user: res + }) + }) + .catch(() => this.setState({ loading: false })); + } + + render() { + if (this.state.loading) { + return( + <React.Fragment> + <div className="container"> + <h1>Loading...</h1> + </div> + </React.Fragment> + ); + } else if (!this.state.user) { + window.location.replace('http://localhost:8088/oauth/login'); // OAuth2... + return (<React.Fragment />); + } else { + return( + <React.Fragment> + <Router> + <div className="container"> + <NavigationBar user={this.state.user} /> + + <br /> + + <Route exact path="/" render={(props) => <ServerSelection {...props} user={this.state.user} /> } /> + <Route exact path="/server/:id" render={(props) => <ManageServer {...props} user={this.state.user} /> } /> + + <br /> + </div> + </Router> + </React.Fragment> + ); + } + } +}
\ No newline at end of file diff --git a/client/src/components/manageserver/ManageServerSettings.js b/client/src/components/manageserver/ManageServerSettings.js new file mode 100644 index 0000000..66a5fe5 --- /dev/null +++ b/client/src/components/manageserver/ManageServerSettings.js @@ -0,0 +1,71 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { MDBCard, MDBCardHeader, MDBCardBody, MDBInput, MDBAlert, MDBBtn } from 'mdbreact'; +import fetch from 'node-fetch'; + +export default class ManageServerSettings extends Component { + state = { + error: null, + success: false, + disabled: false + } + + handleSave() { + this.setState({ + error: null, + success: false, + disabled: true + }); + + fetch(`http://localhost:8088/v1/post/guild-name/${this.props.guild}`, { + method: 'POST', + credentials: 'include', + headers: { + 'Authorization': process.env.REACT_APP_AUTHORIZATION, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + name: this.props.data.name + }) + }) + .then(res => res.json()) + .then(res => { + if (res.message) return this.setState({ error: res.message, disabled: false }); + + this.setState({ success: true }); + }) + .catch(err => { + console.log(err); + this.setState({ error: 'An unknown error occured' }); + }); + } + + render() { + return( + <React.Fragment> + <MDBCard> + <MDBCardHeader> + <h3>Server Settings</h3> + </MDBCardHeader> + <MDBCardBody> + {this.state.error && + <MDBAlert color="danger">{this.state.error}</MDBAlert> + } + {this.state.success && + <MDBAlert color="success">Updated server settings successfully</MDBAlert> + } + + <MDBInput id="name" label="Server name" value={this.props.data.name} onChange={this.props.handleInput} /> + <MDBBtn color="dark" onClick={this.handleSave.bind(this)} disabled={this.state.disabled}>Save</MDBBtn> + </MDBCardBody> + </MDBCard> + </React.Fragment> + ) + } +} + +ManageServerSettings.propTypes = { + data: PropTypes.object, + handleInput: PropTypes.func, + guild: PropTypes.string +}
\ No newline at end of file diff --git a/client/src/components/navigation/NavigationBar.js b/client/src/components/navigation/NavigationBar.js new file mode 100644 index 0000000..3962aae --- /dev/null +++ b/client/src/components/navigation/NavigationBar.js @@ -0,0 +1,50 @@ +import React, { Component } from 'react'; +import { + MDBNavbar, MDBNavbarBrand, MDBNavbarNav, MDBNavItem, MDBNavLink, MDBNavbarToggler, MDBCollapse, MDBIcon, + MDBDropdown, MDBDropdownToggle, MDBDropdownMenu, MDBDropdownItem, MDBCol +} from 'mdbreact' +import PropTypes from 'prop-types'; + +export default class NavigationBar extends Component { + state = { + isOpen: false + }; + + toggleCollapse() { + this.setState({ isOpen: !this.state.isOpen }); + } + + render() { + return( + <MDBNavbar color="black" dark expand="md"> + <MDBNavbarBrand> + <strong className="white-text">Bot Dashboard</strong> + </MDBNavbarBrand> + <MDBNavbarToggler onClick={this.toggleCollapse} /> + <MDBCollapse id="navbarCollapse" isOpen={this.state.isOpen} navbar> + <MDBNavbarNav left> + <MDBNavItem> + <MDBNavLink to="/">Server Selection</MDBNavLink> + </MDBNavItem> + </MDBNavbarNav> + <MDBNavbarNav right> + <MDBNavItem> + <MDBDropdown> + <MDBDropdownToggle nav caret> + <MDBIcon icon='user' /> + </MDBDropdownToggle> + <MDBDropdownMenu className="dropdown-default"> + <MDBDropdownItem href="http://localhost:8088/oauth/logout">{`Logout (${this.props.user.username})`}</MDBDropdownItem> + </MDBDropdownMenu> + </MDBDropdown> + </MDBNavItem> + </MDBNavbarNav> + </MDBCollapse> + </MDBNavbar> + ); + } +} + +NavigationBar.propTypes = { + user: PropTypes.object +}
\ No newline at end of file diff --git a/client/src/components/selection/ServerCard.js b/client/src/components/selection/ServerCard.js new file mode 100644 index 0000000..93c7ad6 --- /dev/null +++ b/client/src/components/selection/ServerCard.js @@ -0,0 +1,37 @@ +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; +import PropTypes from 'prop-types'; +import { MDBBtn, MDBCard, MDBCardBody, MDBCardTitle, MDBCol } from 'mdbreact'; + +export default class ServerCard extends Component { + render() { + return( + <React.Fragment> + <MDBCol size={6}> + <MDBCard className="server-card"> + <MDBCardBody> + <img + width="200px" + alt={`Icon of ${this.props.guild.name}`} + className="server-card-image" + src={this.props.guild.icon ? + `https://cdn.discordapp.com/icons/${this.props.guild.id}/${this.props.guild.icon}.png?size=4096` : + `https://cdn.discordapp.com/embed/avatars/3.png` + } + /> + + <MDBCardTitle><h6><strong>{this.props.guild.name}</strong></h6></MDBCardTitle> + <Link to={`/server/${this.props.guild.id}`}> + <MDBBtn color="primary">Manage</MDBBtn> + </Link> + </MDBCardBody> + </MDBCard> + </MDBCol> + </React.Fragment> + ) + } +} + +ServerCard.propTypes = { + guild: PropTypes.object +}
\ No newline at end of file diff --git a/client/src/index.js b/client/src/index.js new file mode 100644 index 0000000..88c1be6 --- /dev/null +++ b/client/src/index.js @@ -0,0 +1,20 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import '@fortawesome/fontawesome-free/css/all.min.css'; +import 'bootstrap-css-only/css/bootstrap.min.css'; +import 'mdbreact/dist/css/mdb.css'; +import './styles/styles.css' +import App from './components/App'; +import * as serviceWorker from './serviceWorker'; + +ReactDOM.render( + <React.StrictMode> + <App /> + </React.StrictMode>, + document.getElementById('root') +); + +// If you want your app to work offline and load faster, you can change +// unregister() to register() below. Note this comes with some pitfalls. +// Learn more about service workers: https://bit.ly/CRA-PWA +serviceWorker.unregister(); diff --git a/client/src/pages/ManageServer.js b/client/src/pages/ManageServer.js new file mode 100644 index 0000000..990884e --- /dev/null +++ b/client/src/pages/ManageServer.js @@ -0,0 +1,69 @@ +import React, { Component } from 'react'; +import fetch from 'node-fetch'; +import PropTypes from 'prop-types'; +import { MDBBadge, MDBAlert } from 'mdbreact'; + +import ManageServerSettings from '../components/manageserver/ManageServerSettings'; + +export default class ManageServer extends Component { + constructor(props) { + super(props) + + this.state = { + loading: true, + data: null + } + + this.handleInput = this.handleInput.bind(this); + } + + componentDidMount() { + fetch(`http://localhost:8088/v1/get/guild/${this.props.match.params.id}`) + .then(res => res.json()) + .then(res => this.setState({ + loading: false, + data: res.message ? null : res + })) + .catch(() => this.setState({ loading: false })); + } + + handleInput(event) { + const eventId = event.target.id; + const value = event.target.value; + + this.setState(prevState => ({ + data: { + ...prevState.data, + [eventId]: value + } + })); + } + + render() { + if (this.state.loading) { + return( + <h1>Loading...</h1> + ); + } else if(!this.state.data) { + return( + <MDBAlert color="warning">This bot is not in this server</MDBAlert> + ); + } else { + return( + <React.Fragment> + <h1><strong>{this.state.data.name}</strong></h1> + <MDBBadge color="info">{`${this.state.data.members} Members`}</MDBBadge> + <MDBBadge color="success">{`Owner: ${this.state.data.owner}`}</MDBBadge> + + <hr /> + + <ManageServerSettings data={this.state.data} handleInput={this.handleInput} guild={this.props.match.params.id} /> + </React.Fragment> + ) + } + } +} + +ManageServer.propTypes = { + user: PropTypes.object +}
\ No newline at end of file diff --git a/client/src/pages/ServerSelection.js b/client/src/pages/ServerSelection.js new file mode 100644 index 0000000..f1e3a39 --- /dev/null +++ b/client/src/pages/ServerSelection.js @@ -0,0 +1,33 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { MDBAlert, MDBRow } from 'mdbreact'; + +import ServerCard from '../components/selection/ServerCard'; + +export default class ServerSelection extends Component { + render() { + const guilds = this.props.user.guilds.filter(g => g.admin); + + if (!guilds.length) { + return( + <MDBAlert color="warning"> + <strong>You cannot manage any servers</strong> + </MDBAlert> + ); + } else { + return( + <React.Fragment> + <MDBRow> + {guilds.map(guild => { + return(<ServerCard guild={guild} />); + })} + </MDBRow> + </React.Fragment> + ); + } + } +} + +ServerSelection.propTypes = { + user: PropTypes.object +}
\ No newline at end of file diff --git a/client/src/serviceWorker.js b/client/src/serviceWorker.js new file mode 100644 index 0000000..b04b771 --- /dev/null +++ b/client/src/serviceWorker.js @@ -0,0 +1,141 @@ +// This optional code is used to register a service worker. +// register() is not called by default. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on subsequent visits to a page, after all the +// existing tabs open on the page have been closed, since previously cached +// resources are updated in the background. + +// To learn more about the benefits of this model and instructions on how to +// opt-in, read https://bit.ly/CRA-PWA + +const isLocalhost = Boolean( + window.location.hostname === 'localhost' || + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.0/8 are considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) +); + +export function register(config) { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + // The URL constructor is available in all browsers that support SW. + const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); + if (publicUrl.origin !== window.location.origin) { + // Our service worker won't work if PUBLIC_URL is on a different origin + // from what our page is served on. This might happen if a CDN is used to + // serve assets; see https://github.com/facebook/create-react-app/issues/2374 + return; + } + + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + + if (isLocalhost) { + // This is running on localhost. Let's check if a service worker still exists or not. + checkValidServiceWorker(swUrl, config); + + // Add some additional logging to localhost, pointing developers to the + // service worker/PWA documentation. + navigator.serviceWorker.ready.then(() => { + console.log( + 'This web app is being served cache-first by a service ' + + 'worker. To learn more, visit https://bit.ly/CRA-PWA' + ); + }); + } else { + // Is not localhost. Just register service worker + registerValidSW(swUrl, config); + } + }); + } +} + +function registerValidSW(swUrl, config) { + navigator.serviceWorker + .register(swUrl) + .then(registration => { + registration.onupdatefound = () => { + const installingWorker = registration.installing; + if (installingWorker == null) { + return; + } + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the updated precached content has been fetched, + // but the previous service worker will still serve the older + // content until all client tabs are closed. + console.log( + 'New content is available and will be used when all ' + + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' + ); + + // Execute callback + if (config && config.onUpdate) { + config.onUpdate(registration); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); + + // Execute callback + if (config && config.onSuccess) { + config.onSuccess(registration); + } + } + } + }; + }; + }) + .catch(error => { + console.error('Error during service worker registration:', error); + }); +} + +function checkValidServiceWorker(swUrl, config) { + // Check if the service worker can be found. If it can't reload the page. + fetch(swUrl, { + headers: { 'Service-Worker': 'script' }, + }) + .then(response => { + // Ensure service worker exists, and that we really are getting a JS file. + const contentType = response.headers.get('content-type'); + if ( + response.status === 404 || + (contentType != null && contentType.indexOf('javascript') === -1) + ) { + // No service worker found. Probably a different app. Reload the page. + navigator.serviceWorker.ready.then(registration => { + registration.unregister().then(() => { + window.location.reload(); + }); + }); + } else { + // Service worker found. Proceed as normal. + registerValidSW(swUrl, config); + } + }) + .catch(() => { + console.log( + 'No internet connection found. App is running in offline mode.' + ); + }); +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready + .then(registration => { + registration.unregister(); + }) + .catch(error => { + console.error(error.message); + }); + } +} diff --git a/client/src/styles/styles.css b/client/src/styles/styles.css new file mode 100644 index 0000000..b988e04 --- /dev/null +++ b/client/src/styles/styles.css @@ -0,0 +1,8 @@ +.server-card { + text-align: center; + margin-bottom: 20px; +} + +.server-card-image { + border-radius: 50%; +}
\ No newline at end of file diff --git a/fix/anime/neko.ts b/fix/anime/neko.ts deleted file mode 100644 index 26c37c7..0000000 --- a/fix/anime/neko.ts +++ /dev/null @@ -1,283 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import nekoClient from 'nekos.life'; -const neko = new nekoClient() - -module.exports = class NekoAnime extends Command { - constructor(client) { - super(client, { - name: 'neko', - aliases: ['kemonomimi', 'nekoslife', 'nekos-life', 'nekos.life'], - group: 'anime', - memberName: 'neko', - description: 'Allows you to choose from a wide variety of Neko images. (NSFW and SFW)', - nsfw: false, - examples: [ - 'uwu!neko', - 'uwu!kemonomimi', - 'uwu!nekoslife', - 'uwu!nekos-life', - 'uwu!nekos.life' - ], - args: [ - { - key: 'nekoNSFW', - prompt: 'NSFW or SFW? (NSFW only works in NSFW marked channels)', - type: 'string' - }, - { - key: 'nekoType', - prompt: 'What type of Neko would you like?', - type: 'string' - } - ] - }); - } - async run(msg: CommandoMessage, { nekoNSFW, nekoType }) { - if (nekoNSFW == 'sfw') { - var typeNum = Math.floor((Math.random() * 3) + 1); - if (nekoType == 'smug') { - neko.sfw.smug().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'baka') { - neko.sfw.baka().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'tickle') { - neko.sfw.tickle().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'slap') { - neko.sfw.slap().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'poke') { - neko.sfw.poke().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'pat') { - neko.sfw.pat().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'neko') { - // gif or no - } else if (nekoType == 'meow') { - neko.sfw.meow().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'lizard') { - neko.sfw.lizard().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'kiss') { - neko.sfw.kiss().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'hug') { - neko.sfw.hug().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'foxgirl') { - neko.sfw.foxGirl().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'feed') { - neko.sfw.feed().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'cuddle') { - neko.sfw.cuddle().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'kemo' || nekoType == 'kemonomimi') { - neko.sfw.kemonomimi().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'holo') { - neko.sfw.holo().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'woof') { - neko.sfw.woof().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'wallpaper') { - neko.sfw.wallpaper().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'goose') { - neko.sfw.goose().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'catgirl' || nekoType == 'gecg') { - neko.sfw.gecg().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'avatar') { - neko.sfw.avatar().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'neko') { - if (typeNum == 1) { - neko.sfw.neko().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.sfw.nekoGif().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else { - msg.reply('That was not an option.') - } - } else if (nekoNSFW == 'nsfw') { - var typeNum = Math.floor((Math.random() * 3) + 1); - if (!msg.channel.nsfw) msg.reply('This command must be used in a NSFW marked text channel.') - if (nekoType == 'pussy') { - if (typeNum == 1) { - neko.nsfw.pussy().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (typeNum == 2) { - neko.nsfw.pussyArt().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.pussyWankGif().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'lesbian' || nekoType == 'lesbo') { - neko.nsfw.lesbian().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'kuni') { - neko.nsfw.kuni().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'cumsluts' || nekoType == 'cumslut') { - neko.nsfw.cumsluts().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'classic') { - neko.nsfw.classic().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'boobs' || nekoType == 'boob') { - neko.nsfw.boobs().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'bj' || nekoType == 'blowjob') { - if (typeNum == 1) { - neko.nsfw.bJ().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.blowJob().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'anal') { - neko.nsfw.anal().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'yuri') { - if (typeNum == 1) { - neko.nsfw.yuri().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.eroYuri().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'trap') { - neko.nsfw.trap().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'tits') { - neko.nsfw.tits().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'girl' || nekoType == 'girlsolo' || nekoType == 'girl solo' || nekoType == 'girl-solo' || nekoType == 'girls') { - if (typeNum == 1) { - neko.nsfw.girlSolo().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.girlSoloGif().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'kitsune') { - if (typeNum == 1) { - neko.nsfw.kitsune().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.eroKitsune().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'keta') { - neko.nsfw.keta().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'hentai') { - if (typeNum == 1) { - neko.nsfw.hentai().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.randomHentaiGif().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'futanari') { - neko.nsfw.futanari().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'femdom') { - neko.nsfw.femdom().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'feet') { - if (typeNum == 1) { - neko.nsfw.feet().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (typeNum == 2) { - neko.nsfw.feetGif().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.eroFeet().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else if (nekoType == 'ero') { - neko.nsfw.ero().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'cumart') { - neko.nsfw.cumArts().then(result => { - msg.reply({ files: [result.url] }) - }) - } else if (nekoType == 'cum') { - if (typeNum == 1) { - neko.nsfw.cumArts().then(result => { - msg.reply({ files: [result.url] }) - }) - } else { - neko.nsfw.cumsluts().then(result => { - msg.reply({ files: [result.url] }) - }) - } - } else { - msg.reply('That was not an option.') - } - } else { - msg.reply('That was not an option.') - } - } -};
\ No newline at end of file diff --git a/fix/fun/dm.ts b/fix/fun/dm.ts deleted file mode 100644 index 73fa0b6..0000000 --- a/fix/fun/dm.ts +++ /dev/null @@ -1,63 +0,0 @@ -// TODO: remove mention from final msg - -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class DMFun extends Command { - constructor(client) { - super(client, { - name: 'dm', - aliases: [ - 'directmessage', - 'directmsg', - 'direct-message', - 'direct-msg' - ], - group: 'fun', - memberName: 'dm', - description: 'Allows you to DM somebody as the bot.', - guildOnly: true, - args: [ - { - key: 'msgContent', - prompt: 'What message would you like to send?', - type: 'string' - } - ], - examples: [ - 'uwu!dm @sin#1337 hi', - 'uwu!directmessage @sin#1337 hey', - 'uwu!directmsg @sin#1337 hello', - 'uwu!direct-message @sin#1337 yo', - 'uwu!direct-msg @sin#1337 aye', - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'ADMINISTRATOR'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { msgContent }) { - if (msg.author.id == '217348698294714370') { - if (!msg.mentions.users.first() && msgContent) { - msg.reply('You haven\'t specified anyone to send a message to.'); - } else { - var sendTo = msg.mentions.users.first().id; - var d = new Date(msg.createdTimestamp); - - msg.guild.members.fetch(sendTo).then(messageUser => { - messageUser.send(msgContent); - - var emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle('uwufier - DM') - .addField('Message content', `${msgContent}`) - .addField('Recipient', `${msg.mentions.users.first()}`) - .addField('Sender', `${msg.author}`) - .addField('Time sent', `Now`) - msg.say(emb) - }); - } - } else { - msg.reply('Insufficent permissions.'); - } - } -};
\ No newline at end of file diff --git a/fix/utility/math.ts b/fix/utility/math.ts deleted file mode 100644 index a55edf1..0000000 --- a/fix/utility/math.ts +++ /dev/null @@ -1,56 +0,0 @@ -// TODO: get this working someday -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class MathUtility extends Command { - constructor(client) { - super(client, { - name: 'math', - group: 'utility', - memberName: 'math', - description: 'Allows you to do simple math operations.', - args: [ - { - key: 'mVal1', - prompt: 'First number?', - type: 'integer' - }, - { - key: 'mOp', - prompt: 'What operation would you like to use?', - type: 'string' - }, - { - key: 'mVal2', - prompt: 'Second number?', - type: 'integer' - } - ], - examples: [ - 'uwu!math 5 + 2' - ] - }); - } - async run(msg: CommandoMessage, { mVal1, mOp, mVal2 }) { - if (!mVal1 || !mOp || !mVal2) { - msg.reply('You are missing a critical part of the operation, please try again.') - } else { - var mSol - switch (mOp) { - case mOp = '+': - if (mVal1 < mVal2) mSol = mVal1 + mVal1; - break - case mOp = '-': - mSol = mVal1 - mVal1; - break - case mOp = '/': - mSol = mVal1 / mVal1; - break - case mOp = '*' || 'x': - mSol = mVal1 * mVal1; - break - } - await msg.reply(`**${mVal1}** ${mOp} **${mVal2}** = **${mSol}**.`) - } - } -};
\ No newline at end of file diff --git a/fix/voice/fart.js b/fix/voice/fart.js deleted file mode 100644 index a5f8a21..0000000 --- a/fix/voice/fart.js +++ /dev/null @@ -1,208 +0,0 @@ -// TODO: shits broken bc i cant get variables from different scopes -/* -const ytdl = require('ytdl-core'); -const { Command } = require('discord.js-commando'); -const { MessageEmbed } = require('discord.js'); -const Youtube = require('simple-youtube-api'); -//const { youtubeAPI } = require('../../config.json'); -const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds'); -const emoji = require('emoji-random'); -module.exports = class FartVoice extends Command { - constructor(client) { - super(client, { - name: 'fart', - group: 'voice', - memberName: 'fart', - description: 'gives you a random fart', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT'], - examples: ['s5n!fart'] - }); - } - async run(msg) { - var fartNum = Math.floor((Math.random() * 8) + 1); - if (fartNum == 1) { - var fartMsg = 'you got fart 1, courtesy of sin ' + emoji.random(); - var fartTitle = 'fart 1'; - var fartAudio = '../../../assets/audio/farts/1.mp3'; - } else if (fartNum == 2) { - var fartMsg = 'you got fart 2, courtesy of sin ' + emoji.random(); - var fartTitle = 'fart 2'; - var fartAudio = '../../../assets/audio/farts/2.mp3'; - } else if (fartNum == 3) { - var fartMsg = 'you got fart 3, courtesy of sin ' + emoji.random(); - var fartTitle = 'fart 3'; - var fartAudio = '../../../assets/audio/farts/3.mp3'; - } else if (fartNum == 4) { - var fartMsg = 'you got fart 4, courtesy of sin ' + emoji.random(); - var fartTitle = 'fart 4'; - var fartAudio = '../../../assets/audio/farts/4.mp3'; - } else if (fartNum == 5) { - var fartMsg = 'you got fart 5, courtesy of sin ' + emoji.random(); - var fartTitle = 'fart 5'; - var fartAudio = '../../../assets/audio/farts/5.mp3'; - } else if (fartNum == 6) { - var fartMsg = 'you got fart 6, courtesy of nick ' + emoji.random(); - var fartTitle = 'fart 6'; - var fartAudio = '../../../assets/audio/farts/6.mp3'; - } else if (fartNum == 7) { - var fartMsg = 'you got fart 7, courtesy of nick ' + emoji.random(); - var fartTitle = 'fart 7'; - var fartAudio = '../../../assets/audio/farts/7.mp3'; - } else if (fartNum == 8) { - var fartMsg = 'you got fart 8, courtesy of nick ' + emoji.random(); - var fartTitle = 'fart 8'; - var fartAudio = '../../../assets/audio/farts/8.mp3'; - } - - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random()); - - const video = await fartAudio; - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - msg.reply(fartMsg); - msg.say(fartTitle, 'added to queue ' + emoji.random()); - return - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say(fartTitle, 'added to queue ' + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'an error has occured when trying to get the video file ' + emoji.random() - ); - }); - }); - } - playSong(queue, msg) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - fartAudio // TODO: broken here - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xF97DAE) - .addField('now playing:', queue[0].title) - .addField('duration:', queue[0].duration); - if (queue[1]) videoEmbed.addField('next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('can\'t play song ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - return { // TODO: and broken here - url: 'fart', - title: 'fart 1', - voiceChannel - }; - } -};
\ No newline at end of file diff --git a/fix/voice/moan.js b/fix/voice/moan.js deleted file mode 100644 index 8a2103e..0000000 --- a/fix/voice/moan.js +++ /dev/null @@ -1,170 +0,0 @@ -// TODO: eventually fix this by uploading the audio to youtube and if i havent already copy and paste the code from abee - -//const ytdl = require('ytdl-core'); -const { Command } = require('discord.js-commando'); -const { MessageEmbed } = require('discord.js'); -const Youtube = require('simple-youtube-api'); -//const { youtubeAPI } = require('../../config.json'); -const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds'); -const emoji = require('emoji-random'); -module.exports = class MoanVoice extends Command { - constructor(client) { - super(client, { - name: 'moan', - group: 'voice', - memberName: 'moan', - description: 'uhhhh', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT'], - examples: ['s5n!moan', 's5n!uhhhh'] - }); - } - async run(msg) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random()); - - const video = '../../../assets/audio/uhhhh.wav'; - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say('uhhhh added to queue ' + emoji.random()); - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say(fartTitle, 'added to queue ' + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'an error has occured when trying to get the video file ' + emoji.random() - ); - }); - }); - } - playSong(queue, msg) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - '../../../assets/audio/uhhhh.wav' - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xF97DAE) - .addField('now playing:', 'uhhhh') - .addField('duration:', 'no'); - if (queue[1]) videoEmbed.addField('next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('can\'t play song ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - return { // TODO: and broken here - title: 'uhhhh', - voiceChannel - }; - } -};
\ No newline at end of file diff --git a/fix/voice/squeak.js b/fix/voice/squeak.js deleted file mode 100644 index c25547d..0000000 --- a/fix/voice/squeak.js +++ /dev/null @@ -1,172 +0,0 @@ -// TODO: eventually fix this by uploading the audio to youtube and if i havent already copy and paste the code from abee -/* -//const ytdl = require('ytdl-core'); -const { Command } = require('discord.js-commando'); -const { MessageEmbed } = require('discord.js'); -const Youtube = require('simple-youtube-api'); -//const { youtubeAPI } = require('../../config.json'); -const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds'); -const emoji = require('emoji-random'); -module.exports = class SqueakVoice extends Command { - constructor(client) { - super(client, { - name: 'squeak', - group: 'voice', - memberName: 'squeak', - description: 'squeak :D', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT'], - examples: ['s5n!squeak'] - }); - } - async run(msg) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random()); - - //const video = await fartAudio; - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - msg.reply(fartMsg); - msg.say(fartTitle, 'added to queue ' + emoji.random()); - return - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say(fartTitle, 'added to queue ' + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'an error has occured when trying to get the video file ' + emoji.random() - ); - }); - }); - } - playSong(queue, msg) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - '../../../assets/audio/uhhhh.wav' - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xF97DAE) - .addField('now playing:', 'uhhhh') - .addField('duration:', 'no'); - if (queue[1]) videoEmbed.addField('next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('can\'t play song ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - return { // TODO: and broken here - title: 'uhhhh', - voiceChannel - }; - } -};
\ No newline at end of file diff --git a/fix/voice/wahoo.js b/fix/voice/wahoo.js deleted file mode 100644 index 25424f5..0000000 --- a/fix/voice/wahoo.js +++ /dev/null @@ -1,32 +0,0 @@ -// TODO: eventually fix this by uploading the audio to youtube and if i havent already copy and paste the code from abee -/* -const { Command } = require('discord.js-commando'); -const emoji = require('emoji-random'); - -module.exports = class WahooVoice extends Command { - constructor(client) { - super(client, { - name: 'wahoo', - aliases: ['mario'], - group: 'voice', - memberName: 'wahoo', - description: 'wahoo', - guildOnly: true, - examples: ['s5n!wahoo', 's5n!mario'] - }); - } - async run(msg) { - if (msg.member.voice.channel && !msg.guild.voice) { - const connection = await msg.member.voice.channel.join(); - const dispatcher = connection.play('../../../assets/audio/wahoo.mp3'); - - dispatcher.on('finish', () => { - connection.disconnect(); - }); - } else if (msg.guild.voice) { - msg.reply('i\'m already playing that lol ' + emoji.random()); - } else { - msg.reply('you need to join a voice channel first silly ' + emoji.random()); - } - } -};
\ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 672f55b..0000000 --- a/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "uwufier", - "version": "1.10.0", - "description": "A Discord bot that supports audio playback, fun commands, utilities, and soundsboard, and more to come!", - "main": "./dist/app.js", - "scripts": { - "build": "tsc || true", - "build:dev": "tsc --watch || true", - "start": "cd dist && node app || true", - "start:dev": "cd dist && supervisor app || true" - }, - "author": "sin", - "license": "MIT", - "dependencies": { - "@discordjs/opus": "^0.1.0", - "animequote": "^1.1.1", - "arnie-quote": "^1.3.0", - "axios": "^0.19.2", - "body-parser": "^1.19.0", - "btc-value": "^3.0.1", - "canvas": "^2.6.1", - "cheerio": "^1.0.0-rc.3", - "chewbacca-quotes": "^1.0.0", - "common-tags": "^1.8.0", - "cows": "^2.1.0", - "crypto": "^1.0.1", - "culturedtext": "^1.2.0", - "date-fns": "^2.12.0", - "discord.js": "github:discordjs/discord.js", - "discord.js-commando": "github:discordjs/Commando", - "dogeify-js": "^1.2.0", - "emoji-random": "^0.1.2", - "express": "^4.17.1", - "express-handlebars": "^4.0.3", - "ffmpeg-static": "^4.1.1", - "figlet": "^1.3.0", - "gamedig": "^2.0.20", - "harvey-specter-quotes": "^1.4.1", - "howifier": "^1.2.2", - "insult": "0.0.3", - "is-image-url": "^1.1.8", - "lorem-memesum": "^1.2.0", - "mathjs": "^6.6.4", - "moment": "^2.24.0", - "moment-duration-format": "^2.3.2", - "mongoose": "^5.9.10", - "motivations": "^1.1.2", - "nekos.life": "^2.0.6", - "node-opus": "^0.3.3", - "node-superfetch": "^0.1.10", - "popular-movie-quotes": "^1.2.4", - "random-js": "^2.1.0", - "romanize": "^1.1.1", - "rss-parser": "^3.7.6", - "simple-youtube-api": "^5.2.1", - "spongibobu.js": "^1.1.0", - "uwufy": "^1.0.5", - "whois": "^2.12.1", - "winston": "^3.2.1", - "ytdl-core": "^2.1.0", - "zero-two-quotes": "^1.0.2" - }, - "devDependencies": { - "@types/express": "^4.17.6", - "@types/express-handlebars": "^3.1.0", - "@types/mongoose": "^5.7.15", - "supervisor": "^0.12.0", - "typescript": "^3.8.3" - } -} diff --git a/scripts/build.bat b/scripts/build.bat deleted file mode 100644 index 59c629b..0000000 --- a/scripts/build.bat +++ /dev/null @@ -1,3 +0,0 @@ -%cd% -cd .. -tsc
\ No newline at end of file diff --git a/scripts/heroku_application_log.bat b/scripts/heroku_application_log.bat deleted file mode 100644 index 49f71a4..0000000 --- a/scripts/heroku_application_log.bat +++ /dev/null @@ -1 +0,0 @@ -heroku logs -t --app uwufier
\ No newline at end of file diff --git a/scripts/install_prerequisites.bat b/scripts/install_prerequisites.bat deleted file mode 100644 index 7b67ea9..0000000 --- a/scripts/install_prerequisites.bat +++ /dev/null @@ -1,3 +0,0 @@ -%cd% -cd .. -npm npm i
\ No newline at end of file diff --git a/scripts/logs.bat b/scripts/logs.bat deleted file mode 100644 index 49f71a4..0000000 --- a/scripts/logs.bat +++ /dev/null @@ -1 +0,0 @@ -heroku logs -t --app uwufier
\ No newline at end of file diff --git a/scripts/prepare_build.bat b/scripts/prepare_build.bat deleted file mode 100644 index 27f4874..0000000 --- a/scripts/prepare_build.bat +++ /dev/null @@ -1,3 +0,0 @@ -%cd% -cd .. -@RD /S /Q "dist"
\ No newline at end of file diff --git a/server/package.json b/server/package.json new file mode 100644 index 0000000..44fd26f --- /dev/null +++ b/server/package.json @@ -0,0 +1,35 @@ +{ + "dependencies": { + "@types/cheerio": "^0.22.21", + "@types/mongoose": "^5.7.32", + "axios": "^0.19.2", + "cheerio": "^1.0.0-rc.3", + "common-tags": "^1.8.0", + "cors": "^2.8.5", + "date-fns": "^2.15.0", + "discord-akairo": "1Computer1/discord-akairo", + "discord.js": "discordjs/discord.js", + "express": "^4.17.1", + "express-session": "^1.17.1", + "moment": "^2.27.0", + "moment-duration-format": "^2.3.2", + "mongoose": "^5.9.25", + "node-emoji": "^1.10.0", + "node-superfetch": "^0.1.10", + "rss-parser": "^3.9.0", + "winston": "^3.3.3" + }, + "devDependencies": { + "@types/express": "^4.17.7", + "@types/express-session": "^1.17.0", + "@types/node": "^14.0.24", + "rimraf": "^3.0.2" + }, + "main": "dist/Bot.js", + "scripts": { + "build": "yarn cleardir && yarn compile", + "cleardir": "rimraf dist/*", + "compile": "tsc", + "start": "yarn build && node ." + } +} diff --git a/server/src/API/API.ts b/server/src/API/API.ts new file mode 100644 index 0000000..8a6eb0f --- /dev/null +++ b/server/src/API/API.ts @@ -0,0 +1,33 @@ +import { AkairoClient } from 'discord-akairo'; +import express, { Application } from 'express'; +import { createServer } from 'http'; +import cors from 'cors'; +import OAuth2 from '../structures/OAuth2'; + +import OAuth2Router from './routers/OAuth2Router'; +import GuildRouter from './routers/GuildRouter'; + +export default class API { + protected client: AkairoClient; + protected server: Application; + protected oauth: OAuth2; + + public constructor(client: AkairoClient) { + this.client = client; + this.oauth = new OAuth2(this.client); + } + + public start(): void { + this.server = express(); + this.server.use(express.json()); + this.server.use(cors({ + origin: true, + credentials: true + })); + + new OAuth2Router(this.server, this.client, this.oauth); + new GuildRouter(this.server, this.client); + + createServer(this.server).listen(8088, (): void => console.log('API is online.')); + } +}
\ No newline at end of file diff --git a/server/src/API/routers/GuildRouter.ts b/server/src/API/routers/GuildRouter.ts new file mode 100644 index 0000000..01a8a9b --- /dev/null +++ b/server/src/API/routers/GuildRouter.ts @@ -0,0 +1,44 @@ +import { Router, Request, Response, Application } from 'express'; +import { AkairoClient } from 'discord-akairo'; +import { Guild } from 'discord.js'; +import { authorization } from '../../Config'; + +export default class GuildRouter { + protected app: Application; + protected client: AkairoClient; + protected router: Router; + + public constructor(app: Application, client: AkairoClient) { + this.app = app; + this.client = client; + this.router = Router(); + + this.app.use(this.router); + + this.router.get('/v1/get/guild/:id', (req: Request, res: Response) => { + const guild: Guild = this.client.guilds.cache.get(req.params.id); + if (!guild) return res.status(404).send({ message: 'Guild Not Found' }); + + return res.status(200).send({ + name: guild.name, + owner: guild.owner.user.tag, + members: guild.memberCount + }); + }); + + this.router.post('/v1/post/guild-name/:id', (req: Request, res: Response) => { + if (req.headers.authorization !== authorization) return res.status(401).send({ message: 'Unauthorized' }); + + const guild: Guild = this.client.guilds.cache.get(req.params.id); + if (!guild) return res.status(404).send({ message: 'Guild Not Found' }); + + if (!req.body.name) return res.status(404).send({ message: 'No Guild Name Provided' }); + if (req.body.name.length > 32) return res.status(400).send({ message: 'Guild Name Exceeds 32 Characters' }); + if (!guild.me.permissions.has('MANAGE_GUILD')) return res.status(401).send({ message: 'Cannot Manage Guild' }); + + guild.setName(req.body.name); + + return res.status(201).send(req.body); + }); + } +}
\ No newline at end of file diff --git a/server/src/API/routers/OAuth2Router.ts b/server/src/API/routers/OAuth2Router.ts new file mode 100644 index 0000000..60b0410 --- /dev/null +++ b/server/src/API/routers/OAuth2Router.ts @@ -0,0 +1,71 @@ +import { Router, Request, Response, Application } from 'express'; +import { AkairoClient } from 'discord-akairo'; +import fetch from 'node-fetch'; +import session from 'express-session'; +import OAuth2 from '../../structures/OAuth2'; +import { callbackUrl, authorization, clientID, redirectUri, clientSecret } from '../../Config'; + +export default class OAuth2Router { + protected app: Application; + protected client: AkairoClient; + protected router: Router; + protected oauth: OAuth2; + + public constructor(app: Application, client: AkairoClient, oauth: OAuth2) { + this.app = app; + this.client = client; + this.router = Router(); + this.oauth = oauth; + + this.app.use(session({ + secret: authorization, + resave: false, + saveUninitialized: false, + cookie: { + secure: 'auto', + sameSite: false, + httpOnly: false, + maxAge: 6048e5 + } + })); + + this.app.use(this.router); + + this.router.get('/oauth/login', (req: Request, res: Response) => { + return res.redirect(`https://discord.com/api/oauth2/authorize?client_id=${clientID}&redirect_uri=${encodeURIComponent(callbackUrl)}&response_type=code&scope=${encodeURIComponent('identify guilds')}`); + }); + + this.router.get('/oauth/logout', (req: Request, res: Response) => { + req.session.destroy(null); + return res.redirect(redirectUri); + }); + + this.router.get('/oauth/callback', (req: Request, res: Response) => { + fetch('https://discord.com/api/oauth2/token', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + //@ts-ignore + body: new URLSearchParams({ + 'client_id': clientID, + 'client_secret': clientSecret, + 'grant_type': 'authorization_code', + 'code': req.query.code, + 'redirect_uri': callbackUrl, + 'scope': 'identify' + }) + }) + .then(response => response.json()) + .then(response => { + req.session.token = response['access_token']; + res.redirect(redirectUri); + }); + }); + + this.router.get('/oauth/details', async (req: Request, res: Response) => { + const details = await this.oauth.resolveInformation(req); + return res.status(200).send(details); + }); + } +}
\ No newline at end of file diff --git a/server/src/Bot.ts b/server/src/Bot.ts new file mode 100644 index 0000000..899aff4 --- /dev/null +++ b/server/src/Bot.ts @@ -0,0 +1,5 @@ +import { token, owners } from './Config'; +import BotClient from './client/BotClient'; + +const client: BotClient = new BotClient({ token, owners }); +client.start();
\ No newline at end of file diff --git a/server/src/Config.ts b/server/src/Config.ts new file mode 100644 index 0000000..8be44ed --- /dev/null +++ b/server/src/Config.ts @@ -0,0 +1,12 @@ +export const token: string = "NzEyMDg4MzY5MjA2OTE5MjY5.XxZ9gQ.Qf-wdR-rRG4-4ImmOf7No3XdkP0"; +export const prefix: string = "uwu$"; +export const owners: string[] = ['217348698294714370']; +export const authorization: string = "rex-1337"; +// This is all devifier's information, change this in production. +export const clientID: string = "712088369206919269"; +export const clientSecret: string = "qpj1nsOo7HWVyNh6lY8Z8I8IvtV0bPiM"; +export const redirectUri: string = "http://localhost:3000"; +export const callbackUrl: string = "http://localhost:8088/oauth/callback"; // 8080 +export const colour: string = "ecb1d1"; +export const validIDs: string[] = []; +export const mongoDBUri: string = "mongodb://sin:[email protected]:47107/heroku_4qrjvmb9";
\ No newline at end of file diff --git a/server/src/client/BotClient.ts b/server/src/client/BotClient.ts new file mode 100644 index 0000000..da23a7b --- /dev/null +++ b/server/src/client/BotClient.ts @@ -0,0 +1,103 @@ +import { AkairoClient, CommandHandler, ListenerHandler, InhibitorHandler } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { join } from 'path'; +import { prefix, owners } from '../Config'; +import { logger } from '../utils/Logger'; +import { SettingsProvider } from '../database'; +import { Logger } from 'winston'; + +declare module 'discord-akairo' { + interface AkairoClient { + commandHandler: CommandHandler; + listenerHandler: ListenerHandler; + logger: Logger; + settings: SettingsProvider; + } +} + +interface BotOptions { + token?: string; + owners?: string[]; + // prefix?: string; +} + +export default class BotClient extends AkairoClient { + public readonly config: BotOptions; + + public logger = logger; + + public inhibitorHandler: InhibitorHandler = new InhibitorHandler(this, { + directory: join(__dirname, '..', 'inhibitors') + }); + + public listenerHandler: ListenerHandler = new ListenerHandler(this, { + directory: join(__dirname, '..', 'listeners') + }); + + public commandHandler: CommandHandler = new CommandHandler(this, { + directory: join(__dirname, '..', 'commands'), + /* prefix: async (msg: Message): Promise<string> => { + if (msg.guild) { + const doc = this.settings.cache.guilds.get(msg.guild.id); + if (doc?.prefix) return doc.prefix; + } + return this.config.prefix + }, */ + prefix, + allowMention: true, + defaultCooldown: 6e4, // 60000 - 6 - count the zeroes... = 4, so its 6e4 + ignorePermissions: owners, + // Extra stuff + argumentDefaults: { + prompt: { + modifyStart: (_: Message, str: string): string => `${str}\n\nType \`cancel\` to cancel the command...`, + modifyRetry: (_: Message, str: string): string => `${str}\n\nType \`cancel\` to cancel the command...`, + timeout: 'You took too long, the command has now been cancelled...', + ended: 'You exceeded the maximum amount of tries, this command has now been cancelled...', + cancel: 'This command has been cancelled...', + retries: 3, + time: 3e4 + }, + otherwise: '' + } + }); + + public settings: SettingsProvider = new SettingsProvider(this); + + public constructor(config: BotOptions) { + super({ + ownerID: config.owners, + messageCacheMaxSize: 50, + messageSweepInterval: 900, + messageCacheLifetime: 300, + partials: ['MESSAGE', 'REACTION'] + }); + + this.config = config; + + this.on('shardError', (err: Error, id: any): Logger => this.logger.warn(`[SHARD ${id} ERROR] ${err.message}`, err.stack)) + .on('warn', (warn: any): Logger => this.logger.warn(`[CLIENT WARN] ${warn}`)); + } + + private async init(): Promise<this> { + await this.settings.init(); + this.commandHandler.useInhibitorHandler(this.inhibitorHandler); + this.commandHandler.useListenerHandler(this.listenerHandler); + this.listenerHandler.setEmitters({ + commandHandler: this.commandHandler, + listenerHandler: this.listenerHandler, + inhibitorHandler: this.inhibitorHandler, + process + }); + this.commandHandler.loadAll(); + this.listenerHandler.loadAll(); + this.inhibitorHandler.loadAll(); + + return this; + } + + public async start(): Promise<string> { + await this.init(); + return this.login(this.config.token); + } +}
\ No newline at end of file diff --git a/server/src/commands/.todo b/server/src/commands/.todo new file mode 100644 index 0000000..0420950 --- /dev/null +++ b/server/src/commands/.todo @@ -0,0 +1,44 @@ +Commands: + [ ] Animals + [x] Anime + [ ] Bot + [ ] Crypto + [ ] Emma + [ ] Fun + [ ] Aesthetic + [ ] Cultured Text + [ ] Dogeify + [ ] Draw Cards + [ ] Embed + [ ] Emoji + [ ] FML + [ ] Gay + [ ] Howify + [ ] Insult + [ ] IQ + [ ] KMK + [ ] Lorem + [ ] Motivate + [ ] Oddcase + [ ] Offspring + [ ] Onion + [ ] Quote + [ ] RoastWilly/ RoastWillyC + [ ] Rock, Paper, Scissors + [ ] ShowerThoughts + [ ] Smash or Pass + [ ] Spongebob + [ ] Stretch + [ ] Subreddit + [ ] Surreal + [ ] Minecraft + [ ] Moderation + [ ] NSFW + [ ] Roleplay + [ ] Server + [ ] User + [ ] Utility + [ ] Voice + [ ] Zero Two + [x] Douse + [ ] Darling
\ No newline at end of file diff --git a/server/src/commands/animals/Bunny.ts b/server/src/commands/animals/Bunny.ts new file mode 100644 index 0000000..5325002 --- /dev/null +++ b/server/src/commands/animals/Bunny.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class BunnyAnimals extends Command { + public constructor() { + super('bunny', { + aliases: ['bunny'], + category: 'animals', + description: { + content: 'Gives you a random bunny!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`https://api.bunnies.io/v2/loop/random/?media=gif,png`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://api.bunies.io/) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('bunnies.io') + //@ts-ignore + .setImage(animal.data.media.gif); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/animals/Cat.ts b/server/src/commands/animals/Cat.ts new file mode 100644 index 0000000..8c37d2c --- /dev/null +++ b/server/src/commands/animals/Cat.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class CatAnimals extends Command { + public constructor() { + super('cat', { + aliases: ['cat'], + category: 'animals', + description: { + content: 'Gives you a random cat!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`https://aws.random.cat/meow`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://random.cat/) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('bunnies.io', 'https://i.imgur.com/Ik0Gf0r.png', 'https://random.cat') + //@ts-ignore + .setImage(animal.data.file); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/animals/Dog.ts b/server/src/commands/animals/Dog.ts new file mode 100644 index 0000000..c44131e --- /dev/null +++ b/server/src/commands/animals/Dog.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class DogAnimals extends Command { + public constructor() { + super('dog', { + aliases: ['dog'], + category: 'animals', + description: { + content: 'Gives you a random dog!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`https://dog.ceo/api/breeds/image/random`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://dog.ceo/api) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('dog.ceo', 'https://dog.ceo/img/favicon.png', 'https://dog.ceo/dog-api/') + //@ts-ignore + .setImage(animal.data.message); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/animals/Duck.ts b/server/src/commands/animals/Duck.ts new file mode 100644 index 0000000..c1b75f9 --- /dev/null +++ b/server/src/commands/animals/Duck.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class DuckAnimals extends Command { + public constructor() { + super('duck', { + aliases: ['duck'], + category: 'animals', + description: { + content: 'Gives you a random duck!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`https://random-d.uk/api/v1/random?type=gif`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://random-d.uk/api/) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('random-d.uk', 'https://random-d.uk/favicon.ico', 'https://random-d.uk') + //@ts-ignore + .setImage(animal.data.url); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/animals/Fox.ts b/server/src/commands/animals/Fox.ts new file mode 100644 index 0000000..fc887ef --- /dev/null +++ b/server/src/commands/animals/Fox.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class FoxAnimals extends Command { + public constructor() { + super('fox', { + aliases: ['fox'], + category: 'animals', + description: { + content: 'Gives you a random fox!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`https://randomfox.ca/floof/`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://randomfox.ca/floof/) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('randomfox.ca') + //@ts-ignore + .setImage(animal.data.image); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/animals/Owl.ts b/server/src/commands/animals/Owl.ts new file mode 100644 index 0000000..bec7a5b --- /dev/null +++ b/server/src/commands/animals/Owl.ts @@ -0,0 +1,36 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class OwlAnimals extends Command { + public constructor() { + super('owl', { + aliases: ['owl'], + category: 'animals', + description: { + content: 'Gives you a random owl!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'] + }); + } + + public async exec(msg: Message): Promise<Message> { + const animal = await Axios.get(`http://pics.floofybot.moe/owl`).catch(err => { + console.error(err); + msg.reply('Woops, there was an error with the (http://pics.floofybot.moe/owl) API.'); + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('pics.floofybot.moe/owl', 'http://pics.floofybot.moe/assets/favicon.svg', 'http://pics.floofybot.moe/') + //@ts-ignore + .setImage(animal.data.image); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/anime/Darling.ts b/server/src/commands/anime/Darling.ts new file mode 100644 index 0000000..5b5a7bb --- /dev/null +++ b/server/src/commands/anime/Darling.ts @@ -0,0 +1,90 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Darling from '../../database/models/DarlingModel'; +import mongoose from 'mongoose'; +import { mongoDBUri } from '../../Config'; +mongoose.connect(mongoDBUri, { + useNewUrlParser: true, + useUnifiedTopology: true +}); + +export default class DarlingAnime extends Command { + public constructor() { + super('darling', { + aliases: ['darling'], + category: 'anime', + description: { + content: 'Allows you to set, check or delete the/ a server\'s darling.', + usage: '[type]', + examples: [ + '', + 'set', + 'remove', + 'check' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'type', + type: 'string', + prompt: { + start: 'Would you like to set, check or delete the current darling?', + retries: 3, + retry: 'Sorry, that was not a valid type.' + } + } + ], + userPermissions: ['MANAGE_GUILD'] + }); + } + + public exec(msg: Message, { type }): Promise<Message> | any { + const darling = new Darling({ + _id: mongoose.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + channelname: msg.channel, + channelID: msg.channel.id, + time: msg.createdAt + }); + + return Darling.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.error(error); + + if (guild) { + if (type === 'remove') { + //@ts-ignore + if (msg.author.id !== guild.userID || msg.author.id !== msg.guild.owner.id) + return msg.reply('Only my darling or the guild owner can remove the current darling.'); + + await Darling.findOneAndDelete({ guildID: msg.guild.id }); + return msg.channel.send('The current darling has been removed!'); + } else if (type === 'set') { + //@ts-ignore + return msg.channel.send(`I already have a darling! It's **${guild.username}**! To set a new darling, either the current darling or the guild owner has to do \`${this.client.commandHandler.prefix}darling remove\`.`); + } else if (type === 'check') { + //@ts-ignore + return msg.channel.send(`My darling is ${guild.username}.`); + } + } else if (!guild) { + if (type === 'remove') { + return msg.channel.send('There is no darling set in this server.'); + } else if (type === 'set') { + await darling.save().catch(err => console.error(err)); + const quotes = [ + 'I think I have taken a liking to you. Won\'t you be my darling?', + 'I like the look in your eyes. It makes my heart race. You are now my darling!', + 'Wow, your taste makes my heart race. It bites and lingers... The taste of danger. You are now my darling!' + ]; + return msg.channel.send(quotes[Math.floor(Math.random() * quotes.length)]); + } else if (type === 'check') { + return msg.reply(`I haven't found my darling yet! To set one, do ${this.client.commandHandler.prefix}darling set.`); + } + } + }); + } +}
\ No newline at end of file diff --git a/server/src/commands/anime/Douse.ts b/server/src/commands/anime/Douse.ts new file mode 100644 index 0000000..02b5771 --- /dev/null +++ b/server/src/commands/anime/Douse.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class DouseAnime extends Command { + public constructor() { + super('douse', { + aliases: ['douse'], + category: 'anime', + description: { + content: 'Douses Zero Two.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const embed = this.client.util.embed() + .setColor(colour) + .setImage('https://i.pinimg.com/originals/6a/c8/26/6ac826e3d0cbd64eb4f42c12a73fcdb8.gif'); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/anime/Waifu.ts b/server/src/commands/anime/Waifu.ts new file mode 100644 index 0000000..043b8ac --- /dev/null +++ b/server/src/commands/anime/Waifu.ts @@ -0,0 +1,32 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; +import request from 'node-superfetch'; +import Util from '../../utils/Utils'; + +export default class WaifuAnime extends Command { + public constructor() { + super('waifu', { + aliases: ['waifu', 'thiswaifudoesnotexist'], + category: 'anime', + description: { + content: 'Sends a randomly generated waifu with a backstory. WARNING: don\'t get too attatched.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const num = Math.floor(Math.random() * 100000); + const { text } = await request.get(`https://www.thiswaifudoesnotexist.net/snippet-${num}.txt`); + const embed = this.client.util.embed() + .setDescription(Util.shorten(text, 1000)) + .setColor(colour) + .setThumbnail(`https://www.thiswaifudoesnotexist.net/example-${num}.jpg`); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/bot/Info.ts b/server/src/commands/bot/Info.ts new file mode 100644 index 0000000..cda8f7a --- /dev/null +++ b/server/src/commands/bot/Info.ts @@ -0,0 +1,61 @@ +import { Command, version as akairoversion } from 'discord-akairo'; +import { Message, version as djsversion } from 'discord.js'; +import { stripIndents } from 'common-tags'; +import * as moment from 'moment'; +import 'moment-duration-format'; +import { colour, owners } from '../../Config'; + +export default class InfoBot extends Command { + public constructor() { + super('info', { + aliases: ['info', 'stats', 'uptime'], + category: 'bot', + description: { + content: 'Provides some information/ stats on the bot.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + // @ts-ignore + const duration = moment.duration(this.client.uptime!).format(' D[d] H[h] m[m] s[s]'); + const embed = this.client.util.embed() + .setTitle(`${this.client.user!.username} Stats`) + .setColor(colour) + .setThumbnail(this.client.user!.displayAvatarURL()) + .addField(`\`⏰\` Uptime`, duration, true) + .addField(`\`💾\`Memory Usage`, `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB`, true) + .addField( + `\`📊\` General Stats`, + // • Servers: ${this.client.guilds.cache.size.toLocaleString('en-US')} + stripIndents` + • Channels: ${this.client.channels.cache.size.toLocaleString('en-US')} + • Users: ${this.client.guilds.cache + .reduce((prev, val) => prev + val.memberCount, 0) + .toLocaleString('en-US')} + `, true) + /* .addField( + '`👴` Reaction Role Stats', + stripIndents` + • Current: ${this.client.settings.cache.reactions.filter(r => r.active).size} + • Lifetime: ${this.client.settings.cache.reactions.size} + `, + true, + ) */ + .addField( + '`📚` Library Info', + stripIndents` + [\`Akairo Framework\`](https://discord-akairo.github.io/#/): ${akairoversion} + [\`Discord.js\`](https://discord.js.org/#/): ${djsversion} + `, true) + .addField('`👧` Lead Developer', (await this.client.fetchApplication()).owner!.toString(), true) + .setFooter(`For more information about ${this.client.users.resolve(owners[0]).tag}, use ${this.client.commandHandler.prefix}sin`, + `${this.client.users.resolve(owners[0]).avatarURL()}`); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/bot/Invite.ts b/server/src/commands/bot/Invite.ts new file mode 100644 index 0000000..a25a20c --- /dev/null +++ b/server/src/commands/bot/Invite.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class InviteBot extends Command { + public constructor() { + super('invite', { + aliases: ['invite'], + category: 'bot', + description: { + content: 'Gives you the bot\'s invite link.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const embed = this.client.util.embed() + .setColor(colour) + .setDescription('To invite the bot, please use [this link](https://kyzer.co/discord/bots/uwufier/).'); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/bot/Ping.ts b/server/src/commands/bot/Ping.ts new file mode 100644 index 0000000..d7857c7 --- /dev/null +++ b/server/src/commands/bot/Ping.ts @@ -0,0 +1,23 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class PingBot extends Command { + public constructor() { + super('ping', { + aliases: ['ping'], + category: 'bot', + description: { + content: 'Check the latency of the ping to the Discord API.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + return msg.channel.send(`Pong! \`${this.client.ws.ping}ms\`.`); + } +}
\ No newline at end of file diff --git a/server/src/commands/bot/Sin.ts b/server/src/commands/bot/Sin.ts new file mode 100644 index 0000000..66e1f2f --- /dev/null +++ b/server/src/commands/bot/Sin.ts @@ -0,0 +1,35 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; +import { stripIndents } from 'common-tags'; + +export default class SinBot extends Command { + public constructor() { + super('sin', { + aliases: ['sin'], + category: 'bot', + description: { + content: 'Will get you more information about Sin, the lead developer.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const embed = this.client.util.embed() + .setColor(colour) + .addField('Sin\'s Stuff', stripIndents` + 💎 [GitHub](https://github.com/8cy) + 🎀 [NPM](https://www.npmjs.com/~sinny) + 🎨 [Twitter](https://twitter.com/__cpuid) + 🎁 [Website](https://kyzer.co) + ✨ [YouTube](https://youtube.com/s1nny) + 🎐 [Top.gg Vote](https://discordbots.org/bot/699473263998271489/vote) + `, false) + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/bot/Suggest.ts b/server/src/commands/bot/Suggest.ts new file mode 100644 index 0000000..7478182 --- /dev/null +++ b/server/src/commands/bot/Suggest.ts @@ -0,0 +1,35 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { owners } from '../../Config'; + +export default class SuggestBot extends Command { + public constructor() { + super('suggest', { + aliases: ['suggest'], + category: 'bot', + description: { + content: 'Suggest a feature that the bot should add.', + usage: '[suggestion]', + examples: [ + 'walter command please' + ] + }, + ratelimit: 3, + args: [ + { + id: 'suggestion', + type: 'string', + prompt: { + start: 'What would you like to suggest?' + }, + match: 'rest' + } + ] + }); + } + + public async exec(msg: Message, { suggestion }): Promise<Message> { + await this.client.users.resolve(owners[0]).send(`**${msg.author.tag}** suggest; *${suggestion}*`); + return msg.channel.send('Thank you for your suggestion!'); + } +}
\ No newline at end of file diff --git a/server/src/commands/emma/FanArt.ts b/server/src/commands/emma/FanArt.ts new file mode 100644 index 0000000..3cab365 --- /dev/null +++ b/server/src/commands/emma/FanArt.ts @@ -0,0 +1,132 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import FanArt from '../../database/models/FanArtModel'; +import mongoose from 'mongoose'; +import { mongoDBUri, colour } from '../../Config'; +mongoose.connect(mongoDBUri, { + useNewUrlParser: true, + useUnifiedTopology: true +}); + +export default class FanArtEmma extends Command { + public constructor() { + super('fanart', { + aliases: ['fanart', 'art'], + category: 'emma', + description: { + content: 'Allows you to set, check or delete the/ a server fanart channel.', + usage: '[type]', + examples: [ + '', + 'set', + 'remove', + 'check' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'type', + type: 'string', + prompt: { + start: 'Would you like to set, check or delete the fanart channel?', + retries: 3, + retry: 'Sorry, that was not a valid type.' + } + }, + { + id: 'comment', + type: 'string' + } + ], + userPermissions: ['MANAGE_GUILD'] + }); + } + + public exec(msg: Message, { type, comment }): Promise<Message> | any { + if (msg.guild.id.toString() !== '663964105983393793') return; + const welcome = new FanArt({ + _id: mongoose.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + channelname: msg.channel, + channelID: msg.channel.id, + time: msg.createdAt + }); + + const validTypes = ['set', 'remove', 'check']; + + if (type === 'submit') { + FanArt.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.log(error); + + //@ts-ignore + let fanartServer = this.client.guilds.cache.get(guild.guildID); + //@ts-ignore + let fanartChannel = guild.channelID; + + if (msg.attachments.size) { + msg.attachments.forEach(fanart => { + if (fanart.url) { + //@ts-ignore + return fanartServer.channels.cache.get(fanartChannel).send(`**New fanart submitted!**\nFanart by <@${msg.author.id}>.\n\n**Comment**\n${comment ? comment : 'None.'}\n\n**Video** ` + fanart.url) + .then(m => { + m.react('😍'); + m.react('😂'); + m.react('😁'); + m.react('😳'); + m.react('😱'); + }); + } else { + return msg.reply(`No attachment was submitted! If you need help, please do \`${this.client.commandHandler.prefix}fanart help\`.`); + } + }); + } else { + return msg.reply(`No attachment was submitted! If you need help, please do \`${this.client.commandHandler.prefix}fanart help\`.`); + } + }); + } else if (type === 'help') { + const embed = this.client.util.embed() + .setTitle('Fanart - Help') + .setColor(colour) + .setDescription('How to submmit fanart:') + .setThumbnail(msg.guild.iconURL()) + .addField('#1', 'Go to the `#media` channel.') + .addField('#2', 'Click on the add media button in the bottom left corner of your screen and select a video or image.') + .addField('#3', 'In the message section, please put `uwu!art submit`.') + .addField('#4 (Optional)', 'If you would like, you can also put a comment on your fanart, you can do this by adding an extra string to the end of your submit command. e.g. `uwu!art submit this is where the comment goes!`, if you followed the steps correctly, your comment should be `this is where the comment goes!') + .addField('Admin Stuff', `If you are an admin or moderator who would like to set/ remove a fanart channel, you can do this by going to to the channel you would like to set as the new fanart channel and doing \`${this.client.commandHandler.prefix}fanart set\`, this will set the current channel as the fanart channel. To remove a fanart channel, just do \`${this.client.commandHandler.prefix}fanart remove\`.`) + .addField('More Admin Info', 'You can only have **ONE** fanart channel (I think, I haven\'t tested it lol. If you change the name of the fanart channel, you will have to re-register with the bot by simply removing and re-setting the fanart channel'); + return msg.channel.send(embed); + } else if (validTypes.includes(type)) { + return FanArt.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.error(error); + + if (guild) { + if (type === 'remove') { + await FanArt.findOneAndDelete({ guildID: msg.guild.id }); + return msg.channel.send('The current fanart channel has been unset!'); + } else if (type === 'set') { + //@ts-ignore + return msg.channel.send(`There already is a fanart channel set! It's ${guild.channelname}`); + } else if (type === 'check') { + //@ts-ignore + return msg.channel.send(`The current fanart channel is ${guild.channelname}!`); + } + } else if (!guild) { + if (type === 'remove') { + return msg.channel.send('There is no current fanart channel set for this guild!'); + } else if (type === 'set') { + await welcome.save().catch(err => console.error(err)); + return msg.channel.send(`The fanart channel has been set to ${msg.channel!}`); + } else if (type === 'check') { + return msg.reply(`There is no current fanart channel set for this guild! To set one, do ${this.client.commandHandler.prefix}fanart set in the channel you want to set it in!`); + } + } + }); + } + } +}
\ No newline at end of file diff --git a/server/src/commands/emma/UglyCat.ts b/server/src/commands/emma/UglyCat.ts new file mode 100644 index 0000000..95193fe --- /dev/null +++ b/server/src/commands/emma/UglyCat.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class UglyCatEmma extends Command { + public constructor() { + super('uglycat', { + aliases: ['uglycat', 'ugycat'], + category: 'fun', + description: { + content: 'Ugly Cat.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const embed = this.client.util.embed() + .setColor(colour) + .setImage('https://i.pinimg.com/originals/4d/19/0f/4d190f1307b35e7155bb4b898e19d545.jpg'); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Advice.ts b/server/src/commands/fun/Advice.ts new file mode 100644 index 0000000..17035c0 --- /dev/null +++ b/server/src/commands/fun/Advice.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class AdviceFun extends Command { + public constructor() { + super('advice', { + aliases: ['advice'], + category: 'fun', + description: { + content: 'Gives you a random piece of advice.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const response = await Axios.get('http://api.adviceslip.com/advice').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(response.data.slip.advice); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Clapify.ts b/server/src/commands/fun/Clapify.ts new file mode 100644 index 0000000..3e6e0fd --- /dev/null +++ b/server/src/commands/fun/Clapify.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class ClapifyFun extends Command { + public constructor() { + super('clapify', { + aliases: ['clapify'], + category: 'fun', + description: { + content: 'Clapifies your specified text.', + usage: '[text]', + examples: [ + 'clap this lol' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to clapify?' + }, + match: 'rest' + }, + { + id: 'deleteinitialmessage', + flag: ['-delete', '-d'], + match: 'flag' + } + ] + }); + } + + public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> { + if (deleteinitialmessage) msg.delete(); + return msg.channel.send(text.split(' ').join('👏')); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/DateFact.ts b/server/src/commands/fun/DateFact.ts new file mode 100644 index 0000000..6fe94bc --- /dev/null +++ b/server/src/commands/fun/DateFact.ts @@ -0,0 +1,52 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class DateFactFun extends Command { + public constructor() { + super('datefact', { + aliases: ['datefact'], + category: 'fun', + description: { + content: 'Grabs a fact about a specified date.', + usage: '[numeric day] [numeric month]', + examples: [ + '8 4' + ] + }, + ratelimit: 3, + args: [ + { + id: 'day', + type: 'integer', + prompt: { + start: 'What day would you like to get facts for? (Numeric value)', + retry: 'That is not a valid day, please try again.', + retries: 3 + }, + default: 'random', + }, + { + id: 'month', + type: 'integer', + prompt: { + start: 'What month would you like to get facts for? (Numeric value)', + retry: 'That is not a valid month, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { day, month }): Promise<Message> { + const uri = `http://numbersapi.com/${month === 'random' || day === 'random' ? 'random' : `${month}/${day}/date`}`; + const fact = await Axios.get(uri).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/DayFact.ts b/server/src/commands/fun/DayFact.ts new file mode 100644 index 0000000..df5d3b7 --- /dev/null +++ b/server/src/commands/fun/DayFact.ts @@ -0,0 +1,41 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class DayFactFun extends Command { + public constructor() { + super('dayfact', { + aliases: ['dayfact'], + category: 'fun', + description: { + content: 'Grabs a fact about a specified day.', + usage: '[numeric day]', + examples: [ + '8' + ] + }, + ratelimit: 3, + args: [ + { + id: 'day', + type: 'integer', + prompt: { + start: 'What day would you like to get facts for? (Numeric value)', + retry: 'That is not a valid day, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { day }): Promise<Message> { + const fact = await Axios.get(`http://numbersapi.com/${day}/date`).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/FML.ts b/server/src/commands/fun/FML.ts new file mode 100644 index 0000000..041622c --- /dev/null +++ b/server/src/commands/fun/FML.ts @@ -0,0 +1,33 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import request from 'node-superfetch'; +import * as cheerio from 'cheerio'; + +export default class FMLFun extends Command { + public constructor() { + super('fml', { + aliases: ['fml'], + category: 'fun', + description: { + content: 'Gives you a random FML.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + //@ts-ignore + const { text } = await request.get('http://www.fmylife.com/random').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://www.fmylife.com/random) API.'); + }); + const $ = cheerio.load(text, { normalizeWhitespace: true }); + const fml = $('a.article-link').first().text().trim(); + //@ts-ignore + return msg.reply(fml); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Fact b/server/src/commands/fun/Fact new file mode 100644 index 0000000..c942b45 --- /dev/null +++ b/server/src/commands/fun/Fact @@ -0,0 +1,67 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import request from 'node-superfetch'; + +export default class FactFun extends Command { + public constructor() { + super('fact', { + aliases: ['fact', 'facts'], + category: 'fun', + description: { + content: 'Grabs a random fact.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const article = await this.randomWikipediaArticle(); + const body = await request.get('https://en.wikipedia.org/w/api.php') + .query({ + action: 'query', + prop: 'extracts', + format: 'json', + titles: article, + exintro: '', + explaintext: '', + redirects: '', + //@ts-ignore + formatversion: 2 + }) + .catch(err => { + console.error(err); + msg.reply('Woops, there was an error regarding the (http://en.wikipedia.org) API.'); + }); + //@ts-ignore + let fact = body.query.pages[0].extract; + if (fact.length > 200) { + const facts = fact.split('.'); + fact = `${facts[0]}.`; + if (fact.length < 200 && facts.length > 1) fact += `${facts[1]}.`; + } + return msg.reply(fact); + } + + public async randomWikipediaArticle() { + const { body } = await request.get('https://en.wikipedia.org/w/api.php') + .query({ + action: 'query', + list: 'random', + //@ts-ignore + rnnamespace: 0, + //@ts-ignore + rnlimit: 1, + format: 'json', + //@ts-ignore + formatversion: 2 + }); + //@ts-ignore + if (!body.query.random[0].title) return 'Facts are hard to find sometimes.'; + //@ts-ignore + return body.query.random[0].title; + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/GitHubZen.ts b/server/src/commands/fun/GitHubZen.ts new file mode 100644 index 0000000..a1ffeee --- /dev/null +++ b/server/src/commands/fun/GitHubZen.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class GitHubZenFun extends Command { + public constructor() { + super('githubzen', { + aliases: ['githubzen', 'github-zen'], + category: 'fun', + description: { + content: 'Gives you a random GitHub design philosophy.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const text = await Axios.get('https://api.github.com/zen').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://api.github.com) API.'); + }); + //@ts-ignore + return msg.reply(text.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Hello.ts b/server/src/commands/fun/Hello.ts new file mode 100644 index 0000000..a866d39 --- /dev/null +++ b/server/src/commands/fun/Hello.ts @@ -0,0 +1,23 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class HelloFun extends Command { + public constructor() { + super('hello', { + aliases: ['hello', 'hi'], + category: 'fun', + description: { + content: 'Say hello!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + return msg.reply('Hi!'); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Insult.ts b/server/src/commands/fun/Insult.ts new file mode 100644 index 0000000..941824f --- /dev/null +++ b/server/src/commands/fun/Insult.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class InsultFun extends Command { + public constructor() { + super('insult', { + aliases: ['insult', 'roast', 'roastwilly'], + category: 'fun', + description: { + content: 'Gives you a random insult.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const response = await Axios.get('https://evilinsult.com/generate_insult.php?lang=en&type=json').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(response.data.insult); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/NumberFact.ts b/server/src/commands/fun/NumberFact.ts new file mode 100644 index 0000000..2739218 --- /dev/null +++ b/server/src/commands/fun/NumberFact.ts @@ -0,0 +1,41 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class NumberFactFun extends Command { + public constructor() { + super('numberfact', { + aliases: ['numberfact', 'number-fact', 'numfact', 'num-fact'], + category: 'fun', + description: { + content: 'Grabs a facts about a specified number.', + usage: '[number]', + examples: [ + '8' + ] + }, + ratelimit: 3, + args: [ + { + id: 'number', + type: 'integer', + prompt: { + start: 'What number would you like to get facts for? (Numeric value)', + retry: 'That is not a valid number, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { number }): Promise<Message> { + const fact = await Axios.get(`http://numbersapi.com/${number}`).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Onion.ts b/server/src/commands/fun/Onion.ts new file mode 100644 index 0000000..e056ec7 --- /dev/null +++ b/server/src/commands/fun/Onion.ts @@ -0,0 +1,35 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { stripIndents } from 'common-tags'; +import RSS from 'rss-parser'; + +export default class OnionFun extends Command { + public constructor() { + super('onion', { + aliases: ['onion', 'theonion', 'the-onion'], + category: 'fun', + description: { + content: 'Gives you a random Onion article.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const parser = new RSS(); + const feed = await parser.parseURL('https://www.theonion.com/rss').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + const article = feed.items[Math.floor(Math.random() * feed.items.length)]; + return msg.reply(stripIndents` + ${article.title} + ${article.link} + `); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Opinion.ts b/server/src/commands/fun/Opinion.ts new file mode 100644 index 0000000..012af7e --- /dev/null +++ b/server/src/commands/fun/Opinion.ts @@ -0,0 +1,34 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class OpinionFun extends Command { + public constructor() { + super('opinion', { + aliases: ['opinion'], + category: 'fun', + description: { + content: 'Determines the bot\'s opinion on something. WARNING: do not take these seriously.', + usage: '[question]', + examples: [ + 'avocadoes' + ] + }, + ratelimit: 3, + args: [ + { + id: 'question', + type: 'string', + prompt: { + start: 'What would you like to get an opinion on?' + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { question }): Promise<Message> { + const opinions = ['👍', '👎']; + return msg.reply(`*${question}* ${opinions[Math.floor(Math.random() * opinions.length)]}`); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/PayRespects.ts b/server/src/commands/fun/PayRespects.ts new file mode 100644 index 0000000..a7c9c68 --- /dev/null +++ b/server/src/commands/fun/PayRespects.ts @@ -0,0 +1,24 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { MessageReaction } from 'discord.js'; + +export default class PayRespectsFun extends Command { + public constructor() { + super('payrespects', { + aliases: ['payrespects', 'respect', 'f'], + category: 'fun', + description: { + content: 'Press F to pay respects.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message | MessageReaction> { + return msg.channel.send('Press F to pay respects').then(m => m.react('🇫')); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Rate.ts b/server/src/commands/fun/Rate.ts new file mode 100644 index 0000000..d377c11 --- /dev/null +++ b/server/src/commands/fun/Rate.ts @@ -0,0 +1,33 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class RateFun extends Command { + public constructor() { + super('rate', { + aliases: ['rate'], + category: 'fun', + description: { + content: 'Determines the bot\'s rating on something. WARNING: do not take these seriously.', + usage: '[question/ item/ topic]', + examples: [ + 'avocadoes' + ] + }, + ratelimit: 3, + args: [ + { + id: 'item', + type: 'string', + prompt: { + start: 'What would you like to get a rating on?' + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { item }): Promise<Message> { + return msg.reply(`I'd give *${item}* a rating of **${Math.floor(Math.random() * 10) + 1}/ 10**!`); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Say.ts b/server/src/commands/fun/Say.ts new file mode 100644 index 0000000..876f539 --- /dev/null +++ b/server/src/commands/fun/Say.ts @@ -0,0 +1,40 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { validIDs, owners } from '../../Config'; + +export default class SayFun extends Command { + public constructor() { + super('say', { + aliases: ['say'], + category: 'fun', + description: { + content: 'Allows you to speak as the bot.', + usage: '[text]', + examples: [ + 'hi this is bot' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to say?' + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { text }): Promise<Message> { + console.log(text) + if (validIDs.includes(msg.author.id) || owners.includes(msg.author.id)) { + msg.delete(); + return msg.channel.send(text); + } + + return msg.delete(); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Spoiler.ts b/server/src/commands/fun/Spoiler.ts new file mode 100644 index 0000000..fb061f9 --- /dev/null +++ b/server/src/commands/fun/Spoiler.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class SpoilerFun extends Command { + public constructor() { + super('spoiler', { + aliases: ['spoiler'], + category: 'fun', + description: { + content: 'Turn every character in a specified phrase as a ||s||||p||||o||||i||||l||||e||||r||.', + usage: '[text]', + examples: [ + 'hide this lol' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to *spoil* (hide)?' + }, + match: 'rest' + }, + { + id: 'deleteinitialmessage', + flag: ['-delete', '-d'], + match: 'flag' + } + ] + }); + } + + public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> { + if (deleteinitialmessage) msg.delete(); + return msg.channel.send(text.replace(/./g, '||$&||')); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Uwufy.ts b/server/src/commands/fun/Uwufy.ts new file mode 100644 index 0000000..15aff06 --- /dev/null +++ b/server/src/commands/fun/Uwufy.ts @@ -0,0 +1,48 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class UwufyFun extends Command { + public constructor() { + super('uwufy', { + aliases: ['uwufy', 'owofy'], + category: 'fun', + description: { + content: 'Uwufys a specified string.', + usage: '[text]', + examples: [ + 'how are you doing today?' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to uwufy?' + }, + match: 'rest' + }, + { + id: 'deleteinitialmessage', + flag: ['-delete', '-d'], + match: 'flag' + } + ] + }); + } + + public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> { + if (deleteinitialmessage) msg.delete(); + text.replace(/(?:l|r)/g, 'w'); + text.replace(/(?:L|R)/g, 'W'); + text.replace(/!+/g, ` >w< `); + + const f = (Math.random() < 0.25) + if (f) { + let c = text.charAt(0); + text = c + '-' + text + } + return msg.channel.send(`*${text}*`); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/YearFact.ts b/server/src/commands/fun/YearFact.ts new file mode 100644 index 0000000..e6b2208 --- /dev/null +++ b/server/src/commands/fun/YearFact.ts @@ -0,0 +1,41 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class YearFactFun extends Command { + public constructor() { + super('yearfact', { + aliases: ['yearfact'], + category: 'fun', + description: { + content: 'Grabs a fact about a specified year.', + usage: '[numeric year]', + examples: [ + '1995' + ] + }, + ratelimit: 3, + args: [ + { + id: 'year', + type: 'integer', + prompt: { + start: 'What year would you like to get facts for? (Numeric value)', + retry: 'That is not a valid year, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { year }): Promise<Message> { + const fact = await Axios.get(`http://numbersapi.com/${year}/year`).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/YoMomma.ts b/server/src/commands/fun/YoMomma.ts new file mode 100644 index 0000000..f156e8d --- /dev/null +++ b/server/src/commands/fun/YoMomma.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class YoMommaFun extends Command { + public constructor() { + super('yomomma', { + aliases: ['yomomma', 'yo-momma'], + category: 'fun', + description: { + content: 'Grabs a "Yo Momma" joke.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const fact = await Axios.get('https://api.yomomma.info/').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (https://api.yomomma.info/) API.'); + }); + //@ts-ignore + return msg.reply(fact.data.joke); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/8Ball.ts b/server/src/commands/minigames/8Ball.ts new file mode 100644 index 0000000..2ff3904 --- /dev/null +++ b/server/src/commands/minigames/8Ball.ts @@ -0,0 +1,31 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import * as EightBallResponses from '../../json/8ball.json' +import { colour } from '../../Config'; + +export default class EightBallMinigames extends Command { + public constructor() { + super('8ball', { + aliases: ['8ball', '8b', '8-ball', '8-b'], + category: 'minigames', + description: { + content: 'Shake the magic 8 Ball for a fortune!', + usage: '[question]', + examples: [ + 'will I ever get married?' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + let randomResponse = EightBallResponses.standard[Math.floor(Math.random() * EightBallResponses.standard.length)]; + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('The 8-ball says', + 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') + .setDescription(`\`${randomResponse}\``); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/Coinflip.ts b/server/src/commands/minigames/Coinflip.ts new file mode 100644 index 0000000..1962b00 --- /dev/null +++ b/server/src/commands/minigames/Coinflip.ts @@ -0,0 +1,50 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class CoinflipMinigames extends Command { + public constructor() { + super('coinflip', { + aliases: ['coinflip', 'flipcoin', 'coin-flip', 'flip-coin'], + category: 'minigames', + description: { + content: 'Flip a coin.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + args: [ + { + id: 'type', + type: 'string', + prompt: { + start: 'What type of coinflip would you like?', + retry: 'That is not a valid type', + optional: true + } + } + ] + }); + } + + public exec(msg: Message, { type }): Promise<Message> { + let outcomes; + let quantum = false; + if (type === 'quantum' || type === 'q') { + outcomes = ['NaN', '0', 'null', 'undefined', '']; + quantum = true; + } else { + outcomes = ['heads!', 'tails!']; + } + const side = outcomes[Math.floor(Math.random() * outcomes.length)]; + + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor(`The ${quantum ? 'quantum' : ''} coin landed on`, + 'https://i.imgur.com/pr7JCce.png') + .setDescription(`\`${side}\``); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/RollDie.ts b/server/src/commands/minigames/RollDie.ts new file mode 100644 index 0000000..8631874 --- /dev/null +++ b/server/src/commands/minigames/RollDie.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class RollDieMinigames extends Command { + public constructor() { + super('rolldie', { + aliases: ['rolldie', 'rolldice', 'roll-die', 'roll-dice'], + category: 'minigames', + description: { + content: 'Roll a die.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const sides = [1, 2, 3, 4, 5, 6]; + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('The die landed on', 'https://i.imgur.com/dK18NpV.png') + .setDescription(`\`${sides[Math.floor(Math.random() * sides.length)]}\``); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/RussianRoulette.ts b/server/src/commands/minigames/RussianRoulette.ts new file mode 100644 index 0000000..c52a4c8 --- /dev/null +++ b/server/src/commands/minigames/RussianRoulette.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class RussianRouletteMinigames extends Command { + public constructor() { + super('russianroulette', { + aliases: ['russianroulette', 'rr'], + category: 'minigames', + description: { + content: 'Play a round of Russian Roulette.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const chamber = Math.floor(Math.random() * 6); + if (chamber === 0) + return msg.reply('💥 *Bang.* You lose.'); + else + return msg.reply("🔫 *Click.* You survived."); + } +}
\ No newline at end of file diff --git a/server/src/commands/mod/Ban.ts b/server/src/commands/mod/Ban.ts new file mode 100644 index 0000000..d91731e --- /dev/null +++ b/server/src/commands/mod/Ban.ts @@ -0,0 +1,64 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class BanMod extends Command { + public constructor() { + super('ban', { + aliases: ['ban', 'banish'], + category: 'moderation', + description: { + content: 'Ban a specified user from the server.', + usage: '[user] [reason(s)]', + examples: [ + '@sin#1337', + '@sin#1337 too cool' + ] + }, + ratelimit: 3, + channel: 'guild', + clientPermissions: ['BAN_MEMBERS'], + userPermissions: ['BAN_MEMBERS'], + args: [ + { + id: 'user', + type: 'string', + prompt: { + start: 'Which user would you like to ban?', + retry: 'That doesn\' seem to be a user, please try again!' + } + }, + { + id: 'reason', + type: 'string', + prompt: { + start: 'For what reason would you like to ban this user?', + optional: true + }, + match: 'rest' + } + ] + }); + } + + public async exec(msg: Message, { user, reason }): Promise<Message> { + if (msg.mentions.members.first()) user = msg.mentions.members.first().id; + + if (user === this.client.user.id) return msg.channel.send('You can\'t ban me!'); + if (!reason) reason = 'No reason has been specified.'; + if (user === msg.author.id) return msg.channel.send('You can\'t ban yourself!'); + + if (msg.mentions.members.first()) { + user = msg.mentions.members.first(); + await user.send(`You have been banned from **${msg.guild.name}** for the following reason(s): "**${reason}**".`); + // .catch(() => console.log('[ERROR] Could not send message to banned user.')); + + return user.ban({ reason: `Banned by: ${msg.author.username} for the following reason(s): ${reason}.`}) + .then(() => msg.reply(`${user.user.username} was successfully banned with the following reason(s): "**${reason}**".`)) + .catch(err => console.error(err)); + } else { + msg.guild.members.ban(user, { reason: `Banned by: ${msg.author.username} for the following reason(s): ${reason}.`}) + .then(() => msg.reply(`User ID ${user} was successfully banned with the following reason(s): "**${reason}**".`)) + .catch(err => console.error(err)); + } + } +}
\ No newline at end of file diff --git a/server/src/commands/mod/Kick.ts b/server/src/commands/mod/Kick.ts new file mode 100644 index 0000000..3295c2a --- /dev/null +++ b/server/src/commands/mod/Kick.ts @@ -0,0 +1,57 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class KickMod extends Command { + public constructor() { + super('kick', { + aliases: ['kick'], + category: 'moderation', + description: { + content: 'Kick a specified user from the server.', + usage: '[user] [reason(s)]', + examples: [ + '@sin#1337', + '@sin#1337 too cool' + ] + }, + ratelimit: 3, + channel: 'guild', + clientPermissions: ['KICK_MEMBERS'], + userPermissions: ['KICK_MEMBERS'], + args: [ + { + id: 'user', + type: 'string', + prompt: { + start: 'Which user would you like to kick?', + retry: 'That doesn\' seem to be a user, please try again!' + } + }, + { + id: 'reason', + type: 'string', + prompt: { + start: 'For what reason would you like to kick this user?', + optional: true + }, + match: 'rest' + } + ] + }); + } + + public async exec(msg: Message, { user, reason }): Promise<Message> { + if (msg.mentions.members.first()) user = msg.mentions.members.first().id; + + if (user === this.client.user.id) return msg.channel.send('You can\'t kick me!'); + if (!reason) reason = 'No reason has been specified.'; + if (user === msg.author.id) return msg.channel.send('You can\'t kick yourself!'); + + await user.send(`You have been kick from **${msg.guild.name}** for the following reason(s): "**${reason}**".`); + // .catch(() => console.log('[ERROR] Could not send message to banned user.')); + + return user.kick({ reason: `Kicked by: ${msg.author.username} for the following reason(s): ${reason}.`}) + .then(() => msg.reply(`${user.user.username} was successfully kick with the following reason(s): "**${reason}**".`)) + .catch(err => console.error(err)); + } +}
\ No newline at end of file diff --git a/server/src/commands/mod/Prune.ts b/server/src/commands/mod/Prune.ts new file mode 100644 index 0000000..bf56846 --- /dev/null +++ b/server/src/commands/mod/Prune.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { TextChannel } from 'discord.js'; + +export default class PruneMod extends Command { + public constructor() { + super('prune', { + aliases: ['prune', 'clear', 'purge'], + category: 'moderation', + description: { + content: 'Bulk delete a specified amount of message from the server.', + usage: '[amount]', + examples: [ + '50' + ] + }, + ratelimit: 3, + channel: 'guild', + clientPermissions: ['MANAGE_MESSAGES'], + userPermissions: ['MANAGE_MESSAGES'], + args: [ + { + id: 'amount', + type: 'integer', + prompt: { + start: 'How many messages would you like to delete?' + } + } + ] + }); + } + + public exec(msg: Message, { amount }): Promise<Message> { + if (amount <= 100) amount = 99; + (msg.channel as TextChannel).bulkDelete(amount, true); + return msg.reply('Due to Discord API limitations, the amount of messages you have specified has been rounded down to **99**. (This message will automatically be deleted in 3 seconds.)') + .then(m => m.delete({ timeout: 3000 })); + } +}
\ No newline at end of file diff --git a/server/src/commands/mod/Slowmode.ts b/server/src/commands/mod/Slowmode.ts new file mode 100644 index 0000000..1d626ec --- /dev/null +++ b/server/src/commands/mod/Slowmode.ts @@ -0,0 +1,61 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class SlowmodeMod extends Command { + public constructor() { + super('slowmode', { + aliases: ['slowmode', 'slow', 'cooldown'], + category: 'moderation', + description: { + content: 'Add a specified amount of slowmode to the current channel.', + usage: '[amount 1-120] [time slowmode should be active for]', + examples: [ + '5 60' + ] + }, + ratelimit: 3, + channel: 'guild', + clientPermissions: ['MANAGE_CHANNELS'], + userPermissions: ['MANAGE_CHANNELS'], + args: [ + { + id: 'amount', + type: 'integer', + prompt: { + start: 'What amount of slowmode would you like to add to the channel?' + } + }, + { + id: 'realtime', + type: 'integer', + prompt: { + start: 'How long would you like the slowmode to last?', + optional: true + } + } + ] + }); + } + + public exec(msg: Message, { amount, realtime }): Promise<Message> { + try { + if (amount > 120) return msg.channel.send('Due to Discord API limitations, slow mode can only be a max of **120** seconds or less!'); + + // msg.channel.setRateLimitPerUser(amount); + + if (realtime) { + let time = 60000 * realtime; + msg.channel.send(`Slowmode has now been set to ${amount} seconds and will end in ${realtime} minutes!`); + setTimeout(() => { + // msg.channel.setRateLimitPerUser(0); + return msg.channel.send('Slowmode has now been disabled!'); + }, time); + } else { + if (amount == 0) return msg.channel.send('Slowmode has now been disabled!'); + return msg.channel.send(`Slowmode has now been set to ${amount} seconds!`); + } + } catch (err) { + console.error(err); + } + } +}
\ No newline at end of file diff --git a/server/src/commands/mod/Unban.ts b/server/src/commands/mod/Unban.ts new file mode 100644 index 0000000..7e66af1 --- /dev/null +++ b/server/src/commands/mod/Unban.ts @@ -0,0 +1,38 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class UnbanMod extends Command { + public constructor() { + super('unban', { + aliases: ['unban'], + category: 'moderation', + description: { + content: 'Unban a specified user from the server.', + usage: '[user id]', + examples: [ + '50' + ] + }, + ratelimit: 3, + channel: 'guild', + clientPermissions: ['BAN_MEMBERS'], + userPermissions: ['BAN_MEMBERS'], + args: [ + { + id: 'user', + type: 'integer', + prompt: { + start: 'Which user would you like to unban?', + retry: 'That doesn\' seem to be a user ID, please try again!' + } + } + ] + }); + } + + public exec(msg: Message, { user }): Promise<Message> { + return msg.guild.members.unban(user.toString()) // Does this really need to be returned? + .then(() => { return msg.reply(`User ID ${user} was successfully unbanned!`)}) + .catch(() => { return msg.reply('Could not unban the specified user, are they banned in the first place?')}); + } +}
\ No newline at end of file diff --git a/server/src/commands/nsfw/Danbooru.ts b/server/src/commands/nsfw/Danbooru.ts new file mode 100644 index 0000000..15e08fa --- /dev/null +++ b/server/src/commands/nsfw/Danbooru.ts @@ -0,0 +1,77 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class DanbooruNSFW extends Command { + public constructor() { + super('danbooru', { + aliases: ['danbooru'], + category: 'nsfw', + description: { + content: 'Danbooru.', + usage: '[tag]', + examples: [ + '', + 'minecraft' + ] + }, + ratelimit: 3, + args: [ + { + id: 'tag', + type: 'string', + prompt: { + start: 'What tag would you like? (Only one is supported at this time because I have no idea how this API works...)', + optional: true + } + } + ] + }); + } + + public async exec(msg: Message, { tag }): Promise<Message> { + //@ts-ignore + if (!msg.channel.nsfw) return msg.reply('This is not an NSFW marked channel!'); + + const tags = await tag.trim().toLowerCase(); + const denylist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vote', 'scat', 'poop', 'kid', 'kiddie', 'kiddy', 'cp', 'shit', 'turd', 'feces', 'excrement', 'excrete']; + + if (tags && denylist.includes(tags)) return msg.reply('A denylisted word was used! ⛔'); + + const response = await Axios.get(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`) + .catch(error => { + console.error(error); + return msg.reply('Woops, there was an error regarding the (https://danbooru.donmai.us) API.'); + }); + + //@ts-ignore + const randomInt = Math.floor(Math.random() * response.data.length); + + //@ts-ignore + if (denylist.includes(response.data[randomInt].tags)) { + return msg.reply('Sorry! This image had a tag that was denylisted! ⛔'); + } + + let getRating = (rating: string) => { + switch (rating) { + case 's': return 'Safe'; break; + case 'q': return 'Questionable'; break; + case 'e': return 'Explicit'; break; + case 'u': return 'Unrated'; break; + } + } + + const embed = this.client.util.embed() + .setColor(colour) + .setTitle(`Danbooru - ${!tags ? 'Random Image' : tags}`) + //@ts-ignore + .setDescription(`[Source](https://danbooru.donmai.us/posts/${response.data[randomInt].id})`) + //@ts-ignore + .setImage(response.data[randomInt].file_url) + .setTimestamp() + //@ts-ignore + .setFooter(`Score: ${response.data[randomInt].score} | Rating: ${getRating(response.data[randomInt].rating)}`, msg.author.avatarURL()); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/nsfw/Gelbooru.ts b/server/src/commands/nsfw/Gelbooru.ts new file mode 100644 index 0000000..a858ea1 --- /dev/null +++ b/server/src/commands/nsfw/Gelbooru.ts @@ -0,0 +1,77 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class GelbooruNSFW extends Command { + public constructor() { + super('gelbooru', { + aliases: ['gelbooru'], + category: 'nsfw', + description: { + content: 'Gelbooru.', + usage: '[tag]', + examples: [ + '', + 'minecraft' + ] + }, + ratelimit: 3, + args: [ + { + id: 'tag', + type: 'string', + prompt: { + start: 'What tag would you like? (Only one is supported at this time because I have no idea how this API works...)', + optional: true + } + } + ] + }); + } + + public async exec(msg: Message, { tag }): Promise<Message> { + //@ts-ignore + if (!msg.channel.nsfw) return msg.reply('This is not an NSFW marked channel!'); + + const tags = await tag.trim().toLowerCase(); + const denylist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vote', 'scat', 'poop', 'kid', 'kiddie', 'kiddy', 'cp', 'shit', 'turd', 'feces', 'excrement', 'excrete']; + + if (tags && denylist.includes(tags)) return msg.reply('A denylisted word was used! ⛔'); + + const response = await Axios.get(`https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) + .catch(error => { + console.error(error); + return msg.reply('Woops, there was an error regarding the (https://gelbooru.com) API.'); + }); + + //@ts-ignore + const randomInt = Math.floor(Math.random() * response.data.length); + + //@ts-ignore + if (denylist.includes(response.data[randomInt].tags)) { + return msg.reply('Sorry! This image had a tag that was denylisted! ⛔'); + } + + let getRating = (rating: string) => { + switch (rating) { + case 's': return 'Safe'; break; + case 'q': return 'Questionable'; break; + case 'e': return 'Explicit'; break; + case 'u': return 'Unrated'; break; + } + } + + const embed = this.client.util.embed() + .setColor(colour) + .setTitle(`Gelbooru - ${!tags ? 'Random Image' : tags}`) + //@ts-ignore + .setDescription(`[Source](https://gelbooru.com/index.php?page=post&s=view&id=${response.data[randomInt].id})`) + //@ts-ignore + .setImage(response.data[randomInt].file_url) + .setTimestamp() + //@ts-ignore + .setFooter(`Score: ${response.data[randomInt].score} | Rating: ${getRating(response.data[randomInt].rating)}`, msg.author.avatarURL()); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/nsfw/Rule34.ts b/server/src/commands/nsfw/Rule34.ts new file mode 100644 index 0000000..bea3af1 --- /dev/null +++ b/server/src/commands/nsfw/Rule34.ts @@ -0,0 +1,68 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; +import { colour } from '../../Config'; + +export default class Rule34NSFW extends Command { + public constructor() { + super('rule34', { + aliases: ['rule34', 'r34'], + category: 'nsfw', + description: { + content: 'If it exists, theres porn of it. If there isn\'t, there will be.', + usage: '[tag]', + examples: [ + '', + 'minecraft' + ] + }, + ratelimit: 3, + args: [ + { + id: 'tag', + type: 'string', + prompt: { + start: 'What tag would you like? (Only one is supported at this time because I have no idea how this API works...)', + optional: true + } + } + ] + }); + } + + public async exec(msg: Message, { tag }): Promise<Message> { + //@ts-ignore + if (!msg.channel.nsfw) return msg.reply('This is not an NSFW marked channel!'); + + const tags = await tag.trim().toLowerCase(); + const denylist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vote', 'scat', 'poop', 'kid', 'kiddie', 'kiddy', 'cp', 'shit', 'turd', 'feces', 'excrement', 'excrete']; + + if (tags && denylist.includes(tags)) return msg.reply('A denylisted word was used! ⛔'); + + const response = await Axios.get(`http://rule34.xxx/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) + .catch(error => { + console.error(error); + return msg.reply('Woops, there was an error regarding the (https://rule34.xxx) API.'); + }); + + //@ts-ignore + const randomInt = Math.floor(Math.random() * response.data.length); + + //@ts-ignore + if (denylist.includes(response.data[randomInt].tags)) { + return msg.reply('Sorry! This image had a tag that was denylisted! ⛔'); + } + + const embed = this.client.util.embed() + .setColor(colour) + .setTitle(`Rule34 - ${!tags ? 'Random Image' : tags}`) + //@ts-ignore + .setDescription(`[Source](https://rule34.xxx/index.php?page=post&s=view&id=${response.data[randomInt].id})`) + //@ts-ignore + .setImage(`https://rule34.xxx/images/${response.data[randomInt].directory}/${response.data[randomInt].image}`) + .setTimestamp() + //@ts-ignore + .setFooter(`Score: ${response.data[randomInt].score} | Rating: ${getRating(response.data[randomInt].rating)}`, msg.author.avatarURL()); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/owner/DM.ts b/server/src/commands/owner/DM.ts new file mode 100644 index 0000000..e0e793a --- /dev/null +++ b/server/src/commands/owner/DM.ts @@ -0,0 +1,90 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class DMOwner extends Command { + public constructor() { + super('dm', { + aliases: ['dm', 'pm'], + category: 'owner', + description: { + content: 'DM a specified user.', + usage: '[user id] [message]', + examples: [ + '217348698294714370 hi' + ] + }, + ratelimit: 3, + args: [ + { + id: 'user', + type: 'string' + }, + { + id: 'type', + type: 'string', + prompt: { + start: 'What type of DM would you like to send the specified user?', + retry: 'That is not a valid DM type!' + } + }, + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to send to the specified user?' + }, + match: 'rest' + } + ], + ownerOnly: true + }); + } + + public exec(msg: Message, { user, type, text }): Promise<Message> { + if (type == 'embed') { + function uuidv4() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + let r = Math.random() * 16 | 0, v = c == 'x' ? r : (4 & 0x3 | 0x8); + return v.toString(16); + }); + } + + const uuid = uuidv4(); + + user = this.client.users.resolve(user); + if (!user) return msg.channel.send('An incorrect user ID was provided.'); + + const embed = this.client.util.embed() + .setTitle('You received a message from the developer!') + .setColor(colour) + .setDescription(text) + .setFooter(`If you wish to respond, use the following command: ${this.client.commandHandler.prefix}feedback --reply ${uuid} <message>`) + .setTimestamp(); + + let attachment = (msg.attachments).array(); + if (attachment[0]) { + this.client.users.resolve(user).send(embed, { files: [attachment[0].url] }) + .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.username}.`)}) + .catch(() => { return msg.channel.send(`Could not send a DM to ${user.username}.`)}); + } else { + this.client.users.resolve(user).send(embed) + .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.tag}.`)}) + .catch(() => { return msg.channel.send(`Could not send a DM to ${user.tag}.`)}); + } + } else if (type === 'normal') { + let attachment = (msg.attachments).array(); + if (attachment[0]) { + this.client.users.resolve(user).send(text, { files: [attachment[0].url] }) + .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.username}.`)}) + .catch(() => { return msg.channel.send(`Could not send a DM to ${user.username}.`)}); + } else { + this.client.users.resolve(user).send(text) + .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.tag}.`)}) + .catch(() => { return msg.channel.send(`Could not send a DM to ${user.tag}.`)}); + } + } + + return; + } +}
\ No newline at end of file diff --git a/server/src/commands/owner/IP.ts b/server/src/commands/owner/IP.ts new file mode 100644 index 0000000..244c11f --- /dev/null +++ b/server/src/commands/owner/IP.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import request from 'node-superfetch'; + +export default class IPOwner extends Command { + public constructor() { + super('ip', { + aliases: ['ip'], + category: 'owner', + description: { + content: 'Gives you the bot\'s IP address.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + ownerOnly: true + }); + } + + public async exec(msg: Message): Promise<Message> { + let { body } = await request.get('https://api.ipify.org').query({ format: 'json' }); + //@ts-ignore + return msg.reply(`${this.client.user.username}'s IP address is **${body.ip}**. *Which script kiddie in chat asked you to send this zzz. -Sin*`); + } +}
\ No newline at end of file diff --git a/server/src/commands/owner/Reload.ts b/server/src/commands/owner/Reload.ts new file mode 100644 index 0000000..ac7bd1f --- /dev/null +++ b/server/src/commands/owner/Reload.ts @@ -0,0 +1,40 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class ReloadOwner extends Command { + public constructor() { + super('reload', { + aliases: ['reload', 'reboot', 'reloadlistener'], + category: 'owner', + description: { + content: 'Reload a command.', + usage: '[command]', + examples: [ + 'ping' + ] + }, + ratelimit: 3, + args: [ + { + id: 'command', + type: 'string', + prompt: { + start: 'What command would you like to reload?', + }, + match: 'rest' + } + ], + ownerOnly: true + }); + } + + public exec(msg: Message, { command }): Promise<Message> { + if (msg.util.parsed.alias == 'reloadlistener') { + this.client.listenerHandler.reload(command); + return msg.channel.send(`Successfully reloaded the listener ${command}`); + } else { + this.handler.reload(command); + return msg.channel.send(`Successfully reloaded the command ${command}`); + } + } +}
\ No newline at end of file diff --git a/server/src/commands/owner/ServerCount.ts b/server/src/commands/owner/ServerCount.ts new file mode 100644 index 0000000..5068c22 --- /dev/null +++ b/server/src/commands/owner/ServerCount.ts @@ -0,0 +1,24 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class ServerCountOwner extends Command { + public constructor() { + super('servercount', { + aliases: ['servercount', 'server-count'], + category: 'owner', + description: { + content: 'Check the amount of servers the bot is in.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + ownerOnly: true + }); + } + + public exec(msg: Message): Promise<Message> { + return msg.channel.send(`${this.client.user.username} is currently in **${this.client.guilds.cache.size}** server(s).`); + } +}
\ No newline at end of file diff --git a/server/src/commands/owner/Status.ts b/server/src/commands/owner/Status.ts new file mode 100644 index 0000000..8bf8dad --- /dev/null +++ b/server/src/commands/owner/Status.ts @@ -0,0 +1,35 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class StatusOwner extends Command { + public constructor() { + super('status', { + aliases: ['status'], + category: 'owner', + description: { + content: 'Change the status of the bot.', + usage: '[status message]', + examples: [ + 'hello, world!' + ] + }, + ratelimit: 3, + args: [ + { + id: 'status', + type: 'string', + prompt: { + start: 'Which status would you like to give me?', + }, + match: 'rest' + } + ], + ownerOnly: true + }); + } + + public exec(msg: Message, { status }): Promise<Message> { + this.client.user.setActivity(status); + return msg.channel.send(`My status has not been set to ${status}!`); + } +}
\ No newline at end of file diff --git a/server/src/commands/owner/Username.ts b/server/src/commands/owner/Username.ts new file mode 100644 index 0000000..df6d6c4 --- /dev/null +++ b/server/src/commands/owner/Username.ts @@ -0,0 +1,35 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class UsernameOwner extends Command { + public constructor() { + super('username', { + aliases: ['username'], + category: 'owner', + description: { + content: 'Change the username of the bot.', + usage: '[username]', + examples: [ + 'Aki' + ] + }, + ratelimit: 3, + args: [ + { + id: 'username', + type: 'string', + prompt: { + start: 'What username would you like to give me?', + }, + match: 'rest' + } + ], + ownerOnly: true + }); + } + + public exec(msg: Message, { username }): Promise<Message> { + this.client.user.setUsername(username); + return msg.channel.send(`My username has now been set to ${username}!`) + } +}
\ No newline at end of file diff --git a/server/src/commands/reaction/List.ts b/server/src/commands/reaction/List.ts new file mode 100644 index 0000000..36c1156 --- /dev/null +++ b/server/src/commands/reaction/List.ts @@ -0,0 +1,46 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { oneLine } from 'common-tags'; +import { colour } from '../../Config'; + +export default class ListReaction extends Command { + public constructor() { + super('reactionlist', { + aliases: ['reactionlist', 'reactionls'], + category: 'reactions', + description: { + content: 'Lists all current reaction roles.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + userPermissions: ['MANAGE_ROLES'], + channel: 'guild' + }); + } + + public async exec(msg: Message): Promise<Message | Message[]> { + const reactions = this.client.settings.cache.reactions.filter(r => r.guildID === msg.guild!.id && r.active); + if (!reactions.size) return msg.reply('you have no live reaction roles!'); + + const embed = this.client.util.embed() + .setColor(colour) + .setTitle('Live Reaction Roles') + .setDescription( + reactions + .map(r => { + const emoji = r.emojiType === 'custom' ? this.client.emojis.cache.get(r.emoji) : r.emoji; + return oneLine`[\`${r.id}\`] ${emoji} + ${this.client.channels.cache.get(r.channelID) || '#deleted-channel'} + ${msg.guild!.roles.cache.get(r.roleID) || '@deleted-role'} + `; + }) + .join('\n') + .substring(0, 2048), + ); + + return msg.reply({ embed }); + } +}
\ No newline at end of file diff --git a/server/src/commands/reaction/New.ts b/server/src/commands/reaction/New.ts new file mode 100644 index 0000000..c695dbc --- /dev/null +++ b/server/src/commands/reaction/New.ts @@ -0,0 +1,168 @@ +import { Command } from 'discord-akairo'; +import { Message, MessageReaction, Permissions, Role, TextChannel, User } from 'discord.js'; +import { stripIndents } from 'common-tags'; +import * as nodemoji from 'node-emoji'; +import { colour } from '../../Config'; + +export default class NewReaction extends Command { + public constructor() { + super('reactionnew', { + aliases: ['reactionnew', 'reactionadd'], + category: 'reactions', + description: { + content: 'Create a new reaction role.', + usage: '[type] [channel] [message id] [emoji] [role]', + examples: [ + '1 #welcome 603009228180815882 🍕 @Pizza Lover' + ] + }, + ratelimit: 3, + userPermissions: ['MANAGE_ROLES'], + clientPermissions: ['ADD_REACTIONS', 'MANAGE_ROLES', 'MANAGE_MESSAGES'], + channel: 'guild' + }); + } + + public *args(m: Message): object { + const type = yield { + type: 'number', + prompt: { + start: stripIndents` + What type of reaction role do you wish to create? + + \`[1]\` for react to add and remove. *Classic* + ~~\`[2]\` for react to add only. + \`[3]\` for react to delete only.~~ + `, + restart: stripIndents` + Please provide a valid number for which type of reaction role do you wish to create? + + \`[1]\` Both react to add and remove. *Classic* + ~~\`[2]\` Only react to add. + \`[3]\` Only react to remove role.~~ + `, + }, + }; + + const channel = yield { + type: 'textChannel', + prompt: { + start: "What channel of the message you'd like to add this reaction role to?", + retry: 'Please provide a valid channel.', + }, + }; + + const message = yield { + type: async (_: Message, str: string): Promise<null | Message> => { + if (str) { + try { + const m = await channel.messages.fetch(str); + if (m) return m; + } catch {} + } + return null; + }, + prompt: { + start: 'What is the ID of the message you want to add that reaction role to?', + retry: 'Please provide a valid message ID.', + }, + }; + + const emoji = yield { + type: async (_: Message, str: string): Promise<string | null> => { + if (str) { + const unicode = nodemoji.find(str); + if (unicode) return unicode.emoji; + + const custom = this.client.emojis.cache.find(r => r.toString() === str); + if (custom) return custom.id; + return null; + } + + const message = await m.channel.send( + stripIndents`Please **react** to **this** message with the emoji you wish to use? + If it's a custom emoji, please ensure I'm in the server that it's from!`, + ); + // Please **react** to **this** message or respond with the emoji you wish to use? + // If it's a custom emoji, please ensure I'm in the server that it's from! + + const collector = await message.awaitReactions((_: MessageReaction, u: User): boolean => m.author.id === u.id, { + max: 1, + }); + if (!collector || collector.size !== 1) return null; + + const collected = collector.first()!; + + if (collected.emoji.id) { + const emoji = this.client.emojis.cache.find(e => e.id === collected.emoji.id); + if (emoji) return emoji.id; + return null; + } + + return null; + }, + prompt: { + start: + "Please **respond** to **this** message with the emoji you wish to use? If it's a custom emoji, please ensure I'm in the server that it's from!", + retry: + "Please **respond** to **this** message with a valid emoji. If it's a custom emoji, please ensure I'm in the server that it's from!", + }, + }; + + const role = yield { + type: 'role', + match: 'rest', + prompt: { + start: 'What role would you like to apply when they react?', + retry: 'Please provide a valid role.', + }, + }; + + return { type, channel, message, emoji, role }; + } + + public async exec(msg: Message, { type, channel, message, emoji, role }: { type: number; channel: TextChannel; message: Message; emoji: string; role: Role }): Promise<Message | Message[] | void> { + if (!channel.permissionsFor(this.client.user!.id)!.has(Permissions.FLAGS.ADD_REACTIONS)) + return msg.reply(`I'm missing the permissions to react in ${channel}!`); + + const reaction = await message.react(emoji).catch((err: Error) => err); + + if (reaction instanceof Error) + return msg.reply(`an error occurred when trying to react to that message: \`${reaction}\`.`); + + const id = this.makeID(); + + await this.client.settings.new('reaction', { + guildID: msg.guild!.id, + messageID: message.id, + userID: msg.author.id, + channelID: channel.id, + id, + emoji, + emojiType: emoji.length >= 3 ? 'custom' : 'unicode', + roleID: role.id, + uses: 0, + type, + }); + + const embed = this.client.util.embed() + .setColor(colour) + .setTitle('New Reaction Role!') + .setDescription("Please make sure my highest role is above the one you're trying to assign!") + .addField('🔢 Reference ID', id) + .addField('🏠 Channel', `${channel} \`[${channel.id}]\``) + .addField('💬 Message', `\`${message.id}\``) + .addField('🍕 Emoji', emoji.length >= 3 ? `${emoji} \`[${emoji}]\`` : emoji) + .addField('💼 Role', `${role} \`[${role.id}]\``); + return msg.channel.send({ embed }); + } + + public makeID(times?: number): string { + const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + return 'X' + .repeat(times || 4) + .split('') + .map(() => possible.charAt(Math.floor(Math.random() * possible.length))) + .join(''); + } +}
\ No newline at end of file diff --git a/server/src/commands/reaction/Remove.ts b/server/src/commands/reaction/Remove.ts new file mode 100644 index 0000000..0a58cdd --- /dev/null +++ b/server/src/commands/reaction/Remove.ts @@ -0,0 +1,61 @@ +import { Command } from 'discord-akairo'; +import { Message, TextChannel } from 'discord.js'; +import { Reaction } from '../../database/models/ReactionModel'; + +export default class RemoveReaction extends Command { + public constructor() { + super('reactionremove', { + aliases: ['reactionremove', 'reactionrm', 'reactiondelete', 'reactiondel'], + category: 'reactions', + description: { + content: 'Removes a reaction from a message via an discriminator.', + usage: '[discriminator]', + examples: [ + '[fV9k]' + ] + }, + ratelimit: 3, + userPermissions: ['MANAGE_ROLES'], + channel: 'guild', + args: [ + { + id: 'reaction', + type: (msg: Message, str: string): Reaction | null => { + const req = this.client.settings.cache.reactions.find(r => r.id === str && r.guildID === msg.guild!.id); + if (!req) return null; + return req; + }, + match: 'rest', + prompt: { + start: "Please provide the unique identifier for the reaction you'd like to delete.", + retry: + "Please provide a valid identifier for the reaction role you'd like to delete. You can also delete the whole message to delete reaction roles on it.", + }, + }, + ], + }); + } + + public async exec(msg: Message, { reaction }: { reaction: Reaction }): Promise<Message | Message[] | void> { + this.client.logger.info(reaction); + try { + const chan = this.client.channels.cache.get(reaction.channelID) as TextChannel; + if (!chan) throw new Error("That channel doesn't exist!"); + const message = await chan.messages.fetch(reaction.messageID); + if (!message) throw new Error("That message doesn't exist!"); + await message.reactions.cache.get(reaction.emoji)!.users.remove(this.client.user!.id); + } catch (err) { + this.client.logger.error(`[ERROR in REMOVE CMD]: ${err}.`); + } + + this.client.settings.set( + 'reaction', + { messageID: reaction.messageID }, + { + active: false, + }, + ); + + return msg.reply('successfully deleted that reaction role.'); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/Goodbye.ts b/server/src/commands/server/Goodbye.ts new file mode 100644 index 0000000..bc341b8 --- /dev/null +++ b/server/src/commands/server/Goodbye.ts @@ -0,0 +1,81 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Goodbye from '../../database/models/GoodbyeModel'; +import mongoose from 'mongoose'; +import { mongoDBUri } from '../../Config'; +mongoose.connect(mongoDBUri, { + useNewUrlParser: true, + useUnifiedTopology: true +}); + +export default class GoodbyeServer extends Command { + public constructor() { + super('goodbye', { + aliases: ['goodbye'], + category: 'server', + description: { + content: 'Allows you to set, check or delete the/ a server goodbye message.', + usage: '[type]', + examples: [ + '', + 'set', + 'remove', + 'check' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'type', + type: 'string', + prompt: { + start: 'Would you like to set, check or delete the goodbye channel?', + retries: 3, + retry: 'Sorry, that was not a valid type.' + } + } + ], + userPermissions: ['MANAGE_GUILD'] + }); + } + + public exec(msg: Message, { type }): Promise<Message> | any { + const goodbye = new Goodbye({ + _id: mongoose.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + channelname: msg.channel, + channelID: msg.channel.id, + time: msg.createdAt + }); + + return Goodbye.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.error(error); + + if (guild) { + if (type === 'remove') { + await Goodbye.findOneAndDelete({ guildID: msg.guild.id }); + return msg.channel.send('The current goodbye channel has been unset!'); + } else if (type === 'set') { + //@ts-ignore + return msg.channel.send(`There already is a goodbye channel set! It's ${guild.channelname}`); + } else if (type === 'check') { + //@ts-ignore + return msg.channel.send(`The current goodbye channel is ${guild.channelname}!`); + } + } else if (!guild) { + if (type === 'remove') { + return msg.channel.send('There is no current goodbye channel set for this guild!'); + } else if (type === 'set') { + await goodbye.save().catch(err => console.error(err)); + return msg.channel.send(`The goodbye channel has been set to ${msg.channel!}`); + } else if (type === 'check') { + return msg.reply(`There is no current goodbye channel set for this guild! To set one, do ${this.client.commandHandler.prefix}goodbye set in the channel you want to set it in!`); + } + } + }); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/MemberCount.ts b/server/src/commands/server/MemberCount.ts new file mode 100644 index 0000000..ee870fe --- /dev/null +++ b/server/src/commands/server/MemberCount.ts @@ -0,0 +1,24 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class MemberCountServer extends Command { + public constructor() { + super('membercount', { + aliases: ['membercount', 'mc', 'member-count', 'members'], + category: 'bot', + description: { + content: 'Grabs the current server\'s member count.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + channel: 'guild' + }); + } + + public exec(msg: Message): Promise<Message> { + return msg.reply(`There are **${msg.guild.memberCount}** members in **${msg.guild.name}**.`); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/OldestMember.ts b/server/src/commands/server/OldestMember.ts new file mode 100644 index 0000000..6fea716 --- /dev/null +++ b/server/src/commands/server/OldestMember.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { formatDistance, formatRelative } from 'date-fns'; + +export default class OldestMemberServer extends Command { + public constructor() { + super('oldestmember', { + aliases: ['oldestmember'], + category: 'bot', + description: { + content: 'Grabs the current server\'s oldest member (registration time).', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + channel: 'guild' + }); + } + + public exec(msg: Message): Promise<Message> { + const oldest = msg.guild.members.cache.sort((member1, member2) => { + const timestamp1 = member1.user.createdTimestamp; + const timestamp2 = member2.user.createdTimestamp; + + if (timestamp1 > timestamp2) + return 1; + else if (timestamp1 < timestamp2) + return -1; + return 0 + }).first().user; + + const { createdAt } = oldest; + const age = formatDistance(createdAt, new Date()); + const date = formatRelative(createdAt, new Date()); + return msg.reply(`${oldest.tag} is the oldest member in this server! Their account's age is **${age}** old (created **${date}**).`); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/PFP.ts b/server/src/commands/server/PFP.ts new file mode 100644 index 0000000..d5ac00b --- /dev/null +++ b/server/src/commands/server/PFP.ts @@ -0,0 +1,63 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class PFPServer extends Command { + public constructor() { + super('pfp', { + aliases: ['pfp', 'avatar', 'avi'], + category: 'server', + description: { + content: 'Grabs a specified user\'s profile picture.', + usage: '[user]', + examples: [ + '@sin#1337' + ] + }, + ratelimit: 3, + args: [ + { + id: 'user', + type: 'user', + prompt: { + start: 'Which user\'s avatar would you like to grab?', + retries: 3, + retry: 'Please choose a valid user.', + optional: true + } + } + ] + }); + } + + public exec(msg: Message, { user }): Promise<Message> { + let embed = this.client.util.embed() + .setColor(colour) + + if (!user) { + let format = msg.author.displayAvatarURL({ dynamic: true }).substr(msg.author.displayAvatarURL({ dynamic: true}).length - 3); + if (format == 'gif') { + embed.setAuthor(msg.author.username); + embed.setDescription(`[gif](${msg.author.displayAvatarURL({ format: 'gif', size: 2048 })})`); + embed.setImage(msg.author.displayAvatarURL({ format: 'gif', size: 2048 })); + } else { + embed.setAuthor(msg.author.username); + embed.setDescription(`[png](${msg.author.displayAvatarURL({ format: 'png', size: 2048 })}) | [jpeg](${user.displayAvatarURL({ format: 'jpeg', size: 2048 })}) | [webp](${user.displayAvatarURL({ format: 'webp', size: 2048 })})`); + embed.setImage(msg.author.displayAvatarURL({ format: 'png', size: 2048 })); + } + return msg.channel.send(embed); + } else { + let format = user.displayAvatarURL({ dynamic: true }).substr(user.displayAvatarURL({ dynamic: true}).length - 3); + if (format == 'gif') { + embed.setAuthor(user.username); + embed.setDescription(`[gif](${user.displayAvatarURL({ format: 'gif', size: 2048 })})`); + embed.setImage(user.displayAvatarURL({ format: 'gif', size: 2048 })); + } else { + embed.setAuthor(user.username); + embed.setDescription(`[png](${user.displayAvatarURL({ format: 'png', size: 2048 })}) | [jpeg](${user.displayAvatarURL({ format: 'jpeg', size: 2048 })}) | [webp](${user.displayAvatarURL({ format: 'webp', size: 2048 })})`); + embed.setImage(user.displayAvatarURL({ format: 'png', size: 2048 })); + } + return msg.channel.send(embed); + } + } +}
\ No newline at end of file diff --git a/server/src/commands/server/Poll.ts b/server/src/commands/server/Poll.ts new file mode 100644 index 0000000..54b617f --- /dev/null +++ b/server/src/commands/server/Poll.ts @@ -0,0 +1,42 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class PollServer extends Command { + public constructor() { + super('poll', { + aliases: ['poll', 'vote'], + category: 'server', + description: { + content: 'Make a poll.', + usage: '[poll contents]', + examples: [ + 'Is Ice Cream good?' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'poll', + type: 'string', + prompt: { + start: 'What is the poll about?' + } + } + ], + userPermissions: ['MANAGE_MESSAGES'] + }); + } + + public exec(msg: Message, { poll }): Promise<Message | void> { + const embed = this.client.util.embed() + .setColor(colour) + .setFooter('React to vote.') + .setDescription(poll) + .setTitle(`Poll created by ${msg.author.username}`); + return msg.channel.send(embed).then(m => { + m.react('✅'); m.react('❎'); + }); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/RandomMember.ts b/server/src/commands/server/RandomMember.ts new file mode 100644 index 0000000..55b5cec --- /dev/null +++ b/server/src/commands/server/RandomMember.ts @@ -0,0 +1,23 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class RandomMemberServer extends Command { + public constructor() { + super('randommember', { + aliases: ['randommember', 'randomuser', 'random-member', 'random-user', 'someone', '@someone'], + category: 'server', + description: { + content: 'Gets a random member from the current server.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + return msg.reply(`I choose ${msg.guild.members.cache.random().displayName}!`); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/Server.ts b/server/src/commands/server/Server.ts new file mode 100644 index 0000000..7caf899 --- /dev/null +++ b/server/src/commands/server/Server.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class ServerServer extends Command { + public constructor() { + super('server', { + aliases: ['server', 'serverinfo', 'server-info', 'serverstats', 'server-stats'], + category: 'server', + description: { + content: 'Gives you information about the current server.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3, + channel: 'guild' + }); + } + + public exec(msg: Message): Promise<Message> { + const online = msg.guild.members.cache.filter(m => m.presence.status === 'online').size; + + const embed = this.client.util.embed() + .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL()}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) + .setDescription(`Heres's all the information on \`${msg.guild.name}\``) + .setThumbnail(`${msg.guild.iconURL()}`) + .addField('Owner', `\`${msg.guild.owner.user.tag}\``) + .addField(`Members [${msg.guild.memberCount}]`, `${online} members are online.`, true) + .addField(`Region`, `${msg.guild.region}`, true) + .addField(`Text Channels`, `${msg.guild.channels.cache.filter(c => c.type === 'text').size}`, true) + .addField(`Voice Channels`, `${msg.guild.channels.cache.filter(c => c.type === 'voice').size}`, true) + .addField('Guild Created', `${msg.guild.createdAt}`, false) + .addField(`${this.client.user.username} joined`, `${msg.guild.members.cache.get(this.client.user.id).joinedAt}`) + .setColor(colour); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/User.ts b/server/src/commands/server/User.ts new file mode 100644 index 0000000..26a24e1 --- /dev/null +++ b/server/src/commands/server/User.ts @@ -0,0 +1,75 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class UserServer extends Command { + public constructor() { + super('user', { + aliases: ['user', 'userinfo', 'user-info'], + category: 'bot', + description: { + content: 'Grabs information on a specified user.', + usage: '[user]', + examples: [ + '@sin#1337' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'user', + type: 'user', + prompt: { + optional: true + } + } + ] + }); + } + + public exec(msg: Message, { user }): Promise<Message> { + if (!user) user == msg.author; + + const member = msg.guild.member(user); + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor(`${user.tag} (${user.id})`, user.displayAvatarURL()) + .addField('Highest rank HEX colour', member ? member.displayHexColor : 'No rank colour', true) + .addField('Joined guild at', member ? member.joinedAt : 'Not in this guild', true) + .addField('Date when account was created', user.createdAt, true) + .setTimestamp(); + // embed.addField('-', '-'); + + // User status + if (user.presence.activities[0]) { + embed.addField('Presence', user.presence.activities[0], true); + if (user.presence.activities[0].details) embed.addField('Details', user.presence.activities[0].details, true); + if (user.presence.activities[0].state) embed.addField('State', user.presence.activities[0].state, true); + } + // Bot status + if (user.bot) embed.addField('Is a bot?', '✅', true); + + // Show user locale + if (user.locale) embed.addField('Locale Settings', user.locale, true); + + // Show user platform + if (user.presence.clientStatus && !user.bot) { + // embed.addField('-', '-'); + if (user.presence.clientStatus.mobile) embed.addField('Using Discord on', '📱 ' + user.presence.clientStatus.mobile, true); + if (user.presence.clientStatus.desktop) embed.addField('Using Discord on', '💻 ' + user.presence.clientStatus.desktop, true); + if (user.presence.clientStatus.web) embed.addField('Using Discord on', '☁️ ' + user.presence.clientStatus.web, true); + } + + if (member) { + // Boosting since + if (member.premiumSince) embed.addField('Boosting this guild since', member.premiumSince, true); + // Nickname + if (member.nickname) embed.addField('Nickname', member.nickname, true); + // Roles + if (member.roles) embed.addField('Roles', `${member.roles.cache.array().join(', ')}`); + } + + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/server/Welcome.ts b/server/src/commands/server/Welcome.ts new file mode 100644 index 0000000..6c116d9 --- /dev/null +++ b/server/src/commands/server/Welcome.ts @@ -0,0 +1,81 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Welcome from '../../database/models/WelcomeModel'; +import mongoose from 'mongoose'; +import { mongoDBUri } from '../../Config'; +mongoose.connect(mongoDBUri, { + useNewUrlParser: true, + useUnifiedTopology: true +}); + +export default class WelcomeServer extends Command { + public constructor() { + super('welcome', { + aliases: ['welcome'], + category: 'server', + description: { + content: 'Allows you to set, check or delete the/ a server welcome message.', + usage: '[type]', + examples: [ + '', + 'set', + 'remove', + 'check' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'type', + type: 'string', + prompt: { + start: 'Would you like to set, check or delete the welcome channel?', + retries: 3, + retry: 'Sorry, that was not a valid type.' + } + } + ], + userPermissions: ['MANAGE_GUILD'] + }); + } + + public exec(msg: Message, { type }): Promise<Message> | any { + const welcome = new Welcome({ + _id: mongoose.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + channelname: msg.channel, + channelID: msg.channel.id, + time: msg.createdAt + }); + + return Welcome.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.error(error); + + if (guild) { + if (type === 'remove') { + await Welcome.findOneAndDelete({ guildID: msg.guild.id }); + return msg.channel.send('The current welcome channel has been unset!'); + } else if (type === 'set') { + //@ts-ignore + return msg.channel.send(`There already is a welcome channel set! It's ${guild.channelname}`); + } else if (type === 'check') { + //@ts-ignore + return msg.channel.send(`The current welcome channel is ${guild.channelname}!`); + } + } else if (!guild) { + if (type === 'remove') { + return msg.channel.send('There is no current welcome channel set for this guild!'); + } else if (type === 'set') { + await welcome.save().catch(err => console.error(err)); + return msg.channel.send(`The welcome channel has been set to ${msg.channel!}`); + } else if (type === 'check') { + return msg.reply(`There is no current welcome channel set for this guild! To set one, do ${this.client.commandHandler.prefix}welcome set in the channel you want to set it in!`); + } + } + }); + } +}
\ No newline at end of file diff --git a/server/src/commands/util/Categories.ts b/server/src/commands/util/Categories.ts new file mode 100644 index 0000000..7b07027 --- /dev/null +++ b/server/src/commands/util/Categories.ts @@ -0,0 +1,155 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class CategoriesUtil extends Command { + public constructor() { + super('categories', { + aliases: ['categories', 'category'], + category: 'utility', + description: { + content: 'Displays a list of categories or lists all commands in a specified category.', + usage: '[command]', + examples: [ + '', + 'ping' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'], + args: [ + { + id: 'category', + type: 'string', + prompt: { + start: 'Which category do you need help with?', + retry: 'Please provide a valid category.', + optional: true + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { category }): Promise<Message> { + if (!category) return this.execCategoryList(msg); + + let categories = []; + for (const category of this.handler.categories.values()) { + if (!categories.includes(category.id)) categories.push(category.id); + } + if (categories.includes(category)) return this.execCommandList(msg, category); + } + + public async execCommandList(message, categorii): Promise<Message> { + const embed = this.client.util.embed() + .setColor(colour) + .addField('Command List', [ + `This is a list of commands in the **${categorii}** category.`, + `To view details for a specific command, do \`${this.client.commandHandler.prefix}help <command>\`.` + ]); + + for (const category of this.handler.categories.values()) { + let title + if (message.channel.type != 'dm' && message.guild.id == '663964105983393793') { + title = { + general: '📝\u2000General', + fun: '🎉\u2000Fun', + minigames: '🕹\u2000Minigames (WIP)', + images: '🖼\u2000Images', + utility: '🔩\u2000Utility', + moderation: '⚡\u2000Moderation', + owner: '🛠️\u2000Owner', + voice: '🎧\u2000Voice', + bot: '🤖\u2000Bot', + server: '🖥\u2000Server', + anime: '🎀\u2000Anime', + animals: '🐛\u2000Animals', + emma: '🔥\u2000Emma', + nsfw: '🔞\u2000NSFW', + reactions: '😮\u2000Reactions' + }[category.id]; + } else { + title = { + general: '📝\u2000General', + fun: '🎉\u2000Fun', + minigames: '🕹\u2000Minigames (WIP)', + images: '🖼\u2000Images', + utility: '🔩\u2000Utility', + moderation: '⚡\u2000Moderation', + owner: '🛠️\u2000Owner', + voice: '🎧\u2000Voice', + bot: '🤖\u2000Bot', + server: '🖥\u2000Server', + anime: '🎀\u2000Anime', + animals: '🐛\u2000Animals', + nsfw: '🔞\u2000NSFW', + reactions: '😮\u2000Reactions' + }[category.id]; + } + + if (title && (category.id == categorii)) embed.addField(title, `${category.map(cmd => '`' + cmd.aliases[0] + '` - ' + cmd.description.content).join('\n')}`); // .join('`\n`') + } + + return message.channel.send({ embed }); + } + + public async execCategoryList(message): Promise<Message> { + const embed = this.client.util.embed() + .setColor(colour) + .addField('Category List', [ + `To view details for a specific category, do \`${this.client.commandHandler.prefix}category <category>\`.` + ]); + + let count; + for (const category of this.handler.categories.values()) { + count++; + let title + if (message.channel.type != 'dm' && message.guild.id == '663964105983393793') { + title = { + general: '📝\u2000General', + fun: '🎉\u2000Fun', + minigames: '🕹\u2000Minigames (WIP)', + images: '🖼\u2000Images', + utility: '🔩\u2000Utility', + moderation: '⚡\u2000Moderation', + owner: '🛠️\u2000Owner', + voice: '🎧\u2000Voice', + bot: '🤖\u2000Bot', + server: '🖥\u2000Server', + anime: '🎀\u2000Anime', + animals: '🐛\u2000Animals', + emma: '🔥\u2000Emma', + nsfw: '🔞\u2000NSFW', + reactions: '😮\u2000Reactions' + }[category.id]; + } else { + title = { + general: '📝\u2000General', + fun: '🎉\u2000Fun', + minigames: '🕹\u2000Minigames (WIP)', + images: '🖼\u2000Images', + utility: '🔩\u2000Utility', + moderation: '⚡\u2000Moderation', + owner: '🛠️\u2000Owner', + voice: '🎧\u2000Voice', + bot: '🤖\u2000Bot', + server: '🖥\u2000Server', + anime: '🎀\u2000Anime', + animals: '🐛\u2000Animals', + nsfw: '🔞\u2000NSFW', + reactions: '😮\u2000Reactions' + }[category.id]; + } + + if (title) + if (count % 3 == 0) + embed.addField(`${title}`, `${category.size} commands`, false); + else + embed.addField(`${title}`, `${category.size} commands`, true); + } + + return message.channel.send({ embed }); + } +}
\ No newline at end of file diff --git a/server/src/commands/util/Help.ts b/server/src/commands/util/Help.ts new file mode 100644 index 0000000..76d2bf6 --- /dev/null +++ b/server/src/commands/util/Help.ts @@ -0,0 +1,100 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class HelpUtil extends Command { + public constructor() { + super('help', { + aliases: ['help'], + category: 'utility', + description: { + content: 'List help features or get information on a specified command.', + usage: '[command]', + examples: [ + '', + '8ball' + ] + }, + ratelimit: 3, + clientPermissions: ['EMBED_LINKS'], + args: [ + { + id: 'command', + type: 'commandAlias', + prompt: { + start: 'Which command do you need help with?', + retry: 'Please provide a valid command.', + optional: true + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { command }): Promise<void | Message> { + if (!command) { + const embed = this.client.util.embed() + .setColor(colour) + .addFields([ + { + name: 'Online Command List', + value: '*Coming soon!*' + }, + { + name: 'Specific Command Help', + value: `${this.handler.prefix}help <command>` + }, + { + name: 'List of all public categories', + value: `${this.handler.prefix}categories` + } + ]); + return msg.channel.send({ embed }); + } + + const description = Object.assign({ + content: 'No description available.', + usage: '', + examples: [], + fields: [] + }, command.description); + + const embed = this.client.util.embed() + .setColor(colour) + .setTitle(`\`${this.client.commandHandler.prefix}${command.aliases[0]} ${description.usage}\``) + .addField('Description', description.content); + + for (const field of description.fields) embed.addField(field.name, field.value); + + if (command.aliases.length > 1) { + embed.addField('Aliases', `\`${command.aliases.join('`, `')}\``, true); + } + + if (command.description.examples.length >= 1) { + embed.addField('Examples', `\`${this.client.commandHandler.prefix}${command.aliases[0]} ${command.description.examples.join(`, ${this.client.commandHandler.prefix}${command.aliases[0]} `)}\``, true); + } + + if (command.userPermissions) { + embed.addField('User permission', `\`${command.userPermissions.join('` `')}\``, true); + } + + if (command.clientPermissions) { + embed.addField('Bot permission', `\`${command.clientPermissions.join('` `')}\``, true); + } + + if (command.contentParser.flagWords.length) { + embed.addField('Command flags', `\`${command.contentParser.flagWords.join('` `')}\``, true); + } + + if (command.contentParser.optionFlagWords.length) { + embed.addField('Command options flags', `\`${command.contentParser.optionFlagWords.join('` `')}\``, true); + } + + if (msg.channel.type === 'dm') return msg.author.send({ embed }); + return msg.reply('sending you a DM with information...').then(async m => { + await msg.author.send({ embed }); + m.edit('I\'ve send you a DM with information!'); + }); + } +}
\ No newline at end of file diff --git a/server/src/database/index.ts b/server/src/database/index.ts new file mode 100644 index 0000000..dc10553 --- /dev/null +++ b/server/src/database/index.ts @@ -0,0 +1,5 @@ +import ReactionGuildModel from './models/ReactionGuildModel'; +import ReactionModel from './models/ReactionModel'; +import SettingsProvider from './structures/SettingsProvider'; + +export { SettingsProvider };
\ No newline at end of file diff --git a/server/src/database/models/DarlingModel.ts b/server/src/database/models/DarlingModel.ts new file mode 100644 index 0000000..3f98037 --- /dev/null +++ b/server/src/database/models/DarlingModel.ts @@ -0,0 +1,10 @@ +import mongoose from 'mongoose'; +const darlingSchema = new mongoose.Schema({ + _id: mongoose.Schema.Types.ObjectId, + username: String, + userID: String, + guildname: String, + guildID: String, + time: String +}); +export = mongoose.model('Darling', darlingSchema);
\ No newline at end of file diff --git a/server/src/database/models/FanArtModel.ts b/server/src/database/models/FanArtModel.ts new file mode 100644 index 0000000..c2d983e --- /dev/null +++ b/server/src/database/models/FanArtModel.ts @@ -0,0 +1,12 @@ +import mongoose from 'mongoose'; +const fanArtSchema = new mongoose.Schema({ + _id: mongoose.Schema.Types.ObjectId, + username: String, + userID: String, + guildname: String, + guildID: String, + channelname: String, + channelID: String, + time: String +}); +export = mongoose.model('FanArt', fanArtSchema);
\ No newline at end of file diff --git a/server/src/database/models/GoodbyeModel.ts b/server/src/database/models/GoodbyeModel.ts new file mode 100644 index 0000000..04cc7c4 --- /dev/null +++ b/server/src/database/models/GoodbyeModel.ts @@ -0,0 +1,12 @@ +import mongoose from 'mongoose'; +const goodbyeSchema = new mongoose.Schema({ + _id: mongoose.Schema.Types.ObjectId, + username: String, + userID: String, + guildname: String, + guildID: String, + channelname: String, + channelID: String, + time: String +}); +export = mongoose.model('Goodbye', goodbyeSchema);
\ No newline at end of file diff --git a/server/src/database/models/ReactionGuildModel.ts b/server/src/database/models/ReactionGuildModel.ts new file mode 100644 index 0000000..6389b56 --- /dev/null +++ b/server/src/database/models/ReactionGuildModel.ts @@ -0,0 +1,16 @@ +import { Document, Schema, model } from 'mongoose'; + +export interface Guild extends Document { + id: string; + prefix: string; + premium: boolean; + expiresAt: Date; +} + +const Guild: Schema = new Schema({ + id: String, + prefix: String, + premium: Boolean, + expiresAt: Date +}, { strict: false }); +export default model<Guild>('Guild', Guild);
\ No newline at end of file diff --git a/server/src/database/models/ReactionModel.ts b/server/src/database/models/ReactionModel.ts new file mode 100644 index 0000000..509dadd --- /dev/null +++ b/server/src/database/models/ReactionModel.ts @@ -0,0 +1,36 @@ +import { Document, Schema, model } from 'mongoose'; + +export interface Reaction extends Document { + guildID: string; + messageID: string; + channelID: string; + userID: string; + id: string; + emoji: string; + emojiType: string; + roleID: string; + uses: number; + expiresAt?: Date; + type: number; + active: boolean; +} + +const Reaction: Schema = new Schema({ + guildID: String, + messageID: String, + channelID: String, + userID: String, + id: String, + emoji: String, + emojiType: String, + roleID: String, + uses: Number, + expiresAt: Date, + type: Number, + active: { + type: Boolean, + default: true, + }, +}, { strict: false }); + +export default model<Reaction>('Reaction', Reaction); diff --git a/server/src/database/models/WelcomeModel.ts b/server/src/database/models/WelcomeModel.ts new file mode 100644 index 0000000..2a26a6f --- /dev/null +++ b/server/src/database/models/WelcomeModel.ts @@ -0,0 +1,12 @@ +import mongoose from 'mongoose'; +const welcomeSchema = new mongoose.Schema({ + _id: mongoose.Schema.Types.ObjectId, + username: String, + userID: String, + guildname: String, + guildID: String, + channelname: String, + channelID: String, + time: String +}); +export = mongoose.model('Welcome', welcomeSchema);
\ No newline at end of file diff --git a/server/src/database/structures/SettingsProvider.ts b/server/src/database/structures/SettingsProvider.ts new file mode 100644 index 0000000..0a2325a --- /dev/null +++ b/server/src/database/structures/SettingsProvider.ts @@ -0,0 +1,212 @@ +import { Collection } from 'discord.js'; +import { connect, Model, connection, Connection } from 'mongoose'; +import { Logger } from 'winston'; +import ReactionModel, { Reaction } from '../models/ReactionModel'; +import GuildModel, { Guild } from '../models/ReactionGuildModel'; +import { MONGO_EVENTS } from '../utils/Constants' +import BotClient from '../../client/BotClient'; +import { mongoDBUri } from '../../Config'; + +let i = 0; + +/** + * The key, model and cached collection of a database model. + * @interface + */ +interface Combo { + key: string; + model: Model<any>; + cache: Collection<string, any>; +} + +/** + * The Settings Provider that handles all database reads and rights. + * @private + */ +export default class SettingsProvider { + protected readonly client: BotClient; + + protected readonly guilds: Collection<string, Guild> = new Collection(); + protected readonly reactions: Collection<string, Reaction> = new Collection(); + + protected readonly GuildModel = GuildModel; + protected readonly ReactionModel = ReactionModel; + + /** + * + * @param {GiveawayClient} client - The extended Akairo Client + */ + public constructor(client: BotClient) { + this.client = client; + } + + /** + * Retuns all the collection caches. + * @returns {Object} + */ + public get cache() { + return { + guilds: this.guilds, + reactions: this.reactions, + }; + } + + /** + * Returns the database combos + * @returns {Combo[]} + */ + public get combos(): Combo[] { + return [ + { + key: 'guild', + model: this.GuildModel, + cache: this.guilds, + }, + { + key: 'reaction', + model: this.ReactionModel, + cache: this.reactions, + }, + ]; + } + + /** + * Creates a new database document with the provided collection name and data. + * @param {string} type - The collection name + * @param {object} data - The data for the new document + * @returns {Docuement} + */ + public async new(type: 'guild', data: Partial<Guild>): Promise<Guild>; + public async new(type: 'reaction', data: Partial<Reaction>): Promise<Reaction>; + public async new(type: string, data: object): Promise<object> { + const combo = this.combos.find(c => c.key === type); + if (combo) { + const document = new combo.model(data); + await document.save(); + this.client.logger.data(`[DATABASE] Made new ${combo.model.modelName} document with ID of ${document._id}.`); + combo.cache.set(document.id, document); + return document; + } + throw Error(`"${type}" is not a valid model key.`); + } + + /** + * Updates the a database document's data. + * @param {Types} type - The collection name + * @param {object} key - The search paramaters for the document + * @param {object} data - The data you wish to overwrite in the update + * @returns {Promise<Faction | Guild | null>} + */ + public async set(type: 'guild', key: Partial<Guild>, data: Partial<Guild>): Promise<Guild | null>; + public async set(type: 'reaction', key: Partial<Reaction>, data: Partial<Reaction>): Promise<Reaction | null>; + public async set(type: string, key: object, data: object): Promise<object | null> { + const combo = this.combos.find(c => c.key === type); + if (combo) { + const document = await combo.model.findOneAndUpdate(key, { $set: data }, { new: true }); + if (document) { + this.client.logger.verbose(`[DATABASE] Edited ${combo.model.modelName} document with ID of ${document._id}.`); + combo.cache.set(document.id, document); + return document; + } + return null; + } + throw Error(`"${type}" is not a valid model key.`); + } + + /** + * Removes a database document. + * @param {Types} type - The collection name + * @param {object} data - The search paramaters for the document + * @returns {Promise<Faction | Guild | null>>} The document that was removed, if any. + */ + public async remove(type: 'guild', data: Partial<Guild>): Promise<Guild | null>; + public async remove(type: 'user', data: Partial<Reaction>): Promise<Reaction | null>; + public async remove(type: string, data: object): Promise<object | null> { + const combo = this.combos.find(c => c.key === type); + if (combo) { + const document = await combo.model.findOneAndRemove(data); + if (document) { + this.client.logger.verbose(`[DATABASE] Edited ${combo.model.modelName} document with ID of ${document._id}.`); + combo.cache.delete(document.id); + return document; + } + return null; + } + throw Error(`"${type}" is not a valid model key.`); + } + + /** + * Caching all database documents. + * @returns {number} The amount of documents cached total. + * @private + */ + private async _cacheAll(): Promise<number> { + for (const combo of this.combos) await this._cache(combo); + return i; + } + + /** + * Caching each collection's documents. + * @param {Combo} combo - The combo name + * @returns {number} The amount of documents cached from that collection. + * @private + */ + private async _cache(combo: Combo): Promise<any> { + const items = await combo.model.find(); + for (const i of items) combo.cache.set(i.id, i); + this.client.logger.verbose( + `[DATABASE]: Cached ${items.length.toLocaleString('en-US')} items from ${combo.model.modelName}.`, + ); + return (i += items.length); + } + + /** + * Connect to the database + * @param {string} url - the mongodb uri + * @returns {Promise<number | Logger>} Returns a + */ + private async _connect(url: string | undefined): Promise<Logger | number> { + if (url) { + const start = Date.now(); + try { + await connect(url, { + useCreateIndex: true, + useNewUrlParser: true, + useFindAndModify: false, + useUnifiedTopology: true, + }); + } catch (err) { + this.client.logger.error(`[DATABASE] Error when connecting to MongoDB:\n${err.stack}`); + process.exit(1); + } + return this.client.logger.verbose(`[DATABASE] Connected to MongoDB in ${Date.now() - start}ms.`); + } + this.client.logger.error('[DATABASE] No MongoDB url provided!'); + return process.exit(1); + } + + /** + * Adds all the listeners to the mongo connection. + * @param connection - The mongoose connection + * @returns {void} + * @private + */ + private _addListeners(connection: Connection): void { + for (const [event, msg] of Object.entries(MONGO_EVENTS)) { + connection.on(event, () => this.client.logger.data(`[DATABASE]: ${msg}`)); + } + } + + /** + * Starts the Settings Provider + * @returns {SettingsProvider} + */ + public async init(): Promise<this> { + this._addListeners(connection); + await this._connect(mongoDBUri); + this.client.logger.verbose(`[DATABASE]: Now caching ${this.combos.length} schema documents.`); + await this._cacheAll(); + this.client.logger.info(`[DATABASE] [LAUNCHED] Successfully connected and cached ${i} documents.`); + return this; + } +} diff --git a/server/src/database/utils/Constants.ts b/server/src/database/utils/Constants.ts new file mode 100644 index 0000000..911a28a --- /dev/null +++ b/server/src/database/utils/Constants.ts @@ -0,0 +1,8 @@ +export const MONGO_EVENTS = { + connecting: 'Connecting to MongoDB...', + connected: 'Successfully connected to MongoDB.', + disconnecting: 'Disconnecting from MongoDB...', + disconnected: 'Disconnected from MongoDB...', + close: 'MongoDB connection closed.', + reconnected: 'Successfully reconnected to MongoDB.', +} as { [key: string]: string }; diff --git a/server/src/inhibitors/sendMessages.ts b/server/src/inhibitors/sendMessages.ts new file mode 100644 index 0000000..51e1fe3 --- /dev/null +++ b/server/src/inhibitors/sendMessages.ts @@ -0,0 +1,18 @@ +import { Inhibitor } from 'discord-akairo'; +import { Message, TextChannel } from 'discord.js'; + +export default class SendMessagesInhibtor extends Inhibitor { + public constructor() { + super('sendMessages', { + reason: 'sendMessages', + }); + } + + // @ts-ignore + public exec(msg: Message): boolean { + if (!msg.guild) return false; + if (msg.channel instanceof TextChannel) { + return !msg.channel.permissionsFor(this.client.user!)!.has('SEND_MESSAGES'); + } + } +} diff --git a/server/src/json/8ball.json b/server/src/json/8ball.json new file mode 100644 index 0000000..b8c3856 --- /dev/null +++ b/server/src/json/8ball.json @@ -0,0 +1,37 @@ +{ + "standard": [ + "yes~ uwu", + "no.", + "yes!", + "no!", + "what, no.", + "yes.", + "maybe.", + "perhaps.", + "try again.", + "I\"m not sure." + ], + "ditf": [ + "Maybe, darling.", + "Certainly not, darling.", + "I hope so, darling.", + "Not in our wildest dreams, darling.", + "There is a good chance, darling.", + "Quite likely, darling.", + "I think so, darling.", + "I hope not, darling.", + "I hope so, darling.", + "Never!", + "Ahaha! Really?!? XD", + "Hell, yes.", + "Hell to the no.", + "The future is bleak, darling", + "The future is uncertain, darling", + "I would rather not say, darling", + "Who cares?", + "Possibly, darling", + "Never, ever, ever... ever.", + "There is a small chance, darling.", + "Yes, darling!" + ] +}
\ No newline at end of file diff --git a/server/src/listeners/client/ReadyListener.ts b/server/src/listeners/client/ReadyListener.ts new file mode 100644 index 0000000..706e223 --- /dev/null +++ b/server/src/listeners/client/ReadyListener.ts @@ -0,0 +1,59 @@ +import { Listener } from 'discord-akairo'; +import API from '../../API/API'; +import { ActivityType } from 'discord.js'; +import { Guild } from 'discord.js'; +import { setInterval } from 'timers'; + +export interface ReactionStatus { + text: string; + type: ActivityType; +} + +export default class ReadyListener extends Listener { + public constructor() { + super('ready', { + emitter: 'client', + event: 'ready', + category: 'client' + }); + } + + public exec(): void { + console.log(`${this.client.user.tag} is now online and ready!`); + + /* const activities: ReactionStatus[] = [ + { + text: 'uwu$help', + type: 'WATCHING' + } + ] + + const statuses = this.infinite(activities); + + setInterval(() => { + const status = statuses.next() as IteratorResult<ReactionStatus>; + this.client.user!.setActivity(status.value.text, { type: status.value.type }); + }, 300000); + + setInterval(() => this._clearPresences(), 9e5); */ + + new API(this.client).start(); + } + + /* private _clearPresences(): void { + const i = this.client.guilds.cache.reduce((acc: number, g: Guild): number => { + acc += g.presences.cache.size; + g.presences.cache.clear(); + return acc; + }, 0); + this.client.emit('debug', `[PRESENCES]: Cleared ${i} presences in ${this.client.guilds.cache.size} guilds.`); + } + + public *infinite(arr: ReactionStatus[]) { + let i = 0; + while (true) { + yield arr[i]; + i = (i + 1) % arr.length; + } + } */ +}
\ No newline at end of file diff --git a/server/src/listeners/client/channelDelete.ts b/server/src/listeners/client/channelDelete.ts new file mode 100644 index 0000000..f8c45db --- /dev/null +++ b/server/src/listeners/client/channelDelete.ts @@ -0,0 +1,21 @@ +import { Listener } from 'discord-akairo'; +import { GuildChannel } from 'discord.js'; + +export default class ChannelDeleteListener extends Listener { + public constructor() { + super('channelDelete', { + emitter: 'client', + event: 'channelDelete', + category: 'client', + }); + } + + public exec(channel: GuildChannel): void { + if (!channel.guild) return; + const existing = this.client.settings.cache.reactions.filter(r => r.channelID === channel.id); + if (!existing.size) return; + for (const c of existing.values()) { + this.client.settings.set('reaction', { id: c.id }, { active: false }); + } + } +} diff --git a/server/src/listeners/client/debug.ts b/server/src/listeners/client/debug.ts new file mode 100644 index 0000000..d23314b --- /dev/null +++ b/server/src/listeners/client/debug.ts @@ -0,0 +1,15 @@ +/* import { Listener } from 'discord-akairo'; + +export default class DebugListener extends Listener { + public constructor() { + super('debug', { + emitter: 'client', + event: 'debug', + category: 'client', + }); + } + + public exec(event: any): void { + this.client.logger.info(`[DEBUG]: ${event}`); + } +} */
\ No newline at end of file diff --git a/server/src/listeners/client/emojiDelete.ts b/server/src/listeners/client/emojiDelete.ts new file mode 100644 index 0000000..012d324 --- /dev/null +++ b/server/src/listeners/client/emojiDelete.ts @@ -0,0 +1,20 @@ +import { Listener } from 'discord-akairo'; +import { GuildEmoji } from 'discord.js'; + +export default class EmojiDeleteListener extends Listener { + public constructor() { + super('emojiDelete', { + emitter: 'client', + event: 'emojiDelete', + category: 'client', + }); + } + + public exec(emoji: GuildEmoji): void { + const existing = this.client.settings.cache.reactions.filter(r => r.emoji === emoji.id && r.emojiType === 'custom'); + if (!existing.size) return; + for (const c of existing.values()) { + this.client.settings.set('reaction', { id: c.id }, { active: false }); + } + } +} diff --git a/server/src/listeners/client/guildCreate.ts b/server/src/listeners/client/guildCreate.ts new file mode 100644 index 0000000..f649e2c --- /dev/null +++ b/server/src/listeners/client/guildCreate.ts @@ -0,0 +1,23 @@ +import { Listener } from 'discord-akairo'; +import { Guild } from 'discord.js'; + +export default class GuildCreateListener extends Listener { + public constructor() { + super('guildCreate', { + emitter: 'client', + event: 'guildCreate', + category: 'client', + }); + } + + public async exec(guild: Guild): Promise<void> { + const existing = this.client.settings.cache.guilds.get(guild.id); + if (!existing) { + this.client.settings.new('guild', { + id: guild.id, + premium: false, + prefix: process.env.PREFIX || 'r!', + }); + } + } +} diff --git a/server/src/listeners/client/messageDelete.ts b/server/src/listeners/client/messageDelete.ts new file mode 100644 index 0000000..63d8e56 --- /dev/null +++ b/server/src/listeners/client/messageDelete.ts @@ -0,0 +1,20 @@ +import { Listener } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class MessageDeleteListener extends Listener { + public constructor() { + super('messageDelete', { + emitter: 'client', + event: 'messageDelete', + category: 'client', + }); + } + + public exec(msg: Message): void { + const existing = this.client.settings.cache.reactions.filter(r => r.messageID === msg.id); + if (!existing.size) return; + for (const c of existing.values()) { + this.client.settings.set('reaction', { id: c.id }, { active: false }); + } + } +} diff --git a/server/src/listeners/client/messageReactionAdd.ts b/server/src/listeners/client/messageReactionAdd.ts new file mode 100644 index 0000000..1ef2ea9 --- /dev/null +++ b/server/src/listeners/client/messageReactionAdd.ts @@ -0,0 +1,65 @@ +import { Listener } from 'discord-akairo'; +import { User, MessageReaction, Permissions } from 'discord.js'; +import { stripIndents } from 'common-tags'; + +export default class ReactionAddListener extends Listener { + public queue: Set<string> = new Set(); + + public constructor() { + super('messageReactionAdd', { + emitter: 'client', + event: 'messageReactionAdd', + category: 'client', + }); + } + + public async exec(reaction: MessageReaction, user: User): Promise<boolean | void> { + let msg = reaction.message; + if (msg.partial) msg = await msg.fetch(); + + // ignore a message reaction that isn't a guild + if (!msg.guild) return; + + const key = `${reaction.emoji.toString()}:${user.id}`; + if (this.queue.has(key)) return; + this.queue.add(key); + + // fetch our ME because it can be uncached + if (!msg.guild.me) await msg.guild.members.fetch(this.client.user?.id!); + + // get all of our message reactions with the message ID of our message. If none, return. + const messages = this.client.settings.cache.reactions.filter(r => r.messageID === msg.id); + if (!messages.size) return this.queue.delete(key); + + const rr = messages.find(r => [reaction.emoji.name, reaction.emoji.id].includes(r.emoji)); + if (!rr || !rr.active) return this.queue.delete(key); + + // fetch the role store because it may be uncached + const role = await msg.guild.roles.fetch(rr.roleID).catch(() => undefined); + if (!role) return this.queue.delete(key); + + // check if we have permissions to manage roles + if (!msg.guild.me?.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return this.queue.delete(key); + + // check if we have the permissions to apply that specific role + if (role.comparePositionTo(msg.guild.me.roles.highest) >= 0) return this.queue.delete(key); + + const member = await msg.guild.members.fetch(user).catch(() => undefined); + if (!member) return this.queue.delete(key); + + try { + await member.roles.add(role); + await member.send(stripIndents` + You've been given the **${role.name}** role in ${msg.guild.name}. + Please Note: You must wait 5 seconds before you can un-react to have me remove ${role.name}. + `); + } catch (err) { + this.client.logger.info(`[ADDROLE ERROR]: ${err}.`); + } + + // remove the user from the queue system in 2500 seconds so they can't spam reactions + setTimeout(() => { + this.queue.delete(key); + }, 2500); + } +} diff --git a/server/src/listeners/client/messageReactionRemove.ts b/server/src/listeners/client/messageReactionRemove.ts new file mode 100644 index 0000000..7a1e8f7 --- /dev/null +++ b/server/src/listeners/client/messageReactionRemove.ts @@ -0,0 +1,55 @@ +import { Listener } from 'discord-akairo'; +import { User, MessageReaction, Permissions } from 'discord.js'; +import { stripIndents } from 'common-tags'; + +export default class MessageReactionRemove extends Listener { + public queue: Set<string> = new Set(); + + public constructor() { + super('messageReactionRemove', { + emitter: 'client', + event: 'messageReactionRemove', + category: 'client', + }); + } + + public async exec(reaction: MessageReaction, user: User): Promise<boolean | void> { + let msg = reaction.message; + if (msg.partial) msg = await msg.fetch(); + + // ignore a message reaction that isn't a guild + if (!msg.guild) return; + + // fetch our ME because it can be uncached + if (!msg.guild.me || msg.guild.me.partial) await msg.guild.members.fetch(this.client.user?.id!); + + // get all of our message reactions with the message ID of our message. If none, return. + const messages = this.client.settings.cache.reactions.filter(r => r.messageID === msg.id); + if (!messages || !messages.size) return; + + const rr = messages.find(r => [reaction.emoji.name, reaction.emoji.id].includes(r.emoji)); + if (!rr || !rr.active) return; + + // fetch the role store because it may be uncached + const role = await msg.guild.roles.fetch(rr.roleID).catch(() => undefined); + if (!role) return; + + // check if we have permissions to manage roles + if (!msg.guild.me!.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) return; + + // check if we have the permissions to apply that specific role + if (role.comparePositionTo(msg.guild.me!.roles.highest) >= 0) return; + + const member = await msg.guild.members.fetch(user).catch(() => undefined); + if (!member || !member.roles.cache.has(role.id)) return; + + try { + await member.roles.remove(role); + await member.send(stripIndents` + The **${role.name}** role has been removed from you in ${msg.guild.name}. + + Please Note: You must wait 5 seconds before you can re-react to have **${role.name}** reinstated. + `); + } catch {} + } +} diff --git a/server/src/listeners/client/roleDelete.ts b/server/src/listeners/client/roleDelete.ts new file mode 100644 index 0000000..fd4acf9 --- /dev/null +++ b/server/src/listeners/client/roleDelete.ts @@ -0,0 +1,17 @@ +import { Listener } from 'discord-akairo'; +import { Role } from 'discord.js'; + +export default class RoleDelete extends Listener { + public constructor() { + super('roleDelete', { + emitter: 'client', + event: 'roleDelete', + category: 'client', + }); + } + + public exec(role: Role): void { + const existing = this.client.settings.cache.reactions.filter(r => r.roleID === role.id); + for (const { _id } of existing.values()) this.client.settings.set('reaction', { _id }, { active: false }); + } +} diff --git a/server/src/structures/Interfaces.ts b/server/src/structures/Interfaces.ts new file mode 100644 index 0000000..4ee09f4 --- /dev/null +++ b/server/src/structures/Interfaces.ts @@ -0,0 +1,16 @@ +export interface APIUser { + id: string; + username: string; + discriminator: string; + avatar: string; + guilds: APIGuildMin[]; + admin: boolean; +} + +export interface APIGuildMin { + id: string; + name: string; + icon: string; + admin: boolean; + invited: boolean; +}
\ No newline at end of file diff --git a/server/src/structures/OAuth2.ts b/server/src/structures/OAuth2.ts new file mode 100644 index 0000000..379cf4c --- /dev/null +++ b/server/src/structures/OAuth2.ts @@ -0,0 +1,62 @@ +import { Request } from 'express'; +import { AkairoClient } from 'discord-akairo'; +import { Guild } from 'discord.js'; +import fetch from 'node-fetch'; +import { owners } from '../Config'; +import { APIUser, APIGuildMin } from './Interfaces'; + +export default class OAuth2 { + protected client: AkairoClient; + protected guilds: object; + + public constructor(client: AkairoClient) { + this.client = client; + this.guilds = new Object(); + } + + public async resolveInformation(req: Request): Promise<APIUser | null> { + if (!req.session.token) return null; + + const userReq = await fetch('https://discord.com/api/users/@me', { + headers: { + 'Authorization': `Bearer ${req.session.token}` + } + }); + + const user = await userReq.json(); + if (!user.id) return null; + + if (!this.guilds[user.id]) { + const guildsReq = await fetch('https://discord.com/api/users/@me/guilds', { + headers: { + 'Authorization': `Bearer ${req.session.token}` + } + }); + + const guildsRes = await guildsReq.json(); + + this.guilds[user.id] = guildsRes; + setTimeout(() => { + delete this.guilds[user.id]; + }, 3e5); + } + + return { + id: user.id, + username: user.username, + discriminator: user.discriminator, + avatar: user.avatar, + guilds: this.guilds[user.id].map((guild): APIGuildMin => { + const g: Guild = this.client.guilds.cache.get(guild.id); + return { + id: guild.id, + name: guild.name, + icon: guild.icon, + admin: g ? g.members.cache.get(user.id).permissions.has('MANAGE_GUILD') : guild.owner, + invited: g ? true : false + } + }), + admin: owners.includes(user.id) + } + } +}
\ No newline at end of file diff --git a/server/src/utils/Logger.ts b/server/src/utils/Logger.ts new file mode 100644 index 0000000..6b87806 --- /dev/null +++ b/server/src/utils/Logger.ts @@ -0,0 +1,44 @@ +import { createLogger, transports, format, addColors } from 'winston'; + +const loggerLevels = { + levels: { + error: 0, + debug: 1, + warn: 2, + data: 3, + info: 4, + verbose: 5, + silly: 6, + custom: 7, + }, + colors: { + error: 'red', + debug: 'blue', + warn: 'yellow', + data: 'grey', + info: 'green', + verbose: 'cyan', + silly: 'magenta', + custom: 'yellow', + }, +}; + +addColors(loggerLevels.colors); + +export const logger = createLogger({ + levels: loggerLevels.levels, + format: format.combine( + format.colorize({ level: true }), + format.errors({ stack: true }), + format.splat(), + format.timestamp({ format: 'MM/DD/YYYY HH:mm:ss' }), + format.printf((data: any) => { + const { timestamp, level, message, ...rest } = data; + return `[${timestamp}] ${level}: ${message}${ + Object.keys(rest).length ? `\n${JSON.stringify(rest, null, 2)}` : '' + }`; + }), + ), + transports: new transports.Console(), + level: 'custom', +}); diff --git a/server/src/utils/Utils.ts b/server/src/utils/Utils.ts new file mode 100644 index 0000000..454840e --- /dev/null +++ b/server/src/utils/Utils.ts @@ -0,0 +1,5 @@ +export default class Util { + static shorten(text: string, maxLen = 2000) { + return text.length > maxLen ? `${text.substr(0, maxLen - 3)}...` : text; + } +}
\ No newline at end of file diff --git a/server/tsconfig.json b/server/tsconfig.json new file mode 100644 index 0000000..49c6d14 --- /dev/null +++ b/server/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "CommonJS", + "target": "ES2018", + "outDir": "dist", + "lib": [ + "ESNext", + "ESNext.Array", + "ESNext.AsyncIterable", + "ESNext.Intl", + "ESNext.Symbol", + "DOM" + ], + "sourceMap": false, + "inlineSourceMap": true, + "inlineSources": true, + "incremental": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "removeComments": true, + "resolveJsonModule": true + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules/" + ] +}
\ No newline at end of file diff --git a/Procfile b/spike/Procfile index 3ac3b3b..3ac3b3b 100644 --- a/Procfile +++ b/spike/Procfile diff --git a/package.json.scripts b/spike/package.json.scripts index dc57768..dc57768 100644 --- a/package.json.scripts +++ b/spike/package.json.scripts diff --git a/tsconfig.json b/spike/tsconfig.json.dev index a408deb..a408deb 100644 --- a/tsconfig.json +++ b/spike/tsconfig.json.dev diff --git a/spike/ws/css/main.css b/spike/ws/css/main.css deleted file mode 100644 index 993c46a..0000000 --- a/spike/ws/css/main.css +++ /dev/null @@ -1,116 +0,0 @@ -@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400'); - -body { - display: flex; - width: 100vw; - height: 100vh; - align-items: center; - justify-content: center; - margin: 0; - background: #131313; - color: #fff; - font-size: 96px; - font-family: 'Fira Mono', monospace; - letter-spacing: -7px; -} - -div { - animation: glitch 1s linear infinite; -} - -@keyframes glitch { - - 2%, - 64% { - transform: translate(2px, 0) skew(0deg); - } - - 4%, - 60% { - transform: translate(-2px, 0) skew(0deg); - } - - 62% { - transform: translate(0, 0) skew(5deg); - } -} - -div:before, -div:after { - content: attr(title); - position: absolute; - left: 0; -} - -div:before { - animation: glitchTop 1s linear infinite; - clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%); - -webkit-clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%); -} - -@keyframes glitchTop { - - 2%, - 64% { - transform: translate(2px, -2px); - } - - 4%, - 60% { - transform: translate(-2px, 2px); - } - - 62% { - transform: translate(13px, -1px) skew(-13deg); - } -} - -div:after { - animation: glitchBotom 1.5s linear infinite; - clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%); - -webkit-clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%); -} - -@keyframes glitchBotom { - - 2%, - 64% { - transform: translate(-2px, 0); - } - - 4%, - 60% { - transform: translate(-2px, 0); - } - - 62% { - transform: translate(-22px, 5px) skew(21deg); - } -} - -#green { - color: #05ffa1 -} - -a { - color: white; - text-decoration: none; - transition: 0.5s; -} - -a:hover { - color: rgb(223, 222, 222); - text-decoration: none; - transition: 0.5s; -} - -.footer { - position: fixed; - left: 0; - bottom: 0; - width: 100%; - color: white; - text-align: center; - font-size: 15px; - letter-spacing: -1px; -}
\ No newline at end of file diff --git a/spike/ws/favicon.ico b/spike/ws/favicon.ico Binary files differdeleted file mode 100644 index 7f426f3..0000000 --- a/spike/ws/favicon.ico +++ /dev/null diff --git a/spike/ws/layouts/layout.hbs b/spike/ws/layouts/layout.hbs deleted file mode 100644 index 7d0785a..0000000 --- a/spike/ws/layouts/layout.hbs +++ /dev/null @@ -1 +0,0 @@ -{{body}}
\ No newline at end of file diff --git a/spike/ws/views/index.hbs b/spike/ws/views/index.hbs deleted file mode 100644 index b815c9b..0000000 --- a/spike/ws/views/index.hbs +++ /dev/null @@ -1 +0,0 @@ -{{response}}
\ No newline at end of file diff --git a/src/app.ts b/src/app.ts deleted file mode 100644 index 10b4d50..0000000 --- a/src/app.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ShardingManager } from 'discord.js'; -import config from './config.json'; -const manager = new ShardingManager('./dist/bot.js', { token: config['secret'] }); -// const manager = new ShardingManager('./bot.js', { token: config['secret-dev'] }); - -manager.spawn(); -console.log('\x1b[0m' + 'Connecting...'); -manager.on('shardCreate', shard => console.log('\x1b[0m' + 'Launched shard: ' + '\x1b[36m' + shard.id)); diff --git a/src/assets/audio/farts/1.mp3 b/src/assets/audio/farts/1.mp3 Binary files differdeleted file mode 100644 index 39c85c7..0000000 --- a/src/assets/audio/farts/1.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/2.mp3 b/src/assets/audio/farts/2.mp3 Binary files differdeleted file mode 100644 index ee702d8..0000000 --- a/src/assets/audio/farts/2.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/3.mp3 b/src/assets/audio/farts/3.mp3 Binary files differdeleted file mode 100644 index f9179ad..0000000 --- a/src/assets/audio/farts/3.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/4.mp3 b/src/assets/audio/farts/4.mp3 Binary files differdeleted file mode 100644 index 2a88503..0000000 --- a/src/assets/audio/farts/4.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/5.mp3 b/src/assets/audio/farts/5.mp3 Binary files differdeleted file mode 100644 index b4ccf9d..0000000 --- a/src/assets/audio/farts/5.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/6.mp3 b/src/assets/audio/farts/6.mp3 Binary files differdeleted file mode 100644 index f57c501..0000000 --- a/src/assets/audio/farts/6.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/7.mp3 b/src/assets/audio/farts/7.mp3 Binary files differdeleted file mode 100644 index 5ea9d51..0000000 --- a/src/assets/audio/farts/7.mp3 +++ /dev/null diff --git a/src/assets/audio/farts/8.mp3 b/src/assets/audio/farts/8.mp3 Binary files differdeleted file mode 100644 index d135519..0000000 --- a/src/assets/audio/farts/8.mp3 +++ /dev/null diff --git a/src/assets/audio/longest_fart_ever.mp3 b/src/assets/audio/longest_fart_ever.mp3 Binary files differdeleted file mode 100644 index 82b11e1..0000000 --- a/src/assets/audio/longest_fart_ever.mp3 +++ /dev/null diff --git a/src/assets/audio/squeak.wav b/src/assets/audio/squeak.wav Binary files differdeleted file mode 100644 index fea330b..0000000 --- a/src/assets/audio/squeak.wav +++ /dev/null diff --git a/src/assets/audio/uhhhh.wav b/src/assets/audio/uhhhh.wav Binary files differdeleted file mode 100644 index f8dfb24..0000000 --- a/src/assets/audio/uhhhh.wav +++ /dev/null diff --git a/src/assets/audio/wahoo.mp3 b/src/assets/audio/wahoo.mp3 Binary files differdeleted file mode 100644 index b507034..0000000 --- a/src/assets/audio/wahoo.mp3 +++ /dev/null diff --git a/src/assets/json/meme.json b/src/assets/json/meme.json deleted file mode 100644 index 02687e0..0000000 --- a/src/assets/json/meme.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - "memes", - "wholesomememes", - "tumblr", - "meirl", - "historymemes", - "animemes", - "programmerhumor", - "programmeranimemes", - "bikinibottomtwitter", - "prequelmemes", - "mothmemes", - "meme", - "PoliticalHumor" -]
\ No newline at end of file diff --git a/src/assets/json/month.json b/src/assets/json/month.json deleted file mode 100644 index d02be0a..0000000 --- a/src/assets/json/month.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - "january", - "february", - "march", - "april", - "may", - "june", - "july", - "august", - "september", - "october", - "november", - "december" -]
\ No newline at end of file diff --git a/src/bot.ts b/src/bot.ts deleted file mode 100644 index 658f263..0000000 --- a/src/bot.ts +++ /dev/null @@ -1,207 +0,0 @@ -import config from './config.json'; // Import config -import { CommandoClient } from 'discord.js-commando'; - -//import WS from './server'; - -// Import MongoDB database models -import Welcome from './models/welcome.js'; -import Goodbye from './models/goodbye.js'; -import Verify from './models/Verify'; - -// Connect to database -import mongoose from 'mongoose'; -mongoose.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -import path from 'path'; -// @ts-ignore emoji-random doesn't have types -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -// Import music functions -require('./models/MusicGuild.js') - -// Register client with basic information -const client = new CommandoClient({ - commandPrefix: 'uwu!', - owner: '217348698294714370', - invite: 'https://discord.gg/DVwXUwx' -}); - -// Make webserver public -//const ws = new WS(process.env.PORT, client) - -// Register more client information -client.registry - .registerDefaultTypes() - .registerGroups([ - ['fun', 'Fun Command Group'], - ['moderation', 'Moderation Command Group'], - ['server', 'Server Command Group'], - ['voice', 'Voice Command Group'], - ['nsfw', 'NSFW Command Group'], - ['anime', 'Anime Command Group'], - ['crypto', 'Crypto Command Group'], - ['zerotwo', 'Zero Two Command Group'], - ['bot', 'Bot Command Group'], - ['user', 'User Command Group'], - ['utility', 'Utility Command Group'], - ['minecraft', 'Minecraft Command Group'], - ['animals', 'Animal Command Group'], - ['roleplay', 'Roleplay Command Group'], - ['emma', 'Emma\'s Command Group'] - ]) - .registerDefaultGroups() - .registerDefaultCommands({ - help: true, - //eval: false - }) - .registerCommandsIn(path.join(__dirname, 'commands')); - -client.once('ready', async () => { - // Console out basic bot information - //console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`); - console.log('\x1b[0m' + 'Bot online!') - console.log('\x1b[31m' + ` _ _ __ _ -| | | | / _(_) -| | | |_ ___ _| |_ _ ___ _ __ -| | | \\ \\ /\\ / / | | | _| |/ _ \\ '__| -| |_| |\\ V V /| |_| | | | | __/ | - \\___/ \\_/\\_/ \\__,_|_| |_|\\___|_| - - `) - console.log('\x1b[0m' + 'discord.js Version: ' + '\x1b[36m' + '2.11') - console.log('\x1b[0m' + 'Node.js Version: ' + '\x1b[36m' + process.version) - console.log('\x1b[0m' + 'OS Version: ' + '\x1b[36m' + process.platform) - console.log('\x1b[0m' + 'Name: ' + '\x1b[36m' + `${client.user?.tag}`) - console.log('\x1b[0m' + 'ID: ' + '\x1b[36m' + `${client.user?.id}`) - console.log('\x1b[0m' + 'Servers: ' + '\x1b[36m' + `${client.guilds.cache.size}` + '\x1b[0m') - console.log() - - // Set status - // i would use a set interval in the main msg body but this is better for now because during maintenance you tend to refresh refresh a lot - // kinda crap if you forget to change uppity's status off of maintainence... 2020/05/05, 17:29 - if ((await client.users.fetch('705537104339402815')).presence.activities[0].name == 'maintenance') { - client.user?.setActivity('uwu!help | Maintenance', { - type: 'WATCHING' - }); - } else { - client.user?.setActivity('uwu!help | v' + config['version'], { - type: 'WATCHING' - }); - } -}); - -// Debug stuff -client.on('error', console.error); -//client.on('debug', console.debug); -client.on('warn', console.warn) - -// Logging information -client.on('guildCreate', guild => { - console.log(`Joined server: ${guild.name}`) - let embed = new MessageEmbed() - .setDescription(`Hi! Thank you for inviting uwufier to your server! To view the complete list of commands, do \`uwu!help\`. If you want to contact the lead developer for possible suggestions or to report a bug, please join the [support server](https://discord.com/invite/DVwXUwx). You can also do \`uwu!suggest<thing>\`. If you like the bot, please support the bot on our [top.gg page](https://top.gg/bot/699473263998271489/vote) or our [DBL page](https://discordbotlist.com/bots/699473263998271489/upvote)! ${emoji.random()}`) - guild.owner?.send(embed) - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`Joined server: **${guild.name}**.`) -}) -client.on('guildDelete', guild => { - console.log(`Left server: ${guild.name}`) - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`Joined server: **${guild.name}**.`) -}) - -client.on('guildMemberAdd', async member => { - /* if (member.guild.id.toString() == '663964105983393793') { - const captchaKey = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); - const emmaServer = 663964105983393793; - const unverRole = '729928740359897101'; - member.roles.add(unverRole); - const verify = new Verify({ - _id: mongoose.Types.ObjectId(), - username: member.user.username, - userID: member.user.id, - status: false, - key: captchaKey - }) - await verify.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - //@ts-ignore - member.send(`Please type \`uwu!verify ${captchaKey}\` to be verified.`) - // member.guild.channels.cache.get('729931444008517762')?.send(`Please send the message; \`uwu!verify ${captchaKey}\` to the server channel; \`#verification\` in order to be verified. ${emoji.random()}`); - } */ - - // Execute welcome command if present - Welcome.findOne({ guildID: member.guild.id }, async (error, guild) => { - if (error) { - console.log(error) - } else if (!guild) { - return - } else if (guild) { - // @ts-ignore linting error shows that channelID doesnt exist when it does - member.guild.channels.cache.get(guild.channelID)?.send(`<@${member.id}> has joined the server! ${emoji.random()}`) - } else { - return - } - }) -}) -client.on('guildMemberRemove', member => { - // Execute goodbye command if present - Goodbye.findOne({ guildID: member.guild.id }, async (error, guild) => { - if (error) { - console.log(error) - } else if (!guild) { - return - } else if (guild) { - // @ts-ignore linting error shows that channelID doesnt exist when it does - member.guild.channels.cache.get(guild.channelID)?.send(`<@${member.id}> (**${member.user.tag ? member.user.tag : member.nickname}**) has left the server! ${emoji.random()}`).then(m => m.react('🇫')); - } else { - return - } - }) -}) - -// Just more logging stuff basically -client.on('message', async msg => { - const msgContent = msg.content.toLowerCase(); - // Check if the prefix is present in a string - function prefixCheck() { - // shorthand ? : if else doesn't work for some reason - if (msgContent.startsWith('uwu!')) - return true; - else - return false; - } - if (prefixCheck()) { - if (msg.channel.type == 'dm') { - console.log(msg.author.tag, 'says', msgContent, 'in a DM'); - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`**${msg.author.tag}** says **${msgContent}** in a **DM.**`) - } else { - console.log(msg.member?.user.tag, 'says', msgContent, 'in #' + msg.channel.name + ' in ' + msg.guild?.name); - //@ts-ignore - client.guilds.cache.get('704032355987488791')?.channels.cache.get('706818034999754792')?.send(`**${msg.author.tag}** says **${msgContent}** in **#${msg.channel.name}** in **${msg.guild?.name}**.`) - } - } - - // If a message mentions everyone, react with a random emoji - if (msg.mentions.everyone) msg.react(emoji.random()); - - // If a message is in Kat's Korner and it mentions the word water, react with LizardsWater emoji. - if (msg.guild?.id == '663964105983393793') - if (msg.content.toLowerCase().includes("water") || msg.content.toLowerCase().includes("wader")) { - msg.react('733894420700594187') - msg.react('732062891162992720') - } - - // If message has ugycat then react with ugycat - if (msg.guild?.id == '663964105983393793') { - if (msg.content.toLowerCase().includes('ugy') || msg.content.toLowerCase().includes('ugly')) - msg.react('733301856054280253') - } -}); - -// Register client -client.login(config['secret']); -//client.login(config['secret-dev']); diff --git a/src/commands/animals/bunny.ts b/src/commands/animals/bunny.ts deleted file mode 100644 index 0da4942..0000000 --- a/src/commands/animals/bunny.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { MessageEmbed } from 'discord.js'; -import axios from 'axios'; - -module.exports = class BunnyAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'bunny', - aliases: [ - 'randombunny', - 'random-bunny' - ], - group: 'animals', - memberName: 'bunny', - description: 'Gives you a random bunny.', - examples: ['uwu!bunny'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let emb = new MessageEmbed() - .setAuthor('bunnies.io') - .setColor(0xFFCC4D) - .setImage(await (await axios.get('https://api.bunnies.io/v2/loop/random/?media=gif,png')).data.media.gif) - return msg.say(emb) - } catch (err) { - console.log(err) - return msg.reply('Woops, there was an error with the (https://api.bunnies.io) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/animals/cat.ts b/src/commands/animals/cat.ts deleted file mode 100644 index d4781a5..0000000 --- a/src/commands/animals/cat.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { MessageEmbed } from 'discord.js'; -import axios from 'axios'; - -module.exports = class CatAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'cat', - aliases: [ - 'randomcat', - 'random-cat' - ], - group: 'animals', - memberName: 'cat', - description: 'Gives you a random cat.', - examples: ['uwu!cat'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let emb = new MessageEmbed() - .setAuthor('random.cat', 'https://i.imgur.com/Ik0Gf0r.png', 'https://random.cat') - .setColor(0xFFCC4D) - .setImage(await (await axios.get('https://aws.random.cat/meow')).data.file) - return msg.say(emb) - } catch (err) { - console.log(err) - return msg.reply('Woops, there was an error with the (http://random.cat) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/animals/cow.ts b/src/commands/animals/cow.ts deleted file mode 100644 index 3c84f09..0000000 --- a/src/commands/animals/cow.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import cows from 'cows'; - -module.exports = class CowAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'cow', - aliases: ['cows'], - group: 'animals', - memberName: 'cow', - description: 'Gives you a random cow.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!cow', 'uwu!cows'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - let cowNumber = Math.round((Math.random() * cows().length)) - let cow = cows()[cowNumber] - return msg.reply(`\`\`\`${cow}\`\`\``); - } -};
\ No newline at end of file diff --git a/src/commands/animals/dog.ts b/src/commands/animals/dog.ts deleted file mode 100644 index 0498dbf..0000000 --- a/src/commands/animals/dog.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { MessageEmbed } from 'discord.js'; -import axios from 'axios'; - -module.exports = class DogAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'dog', - aliases: [ - 'randomdog', - 'random-dog' - ], - group: 'animals', - memberName: 'dog', - description: 'Gives you a random dog.', - examples: ['uwu!dog'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let emb = new MessageEmbed() - .setAuthor('dog.ceo', 'https://dog.ceo/img/favicon.png', 'https://dog.ceo/dog-api/') - .setColor(0xFFCC4D) - .setImage(await (await axios.get('https://dog.ceo/api/breeds/image/random')).data.message) - return msg.say(emb) - } catch (err) { - console.log(err) - return msg.reply('Woops, there was an error with the (http://dog.ceo/dog-api) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/animals/duck.ts b/src/commands/animals/duck.ts deleted file mode 100644 index a3683e0..0000000 --- a/src/commands/animals/duck.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { MessageEmbed } from 'discord.js'; -import axios from 'axios'; - -module.exports = class DuckAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'duck', - aliases: [ - 'randomduck', - 'random-duck' - ], - group: 'animals', - memberName: 'duck', - description: 'Gives you a random duck.', - examples: ['uwu!duck'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let emb = new MessageEmbed() - .setAuthor('random-d.uk', 'https://random-d.uk/favicon.ico', 'https://random-d.uk') - .setColor(0xFFCC4D) - .setImage(await (await axios.get('https://random-d.uk/api/v1/random?type=gif')).data.url) - return msg.say(emb) - } catch (err) { - console.log(err) - return msg.reply('Woops, there was an error with the (https://random-d.uk) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/animals/fox.ts b/src/commands/animals/fox.ts deleted file mode 100644 index 155a987..0000000 --- a/src/commands/animals/fox.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { MessageEmbed } from 'discord.js'; -import axios from 'axios'; - -module.exports = class FoxAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'fox', - aliases: [ - 'randomfox', - 'random-fox' - ], - group: 'animals', - memberName: 'fox', - description: 'Gives you a random fox.', - examples: ['uwu!fox'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let emb = new MessageEmbed() - .setAuthor('randomfox.ca') - .setColor(0xFFCC4D) - .setImage(await (await axios.get('https://randomfox.ca/floof/')).data.image) - return msg.say(emb) - } catch (err) { - console.log(err) - return msg.reply('Woops, there was an error with the (https://randomfox.ca/) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/animals/owl.ts b/src/commands/animals/owl.ts deleted file mode 100644 index 6a5f583..0000000 --- a/src/commands/animals/owl.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { MessageEmbed } from 'discord.js'; -import axios from 'axios'; - -module.exports = class OwlAnimals extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'owl', - aliases: [ - 'randomowl', - 'random-owl' - ], - group: 'animals', - memberName: 'owl', - description: 'Gives you a random owl.', - examples: ['uwu!owl'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let emb = new MessageEmbed() - .setAuthor('pics.floofybot.moe/owl', 'http://pics.floofybot.moe/assets/favicon.svg', 'http://pics.floofybot.moe/') - .setColor(0xFFCC4D) - .setImage(await (await axios.get('http://pics.floofybot.moe/owl')).data.image) - return msg.say(emb) - } catch (err) { - console.log(err) - return msg.reply('Woops, there was an error with the (http://pics.floofybot.moe/) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/anime/uwufy.ts b/src/commands/anime/uwufy.ts deleted file mode 100644 index f9f0187..0000000 --- a/src/commands/anime/uwufy.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -import uwufy from 'uwufy' - -module.exports = class UwufyAnime extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'uwufy', - aliases: ['uwu', 'owofy', 'owo'], - group: 'anime', - memberName: 'uwufy', - description: 'Uwufys anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to uwufy?', - type: 'string' - } - ], - examples: [ - 'uwu!uwufy please uwufy this', - 'uwu!uwu can u uwufy this', - 'uwu!owofy this thx', - 'uwu!owo nice now this' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage, { userMsg }: any) { - msg.reply(uwufy(userMsg) + ' ' + emoji.random()) - return msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/anime/waifu.ts b/src/commands/anime/waifu.ts deleted file mode 100644 index d72348f..0000000 --- a/src/commands/anime/waifu.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import request from 'node-superfetch'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore yes it does tf -import { shorten } from '../../utils/Util.js' - -module.exports = class WaifuAnime extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'waifu', - aliases: ['thiswaifudoesnotexist', 'this-waifu-does-not-exist'], - group: 'anime', - memberName: 'waifu', - description: 'Replies with a randomly generated waifu and a backstory. WARNING: don\'t get too attatched.', - examples: [ - - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage) { - const num = Math.floor(Math.random() * 100000) - const { text } = await request.get(`https://www.thiswaifudoesnotexist.net/snippet-${num}.txt`) - let emb = new MessageEmbed() - .setDescription(shorten(text, 1000)) - .setColor(0xFFCC4D) - .setThumbnail(`https://www.thiswaifudoesnotexist.net/example-${num}.jpg`) - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/api.ts b/src/commands/bot/api.ts deleted file mode 100644 index 98486a9..0000000 --- a/src/commands/bot/api.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class APIBot extends Command { - constructor(client) { - super(client, { - name: 'api', - group: 'bot', - memberName: 'api', - description: 'Gives you uwufier\'s API link and documentation.', - examples: ['uwu!api'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - //.setDescription('Here\'s a link to my [API](http://uwufier.kyzer.co/api/v1/). (To use, copy the given URL, then append the API endpoints looking to get to it.) As for documentation, it is currently under heavy re-writing. As soon as the documentation goes live, you can read through it on the [official uwufier website](https://kyzer.co/discord/bots/uwufier/)! ' + emoji.random()) - .setDescription(`Uwifier's API is currently down. ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/clientid.ts b/src/commands/bot/clientid.ts deleted file mode 100644 index 1b084e4..0000000 --- a/src/commands/bot/clientid.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class ClientIDBot extends Command { - constructor(client) { - super(client, { - name: 'clientid', - aliases: ['cid'], - group: 'bot', - memberName: 'clientid', - description: 'Tells you uwufier\'s client ID.', - examples: ['uwu!clientid', 'uwu!cid'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - msg.reply(`**uwufier\'s** client ID is **699473263998271489**. ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/bot/commandsamount.ts b/src/commands/bot/commandsamount.ts deleted file mode 100644 index 49b743e..0000000 --- a/src/commands/bot/commandsamount.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class CommandsAmountBot extends Command { - constructor(client) { - super(client, { - name: 'commandsamount', - aliases: [ - 'commands-amount', - 'cmdsamount', - 'cmds-amount' - ], - group: 'bot', - memberName: 'commandsamount', - description: 'Tells you the amount of available commands uwufier has.', - examples: ['uwu!cmdsamount'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - async run(msg: CommandoMessage) { - msg.reply(`${this.client.user?.tag} has ${this.client.registry.commands.size} available commands! ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/bot/email.ts b/src/commands/bot/email.ts deleted file mode 100644 index f326c22..0000000 --- a/src/commands/bot/email.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class TwitchBot extends Command { - constructor(client) { - super(client, { - name: 'email', - aliases: ['mail', 'contact', 'gmail'], - group: 'bot', - memberName: 'email', - description: 'Gives you a reference to uwufier\'s authors\' (Sin) best method of contact.', - examples: ['uwu!email'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`To contact <@217348698294714370>, please send a email to \`[email protected]\`. Alternatively, you can either send a DM to <@217348698294714370> on Discord or on [Twitter](https://twitter.com/9inny). (All spam and unsolicited inquiries will be dealt with accordingly). ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/generatecommands.ts b/src/commands/bot/generatecommands.ts deleted file mode 100644 index e1079f1..0000000 --- a/src/commands/bot/generatecommands.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class GenerateCommandsBot extends Command { - constructor(client) { - super(client, { - name: 'generatecommands', - aliases: [ - 'generate-commands', - 'generatecmds', - 'generate-cmds', - 'gencommands', - 'gen-commands', - 'gencmds', - 'gen-cmds' - ], - group: 'bot', - memberName: 'generatecommands', - description: 'Generates a .txt file with all of the available commands.', - examples: ['uwu!gencmds'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - ownerOnly: true, - guarded: true - }); - } - async run(msg: CommandoMessage) { - const list = this.client.registry.groups - .map(g => { - const commands = g.commands.filter(c => !c.hidden) - return `\n### ${g.name}\n\n${commands.map(c => { - const extra = `${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}` - return `* ** ${c.name}:** ${c.description}${extra}` - }).join('\n')}` - }) - const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}` - return msg.reply({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] }) - } -};
\ No newline at end of file diff --git a/src/commands/bot/generateservers.ts b/src/commands/bot/generateservers.ts deleted file mode 100644 index 50c65e2..0000000 --- a/src/commands/bot/generateservers.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; - -module.exports = class GenerateServersBot extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'generateservers', - aliases: [ - 'generate-servers', - 'genservers', - 'gen-servers' - ], - group: 'bot', - memberName: 'generateservers', - description: 'Generates a .txt file with all of the servers uwufier is in.', - examples: ['uwu!genservers'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - ownerOnly: true, - guarded: true, - hidden: true - }); - } - async run(msg: CommandoMessage) { - const list = this.client.guilds.cache - .map(g => { - const servers = g.name - return `* ** ${servers}:** ${g.id} - ${g.owner?.user.tag}` - }) - const text = `Total: ${this.client.guilds.cache.size}\n\n### Servers\n\n${list.join('\n')}` - return msg.reply({ files: [{ attachment: Buffer.from(text), name: 'servers.txt' }] }) - } -};
\ No newline at end of file diff --git a/src/commands/bot/github.ts b/src/commands/bot/github.ts deleted file mode 100644 index 9a9b08d..0000000 --- a/src/commands/bot/github.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GitHubBot extends Command { - constructor(client) { - super(client, { - name: 'github', - aliases: ['git', 'gitlab'], - group: 'bot', - memberName: 'github', - description: 'Gives you a link to uwufier\'s authors\' (Sin) GitHub profile.', - examples: ['uwu!github'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Here is <@217348698294714370>'s [GitHub profile](https://github.com/8cy). ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/guildbackdoor.ts b/src/commands/bot/guildbackdoor.ts deleted file mode 100644 index 1282cdd..0000000 --- a/src/commands/bot/guildbackdoor.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random' - -module.exports = class GuildBackdoorBot extends Command { - constructor(client) { - super(client, { - name: 'guildbackdoor', - aliases: [ - 'guild-backdoor', - 'serverbackdoor', - 'server-backdoor' - ], - group: 'fun', - memberName: 'guildbackdoor', - description: 'Checks who the oldest member on the server is.', - examples: ['uwu!guildbackdoor 1234567890'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - hidden: true, - args: [ - { - key: 'gGuild', - prompt: 'What server would you like to join?', - type: 'string' - } - ], - ownerOnly: true - }); - } - async run(msg: CommandoMessage, { gGuild }) { - if (this.client.guilds.cache.has(gGuild)) msg.reply(`Either that is not a valid guild ID or ${this.client.user} is not a member of that guild.`) - - gGuild = this.client.guilds.cache.get(gGuild) - - const invites = await gGuild.fetchInvites() - console.debug('This guild\'s invites:', invites) - if (invites.size > 0) { - msg.author.send(invites.first().url) - } - - // TODO: fix this one day, no idea how to. error: cant find permissionsfor on the channel thing - // for (const channel of gGuild.channels.cache.values()) { - // if (channel.permissionsFor(gGuild.me).has('CREATE_INSTANT_INVITE')) { - // msg.reply(await channel.createInvite({ maxAge: 0 }).url) - // } - // } - - //msg.reply('No existing invites or channels to invite you to. ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/bot/invite.ts b/src/commands/bot/invite.ts deleted file mode 100644 index c6fee83..0000000 --- a/src/commands/bot/invite.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class InviteBot extends Command { - constructor(client) { - super(client, { - name: 'invite', - aliases: ['inv'], - group: 'bot', - memberName: 'invite', - description: 'Gives you uwufier\'s invite link.', - examples: ['uwu!invite', 'uwu!inv'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription('To invite the bot, please use [this link](https://kyzer.co/discord/bots/uwufier/). ' + emoji.random()) - msg.say(emb) - } -}; diff --git a/src/commands/bot/ip.ts b/src/commands/bot/ip.ts deleted file mode 100644 index c565cec..0000000 --- a/src/commands/bot/ip.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; -import request from 'node-superfetch' - -module.exports = class IPBot extends Command { - constructor(client) { - super(client, { - name: 'ip', - group: 'bot', - memberName: 'ip', - description: 'Gives you uwufier\'s ip.', - examples: ['uwu!ip'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - ownerOnly: true - }); - } - async run(msg: CommandoMessage) { - let { body } = await request - .get('https://api.ipify.org') - .query({ format: 'json' }) - - msg.say('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`uwufier\'s current IP address is **${body.ip}**. ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.say(emb); - }); - } -};
\ No newline at end of file diff --git a/src/commands/bot/joinmessage.ts b/src/commands/bot/joinmessage.ts deleted file mode 100644 index 4de424f..0000000 --- a/src/commands/bot/joinmessage.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class InviteBot extends Command { - constructor(client) { - super(client, { - name: 'joinmessage', - aliases: ['joinm', 'mjoin', 'joinmsg'], - group: 'bot', - memberName: 'joinmessage', - description: 'Resends the message which the bot sent when initially joining a server, however, this one does NOT get sent to the guild owner.', - examples: [ - 'uwu!joinmessage', - 'uwu!joinm', - 'uwu!mjoin', - 'uwu!joinmsg' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let embed = new MessageEmbed() - .setDescription(`Hi! Thank you for inviting uwufier to your server! To view the complete list of commands, do \`uwu!help\`. If you want to contact the lead developer for possible suggestions or to report a bug, please join the [support server](https://discord.com/invite/DVwXUwx). You can also do \`uwu!suggest<thing>\`. If you like the bot, please support the bot on our [top.gg page](https://top.gg/bot/699473263998271489/vote) or our [DBL page](https://discordbotlist.com/bots/699473263998271489/upvote)! ${emoji.random()}`) - msg.say(embed) - } -};
\ No newline at end of file diff --git a/src/commands/bot/leaveserver.ts b/src/commands/bot/leaveserver.ts deleted file mode 100644 index 8b7fee9..0000000 --- a/src/commands/bot/leaveserver.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { Message } from 'discord.js'; -//@ts-ignore -import * as emoji from 'emoji-random'; - -module.exports = class LeaveServerBot extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'leaveserver', - aliases: [ - 'leave-server' - ], - group: 'bot', - memberName: 'leaveserver', - description: 'Leaves a specified server uwufier is in.', - examples: ['uwu!leaveserver'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - ownerOnly: true, - guarded: true, - hidden: true, - args: [ - { - key: 'serverId', - prompt: 'Which server would you like to leave? (ID)', - type: 'string', - } - ] - }); - } - async run(msg: CommandoMessage, { serverId }: any): Promise<Message | Message[]> { - await this.client.guilds.cache.get(serverId)?.leave(); - return msg.reply(`Succesfully left server **${this.client.guilds.cache.get(serverId)?.name} (${this.client.guilds.cache.get(serverId)?.id})**. ${emoji.random()}`); - } -};
\ No newline at end of file diff --git a/src/commands/bot/memorystats.ts b/src/commands/bot/memorystats.ts deleted file mode 100644 index cc2a424..0000000 --- a/src/commands/bot/memorystats.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class MemoryStatsBot extends Command { - constructor(client) { - super(client, { - name: 'memorystats', - aliases: [ - 'memstats', - 'mem-stats', - 'memory-stats', - 'memorystats', - 'memstat', - 'mem-stat', - 'memory-stat', - 'memorystat' - ], - group: 'bot', - memberName: 'memorystats', - description: 'Checks the full, current, approximate memory usage statistics of uwufier\'s Node.js process.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - ownerOnly: true - }); - } - run(msg: CommandoMessage) { - const used = process.memoryUsage(); - msg.reply(`The full, current, approximate memory usage statistics are currentaly; -\`\`\`js -rss: ${Math.round(used.rss / 1024 / 1024 * 100) / 100} MBs -heapTotal: ${Math.round(used.heapTotal / 1024 / 1024 * 100) / 100} MBs -heapUsed: ${Math.round(used.heapUsed / 1024 / 1024 * 100) / 100} MBs -external: ${Math.round(used.external / 1024 / 1024 * 100) / 100} MBs -\`\`\``) - } -};
\ No newline at end of file diff --git a/src/commands/bot/memoryusage.ts b/src/commands/bot/memoryusage.ts deleted file mode 100644 index e5ed33b..0000000 --- a/src/commands/bot/memoryusage.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class MemoryUsageBot extends Command { - constructor(client) { - super(client, { - name: 'memoryusage', - aliases: [ - 'memusage', - 'mem-usage', - 'memory-usage', - 'mem', - 'memory' - ], - group: 'bot', - memberName: 'memoryusage', - description: 'Checks the current, approximate memory usage of uwufier\'s Node.js process.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - ownerOnly: true - }); - } - run(msg: CommandoMessage) { - const used = process.memoryUsage().heapUsed / 1024 / 1024; - msg.reply(`The current, approximate memory usage is currently **${Math.round(used * 100) / 100}** MBs. ${emoji.random()}`) - } -}; diff --git a/src/commands/bot/npm.ts b/src/commands/bot/npm.ts deleted file mode 100644 index 06b9f43..0000000 --- a/src/commands/bot/npm.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class NPMBot extends Command { - constructor(client) { - super(client, { - name: 'npm', - group: 'bot', - memberName: 'npm', - description: 'Gives you a link to uwufier\'s authors\' (Sin) NPM profile.', - examples: ['uwu!npm'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Here is <@217348698294714370>'s [NPM profile](https://www.npmjs.com/~sinny). ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/owner.ts b/src/commands/bot/owner.ts deleted file mode 100644 index ac3ba93..0000000 --- a/src/commands/bot/owner.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class OwnerBot extends Command { - constructor(client) { - super(client, { - name: 'owner', - group: 'bot', - memberName: 'owner', - description: 'Self explanatory.', - examples: ['uwu!owner'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`<@217348698294714370> is the owner/ maintainer of this bot. ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/servercount.ts b/src/commands/bot/servercount.ts deleted file mode 100644 index 31f6482..0000000 --- a/src/commands/bot/servercount.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import emoji from 'emoji-random'; - -module.exports = class ServerCountBot extends Command { - constructor(client) { - super(client, { - name: 'servercount', - aliases: ['sc', 'scount', 'serverc'], - group: 'bot', - memberName: 'servercount', - description: 'Tells you the amount of servers uwufier is in.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - ownerOnly: true - }); - } - run(msg: CommandoMessage) { - msg.say('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`Currently running on ${this.client.guilds.cache.size} server(s). ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.say(emb); - }); - } -};
\ No newline at end of file diff --git a/src/commands/bot/status.ts b/src/commands/bot/status.ts deleted file mode 100644 index dbb5080..0000000 --- a/src/commands/bot/status.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Command } from 'discord.js-commando'; -import emoji from 'emoji-random' -import config from '../../config.json' - -module.exports = class StatusBot extends Command { - constructor(client) { - super(client, { - name: 'status', - aliases: ['botstatus', 'bot-status'], - group: 'bot', - memberName: 'status', - description: 'Allows you to change uwufier\'s status.', - args: [ - { - key: 'uType', - prompt: 'Would you like to change the status type or status message?', - type: 'string', - default: '' - }, - { - key: 'uActivity', - prompt: 'What would you like to set the status message to?', - type: 'string', - default: '' - } - ], - examples: [ - 'uwu!botstatus type watching', - 'uwu!status t w', - 'uwu!status message youtube', - 'uwu!bs m lol' - ], - ownerOnly: true, - guarded: true - }); - } - async run(msg, { uType, uActivity }) { - let bType = this.client.user?.presence.activities[0].type; - let bActivity = this.client.user?.presence.activities[0].name; - - function uActivityCheck() { - if (uActivity == 'playing' || uActivity == 'p') { - return true - } else if (uActivity == 'streaming' || uActivity == 's') { - return true - } else if (uActivity == 'listening' || uActivity == 'l') { - return true - } else if (uActivity == 'watching' || uActivity == 'w') { - return true - } else { - return false - } - } - - if (uType == 'type' || uType == 't') { - if (uActivity == 'reset' || uActivity == 'r') { - this.client.user?.setActivity(this.client.user.presence.activities[0].name, { - type: 'WATCHING' - }); - } else { - if (uActivityCheck()) { - this.client.user?.setActivity(this.client.user.presence.activities[0].name, { - type: uActivity - }); - // TODO: fix this not settings the type - } else { - return msg.reply(`That is not a valid status type. ${emoji.random()}`) - } - } - } else if (uType == 'message' || uType == 'msg' || uType == 'm') { - if (uActivity == 'reset' || uActivity == 'r') { - this.client.user?.setActivity('uwu!help | v' + config['version'], { - type: bType - }); - } else { - this.client.user?.setActivity(uActivity, { - type: bType - }); - } - } else if (uType == 'reset' || uType == 'r') { - this.client.user?.setActivity('uwu!help | v' + config['version'], { - type: 'WATCHING' - }); - } else { - if (bType == 'WATCHING') { - var bTypeSoften = 'Watching' - } else if (bType == 'STREAMING') { - var bTypeSoften = 'Watching' - } else if (bType == 'PLAYING') { - var bTypeSoften = 'Playing' - } else if (bType == 'LISTENING') { - var bTypeSoften = 'Listening' - } else { - var bTypeSoften = 'Unresolved' - } - return msg.reply(`My current status is \`${bTypeSoften} ${bActivity}\`. ${emoji.random()}`) - } - } -};
\ No newline at end of file diff --git a/src/commands/bot/suggest.ts b/src/commands/bot/suggest.ts deleted file mode 100644 index a610a68..0000000 --- a/src/commands/bot/suggest.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class SuggestBot extends Command { - constructor(client) { - super(client, { - name: 'suggest', - group: 'bot', - memberName: 'suggest', - description: 'Allows you to suggest an addition or change!', - examples: ['uwu!suggest add more cool commands'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Thank you for your suggestion! ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/support.ts b/src/commands/bot/support.ts deleted file mode 100644 index 9475295..0000000 --- a/src/commands/bot/support.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class SupportBot extends Command { - constructor(client) { - super(client, { - name: 'support', - group: 'bot', - memberName: 'support', - description: 'Gives you uwufier\'s support server link.', - examples: ['uwu!support'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`For support, please join [this Discord server](https://discord.com/invite/DVwXUwx). ${emoji.random()}`) - msg.say(emb) - } -}; diff --git a/src/commands/bot/test.ts b/src/commands/bot/test.ts deleted file mode 100644 index 8140c6e..0000000 --- a/src/commands/bot/test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class TestBot extends Command { - constructor(client) { - super(client, { - name: 'test', - group: 'bot', - memberName: 'test', - description: 'Do not test in production!', - examples: ['uwu!test'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - run(msg: CommandoMessage) { - msg.reply(`Do not test in production! ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/bot/twitch.ts b/src/commands/bot/twitch.ts deleted file mode 100644 index eb935c1..0000000 --- a/src/commands/bot/twitch.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class TwitchBot extends Command { - constructor(client) { - super(client, { - name: 'twitch', - aliases: ['stream', 'streaming'], - group: 'bot', - memberName: 'twitch', - description: 'Gives you a link to uwufier\'s authors\' (Sin) Twitch profile.', - examples: ['uwu!twitch'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Here is <@217348698294714370>'s [Twitch profile](https://www.twitch.tv/yosinny)! ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/twitter.ts b/src/commands/bot/twitter.ts deleted file mode 100644 index 04a8e56..0000000 --- a/src/commands/bot/twitter.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class TwitterBot extends Command { - constructor(client) { - super(client, { - name: 'twitter', - group: 'bot', - memberName: 'twitter', - description: 'Gives you a link to uwufier\'s authors\' (Sin) Twitter profile.', - examples: ['uwu!twitter'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Here is <@217348698294714370>'s [Twitter profile](https://twitter.com/9inny). ${emoji.random()}`) - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/uptime.ts b/src/commands/bot/uptime.ts deleted file mode 100644 index 768d43a..0000000 --- a/src/commands/bot/uptime.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { duration as _duration } from 'moment'; -import 'moment-duration-format'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -export default class UptimeBot extends Command { - constructor(client) { - super(client, { - name: 'uptime', - aliases: ['ut'], - group: 'bot', - memberName: 'uptime', - description: 'Tells you how long uwufier has been online.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!uptime', - 'uwu!ut' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - const duration = _duration(this.client.uptime).format(" D [days], H [hrs], m [mins], s [secs]"); - msg.say('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription('<@699473263998271489> has been up for ' + duration + '. ' + emoji.random()) - .setColor(0xFFCC4D) - - msg.say(emb); - }); - } -}
\ No newline at end of file diff --git a/src/commands/bot/version.ts b/src/commands/bot/version.ts deleted file mode 100644 index 564fd2f..0000000 --- a/src/commands/bot/version.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; -import config from '../../config.json'; - -export default class VersionBot extends Command { - constructor(client) { - super(client, { - name: 'version', - group: 'bot', - memberName: 'version', - description: 'Tells you uwufier\'s current build version.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!version' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.say('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`uwufier\'s current build version is **v${config['version']}**. ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.say(emb); - }); - } -}
\ No newline at end of file diff --git a/src/commands/bot/vote.ts b/src/commands/bot/vote.ts deleted file mode 100644 index 61ac999..0000000 --- a/src/commands/bot/vote.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class VoteBot extends Command { - constructor(client) { - super(client, { - name: 'vote', - group: 'bot', - memberName: 'vote', - description: 'Gives you uwufier\'s top.gg vote link.', - examples: ['uwu!vote'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription('To vote, please use [this link](https://discordbots.org/bot/699473263998271489/vote). 🗳') - msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/bot/website.ts b/src/commands/bot/website.ts deleted file mode 100644 index afc1ef3..0000000 --- a/src/commands/bot/website.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class WebsiteBot extends Command { - constructor(client) { - super(client, { - name: 'website', - aliases: ['site'], - group: 'bot', - memberName: 'website', - description: 'Gives you a link to uwufier\'s authors\' (Sin) website.', - examples: ['uwu!website'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Here is <@217348698294714370>'s [website](https://kyzer.co/)! ${emoji.random()}`) - msg.say(emb) - } -}; diff --git a/src/commands/bot/youtube.ts b/src/commands/bot/youtube.ts deleted file mode 100644 index c0c5289..0000000 --- a/src/commands/bot/youtube.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class YouTubeBot extends Command { - constructor(client) { - super(client, { - name: 'youtube', - aliases: ['yt'], - group: 'bot', - memberName: 'youtube', - description: 'Gives you a link to uwufier\'s authors\' (Sin) YouTube profile.', - examples: ['uwu!youtube'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setDescription(`Here is <@217348698294714370>'s [YouTube profile](https://youtube.com/s1nny). Not the command you were looking for? If you were trying to play YouTube audio via the bot, please do \`uwu!play\` instead. ${emoji.random()}`) - msg.say(emb) - } -}; diff --git a/src/commands/crypto/btc.ts b/src/commands/crypto/btc.ts deleted file mode 100644 index 88cbf5a..0000000 --- a/src/commands/crypto/btc.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; -import btc from 'btc-value'; -btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f'); - -module.exports = class BTCCrypto extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'btc', - aliases: ['bitcoin', 'crypto'], - group: 'crypto', - memberName: 'btc', - description: 'Allows you to check the current Bitcoin price.', - args: [ - { - key: 'currencyName', - prompt: 'What currency could you like to see it in? (USD, AUD, CAD, etc.)', - type: 'string', - default: 'USD' - } - ], - examples: [ - 'uwu!bitcoin aud', - 'uwu!crypto cad', - 'uwu!btc usd' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { currencyName }: any) { - currencyName = currencyName.toUpperCase(); - return btc({ isDecimal: true, currencyCode: currencyName }).then(value => { - return msg.reply(`The current price of *Bitcoin* is **${value} ${currencyName}**. ${emoji.random()}`); - }); - } -};
\ No newline at end of file diff --git a/src/commands/crypto/btcchange.ts b/src/commands/crypto/btcchange.ts deleted file mode 100644 index 002a2cb..0000000 --- a/src/commands/crypto/btcchange.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import btc from 'btc-value'; -//@ts-ignore no types -import emoji from 'emoji-random'; -btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f'); - -module.exports = class BTCChangeCrypto extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'btcchange', - aliases: ['bitcoinchange', 'cryptochange', 'btcc'], - group: 'crypto', - memberName: 'btcchange', - description: 'Allows you to check the fluctuation in Bitcoin prices within a specified amount of time.', - args: [ - { - key: 'timeAmount', - prompt: 'What time range do you want to check the fluction amount in? (day, hour, week)', - type: 'string', - default: 'USD' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!btcchange day', - 'uwu!bitcoinchange hour', - 'uwu!cryptochange week', - 'uwu!btcc day' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { timeAmount }: any) { - if (timeAmount == 'day') { - return btc.getPercentageChangeLastDay().then(percentage => { - return msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); - }); - } else if (timeAmount == 'hour') { - return btc.getPercentageChangeLastHour().then(percentage => { - return msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); - }); - } else if (timeAmount == 'week') { - return btc.getPercentageChangeLastWeek().then(percentage => { - return msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random()); - }); - } else { - return msg.reply('*' + timeAmount + '* is not a valid range. ' + emoji.random()); - } - } -};
\ No newline at end of file diff --git a/src/commands/crypto/securitykey.ts b/src/commands/crypto/securitykey.ts deleted file mode 100644 index a1852e7..0000000 --- a/src/commands/crypto/securitykey.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import crypto from 'crypto' - -module.exports = class RateCrypto extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'securitykey', - aliases: ['security-key'], - group: 'crypto', - memberName: 'securitykey', - description: 'Generates a security key.', - examples: ['uwu!securitykey'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.reply(`Check your DMs! ${emoji.random()}`) - return msg.author.send(crypto.randomBytes(15).toString('hex') + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/emma/art.ts b/src/commands/emma/art.ts deleted file mode 100644 index ee8c451..0000000 --- a/src/commands/emma/art.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; -import FanArt from '../../models/FanArt'; -import mongo from 'mongoose'; -import config from '../../config.json'; -mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -module.exports = class ArtEmma extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'art', - aliases: ['artwork'], - group: 'emma', - memberName: 'art', - description: 'Allows you to submit artwork to Emma\'s artwork channel.', - args: [ - { - key: 'type', - prompt: 'What type of interaction would you like to do?', - type: 'string', - default: 'submit' - }, - { - key: 'comment', - prompt: 'Would you like to leave a comment?', - type: "string", - default: '' - } - ], - examples: [ - 'uwu!art submit <attached file>', - 'uwu!art set', - 'uwu!art remove' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - //@ts-ignore not assignable bc async - run(msg: CommandoMessage, { type, comment }: any) { - const fanart = new FanArt({ - _id: mongo.Types.ObjectId(), - username: msg.author.username, - userID: msg.author.id, - guildname: msg.guild.name, - guildID: msg.guild.id, - channelname: msg.channel, - channelID: msg.channel.id, - time: msg.createdAt - }) - //let fanartServer = this.client.guilds.cache.get('663964105983393793'); - //@ts-ignore - if (msg.guild.id.toString() != '663964105983393793') return msg.reply(`You are not submitting from **Kat\'s Korner**! ${emoji.random()}`); - if (type == 'submit') { - FanArt.findOne({ guildID: msg.guild.id}, async (error, guild) => { - if (error) return console.log(error); - //@ts-ignore - let fanartServer = this.client.guilds.cache.get(guild.guildID); - //@ts-ignore - let fanartChannel = guild.channelID; - if (msg.attachments.size) { - msg.attachments.forEach(fanart => { - if (fanart.url) { - //@ts-ignore - return fanartServer?.channels.cache.get(fanartChannel)?.send(`**New fanart submitted!**\nFanart by <@${msg.author.id}>.\n\n**Comment**\n${comment ? comment : 'None'}\n\n**Video** ` + fanart.url).then(m => { - msg.delete(); - m.react('😍'); - m.react('😂'); - m.react('😁'); - m.react('😳'); - m.react('😱'); - }) - - /* let emb = new MessageEmbed() - .setDescription(`Fanart by <@${msg.author.id}>.`) - .setTitle('New fanart submitted!') - .setURL(fanart.url) - .addField('Comment', `ok`, true) - .setFooter('Do you want to submit and image or video? Do uwu!help art') - - fanartServer?.channels.cache.get('704032357640044556')?.send(emb); */ - } else - return msg.reply(`No attachment was submitted! If you need help, please do \`uwu!art help\`. ${emoji.random()}`); - } - ); - } else { - return msg.reply(`No attachment was submitted! If you need help, please do \`uwu!art help\`. ${emoji.random()}`); - } - }) - } if (type == 'help') { - // msg.guild.channels.cache.get("fanart")?.fetch().then(bool => console.log('get' + bool)) - // msg.guild.channels.cache.find(c => c.name == 'fanart')?.fetch().then(bool => console.log(bool + 'ok')) - /* msg.guild.channels.cache.find(c => c.name === 'fanart', (bool) => { - if (!bool) { - console.log('ok') - msg.guild.channels.create('fanart', { - type: 'text', - reason: 'Initialize fanart channel. This is an automated action by the Uwufier bot.', - nsfw: false - }) - console.log('made channel') - } else { - console.log('exists') - } - }) */ - let emb = new MessageEmbed() - .setTitle('Fanart - Help ' + emoji.random()) - .setColor(0xFFCC4D) - .setDescription(`How to submit fanart:`) - //@ts-ignore - .setThumbnail(msg.guild.iconURL()) - .addFields([ - { - name: '#1', - value: 'Go to the `#media` channel.' - }, - { - name: '#2', - value: 'Click on the add media button in the bottom left corner of your screen and select a video or image.' - }, - { - name: '#3', - value: 'In the message section, please put `uwu!art submit`.' - }, - { - name: '#4 (Optional)', - value: 'If you would like, you can also put a comment on your fanart, you can do this by adding an extra string to the end of your submit command. e.g. `uwu!art submit this is where the comment goes!`, if you followed the steps correctly, your comment should be `this is where the comment goes!` ' + emoji.random() - }, - { - name: 'Admin Stuff', - value: 'If you are an admin or moderator who would like to set/ remove a fanart channel, you can do this by going to to the channel you would like to set as the new fanart channel and doing `uwu!art set`, this will set the current channel as the fanart channel. To remove a fanart channel, just do `uwu!art remove`.' - }, - { - name: 'More Admin Info', - value: 'You can only have **ONE** fanart channel (I think, I haven\'t tested it lol. If you change the name of the fanart channel, you will have to re-register with the bot by simply removing and re-setting the fanart channel.' - } - ]) - - return msg.say(emb); - } else if (type == 'set') { - if (!msg.member.hasPermission('MANAGE_GUILD')) return msg.reply(`Insufficient permission! ${emoji.random()}`); - - FanArt.findOne({ guildID: msg.guild.id }, async (error, guild) => { - if (error) return console.log(error); - - if (guild) { - //@ts-ignore this exists - return msg.reply(`There already is a welcome channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild) { - await fanart.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - - return msg.reply(`The welcome channel has been set to ${msg.channel}! ${emoji.random()}`).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } - }) - } else if (type == 'remove') { - if (!msg.member.hasPermission('MANAGE_GUILD')) return msg.reply(`Insufficient permission! ${emoji.random()}`); - - FanArt.findOne({ guildID: msg.guild.id }, async (error, guild) => { - if (error) return console.log(error); - - if (guild) { - await FanArt.findOneAndDelete({ guildID: msg.guild.id }); - return msg.say(`The current fanart channel has been unset! ${emoji.random()}`).then(mnotif => { - //@ts-ignore - mnotif.delete({ timeout: 2000 }); - //@ts-ignore - msg.delete({ timeout: 2000 }); - }) - } else if (!guild) { - return msg.reply(`There is no current fanart channel set for this guild! ${emoji.random()}`).then(m => { - //@ts-ignore - m.delete({ timeout: 2000 }) - //@ts-ignore - msg.delete({ timeout: 2000 }) - }) - } - }) - } - - /* else { - return msg.reply(`That is not a valid operation! ${emoji.random()}`); - } */ - } -};
\ No newline at end of file diff --git a/src/commands/emma/verify.ts b/src/commands/emma/verify.ts deleted file mode 100644 index 6f4584a..0000000 --- a/src/commands/emma/verify.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; -import Verify from '../../models/Verify'; -import mongo from 'mongoose'; -import config from '../../config.json'; -mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -module.exports = class VerifyEmma extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'verify', - group: 'emma', - memberName: 'verify', - description: 'Lists all the roles on the current server.', - examples: ['uwu!verify set', 'uwu!verify remove'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - guildOnly: true, - args: [ - { - key: 'code', - prompt: 'What is the verification code?', - type: 'string' - } - ] - }); - } - //@ts-ignore this ok - async run(msg: CommandoMessage, { code }: any) { - if (msg.guild.id == '704032355987488791') return msg.reply(`You are not submitting from **Kat\'s Korner**! ${emoji.random()}`); - Verify.findOne({ userID: msg.author.id }, async (error, member) => { - if (error) return console.error(error) - //@ts-ignore this exists - if (msg.author.id == member.userID) { - //@ts-ignore this in-fact - if (code == member.key) { - await Verify.findOneAndDelete({ userID: msg.author.id }); - const unverRole = '729928740359897101'; - return msg.guild.member(msg.author.id)?.roles.remove(unverRole); - } else { - //@ts-ignore this exists - return msg.author.send(`That is not the correct key! Please try again with the correct key: \`${member.key}\`. ${emoji.random()}`); - } - } else { - return msg.author.send(`You are already verified! ${emoji.random()}`) - } - }) - } -};
\ No newline at end of file diff --git a/src/commands/fun/8ball.ts b/src/commands/fun/8ball.ts deleted file mode 100644 index 989e036..0000000 --- a/src/commands/fun/8ball.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import emoji from 'emoji-random' - -module.exports = class EightBallFun extends Command { - constructor(client) { - super(client, { - name: '8ball', - aliases: [ - '8b', - '9b', - '9ball', - '7b', - '7ball' - ], - group: 'fun', - memberName: '8ball', - description: 'Shake the 8ball for a fortune.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!8ball', 'uwu!8b 002'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'bType', - prompt: 'What type of 8ball would you like?', - type: 'string', - default: '' - } - ] - }); - } - run(msg: CommandoMessage, { bType }) { - if (bType == 'darling' || bType == '002' || bType == 'zero two' || bType == 'zero-two') { - var r = [ - 'Maybe, darling.', - 'Certainly not, darling.', - 'I hope so, darling.', - 'Not in our wildest dreams, darling.', - 'There is a good chance, darling.', - 'Quite likely, darling.', - 'I think so, darling.', - 'I hope not, darling.', - 'I hope so, darling.', - 'Never!', - 'Ahaha! Really?!? XD', - 'Hell, yes.', - 'Hell to the no.', - 'The future is bleak, darling', - 'The future is uncertain, darling', - 'I would rather not say, darling', - 'Who cares?', - 'Possibly, darling', - 'Never, ever, ever... ever.', - 'There is a small chance, darling.', - 'Yes, darling!' - ] - } else if (bType) { - msg.reply('Arguments? Try `uwu!8ball 002`. ' + emoji.random()) - var r = ['yes~ uwu', 'no.', 'yes!', 'no!', 'what, no.', 'yes.', 'maybe.', 'perhaps.', 'try again.', 'I\'m not sure.']; - } else { - var r = ['yes~ uwu', 'no.', 'yes!', 'no!', 'what, no.', 'yes.', 'maybe.', 'perhaps.', 'try again.', 'I\'m not sure.']; - } - - var s = r[Math.floor(Math.random() * r.length)]; - let embed = new MessageEmbed() - - .setAuthor('The 8-ball says', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') - .setDescription('`' + s + '`'); - - msg.say(embed); - } -};
\ No newline at end of file diff --git a/src/commands/fun/advice.ts b/src/commands/fun/advice.ts deleted file mode 100644 index 49e011c..0000000 --- a/src/commands/fun/advice.ts +++ /dev/null @@ -1,27 +0,0 @@ -import axios from 'axios' -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class AdviceFun extends Command { - constructor(client) { - super(client, { - name: 'advice', - group: 'fun', - memberName: 'advice', - description: 'Gives you a random piece of advice.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!advice' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - let res = await axios.get('http://api.adviceslip.com/advice') - msg.reply(res.data.slip.advice + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/fun/aesthetic.ts b/src/commands/fun/aesthetic.ts deleted file mode 100644 index a565d84..0000000 --- a/src/commands/fun/aesthetic.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import ct from 'culturedtext'; -import emoji from 'emoji-random'; - -module.exports = class AestheticFun extends Command { - constructor(client) { - super(client, { - name: 'aesthetic', - aliases: ['aestheticifize'], - group: 'fun', - memberName: 'aesthetic', - description: 'Aestheticifies anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to aestheticifie?', - type: 'string' - } - ], - examples: [ - 'uwu!aesthetic please aestheticifie this' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage, { userMsg }) { - var m = userMsg; - var u1 = ct.aethstetic(m); - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/clapify.ts b/src/commands/fun/clapify.ts deleted file mode 100644 index f05c768..0000000 --- a/src/commands/fun/clapify.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class ClapFun extends Command { - constructor(client) { - super(client, { - name: 'clapify', - aliases: ['clap', 'clappify'], - group: 'fun', - memberName: 'clapify', - description: 'Allows you to clapify anything.', - args: [ - { - key: 'say', - prompt: 'What would you like to clapify?', - type: 'string' - } - ], - examples: ['uwu!clapify please clap this lol'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { say }) { - msg.say(say.split(' ').join('👏')) - msg.delete() - } -};
\ No newline at end of file diff --git a/src/commands/fun/coinflip.ts b/src/commands/fun/coinflip.ts deleted file mode 100644 index f491d93..0000000 --- a/src/commands/fun/coinflip.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class CoinFlipFun extends Command { - constructor(client) { - super(client, { - name: 'coinflip', - aliases: ['flipcoin'], - group: 'fun', - memberName: 'coinflip', - description: 'Flip a coin.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!coinflip', 'uwu!flipcoin'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var r = ['heads!', 'tails!']; - var s = r[Math.floor(Math.random() * r.length)]; - let embed = new MessageEmbed() - - .setAuthor('The coin landed on', 'https://i.imgur.com/pr7JCce.png') - .setDescription('`' + s + '`'); - - msg.say(embed); - } -};
\ No newline at end of file diff --git a/src/commands/fun/culturedtext.ts b/src/commands/fun/culturedtext.ts deleted file mode 100644 index 48b3fb8..0000000 --- a/src/commands/fun/culturedtext.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import ct from 'culturedtext'; -import emoji from 'emoji-random'; - -module.exports = class CulturedTextFun extends Command { - constructor(client) { - super(client, { - name: 'culturedtext', - aliases: ['ct'], - group: 'fun', - memberName: 'culturedtext', - description: 'Cultured textifys anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to cultured textifys?', - type: 'string' - }, - { - key: 'ctType', - prompt: 'What type of cultured textification would you like to do? (oddcase, aesthetic, surreal or stretch)', - type: 'string' - } - - ], - examples: [ - 'uwu!culturedtext oddcase please cultured textify this' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage, { userMsg, ctType }) { - var m = userMsg; - if (ctType == "oddcase" || ctType == 'o') { - var u1 = ct.oddcase(m + ' ' + emoji.random()); - } else if (ctType == 'aesthetic' || ctType == 'a') { - var u1 = ct.aethstetic(m + ' ' + emoji.random()); - } else if (ctType == 'surreal') { - var u1 = ct.surreal(m + ' ' + emoji.random()); - } else if (ctType == 'stretch') { - var u1 = ct.stretched(m + ' ' + emoji.random()); - } else { - msg.reply('That is not at option, please sellect a valid option.') - } - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/datefact.ts b/src/commands/fun/datefact.ts deleted file mode 100644 index 378aa52..0000000 --- a/src/commands/fun/datefact.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import axios from 'axios' -import emoji from 'emoji-random' - -module.exports = class DateFactFun extends Command { - constructor(client) { - super(client, { - name: 'datefact', - aliases: [ - 'date-fact', - 'datefacts', - 'date-facts' - ], - group: 'fun', - memberName: 'datefact', - description: 'Grabs facts about a specified date.', - args: [ - { - key: 'day', - prompt: 'What day would you like to get facts for?', - type: 'integer', - max: 31, - min: 1, - default: 'random' - }, - { - key: 'month', - prompt: 'What month would you like to get facts for?', - type: 'integer', - max: 12, - min: 1, - default: 'random' - } - ], - examples: ['uwu!datefact', 'uwu!datefact 12'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage, { day, month }) { - const uri = `http://numbersapi.com/${month === 'random' || day === 'random' ? 'random' : `${month}/${day}`}/date` - const fact = await axios.get(uri).catch(err => { - console.log(err) - msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) - }) - msg.reply(fact.data) - } -};
\ No newline at end of file diff --git a/src/commands/fun/dayfact.ts b/src/commands/fun/dayfact.ts deleted file mode 100644 index f30b828..0000000 --- a/src/commands/fun/dayfact.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import axios from 'axios' -import emoji from 'emoji-random' - -module.exports = class DayFactFun extends Command { - constructor(client) { - super(client, { - name: 'dayfact', - aliases: [ - 'day-fact', - 'dayfacts', - 'day-facts' - ], - group: 'fun', - memberName: 'dayfact', - description: 'Grabs facts about a specified day.', - args: [ - { - key: 'day', - prompt: 'What day would you like to get facts for?', - type: 'integer', - max: 31, - min: 1, - default: 'random' - } - ], - examples: ['uwu!dayfact', 'uwu!dayfact 12'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage, { day }) { - const fact = await axios.get(`http://numbersapi.com/${day}/date`).catch(err => { - console.log(err) - msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) - }) - msg.reply(fact.data) - } -};
\ No newline at end of file diff --git a/src/commands/fun/dicksize.ts b/src/commands/fun/dicksize.ts deleted file mode 100644 index 13986f1..0000000 --- a/src/commands/fun/dicksize.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class DickSizeFun extends Command { - constructor(client) { - super(client, { - name: 'dicksize', - aliases: [ - 'peepeesize', - 'ppsize' - ], - group: 'fun', - memberName: 'dicksize', - description: 'Tells you your dick size.', - examples: [ - 'uwu!dicksize', - 'uwu!peepeesize', - 'uwu!ppsize' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - let size = msg.author.id.slice(-3) % 20 + 1 - - msg.reply('Scanning..').then(scanningMsg => { - // @ts-ignore - scanningMsg.delete() - msg.reply('Your dick size is **' + size + '** inches. ' + emoji.random()); - }); - } -}; */
\ No newline at end of file diff --git a/src/commands/fun/dogeify.ts b/src/commands/fun/dogeify.ts deleted file mode 100644 index a5af4a2..0000000 --- a/src/commands/fun/dogeify.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import doge from 'dogeify-js'; -import emoji from 'emoji-random'; - -module.exports = class DogeifyFun extends Command { - constructor(client) { - super(client, { - name: 'dogeify', - aliases: ['doge'], - group: 'fun', - memberName: 'dogeify', - description: 'Dogifys anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to dogeify?', - type: 'string' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!dogeify please dogify this', - 'uwu!doge can u do this as well' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - async run(msg: CommandoMessage, { userMsg }) { - var m = userMsg; - var u1 = await doge(m); - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/drawcards.ts b/src/commands/fun/drawcards.ts deleted file mode 100644 index 5d53b72..0000000 --- a/src/commands/fun/drawcards.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { shuffle } from '../../utils/Util.js' -const suits = ['♣', '♥', '♦', '♠'] -const faces = ['Jack', 'Queen', 'King'] - -module.exports = class DrawCardsFun extends Command { - constructor(client) { - super(client, { - name: 'drawcards', - aliases: [ - 'draw-cards', - 'drawhand', - 'draw-hand' - ], - group: 'fun', - memberName: 'drawcards', - description: 'Draw a hand of playing cards.', - examples: ['uwu!drawcards 5'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'aAmount', - label: 'hand size', - prompt: 'How many cards would you like to draw?', - type: 'integer', - max: 10, - min: 1 - }, - { - key: 'aJokers', - prompt: 'Do you want to include jokers in the draw?', - type: 'boolean', - default: false - } - ], - }); - this.deck = null - } - run(msg: CommandoMessage, { aAmount, aJokers }) { - if (!this.deck) this.deck = this.generateDeck() - let cards = this.deck - if (!aJokers) cards = cards.filter(card => !card.includes('Joker')) - return msg.reply(`${aAmount === 1 ? '' : '\n'}${shuffle(cards).slice(0, aAmount).join('\n')}`) - } - generateDeck() { - const deck = [] - for (const suit of suits) { - deck.push(`${suit} Ace`) - for (let i = 2; i <= 10; i++) deck.push(`${suit} ${i}`) - for (const face of faces) deck.push(`${suit} ${face}`) - } - deck.push('⭐ Joker') - deck.push('⭐ Joker') - return deck - } -};
\ No newline at end of file diff --git a/src/commands/fun/embed.ts b/src/commands/fun/embed.ts deleted file mode 100644 index fb59845..0000000 --- a/src/commands/fun/embed.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class EmbedFun extends Command { - constructor(client) { - super(client, { - name: 'embed', - group: 'fun', - memberName: 'embed', - description: 'Allows you to speak as the bot, except with embeds.', - args: [ - { - key: 'say', - prompt: 'What would you like to embed?', - type: 'string' - } - ], - examples: ['uwu!embed hi'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { say }) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setDescription(say) - msg.say(emb) - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/emoji.ts b/src/commands/fun/emoji.ts deleted file mode 100644 index f830387..0000000 --- a/src/commands/fun/emoji.ts +++ /dev/null @@ -1,24 +0,0 @@ -import emoji from 'emoji-random'; -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class EmojiFun extends Command { - constructor(client) { - super(client, { - name: 'emoji', - aliases: ['moji'], - group: 'fun', - memberName: 'emoji', - description: 'Gives you a random emoji. ' + emoji.random(), - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!emoji', 'uwu!moji'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.reply(emoji.random()); - } -};
\ No newline at end of file diff --git a/src/commands/fun/fml.ts b/src/commands/fun/fml.ts deleted file mode 100644 index a3fa600..0000000 --- a/src/commands/fun/fml.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import request from 'node-superfetch' -import emoji from 'emoji-random' -import cheerio from 'cheerio' - -module.exports = class FMLFun extends Command { - constructor(client) { - super(client, { - name: 'fml', - aliases: [ - 'fuckmylife', - 'fuck-my-life' - ], - group: 'fun', - memberName: 'fml', - description: 'Gives you a random FML.', - examples: ['uwu!fml'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - async run(msg: CommandoMessage) { - try { - const { text } = await request.get('http://www.fmylife.com/random') - const $ = cheerio.load(text, { normalizeWhitespace: true }) - const fml = $('a.article-link').first().text().trim() - return msg.reply(fml + ' ' + emoji.random()) - } catch (err) { - return msg.reply(`Woops, an error has occured: \`${err.message}\`. Try again later! ${emoji.random()}`) - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/gay.ts b/src/commands/fun/gay.ts deleted file mode 100644 index a70dfc3..0000000 --- a/src/commands/fun/gay.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class GayFun extends Command { - constructor(client) { - super(client, { - name: 'gay', - aliases: [ - 'gayamount', - 'gayrange', - 'gayrate' - ], - group: 'fun', - memberName: 'gay', - description: 'Tells you your level of homosexuality amount. Because we\'re all queens here.🏳️🌈 ', - examples: [ - 'uwu!gay', - 'uwu!gayamount', - 'uwu!gayrange', - 'uwu!gayrate' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var gayAmount = Math.floor((Math.random() * 100) + 1); - var gayAmountDecimal = Math.floor((Math.random() * 100) + 1); - - msg.reply('Scanning..').then(scanningMsg => { - // @ts-ignore - scanningMsg.delete() - msg.reply('Your gay-ness amount is **' + gayAmount + '.' + gayAmountDecimal + '%**. 🏳️🌈'); - }); - } -}; */
\ No newline at end of file diff --git a/src/commands/fun/githubzen.ts b/src/commands/fun/githubzen.ts deleted file mode 100644 index cc2f0a2..0000000 --- a/src/commands/fun/githubzen.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import request from 'node-superfetch' -import emoji from 'emoji-random' -import cheerio from 'cheerio' - -module.exports = class GitHubZenFun extends Command { - constructor(client) { - super(client, { - name: 'githubzen', - aliases: [ - 'github-zen', - 'ghzen', - 'gh-zen' - ], - group: 'fun', - memberName: 'githubzen', - description: 'Gives you a random GitHub design philosophy.', - examples: ['uwu!githubzen'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - async run(msg: CommandoMessage) { - try { - const { text } = await request.get('https://api.github.com/zen') - return msg.reply(text + ' ' + emoji.random()) - } catch (err) { - return msg.reply(`Woops, an error has occured: \`${err.message}\`. Try again later! ${emoji.random()}`) - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/hello.ts b/src/commands/fun/hello.ts deleted file mode 100644 index e555a30..0000000 --- a/src/commands/fun/hello.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class HelloFun extends Command { - constructor(client) { - super(client, { - name: 'hello', - aliases: ['hey', 'hi'], - group: 'fun', - memberName: 'hello', - description: 'Say hello to uwufier!', - examples: ['uwu!hello', 'uwu!hey', 'uwu!hi'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - msg.reply('Hi! ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/fun/howify.ts b/src/commands/fun/howify.ts deleted file mode 100644 index c1337f9..0000000 --- a/src/commands/fun/howify.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import how from 'howifier'; -import emoji from 'emoji-random'; - -module.exports = class HowifyFun extends Command { - constructor(client) { - super(client, { - name: 'howify', - aliases: ['how'], - group: 'fun', - memberName: 'howify', - description: 'Howifies any image you send.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'EMBED_LINKS'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'EMBED_LINKS'], - examples: ['uwu!howify', 'uwu!how'], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - run(msg: CommandoMessage) { - if (msg.attachments.size) { - // fs.unlinkSync('../../../node_modules/howifier/images/blissgay.jpeg') - msg.attachments.forEach(async attachment => { - var u1 = await how(attachment.url); - msg.delete() - msg.reply('Please wait...').then(m => m.delete({ timeout: 2000 })) - setTimeout(() => { - msg.say({ files: [u1] }) - }, 2000); - }); - } else { - msg.reply('No image detected. ' + emoji.random()) - } - - } -};
\ No newline at end of file diff --git a/src/commands/fun/insult.ts b/src/commands/fun/insult.ts deleted file mode 100644 index 47643e7..0000000 --- a/src/commands/fun/insult.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import insult from 'insult'; -import emoji from 'emoji-random'; - -module.exports = class InsultFun extends Command { - constructor(client) { - super(client, { - name: 'insult', - aliases: ['insults', 'roast', 'roasts'], - group: 'fun', - memberName: 'insult', - description: 'Gives you a random insult.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!insult', 'uwu!insults'] - }); - } - run(msg: CommandoMessage) { - msg.reply(insult.Insult() + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/fun/iq.ts b/src/commands/fun/iq.ts deleted file mode 100644 index 2185878..0000000 --- a/src/commands/fun/iq.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MersenneTwister19937, integer } from 'random-js' - -module.exports = class IQFun extends Command { - constructor(client) { - super(client, { - name: 'iq', - group: 'fun', - memberName: 'iq', - description: 'Tells you your IQ.', - examples: ['uwu!iq'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'uUser', - prompt: 'Which user\'s IQ would you like to guess?', - type: 'user', - default: '' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }) { - let random = MersenneTwister19937.seed(uUser.id) - let iq = integer(20, 270)(random) - if (!uUser) { - msg.reply('Scanning..').then(scanningMsg => { - // @ts-ignore - scanningMsg.delete() - msg.reply(`Your IQ score is **${iq}**. ${emoji.random()}`); - }); - } else { - if (uUser.id === this.client.user.id) { - msg.reply('Me? My IQ is too high for you to even comprehend. ' + emoji.random()) - } else { - msg.reply(`${uUser.username}'s IQ score is **${iq}**. ${emoji.random()}`) - } - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/kissmarrykill.ts b/src/commands/fun/kissmarrykill.ts deleted file mode 100644 index 1a7622d..0000000 --- a/src/commands/fun/kissmarrykill.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { shuffle } from '../../utils/Util.js' -import emoji from 'emoji-random' - -module.exports = class KissMarryKillFun extends Command { - constructor(client) { - super(client, { - name: 'kissmarrykill', - aliases: [ - 'kisskillmarry', - 'kiss-kill-marry', - 'killkissmarry', - 'kill-kiss-marry', - 'killmarrykiss', - 'kill-marry-kiss', - 'marrykisskill', - 'marry-kiss-kill', - 'marrykillkiss', - 'marry-kill-kiss', - 'fuck-marry-kill', - 'fuckmarrykill', - 'fuck-kill-marry', - 'fuckkillmarry', - 'kill-fuck-marry', - 'killfuckmarry', - 'kill-marry-fuck', - 'killmarryfuck', - 'marry-fuck-kill', - 'marryfuckkill', - 'marry-kill-fuck', - 'marrykillfuck', - 'kiss-mary-kill' - ], - group: 'fun', - memberName: 'kissmarrykill', - description: 'Kiss Marry Kill.', - examples: ['uwu!kissmarrykill'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'first', - label: 'first name', - prompt: 'Who is the first person you choose?', - type: 'string', - max: 500 - }, - { - key: 'second', - label: 'second name', - prompt: 'Who is the second person you choose?', - type: 'string', - max: 500 - }, - { - key: 'third', - label: 'third name', - prompt: 'Who is the third person you choose?', - type: 'string', - max: 500 - } - ] - }); - } - async run(msg: CommandoMessage, { first, second, third }) { - const kissFuck = msg.channel.nsfw ? 'fuck' : 'kiss'; - const things = shuffle([first, second, third]); - return msg.say(`I'd ${kissFuck} ${things[0]}, marry ${things[1]}, and kill ${things[2]}. ${emoji.random()}`); - } -};
\ No newline at end of file diff --git a/src/commands/fun/lorem.ts b/src/commands/fun/lorem.ts deleted file mode 100644 index 3189375..0000000 --- a/src/commands/fun/lorem.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import lm from 'lorem-memesum'; -import emoji from 'emoji-random'; - -module.exports = class LoremFun extends Command { - constructor(client) { - super(client, { - name: 'lorem', - aliases: ['lorem-impsum', 'loremipsum', 'ipsum', 'lorem-memesum', 'loremmemesum', 'memesum'], - group: 'fun', - memberName: 'lorem', - description: 'Gives you a random memeified Lorem Ipsum.', - examples: [ - 'uwu!lorem', - 'uwu!lorem-ipsum', - 'uwu!loremipsum', - 'uwu!ipsum', - 'uwu!lorem-memesum', - 'uwu!loremmemesum', - 'uwu!memesum' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage) { - msg.reply(lm.sentence.randomSentence() + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/modplz.ts b/src/commands/fun/modplz.ts deleted file mode 100644 index 14f9955..0000000 --- a/src/commands/fun/modplz.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class ModPlzFun extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'modplz', - group: 'fun', - memberName: 'modplz', - description: 'Send this when someone talking about mods.', - examples: [ - 'uwu!modplz' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - msg.delete() - let emb = new MessageEmbed() - .setColor(0xFFD0DF) - .setImage('https://discordapp.com/channels/663964105983393793/664659637039005696/730279064132255794') - return msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/fun/motivate.ts b/src/commands/fun/motivate.ts deleted file mode 100644 index 3dcd7f6..0000000 --- a/src/commands/fun/motivate.ts +++ /dev/null @@ -1,29 +0,0 @@ -import mq from 'motivations'; -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class MotivateFun extends Command { - constructor(client) { - super(client, { - name: 'motivate', - aliases: ['motivateme', 'motivation'], - group: 'fun', - memberName: 'motivate', - description: 'Gives you a random motivating quote from Star Wars.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!motivate', - 'uwu!motivateme' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var quoteNum = Math.floor((Math.random() * 62) + 1); - msg.reply(mq[quoteNum] + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/fun/numberfact.ts b/src/commands/fun/numberfact.ts deleted file mode 100644 index 9e7b698..0000000 --- a/src/commands/fun/numberfact.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import axios from 'axios' -import emoji from 'emoji-random' - -module.exports = class NumberFactFun extends Command { - constructor(client) { - super(client, { - name: 'numberfact', - aliases: [ - 'number-fact', - 'numberfacts', - 'number-facts', - 'numfact', - 'num-fact', - 'numfacts', - 'num-facts' - ], - group: 'fun', - memberName: 'numberfact', - description: 'Grabs facts about a specified number.', - args: [ - { - key: 'nNum', - prompt: 'What number would you like to get facts for?', - type: 'integer', - max: 31, - min: 1, - default: 'random' - } - ], - examples: ['uwu!numberfact', 'uwu!numberfact 12'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage, { nNum }) { - const fact = await axios.get(`http://numbersapi.com/${nNum}`).catch(err => { - console.log(err) - msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) - }) - msg.reply(fact.data) - } -};
\ No newline at end of file diff --git a/src/commands/fun/oddcase.ts b/src/commands/fun/oddcase.ts deleted file mode 100644 index 890773d..0000000 --- a/src/commands/fun/oddcase.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import ct from 'culturedtext'; -import emoji from 'emoji-random'; - -module.exports = class OddcaseFun extends Command { - constructor(client) { - super(client, { - name: 'oddcase', - group: 'fun', - memberName: 'oddcase', - description: 'Oddcases anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to oddcase?', - type: 'string' - } - ], - examples: [ - 'uwu!oddcase please oddcase this' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage, { userMsg }) { - var m = userMsg; - var u1 = ct.oddcase(m); - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/offspring.ts b/src/commands/fun/offspring.ts deleted file mode 100644 index e603f76..0000000 --- a/src/commands/fun/offspring.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random' -const genders = ['boy', 'girl'] - -module.exports = class OffspringFun extends Command { - constructor(client) { - super(client, { - name: 'offspring', - aliases: ['gender'], - group: 'fun', - memberName: 'offspring', - description: 'Determines your future child\'s gender.', - examples: ['uwu!offspring'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage) { - msg.reply(`It\'s a ${genders[Math.floor(Math.random() * genders.length)]}! ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/fun/onion.ts b/src/commands/fun/onion.ts deleted file mode 100644 index 341b461..0000000 --- a/src/commands/fun/onion.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random' -import { stripIndents } from 'common-tags' -import RSS from 'rss-parser' - -module.exports = class OnionFun extends Command { - constructor(client) { - super(client, { - name: 'onion', - aliases: ['theonion', 'the-onion'], - group: 'fun', - memberName: 'onion', - description: 'Reples with a random Onion article.', - examples: ['uwu!onion'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - async run(msg: CommandoMessage) { - const parser = new RSS() - try { - const feed = await parser.parseURL('https://www.theonion.com/rss') - const article = feed.items[Math.floor(Math.random() * feed.items?.length)] - return msg.reply(stripIndents` - ${article.title} - ${article.link} - `) - } catch (err) { - return msg.reply(`Woops, an error has occurred: \`${err.message}\`. Try again later! ${emoji.random()}`); - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/opinion.ts b/src/commands/fun/opinion.ts deleted file mode 100644 index 353846f..0000000 --- a/src/commands/fun/opinion.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random' -import { stripIndents } from 'common-tags' -const opinions = ['👍', '👎'] - -module.exports = class OpinionFun extends Command { - constructor(client) { - super(client, { - name: 'opinion', - group: 'fun', - memberName: 'opinion', - description: 'Determines uwufier\'s opinion of a specified thing.', - examples: ['uwu!opinion'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'qQuestion', - prompt: 'What do you want to get an opinion on?', - type: 'string', - max: 1950 - } - ] - }); - } - run(msg: CommandoMessage, { qQuestion }) { - msg.reply(stripIndents` - ${qQuestion} - ${opinions[Math.floor(Math.random() * opinions.length)]} - `) - } -};
\ No newline at end of file diff --git a/src/commands/fun/quantumcoinflip.ts b/src/commands/fun/quantumcoinflip.ts deleted file mode 100644 index 3f2446d..0000000 --- a/src/commands/fun/quantumcoinflip.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -const sides = [NaN, 0, null, undefined, '']; - -module.exports = class QuantumCoinFlipFun extends Command { - constructor(client) { - super(client, { - name: 'quantumcoinflip', - aliases: ['quantumflipcoin'], - group: 'fun', - memberName: 'quantumcoinflip', - description: 'Flip a quantum coin.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!coinflip', 'uwu!flipcoin'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var s = sides[Math.floor(Math.random() * sides.length)] - let embed = new MessageEmbed() - - .setAuthor('The quantum coin landed on', 'https://i.imgur.com/pr7JCce.png') - .setDescription('`' + s + '`'); - - msg.say(embed); - } -};
\ No newline at end of file diff --git a/src/commands/fun/quote.ts b/src/commands/fun/quote.ts deleted file mode 100644 index e090574..0000000 --- a/src/commands/fun/quote.ts +++ /dev/null @@ -1,80 +0,0 @@ -// Quote Packages -import mq from 'popular-movie-quotes'; -import hsq from 'harvey-specter-quotes' -import aq from 'animequote' -import cq from 'chewbacca-quotes' -import asq from 'arnie-quote' -import ztq from 'zero-two-quotes' - -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class QuoteFun extends Command { - constructor(client) { - super(client, { - name: 'quote', - aliases: ['quotes'], - group: 'fun', - memberName: 'quote', - description: 'Either gives you a random quote or a quote from a specified category.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!quote', - 'uwu!qutoes', - 'uwu!quote movie', - 'uwu!quotes harvey specter' - ], - args: [ - { - key: 'atCharacter', - prompt: 'Would you like a specific type?\nTypes: movie, harvey specter, anime, chewbacca, arnold schwarzenegger or zero two.', - type: 'string' - } - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { atCharacter }) { - if (atCharacter == 'random' || atCharacter == 'no') { - var quoteNum = Math.floor((Math.random() * 6) + 1); - switch (quoteNum) { - case 1: - msg.reply(mq.getRandomQuote() + ' ' + emoji.random()); - break - case 2: - msg.reply(hsq.random() + ' ' + emoji.random()); - break - case 3: - msg.reply(aq().quotesentence + ' ' + emoji.random()); - break - case 4: - msg.reply(cq() + ' ' + emoji.random()) - break - case 5: - msg.reply(asq() + ' ' + emoji.random()) - break - case 6: - msg.reply(ztq() + ' ' + emoji.random()) - break - } - } else if (atCharacter == 'movie' || atCharacter == 'movies') { - msg.reply(mq.getRandomQuote() + ' ' + emoji.random()); - } else if (atCharacter == 'harvey specter' || atCharacter == 'harvey') { - msg.reply(hsq.random() + ' ' + emoji.random()); - } else if (atCharacter == 'anime' || atCharacter == 'animes') { - msg.reply(aq().quotesentence + ' ' + emoji.random()); - } else if (atCharacter == 'chewbacca') { - msg.reply(cq() + ' ' + emoji.random()) - } else if (atCharacter == 'arnold schwarzenegger' || atCharacter == 'arnold' || atCharacter == 'schwarzenegger') { - msg.reply(asq() + ' ' + emoji.random()) - } else if (atCharacter == 'zero two' || atCharacter == 'ditf' || atCharacter == '002' || atCharacter == 'darling in the franxx') { - msg.reply(ztq() + ' ' + emoji.random()) - } else { - msg.reply('That was not at option. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/randomfacts.ts b/src/commands/fun/randomfacts.ts deleted file mode 100644 index 5d9777e..0000000 --- a/src/commands/fun/randomfacts.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import request from 'node-superfetch' -import emoji from 'emoji-random' - -module.exports = class RandomFactFun extends Command { - constructor(client) { - super(client, { - name: 'randomfact', - aliases: [ - 'random-fact', - 'fact', - 'facts' - ], - group: 'fun', - memberName: 'randomfact', - description: 'Gives you a random fact.', - examples: ['uwu!randomfact'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - async run(msg: CommandoMessage) { - try { - const article = await this.randomWikipediaArticle() - const { body } = await request - .get('https://en.wikipedia.org/w/api.php') - .query({ - action: 'query', - prop: 'extracts', - format: 'json', - titles: article, - exintro: '', - explaintext: '', - redirects: '', - formatversion: 2 - }) - let fact = body.query.pages[0].extract; - if (fact.length > 200) { - const facts = fact.split('.'); - fact = `${facts[0]}.`; - if (fact.length < 200 && facts.length > 1) fact += `${facts[1]}.`; - } - return msg.reply(fact + ' ' + emoji.random()); - } catch (err) { - return msg.reply(`Woops, an error has occured: \`${err.message}\`. Try again later! ${emoji.random()}`) - } - } - async randomWikipediaArticle() { - const { body } = await request - .get('https://en.wikipedia.org/w/api.php') - .query({ - action: 'query', - list: 'random', - rnnamespace: 0, - rnlimit: 1, - format: 'json', - formatversion: 2 - }); - if (!body.query.random[0].title) return 'Facts are hard to find sometimes.'; - return body.query.random[0].title; - } -};
\ No newline at end of file diff --git a/src/commands/fun/rate.ts b/src/commands/fun/rate.ts deleted file mode 100644 index 0dfc505..0000000 --- a/src/commands/fun/rate.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random' - -module.exports = class RateFun extends Command { - constructor(client) { - super(client, { - name: 'rate', - group: 'fun', - memberName: 'rate', - description: 'Rate something.', - examples: ['uwu!rate deez nuts'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'tThing', - prompt: 'What would you like to rate?', - type: 'string', - max: 1950 - } - ] - }); - } - run(msg: CommandoMessage, { tThing }) { - msg.reply(`I'd give ${tThing} a ${Math.floor(Math.random() * 10) + 1}/10! ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/fun/respect.ts b/src/commands/fun/respect.ts deleted file mode 100644 index 362773a..0000000 --- a/src/commands/fun/respect.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class RespectFun extends Command { - constructor(client) { - super(client, { - name: 'respect', - aliases: ['f'], - group: 'fun', - memberName: 'respect', - description: 'Press F to pay respects.', - examples: ['uwu!respect', 'uwu!f'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.say('Press F to pay respects.').then(m => { - m.react('🇫'); - msg.delete(); - }); - } -};
\ No newline at end of file diff --git a/src/commands/fun/roastwilly.ts b/src/commands/fun/roastwilly.ts deleted file mode 100644 index 24503cd..0000000 --- a/src/commands/fun/roastwilly.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import insult from 'insult'; -import emoji from 'emoji-random'; - -module.exports = class RoastWillyFun extends Command { - constructor(client) { - super(client, { - name: 'roastwilly', - aliases: ['insultwilly'], - group: 'fun', - memberName: 'roastwilly', - description: 'Gives you a random insult directed towards willy.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!insultwilly', 'uwu!roastwilly'], - args: [ - { - key: 'type', - prompt: 'None', - type: 'string', - default: '' - } - ] - }); - } - run(msg: CommandoMessage, { type }: any) { - const willysRoasts = ['you smell like weenie water', 'you are dead built like a german sausage', 'you are that one flavour of ice cream no one eats']; - const roastCustomBool = Math.floor(Math.random() * 3); - if (type == 'custom' || type == 'c') { - const customRoastNum = Math.floor(Math.random() * willysRoasts.length); - msg.reply(`${willysRoasts[customRoastNum]} <@${msg.guild.member('608481389444333583')?.id}> ${emoji.random()}`) - } else { - if (roastCustomBool == 1) { - const customRoastNum = Math.floor(Math.random() * willysRoasts.length); - msg.reply(`${willysRoasts[customRoastNum]} <@${msg.guild.member('608481389444333583')?.id}> ${emoji.random()}`) - } else { - msg.reply(`${insult.Insult()} <@${msg.guild.member('608481389444333583')?.id}> ${emoji.random()}`) - } - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/roastwillyc.ts b/src/commands/fun/roastwillyc.ts deleted file mode 100644 index 2bb4ee2..0000000 --- a/src/commands/fun/roastwillyc.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import insult from 'insult'; -import emoji from 'emoji-random'; - -module.exports = class RoastWillyCustomFun extends Command { - constructor(client) { - super(client, { - name: 'roastwillyc', - aliases: ['insultwillyc'], - group: 'fun', - memberName: 'roastwillyc', - description: 'Gives you a random custom insult directed towards willy.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!insultwillyc', 'uwu!roastwillyc'], - args: [ - { - key: 'type', - prompt: 'None', - type: 'string', - default: '' - } - ] - }); - } - run(msg: CommandoMessage, { type }: any) { - const willysRoasts = ['you smell like weenie water', 'you are dead built like a german sausage', 'you are that one flavour of ice cream no one eats']; - const roastCustomBool = Math.floor(Math.random() * 3); - const customRoastNum = Math.floor(Math.random() * willysRoasts.length); - msg.reply(`${willysRoasts[customRoastNum]} <@${msg.guild.member('608481389444333583')?.id}> ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/fun/rockpaperscissors.ts b/src/commands/fun/rockpaperscissors.ts deleted file mode 100644 index 422481f..0000000 --- a/src/commands/fun/rockpaperscissors.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class RockPaperScissorsFun extends Command { - constructor(client) { - super(client, { - name: 'rockpaperscissors', - aliases: ['rps'], - group: 'fun', - memberName: 'rockpaperscissors', - description: '**[Disabled]** Play Rock, Paper Scissors.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!rockpaperscissors', 'uwu!rps'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - // TODO: fix this - msg.reply('Command disabled.') - - // const rock = '💎' - // const paper = '🧻' - // const scissors = '✂️' - - // let embed = new MessageEmbed() - // .setAuthor(msg.author.tag, msg.author.displayAvatarURL()) - // .setDescription('What would you like to choose?') - // .setColor(0xFFCC4D) - // .setTimestamp() - - // const m = await msg.channel.send(embed) - - // const react1 = await m.react(rock) - // const react2 = await m.react(paper) - // const react3 = await m.react(scissors) - - // const chooseArr = [rock, paper, scissors] - - // const randChoice = await chooseArr[Math.floor(Math.random() * chooseArr.length)] - - // let collector = await m.createReactionCollector((reacted, user) => user.id === msg.author.id) - - // collector.on('collect', async (reaction, user) => { - // let winEmb = new MessageEmbed() - // .setAuthor(msg.author.tag, msg.author.displayAvatarURL()) - // .setDescription('You won!') - // .addField('Results:', `${reaction.emoji} vs ${randChoice}`) - // .setColor('GREEN') - // .setTimestamp() - - // let tieEmb = new MessageEmbed() - // .setAuthor(msg.author.tag, msg.author.displayAvatarURL()) - // .setDescription('You tied!') - // .addField('Results:', `${reaction.emoji} vs ${randChoice}`) - // .setColor(0xFFCC4D) - // .setTimestamp() - - // let lostEmb = new MessageEmbed() - // .setAuthor(msg.author.tag, msg.author.displayAvatarURL()) - // .setDescription('You lost!') - // .addField('Results:', `${reaction.emoji} vs ${randChoice}`) - // .setColor('RED') - // .setTimestamp() - // if ((reaction.emoji === rock && randChoice === scissors) || (reaction.emoji === paper && randChoice === rock) || (reaction.emoji === scissors && randChoice === paper)) { - // m.delete() - // msg.channel.send(winEmb) - // } else if (reaction.emoji === randChoice) { - // m.delete() - // msg.channel.send(tieEmb) - // } else { - // m.delete() - // msg.channel.send(lostEmb) - // } - // }) - } -};
\ No newline at end of file diff --git a/src/commands/fun/rolldie.ts b/src/commands/fun/rolldie.ts deleted file mode 100644 index 6426238..0000000 --- a/src/commands/fun/rolldie.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class RollDieFun extends Command { - constructor(client) { - super(client, { - name: 'rolldie', - aliases: ['dice'], - group: 'fun', - memberName: 'rolldie', - description: 'Role a die.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!roledie', 'uwu!dice'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var r = [1, 2, 3, 4, 5, 6]; - var s = r[Math.floor(Math.random() * r.length)]; - let embed = new MessageEmbed() - - .setAuthor('The die landed on', 'https://i.imgur.com/dK18NpV.png') - .setDescription('`' + s + '`'); - - msg.say(embed); - } -};
\ No newline at end of file diff --git a/src/commands/fun/russianroulette.ts b/src/commands/fun/russianroulette.ts deleted file mode 100644 index ba67118..0000000 --- a/src/commands/fun/russianroulette.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class RussianRouletteFun extends Command { - constructor(client) { - super(client, { - name: 'russianroulette', - aliases: ['rr'], - group: 'fun', - memberName: 'russianroulette', - description: 'Play a game of Russian Roulette.', - throttling: { - usages: 5, - duration: 30 - }, - examples: ['uwu!russianroulette', 'uwu!rr'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var s = Math.floor(Math.random() * 6) - if (s === 0) { - return msg.reply('💥 *Bang.* You lose.') - } else { - return msg.reply("🔫 *Click.* You survived."); - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/say.ts b/src/commands/fun/say.ts deleted file mode 100644 index 7a610b4..0000000 --- a/src/commands/fun/say.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import * as emoji from 'emoji-random' -import * as config from '../../config.json' - -module.exports = class SayFun extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'say', - group: 'fun', - memberName: 'say', - description: 'Allows you to speak as the bot.', - args: [ - { - key: 'say', - prompt: 'What would you like to send?', - type: 'string' - } - ], - examples: ['uwu!say hi'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - //@ts-ignore - run(msg: CommandoMessage, { say }: any) { - if (config['validUsers'].includes(msg.author.id)) { - if (msg.author.id == '217348698294714370' || msg.guild.member(msg.author.id)?.hasPermission('MANAGE_MESSAGES')) { - msg.say(say) - msg.delete(); - return - } else { - //@ts-ignore - return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) - } - } else { - msg.delete() - //@ts-ignore - return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/showerthought.ts b/src/commands/fun/showerthought.ts deleted file mode 100644 index ba7e86a..0000000 --- a/src/commands/fun/showerthought.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import SubredditCommand from '../../models/commands/Subreddit.js' - -module.exports = class ShowerThoughtFun extends SubredditCommand { - constructor(client) { - super(client, { - name: 'showerthought', - aliases: [ - 'shower-thought', - 'showerthoughts', - 'shower-thoughts' - ], - group: 'fun', - memberName: 'showerthought', - description: 'Gives you a shower thought from **r/Showerthought**.', - examples: ['uwu!showerthought'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - subreddit: 'Showerthoughts' - }); - } - generateText(post) { - return post.title; - } -};
\ No newline at end of file diff --git a/src/commands/fun/smashorpass.ts b/src/commands/fun/smashorpass.ts deleted file mode 100644 index c6aecbc..0000000 --- a/src/commands/fun/smashorpass.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MersenneTwister19937, bool } from 'random-js' - -module.exports = class SmashOrPassFun extends Command { - constructor(client) { - super(client, { - name: 'smashorpass', - aliases: [ - 'smash-or-pass', - 'sop', - 's-o-p' - ], - group: 'fun', - memberName: 'smashorpass', - description: 'Smash or pass.', - examples: ['uwu!sop'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'uUser', - prompt: 'Which user\'s would you like me to check?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }) { - let random = MersenneTwister19937.seed(uUser.id) - let smashOrPass = bool()(random) - if (uUser.id === this.client.user?.id) { - msg.reply(`Obviously smash, Google me. ${emoji.random()}`) - } else { - msg.reply(smashOrPass ? 'Smash, I\'d definetly smash. ' : 'Hard pass. Yuck. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/fun/spoiler.ts b/src/commands/fun/spoiler.ts deleted file mode 100644 index ff1093c..0000000 --- a/src/commands/fun/spoiler.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class SpoilerFun extends Command { - constructor(client) { - super(client, { - name: 'spoiler', - aliases: ['spoil', 'spoilertext', 'spoiler-text', 'spoiltext', 'spoil-text'], - group: 'fun', - memberName: 'spoiler', - description: 'Turn every character in a specified phrase as a ||s||||p||||o||||i||||l||||e||||r||.', - args: [ - { - key: 'say', - prompt: 'What would you like to spoil?', - type: 'string' - } - ], - examples: ['uwu!spoiler hi lol'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage, { say }) { - msg.delete(); - msg.say(say.replace(/./g, '||$&||')) - } -}; diff --git a/src/commands/fun/spongebob.ts b/src/commands/fun/spongebob.ts deleted file mode 100644 index d8010a6..0000000 --- a/src/commands/fun/spongebob.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import sbm from 'spongibobu.js'; -import emoji from 'emoji-random'; - -module.exports = class SpongebobFun extends Command { - constructor(client) { - super(client, { - name: 'spongebob', - aliases: ['spongibobu', 'sbm'], - group: 'fun', - memberName: 'spongebob', - description: 'Spongebob memifys anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to spongebob memify?', - type: 'string' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!spongebob please spongebob memify this', - 'uwu!spongibobu sponge gang', - 'uwu!sbm oooh example' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage, { userMsg }) { - var m = userMsg; - var u1 = sbm(m); - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/stretch.ts b/src/commands/fun/stretch.ts deleted file mode 100644 index 4bb8d00..0000000 --- a/src/commands/fun/stretch.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import ct from 'culturedtext'; -import emoji from 'emoji-random'; - -module.exports = class StretchFun extends Command { - constructor(client) { - super(client, { - name: 'stretch', - aliases: ['stretched'], - group: 'fun', - memberName: 'stretch', - description: 'Stretches anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to stretch?', - type: 'string' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!stretch please stretch this' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage, { userMsg }) { - var m = userMsg; - var u1 = ct.stretched(m); - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/subreddit.ts b/src/commands/fun/subreddit.ts deleted file mode 100644 index a9369d2..0000000 --- a/src/commands/fun/subreddit.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import SubredditCommandBase from '../../models/commands/Subreddit.js' -import { shorten, formatNumber } from '../../utils/Util.js' -import { MessageEmbed } from 'discord.js'; - -module.exports = class SubredditFun extends SubredditCommandBase { - constructor(client) { - super(client, { - name: 'subreddit', - aliases: ['r/', 'sub', 'reddit'], - patterns: [/^r\/(.+)/i], - group: 'fun', - memberName: 'subreddit', - description: 'Replies with a random post from a specified subreddit.', - args: [ - { - key: 'sSub', - prompt: 'Which subreddit would you like to get a post from?', - type: 'string', - parse: subreddit => encodeURIComponent(subreddit) - } - ], - examples: ['uwu!say hi'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - generateText(post, subreddit, icon) { - const embed = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor(`r/${subreddit}`, icon, `https://www.reddit.com/r/${subreddit}/`) - .setTitle(shorten(post.title, 256)) - .setImage(post.post_hint === 'image' ? post.url : null) - .setURL(`https://www.reddit.com${post.permalink}`) - .setTimestamp(post.created_utc * 1000) - .setFooter(`⬆ ${formatNumber(post.score)}`); - if (post.thumbnail && post.thumbnail !== 'self' && post.post_hint !== 'image') { - embed.setThumbnail(post.thumbnail); - } - return embed; - } -};
\ No newline at end of file diff --git a/src/commands/fun/surreal.ts b/src/commands/fun/surreal.ts deleted file mode 100644 index 024874a..0000000 --- a/src/commands/fun/surreal.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import ct from 'culturedtext'; -import emoji from 'emoji-random'; - -module.exports = class SurrealFun extends Command { - constructor(client) { - super(client, { - name: 'surreal', - group: 'fun', - memberName: 'surreal', - description: 'Surrealifies anything you send.', - args: [ - { - key: 'userMsg', - prompt: 'What would you like to surrealify?', - type: 'string' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!surreal please surrealify this' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage, { userMsg }) { - var m = userMsg; - var u1 = ct.surreal(m); - msg.reply(u1 + ' ' + emoji.random()); - msg.delete(); - } -};
\ No newline at end of file diff --git a/src/commands/fun/uglycat.ts b/src/commands/fun/uglycat.ts deleted file mode 100644 index 343bc2d..0000000 --- a/src/commands/fun/uglycat.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; - -module.exports = class UglyCatFun extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'uglycat', - aliases: ['ugycat'], - group: 'fun', - memberName: 'uglycat', - description: 'Sends an ugly cat.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'EMBED_LINKS'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'EMBED_LINKS'], - examples: ['uwu!uglycat'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - return msg.say({ files: ['https://i.pinimg.com/originals/4d/19/0f/4d190f1307b35e7155bb4b898e19d545.jpg'] }) - } -};
\ No newline at end of file diff --git a/src/commands/fun/yearfact.ts b/src/commands/fun/yearfact.ts deleted file mode 100644 index 8448efc..0000000 --- a/src/commands/fun/yearfact.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import axios from 'axios' -import emoji from 'emoji-random' - -module.exports = class DayFactFun extends Command { - constructor(client) { - super(client, { - name: 'yearfact', - aliases: [ - 'year-fact', - 'yearfacts', - 'year-facts' - ], - group: 'fun', - memberName: 'yearfact', - description: 'Grabs facts about a specified year.', - args: [ - { - key: 'year', - prompt: 'What year would you like to get facts for?', - type: 'integer', - default: 'random' - } - ], - examples: ['uwu!yearfact', 'uwu!yearfact 2012'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage, { year }) { - const fact = await axios.get(`http://numbersapi.com/${year}/year`).catch(err => { - console.log(err) - msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) - }) - msg.reply(fact.data) - } -};
\ No newline at end of file diff --git a/src/commands/fun/yomomma.ts b/src/commands/fun/yomomma.ts deleted file mode 100644 index c0b1743..0000000 --- a/src/commands/fun/yomomma.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import axios from 'axios' -import { MessageEmbed } from 'discord.js'; -import emoji from 'emoji-random' - -module.exports = class YoMommaFun extends Command { - constructor(client) { - super(client, { - name: 'yomomma', - aliases: ['yo-momma', 'yomama', 'mum', 'mam', 'mom'], - group: 'fun', - memberName: 'yomomma', - description: 'Gives you a yo momma joke.', - examples: ['uwu!yomomma'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - async run(msg: CommandoMessage) { - try { - let text = await (await axios.get('http://api.yomomma.info/')).data.joke - msg.reply(`${text}` + ' ' + emoji.random()) - } catch (err) { - console.log(err) - msg.reply('Woops, there was an error with the (https://yomomma.info/) API. ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/minecraft/getbody.ts b/src/commands/minecraft/getbody.ts deleted file mode 100644 index 072a9d2..0000000 --- a/src/commands/minecraft/getbody.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GetBodyMinecraft extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'getbody', - aliases: [ - 'get-body', - 'getmcbody', - 'get-mc-body', - 'gmcb' - ], - group: 'minecraft', - memberName: 'getbody', - description: 'Grabs a specified player\'s body from Minecraft.', - examples: [ - 'uwu!getbody notch', - 'uwu!gmcb sin' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUsername', - prompt: 'What is the account name of the user?', - type: 'string' - } - ] - }); - } - async run(msg: CommandoMessage, { uUsername }: any) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor(uUsername, `https://minotar.net/body/${encodeURIComponent(uUsername)}`) - .setImage(`https://minotar.net/body/${encodeURIComponent(uUsername)}`) - - console.debug(`URL for ${uUsername}:`, emb.image?.url) - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/minecraft/getface.ts b/src/commands/minecraft/getface.ts deleted file mode 100644 index 7565d68..0000000 --- a/src/commands/minecraft/getface.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GetFaceMinecraft extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'getface', - aliases: [ - 'get-face', - 'getmcface', - 'get-mc-face', - 'gmcf' - ], - group: 'minecraft', - memberName: 'getface', - description: 'Grabs a specified player\'s face from Minecraft.', - examples: [ - 'uwu!getface notch', - 'uwu!gmcf sin' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUsername', - prompt: 'What is the account name of the user?', - type: 'string' - } - ] - }); - } - async run(msg: CommandoMessage, { uUsername }: any) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) - .setImage(`https://minotar.net/helm/${encodeURIComponent(uUsername)}`) - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/minecraft/gethead.ts b/src/commands/minecraft/gethead.ts deleted file mode 100644 index 4ae61e2..0000000 --- a/src/commands/minecraft/gethead.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GetHeadMinecraft extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'gethead', - aliases: [ - 'get-head', - 'getmchead', - 'get-mc-head', - 'gmch' - ], - group: 'minecraft', - memberName: 'gethead', - description: 'Grabs a specified player\'s head from Minecraft.', - examples: [ - 'uwu!gethead notch', - 'uwu!gmch sin' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUsername', - prompt: 'What is the account name of the user?', - type: 'string' - } - ] - }); - } - async run(msg: CommandoMessage, { uUsername }: any) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) - .setImage(`https://minotar.net/cube/${encodeURIComponent(uUsername)}/100.png`) - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/minecraft/getminime.ts b/src/commands/minecraft/getminime.ts deleted file mode 100644 index c06c7aa..0000000 --- a/src/commands/minecraft/getminime.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GetMiniMeMinecraft extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'getminime', - aliases: [ - 'get-mini-me', - 'getmcminime', - 'get-mc-mini-me', - 'gmcmm' - ], - group: 'minecraft', - memberName: 'getminime', - description: 'Grabs a specified player\'s skin from Minecraft.', - examples: [ - 'uwu!getminime notch', - 'uwu!gmcmm sin false' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUsername', - prompt: 'What is the account name of the user?', - type: 'string' - }, - { - key: 'uTrans', - prompt: 'Would you like the background to be transparant? (yes or no)', - type: 'string', - default: true - } - ] - }); - } - async run(msg: CommandoMessage, { uUsername, uTrans }: any) { - console.debug('Transparency value:', uTrans) - - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor(uUsername, `http://minecraftskinavatar.com/customize?id=${encodeURIComponent(uUsername)}&source=minecraft`, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) - .setFooter('[Provided by minecraftskinavatar.com](Provided by minecraftskinavatar.com)') - - if (uTrans) { - emb.setImage(`http://avatar.yourminecraftservers.com/avatar/trnsp/steve/tall/128/${encodeURIComponent(uUsername)}.png`) - } else { - emb.setImage(`http://avatar.yourminecraftservers.com/avatar/rad/steve/tall/128/${encodeURIComponent(uUsername)}.png`) - } - - console.debug(`Image URL for ${uUsername}: ${emb.image?.url}`) - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/minecraft/getskin.ts b/src/commands/minecraft/getskin.ts deleted file mode 100644 index 137e9b0..0000000 --- a/src/commands/minecraft/getskin.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GetSkinMinecraft extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'getskin', - aliases: [ - 'get-skin', - 'getmcskin', - 'get-mc-skin', - 'gmcs' - ], - group: 'minecraft', - memberName: 'getskin', - description: 'Grabs a specified player\'s skin from Minecraft.', - examples: [ - 'uwu!getskin notch', - 'uwu!gmcs sin' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUsername', - prompt: 'What is the account name of the user?', - type: 'string' - } - ] - }); - } - async run(msg: CommandoMessage, { uUsername }: any) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) - .setImage(`https://minotar.net/skin/${encodeURIComponent(uUsername)}`) - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/minecraft/minecraftserverstatus.ts b/src/commands/minecraft/minecraftserverstatus.ts deleted file mode 100644 index 706b43f..0000000 --- a/src/commands/minecraft/minecraftserverstatus.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' -//@ts-ignore no types -import emoji from 'emoji-random' - -module.exports = class MinecraftServerMinecraft extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'minecraftserverstatus', - aliases: [ - 'mcserverstatus', - 'minecraft-server-status', - 'mcss' - ], - group: 'utility', - memberName: 'minecraftserverstatus', - description: 'Grabs you the server status of a Minecraft server.', - examples: [ - 'uwu!minecraftserverstatus', - 'uwu!mcss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'ip', - prompt: 'What is the IP of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '25565', - max: 65535, - min: 1 - } - ] - }); - } - async run(msg: CommandoMessage, { ip, port }: any) { - const res = ( - await axios(`https://mcapi.us/server/status?ip=${ip}&port=${port}`).catch(err => { - console.error(err) - return msg.reply('Woops, an error has occured. ' + emoji.random()) - }) - //@ts-ignore yes this exists... - ).data - - if (res.status !== 'success') { - return msg.reply('Woops, there was an error with your request. ' + emoji.random()) - } - - let emb = new MessageEmbed() - .setTitle(ip) - .setTimestamp(res.last_updated) - .setColor(0xFFCC4D) - - if (res.online) { - emb.addField('Server Status', 'Currentaly online.', true) - emb.addField('Version', res.server.name, true) - emb.addField('Members', `${res.players.now}/${res.players.max}`, true) - emb.addField('MOTD', `\`\`\`${res.motd}\`\`\``, true) - } else if (res.last_online) { - emb.addField('Server Status', `Offline. Last seen ${new Date(res.last_online)}`, true) - } else { - emb.addField('Server Status', 'Offline. Never seen online before.', true) - } - return msg.reply(emb) - } -};
\ No newline at end of file diff --git a/src/commands/moderation/addrole.ts b/src/commands/moderation/addrole.ts deleted file mode 100644 index 015775b..0000000 --- a/src/commands/moderation/addrole.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore this has no types -import emoji from 'emoji-random' - -module.exports = class AddRoleModeration extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'addrole', - aliases: ['roleadd'], - group: 'moderation', - memberName: 'addrole', - description: '**[Disabled]** Adds a role to a specific user.', - // args: [ - // { - // key: 'userID', - // prompt: 'Who would you like to add the role to? (@someone or myself)', - // type: 'string' - // }, - // { - // key: 'roleID', - // prompt: 'What role would you like to add?', - // type: 'string' - // } - // ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - examples: [ - 'uwu!addrole @CoolRole', - 'uwu!addrole @sin#1337 @CoolRole', - 'uwu!roleadd @sin#1337', - 'uwu!roleadd @sin#1337 @CoolerRole' - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - run(msg: CommandoMessage, { userID, roleID }: any) { - return msg.reply(`Command disabled. ${emoji.random()}`) - // let role = roleID - // console.log('role:', role) - // let member = userID - // console.log('member:', member) - // if (role) { - // if (msg.guild.member(member)?.roles.cache.some(role)) { - // msg.reply(member + ' already has that role! ' + emoji.random()) - // } else { - // msg.guild.member(member)?.roles.add(role).catch(err => console.log(err)) - // msg.reply(`The role **${role}** has been added to **${userID}**.`) - // } - // } else { - // msg.reply('The role or user is either non-existant or you might\'ve mispelled it.') - // } - } -};
\ No newline at end of file diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts deleted file mode 100644 index 6bf6168..0000000 --- a/src/commands/moderation/ban.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore this has no types -import emoji from 'emoji-random' - -module.exports = class BanModeration extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'ban', - aliases: ['banuser', 'ban-user'], - group: 'moderation', - memberName: 'ban', - description: 'Ban someone.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - examples: [ - 'uwu!ban @sin#1337', - 'uwu!banuser @sin#1337', - 'uwu!ban-user @sin#1337' - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - //@ts-ignore this is not promsise based - run(msg: CommandoMessage) { - let userID = msg.mentions.members?.first() - if (!userID?.id) { - return msg.reply('No member was mentioned. ' + emoji.random()) - } else if (userID?.id == msg.author.id) { - return msg.reply('You cannot ban yourself.' + emoji.random()) - } else if (userID?.id == this.client.user?.id) { - return msg.reply('Not funny. ' + emoji.random()) - } else if (!msg.guild.member(userID.id)) { - return msg.reply('Member does not exist in server.') - } else { - msg.guild.members.ban(userID.id) - return msg.say(`**${userID}** has been banned!`).then(m => { - //@ts-ignore yes this exists - m.react('🇫'); - }) - } - } -};
\ No newline at end of file diff --git a/src/commands/moderation/clear.ts b/src/commands/moderation/clear.ts deleted file mode 100644 index c162ac4..0000000 --- a/src/commands/moderation/clear.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class ClearModeration extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'clear', - aliases: ['delete', 'del', 'c'], - group: 'moderation', - memberName: 'clear', - description: 'Clears a specified amount of messages.', - guildOnly: true, - args: [ - { - key: 'deleteAmount', - prompt: 'How many messages would you like to delete?', - type: 'integer' - } - ], - examples: [ - 'uwu!clear 23', - 'uwu!delete 75', - 'uwu!del 32', - 'uwu!c 45', - 'uwu!d 84' - ], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] - }); - } - //@ts-ignore this is not promise based - async run(msg: CommandoMessage, { deleteAmount }: any) { - if (deleteAmount >= 100) { - deleteAmount == 100; - msg.author.send(`Due to Discord API limitations, your request has been rounded down to **100**. ${emoji.random()}`) - } - if (msg.member.hasPermission('MANAGE_MESSAGES')) { - if (!deleteAmount) { - return msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => { - //@ts-ignore this exists - deleteNotificationMessage.delete({ timeout: 2000 }); - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }); - } else if (isNaN(deleteAmount)) { - return msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => { - //@ts-ignore this exists - deleteNotificationMessage.delete({ timeout: 2000 }); - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }); - } else if (deleteAmount > 100) { - return msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => { - //@ts-ignore this exists - deleteNotificationMessage.delete({ timeout: 2000 }); - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }); - } else if (deleteAmount < 1) { - return msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => { - //@ts-ignore this exists - deleteNotificationMessage.delete({ timeout: 2000 }); - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }); - } - /*else if (msg.createdTimestamp > 1209600) { - msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') - } */ - else { - var clearAmount = deleteAmount + 1; - // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. - // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 - // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 - - await msg.channel.messages.fetch({ - limit: clearAmount - }).then(messages => { // I am on v11 discord.js - // why the hell did i put this msg here lol, its 07:56 on 2020/04/27 and i woke up at 6am and i dont really know - // why i put this msg here lol, i am on v12 so that msg mustve been a while ago lol - //@ts-ignore this exists - msg.channel.bulkDelete(messages); - }); - return msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => { - //@ts-ignore this exists - deleteNotificationMessage.delete({ timeout: 2000 }); - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }); - } - } else { - return msg.reply('Insufficent permsissions. ' + emoji.random()); - } - } -};
\ No newline at end of file diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts deleted file mode 100644 index c3e57a2..0000000 --- a/src/commands/moderation/kick.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore this has no types -import emoji from 'emoji-random' - -module.exports = class KickModeration extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'kick', - aliases: ['kickuser', 'kick-user'], - group: 'moderation', - memberName: 'kick', - description: 'Kick someone.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - examples: [ - 'uwu!kick @sin#1337', - 'uwu!kickuser @sin#1337', - 'uwu!kick-user @sin#1337' - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - //@ts-ignore this aint async - run(msg: CommandoMessage) { - let userID = msg.mentions.members?.first() - if (!userID?.id) { - return msg.reply('No member was mentioned. ' + emoji.random()) - } else if (userID?.id == msg.author.id) { - return msg.reply('You cannot kick yourself.' + emoji.random()) - } else if (userID?.id == this.client.user?.id) { - return msg.reply('Not funny. ' + emoji.random()) - } else if (!msg.guild.member(userID.id)) { - return msg.reply('Member does not exist in server.') - } else { - //@ts-ignore stupid typescript error this exists - msg.guild.members.prune(userID.id) - return msg.say(`**${userID}** has been kicked!`).then(m => { - //@ts-ignore this exists - m.react('🇫'); - }) - } - } -};
\ No newline at end of file diff --git a/src/commands/moderation/nickname.ts b/src/commands/moderation/nickname.ts deleted file mode 100644 index 910f7ca..0000000 --- a/src/commands/moderation/nickname.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore this has no types -import emoji from 'emoji-random' - -module.exports = class NicknameModeration extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'nickname', - aliases: ['nick'], - group: 'moderation', - memberName: 'nickname', - description: 'Change someones nickname', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'CHANGE_NICKNAME', 'MANAGE_NICKNAMES'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'CHANGE_NICKNAME', 'MANAGE_NICKNAMES'], - examples: [ - 'uwu!nickname @sin#1337 loser', - 'uwu!nick @sin#1337 loser' - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true, - args: [ - { - key: 'user', - prompt: 'Which users nickname would you like to change?', - type: 'string' - }, - { - key: 'nick', - prompt: 'What would you like to change their nickname to?', - type: 'string' - } - ] - }); - } - //@ts-ignore this aint async - run(msg: CommandoMessage, { nick, user }: any) { - msg.delete() - if (msg.mentions.users) { - user = msg.mentions.users.first()?.id - if (nick) { - msg.guild.members.cache.get(user)?.setNickname(nick) - return msg.reply(`<@${user}>'s nickname has been changed to **${nick}**! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) - } else { - return msg.reply(`No nickname was provided! ${emoji.random()}`) - } - } else { - return msg.reply(`No valid member was mentioned! ${emoji.random()}`) - } - } -};
\ No newline at end of file diff --git a/src/commands/moderation/removerole.ts b/src/commands/moderation/removerole.ts deleted file mode 100644 index e8a950c..0000000 --- a/src/commands/moderation/removerole.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class RemoveRoleModeration extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'removerole', - aliases: ['roleremove'], - group: 'moderation', - memberName: 'removerole', - description: '**[Disabled]** Removes a role from a specific user.', - // args: [ - // { - // key: 'userID', - // prompt: 'Who would you like to remove the role from? (@someone or myself)', - // type: 'string' - // }, - // { - // key: 'roleID', - // prompt: 'What role would you like to remove?', - // type: 'string' - // } - // ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], - examples: [ - 'uwu!removerole @CoolRole', - 'uwu!removerole @sin#1337 @CoolRole', - 'uwu!roleremove @sin#1337', - 'uwu!roleremove @sin#1337 @CoolerRole' - ] - }); - } - run(msg: CommandoMessage, { userID, roleID }: any) { - return msg.reply(`Command disabled. ${emoji.random()}`) - // let role = roleID - // console.log('role:', role) - // let member = userID - // console.log('member:', member) - // if (role) { - // if (msg.guild.member(member)?.roles.cache.some(role)) { - // msg.reply(member + ' already has that role! ' + emoji.random()) - // } else { - // msg.guild.member(member)?.roles.remove(role).catch(err => console.log(err)) - // msg.reply(`The role **${role}** has been remove from **${userID}**.`) - // } - // } else { - // msg.reply('The role or user is either non-existant or you might\'ve mispelled it.') - // } - } -};
\ No newline at end of file diff --git a/src/commands/nsfw/danbooru.ts b/src/commands/nsfw/danbooru.ts deleted file mode 100644 index 065c01b..0000000 --- a/src/commands/nsfw/danbooru.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' - -export default class DanbooruNSFW extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'danbooru', - group: 'nsfw', - memberName: 'danbooru', - description: 'Danbooru.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!danbooru', - 'uwu!danbooru minecraft' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'tTags', - prompt: 'What tag(s) would you like?', - type: 'string', - default: '' - } - ], - nsfw: true - }); - } - async run(msg: CommandoMessage, { tTags }: any) { - const tags = await tTags.trim().toLowerCase() - console.log(tags) - const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - - if (tags) { - if (blacklist.includes(tags)) { - return msg.reply('Blacklisted word was used! ⛔') - } - } - - const res = await axios.get(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`) - .catch(error => console.log(error)) - - //@ts-ignore yes data exists - const randomInt = Math.floor(Math.random() * res.data.length) - - //@ts-ignore yes data exists - if (blacklist.includes(res.data[randomInt].tags)) { - return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') - } - - //@ts-ignore yes all code paths return a value - let getRating = (rating: any) => { - if (rating === 's') { - return 'Safe' - } if (rating === 'q') { - return 'Questionable' - } if (rating === 'e') { - return 'Explicit' - } if (rating === 'u') { - return 'Unrated' - } - } - - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle(`Danbooru - ${!tags ? 'Random Image' : tags}`) - //@ts-ignore yes data exists - .setDescription(`[Source](http://danbooru.donmai.us/posts/${res.data[randomInt].id})\n\nFixed bug where responses were being evaluated out of 100 instead of data length!`) - //@ts-ignore yes data exists - .setImage(res.data[randomInt].file_url) - .setTimestamp(new Date()) - //@ts-ignore yes data exists - .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL()) - return msg.say(emb); - } -}
\ No newline at end of file diff --git a/src/commands/nsfw/gelbooru.ts b/src/commands/nsfw/gelbooru.ts deleted file mode 100644 index a9890fa..0000000 --- a/src/commands/nsfw/gelbooru.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' - -export default class GelbooruNSFW extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'gelbooru', - group: 'nsfw', - memberName: 'gelbooru', - description: 'Gelbooru.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!gelbooru', - 'uwu!gelbooru minecraft' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'tTags', - prompt: 'What tag(s) would you like?', - type: 'string', - default: '' - } - ], - nsfw: true - }); - } - async run(msg: CommandoMessage, { tTags }: any) { - const tags = await tTags.trim() - const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - - if (tags) { - if (blacklist.includes(tags.toLowerCase())) { - return msg.reply('Blacklisted word was used! ⛔') - } - } - - const res = await axios.get(`https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) - .catch(error => console.log(error)) - - //@ts-ignore yes data exists - const randomInt = Math.floor(Math.random() * res.data.length) - - //@ts-ignore yes data exists - if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { - return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') - } - - - //@ts-ignore yes all code paths return a value - let getRating = (rating: any) => { - if (rating === 's') { - return 'Safe' - } if (rating === 'q') { - return 'Questionable' - } if (rating === 'e') { - return 'Explicit' - } if (rating === 'u') { - return 'Unrated' - } - } - - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle(`Gelbooru - ${!tags ? 'Random Image' : tags}`) - //@ts-ignore yes data exists - .setDescription(`[Source](https://gelbooru.com/index.php?page=post&s=view&id=${res.data[randomInt].id})\n\nFixed bug where responses were being evaluated out of 100 instead of data length!`) - //@ts-ignore yes data exists - .setImage(res.data[randomInt].file_url) - .setTimestamp(new Date()) - //@ts-ignore yes data exists - .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${getRating(res.data[randomInt].rating)}`, msg.author.avatarURL()) - return msg.say(emb); - } -}
\ No newline at end of file diff --git a/src/commands/nsfw/rule34.ts b/src/commands/nsfw/rule34.ts deleted file mode 100644 index 568b07a..0000000 --- a/src/commands/nsfw/rule34.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import axios from 'axios' - -export default class Rule34NSFW extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'rule34', - aliases: ['r34'], - group: 'nsfw', - memberName: 'rule34', - description: 'Rule34.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!rule34', - 'uwu!rule34 minecraft' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'tTags', - prompt: 'What tag(s) would you like?', - type: 'string', - default: '' - } - ], - nsfw: true - }); - } - async run(msg: CommandoMessage, { tTags }: any) { - const tags = await tTags.trim() - const blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop', 'kid', 'shit', 'turd', 'feces', 'excrement', 'excrete']; - - if (tags) { - if (blacklist.includes(tags.toLowerCase())) { - return msg.reply('Blacklisted word was used! ⛔') - } - } - - const res = await axios.get(`http://rule34.xxx/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) - .catch(error => console.log(error)) - - //@ts-ignore yes data exists - const randomInt = Math.floor(Math.random() * res.data.length) - - //@ts-ignore yes data exists - if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { - return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') - } - - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle(`Rule34 - ${!tags ? 'Random Image' : tags}`) - //@ts-ignore yes data exists - .setDescription(`[Source](https://rule34.xxx/index.php?page=post&s=view&id=${res.data[randomInt].id})\n\nFixed bug where responses were being evaluated out of 100 instead of data length!`) - //@ts-ignore yes data exists - .setImage(`https://rule34.xxx/images/${res.data[randomInt].directory}/${res.data[randomInt].image}`) - .setTimestamp(new Date()) - //@ts-ignore yes data exists - .setFooter(`Score: ${res.data[randomInt].score} | Rating: ${res.data[randomInt].rating}`, msg.author.avatarURL()) - return msg.say(emb); - } -}
\ No newline at end of file diff --git a/src/commands/roleplay/blush.ts b/src/commands/roleplay/blush.ts deleted file mode 100644 index 5abdb26..0000000 --- a/src/commands/roleplay/blush.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class BlushRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'blush', - group: 'roleplay', - memberName: 'blush', - description: 'Blush at a specified user.', - examples: ['uwu!blush @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to blush at?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** blushes at **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/celebrate.ts b/src/commands/roleplay/celebrate.ts deleted file mode 100644 index d5b012c..0000000 --- a/src/commands/roleplay/celebrate.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class CelebrateRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'celebrate', - group: 'roleplay', - memberName: 'celebrate', - description: 'Celebrate.', - examples: ['uwu!celebrate'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - run(msg: CommandoMessage) { - msg.delete(); - return msg.say(`***${msg.author.username}** celebrates.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/eat.ts b/src/commands/roleplay/eat.ts deleted file mode 100644 index 8af76d5..0000000 --- a/src/commands/roleplay/eat.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class EatRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'eat', - group: 'roleplay', - memberName: 'eat', - description: 'Eat.', - examples: ['uwu!eat'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - run(msg: CommandoMessage) { - msg.delete(); - return msg.say(`***${msg.author.username}** eats.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/fistbump.ts b/src/commands/roleplay/fistbump.ts deleted file mode 100644 index 129c89f..0000000 --- a/src/commands/roleplay/fistbump.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class FistBumpRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'fistbump', - aliases: ['fist-bump'], - group: 'roleplay', - memberName: 'fistbump', - description: 'Fist-bump a specified user.', - examples: ['uwu!fistbump @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to fist-bump?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** fist-bumps **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/highfive.ts b/src/commands/roleplay/highfive.ts deleted file mode 100644 index 28187ef..0000000 --- a/src/commands/roleplay/highfive.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class HighFiveRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'highfive', - aliases: ['high-five'], - group: 'roleplay', - memberName: 'highfive', - description: 'High-fave a specified user.', - examples: ['uwu!highfive @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to high-five?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** high-fives **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/holdhands.ts b/src/commands/roleplay/holdhands.ts deleted file mode 100644 index 88babdd..0000000 --- a/src/commands/roleplay/holdhands.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class HoldHandsRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'holdhands', - aliases: ['hold-hands', 'holdhand', 'hold-hand'], - group: 'roleplay', - memberName: 'holdhands', - description: 'Hold hands with a specified user.', - examples: ['uwu!holdhands @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to hold hands with?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** holds **${uUser.username}** hand.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/hug.ts b/src/commands/roleplay/hug.ts deleted file mode 100644 index f64d6d5..0000000 --- a/src/commands/roleplay/hug.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class HugRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'hug', - group: 'roleplay', - memberName: 'hug', - description: 'Hug a specified user.', - examples: ['uwu!hug @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to hug?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** hugs **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/inhale.ts b/src/commands/roleplay/inhale.ts deleted file mode 100644 index e302e2e..0000000 --- a/src/commands/roleplay/inhale.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class InhaleRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'inhale', - group: 'roleplay', - memberName: 'inhale', - description: 'Inhale a specified user.', - examples: ['uwu!inhale @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to inhale?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** inhales **${uUser.username}** but gained no abilities.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/kill.ts b/src/commands/roleplay/kill.ts deleted file mode 100644 index 809db32..0000000 --- a/src/commands/roleplay/kill.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class KillRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'kill', - group: 'roleplay', - memberName: 'kill', - description: 'Kill a specified user.', - examples: ['uwu!kill @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to kill?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** kills **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/kiss.ts b/src/commands/roleplay/kiss.ts deleted file mode 100644 index ab37cb5..0000000 --- a/src/commands/roleplay/kiss.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class KissRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'kiss', - group: 'roleplay', - memberName: 'kiss', - description: 'Kiss a specified user.', - examples: ['uwu!kiss @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to kiss?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** kisses **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/pat.ts b/src/commands/roleplay/pat.ts deleted file mode 100644 index 923c670..0000000 --- a/src/commands/roleplay/pat.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class PatRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'pat', - group: 'roleplay', - memberName: 'pat', - description: 'Pat a specified user.', - examples: ['uwu!pat @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to pat?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** pats **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/poke.ts b/src/commands/roleplay/poke.ts deleted file mode 100644 index 227e2b6..0000000 --- a/src/commands/roleplay/poke.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class PokeRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'poke', - group: 'roleplay', - memberName: 'poke', - description: 'Poke a specified user.', - examples: ['uwu!poke @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to poke?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** pokes **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/punch.ts b/src/commands/roleplay/punch.ts deleted file mode 100644 index e8a59a6..0000000 --- a/src/commands/roleplay/punch.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class PunchRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'punch', - group: 'roleplay', - memberName: 'punch', - description: 'Punch a specified user.', - examples: ['uwu!punch @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to punch?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** punches **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/slap.ts b/src/commands/roleplay/slap.ts deleted file mode 100644 index 16a52b2..0000000 --- a/src/commands/roleplay/slap.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class SlapRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'slap', - group: 'roleplay', - memberName: 'slap', - description: 'Slap a specified user.', - examples: ['uwu!slap @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to slap?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** slaps **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/sleep.ts b/src/commands/roleplay/sleep.ts deleted file mode 100644 index 3b5c5da..0000000 --- a/src/commands/roleplay/sleep.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class SleepRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'sleep', - group: 'roleplay', - memberName: 'sleep', - description: 'Sleep.', - examples: ['uwu!sleep'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - run(msg: CommandoMessage) { - msg.delete(); - return msg.say(`***${msg.author.username}** falls asleep.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/wakeup.ts b/src/commands/roleplay/wakeup.ts deleted file mode 100644 index 37667a6..0000000 --- a/src/commands/roleplay/wakeup.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class WakeUpRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'wakeup', - aliases: ['wake-up'], - group: 'roleplay', - memberName: 'wakeup', - description: 'Wake up.', - examples: ['uwu!wakeup'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - run(msg: CommandoMessage) { - msg.delete(); - return msg.say(`***${msg.author.username}** wakes up.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/wave.ts b/src/commands/roleplay/wave.ts deleted file mode 100644 index 779e56e..0000000 --- a/src/commands/roleplay/wave.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class WaveRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'wave', - group: 'roleplay', - memberName: 'wave', - description: 'Wave at a specified user.', - examples: ['uwu!wave @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to wave at?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** waves at **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/roleplay/wink.ts b/src/commands/roleplay/wink.ts deleted file mode 100644 index 480b9ab..0000000 --- a/src/commands/roleplay/wink.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class WinkRoleplay extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'wink', - group: 'roleplay', - memberName: 'wink', - description: 'Wink at a specified user.', - examples: ['uwu!wink @sin#1337'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to wink at?', - type: 'user' - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - msg.delete(); - return msg.say(`***${msg.author.username}** winks at **${uUser.username}**.*` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/server/goodbye.ts b/src/commands/server/goodbye.ts deleted file mode 100644 index b924654..0000000 --- a/src/commands/server/goodbye.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -import Goodbye from '../../models/goodbye.js'; -import mongo from 'mongoose'; -import config from '../../config.json'; -mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -module.exports = class GoodbyeServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'goodbye', - group: 'server', - memberName: 'goodbye', - description: 'Allows you to set, change or delete a server goodbye message.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: [ - 'uwu!goodbye', - 'uwu!goodbye set', - 'uwu!goodbye remove' - ], - args: [ - { - key: 'wType', - prompt: 'Would you like to set, remove or change the current goodbye channel?', - type: 'string', - default: '' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - //@ts-ignore doesnt matter if not all code paths return a value - async run(msg: CommandoMessage, { wType }: any) { - const goodbye = new Goodbye({ - _id: mongo.Types.ObjectId(), - username: msg.author.username, - userID: msg.author.id, - guildname: msg.guild.name, - guildID: msg.guild.id, - channelname: msg.channel, - channelID: msg.channel.id, - time: msg.createdAt - }) - const guildExist = await Goodbye.findOne({ guildID: msg.guild.id }) - - if (msg.member.hasPermission('MANAGE_GUILD')) { - Goodbye.findOne({ guildID: msg.guild.id }, async (error, guild) => { - if (error) { - console.log(error) - } else if (guild && wType == 'remove') { - await Goodbye.findOneAndDelete({ guildID: msg.guild.id }) - msg.say('The current goodbye channel has been unset! ' + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild && wType == 'remove') { - msg.reply('There is no current goodbye channel set for this guild! ' + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (guild && wType == 'set') { - //@ts-ignore this exists - msg.reply(`There already is a goodbye channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild && wType == 'set') { - await goodbye.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - - msg.reply(`The goodbye channel has been set to ${msg.channel}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild) { - msg.reply('There is no current goodbye channel set for this guild! To set one, do `uwu!goodbye set` in the channel you want to set it in. ' + emoji.random()) - } else if (guild) { - //@ts-ignore this exists - msg.reply(`The current goodbye channel is ${guild.channelname}. ` + emoji.random()) - } - }) - } else { - return msg.reply('Insufficent permissions! ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/server/membercount.ts b/src/commands/server/membercount.ts deleted file mode 100644 index ef1d271..0000000 --- a/src/commands/server/membercount.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class MemberCountServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'membercount', - aliases: ['memberc', 'mcount', 'mc'], - group: 'server', - memberName: 'membercount', - description: 'Tells you how many members are in the current server.', - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true, - examples: [ - 'uwu!membercount', - 'uwu!memberc', - 'uwu!mcount', - 'uwu!mc' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - return msg.reply(`There are **${msg.guild.memberCount}** members in **${msg.guild.name}**. ` + emoji.random()); - } -};
\ No newline at end of file diff --git a/src/commands/server/oldestmember.ts b/src/commands/server/oldestmember.ts deleted file mode 100644 index 974e476..0000000 --- a/src/commands/server/oldestmember.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { formatDistance, formatRelative } from 'date-fns' -//@ts-ignore no types -import { stripIndents } from 'common-tags' - -module.exports = class OldestMemberServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'oldestmember', - aliases: [ - 'oldest-member', - 'oldestuser', - 'oldest-user', - 'oldest' - ], - group: 'server', - memberName: 'oldestmember', - description: 'Checks who the oldest member on the server is.', - examples: ['uwu!oldestmember'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - guildOnly: true - }); - } - run(msg: CommandoMessage) { - const oldest = msg.guild.members - .cache.sort((member1, member2) => { - const timestamp1 = member1.user.createdTimestamp - const timestamp2 = member2.user.createdTimestamp - - if (timestamp1 > timestamp2) { - return 1 - } else if (timestamp1 < timestamp2) { - return -1 - } - return 0 - }).first()?.user; - - // TODO: - //@ts-ignore no idea why - const { createdAt } = oldest - const age = formatDistance(createdAt, new Date()) - const date = formatRelative(createdAt, new Date()) - return msg.reply(stripIndents`${oldest?.tag} is the oldest member in this server. - Their account is **${age}** old (created **${date}**).` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/server/poll.ts b/src/commands/server/poll.ts deleted file mode 100644 index 8eafcb9..0000000 --- a/src/commands/server/poll.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore no types -import emoji from 'emoji-random' -import config from '../../config.json' - -module.exports = class PollServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'poll', - group: 'server', - memberName: 'poll', - description: 'Make a poll.', - examples: ['uwu!poll am i cool?'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - guildOnly: true - }); - } - //@ts-ignore this is not async - run(msg: CommandoMessage) { - if (config['validUsers'].includes(msg.author.id)) { - let messageArray = msg.content.split(' ') - let args = messageArray.slice(1) - - if (!args || args.length < 1) { - return msg.reply(`No poll content was specified. ${emoji.random()}`) - } else { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setFooter('React to vote.') - .setDescription(args.join(' ')) - .setTitle(`Poll Created by ${msg.author.username} ${emoji.random()}`) - return msg.say(emb).then(fMsg => { - //@ts-ignore yes these exist - fMsg.react('✅') - //@ts-ignore yes these exist - fMsg.react('❎') - //@ts-ignore yes these exist - msg.delete({ timeout: 1000 }) - }) - } - } else { - msg.delete() - //@ts-ignore - return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) - } - } -};
\ No newline at end of file diff --git a/src/commands/server/quotemessage.ts b/src/commands/server/quotemessage.ts deleted file mode 100644 index d421f68..0000000 --- a/src/commands/server/quotemessage.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -const tt = require('../../utils/truncateText.js') -import path from 'path' - -module.exports = class QuoteMessageServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'quotemessage', - aliases: [ - 'quote-message', - 'quotemsg', - 'quote-msg' - ], - group: 'fun', - memberName: 'quotemessage', - description: 'Quote a message from a text channel.', - examples: ['uwu!quotemessage 424936127154094080'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'mMsg', - prompt: 'What message would you like to quote?', - type: 'message', - label: 'message ID' - } - ] - }); - } - run(msg: CommandoMessage, { mMsg }: any) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTimestamp(mMsg.createdAt) - .setAuthor(mMsg.author.tag, mMsg.author.avatarUrl) // TODO: fix avatarurl not working - .addFields([ - { - name: 'Channel', - value: mMsg.channel.toString() - }, - { - name: 'Message', - value: `[Jump to](https://discordapp.com/channels/${mMsg.guild.id}/${mMsg.channel.id}/${mMsg.id})` - } - ]) - - // check if msg had content - console.debug('Does the message have content:', Boolean(mMsg.content)) - if (mMsg.content) emb.setDescription(tt(mMsg.content)) - - // get img from msg - let messageImage - // valid img file extensions - const extensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp'] - // regex for url to img - const linkRegex = /https?:\/\/(?:\w+\.)?[\w-]+\.[\w]{2,3}(?:\/[\w-_.]+)+\.(?:png|jpg|jpeg|gif|webp)/; - - // embed (that may or may not exist) with an img in it - const imageEmbed = mMsg.embeds.find((msgEmbed: { type: string; image: { url: string; }; }) => { - msgEmbed.type === 'rich' && msgEmbed.image && extensions.includes(path.extname(msgEmbed.image.url)) - }) - - if (imageEmbed) messageImage = imageEmbed.image.url - - // uploaded img - const attachment = mMsg.attachments.find((file: { url: string; }) => extensions.includes(path.extname(file.url))) - if (attachment) { - messageImage = attachment.url - } - - // if there wasnt an uploaded img check if there was a url to one - if (!messageImage) { - const linkMatch = mMsg.content.match(linkRegex) - if (linkMatch && extensions.includes(path.extname(linkMatch[0]))) { - [messageImage] = linkMatch - } - } - - // if there was an img, set embed image to it - if (messageImage) emb.setImage(messageImage) - - return msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/server/randommember.ts b/src/commands/server/randommember.ts deleted file mode 100644 index 5514561..0000000 --- a/src/commands/server/randommember.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' - -module.exports = class RandomMemberServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'randommember', - aliases: [ - 'random-member', - 'randomuser', - 'random-user', - 'someone', - '@someone', - ], - group: 'fun', - memberName: 'randommember', - description: 'Gets a random member from the server.', - examples: ['uwu!randommember'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - if (msg.channel.type === 'dm') { - const members = [this.client.user, msg.channel.recipient]; - return msg.reply(`I choose ${members[Math.floor(Math.random() * members.length)]?.username}! ${emoji.random()}`); - } - return msg.reply(`I choose ${msg.guild.members.cache.random().displayName}! ${emoji.random()}`); - } -};
\ No newline at end of file diff --git a/src/commands/server/roleinfo.ts b/src/commands/server/roleinfo.ts deleted file mode 100644 index cfd5d33..0000000 --- a/src/commands/server/roleinfo.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class RoleInfoServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'roleinfo', - aliases: [ - 'role-info' - ], - group: 'server', - memberName: 'roleinfo', - description: 'Gets information on a specified role.', - examples: ['uwu!roleinfo @Role'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - guildOnly: true, - args: [ - { - key: 'rRole', - prompt: 'What role would you like to get information on?', - type: 'role' - } - ] - }); - } - run(msg: CommandoMessage, { rRole }: any) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle(`${rRole.name} (${rRole.id})`) - .setTimestamp(rRole.createdAt) - .addFields([ - { - name: '🔢 Position', - value: `${rRole.position + 1} (raw position: ${rRole.rawPosition})` - }, - { - name: '**@** Mentionable', - value: rRole.mentionable ? 'Yes' : 'No' - }, - { - name: "💡 Display separately", - value: rRole.hoist ? "Yes" : "No" - }, - { - name: "👥 Members", - value: rRole.members.size - }, - { - name: "🔍 Color", - value: `Use ${msg.anyUsage(`color ${rRole.hexColor}`)}` - } - ]) - return msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/server/roles.ts b/src/commands/server/roles.ts deleted file mode 100644 index 4ab14fe..0000000 --- a/src/commands/server/roles.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -const tt = require('../../utils/truncateText.js') - -module.exports = class RolesServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'roles', - aliases: [ - 'list-roles', - 'listroles', - 'roles-list', - 'roleslist' - ], - group: 'server', - memberName: 'roles', - description: 'Lists all the roles on the current server.', - examples: ['uwu!roles'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - guildOnly: true - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle('All Roles') - .setDescription(tt( - msg.guild.roles - .cache.sort((role1, role2) => role2.position - role1.position) - .array() - .join(', ') - )) - return msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/server/server.ts b/src/commands/server/server.ts deleted file mode 100644 index 974a435..0000000 --- a/src/commands/server/server.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class ServerServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'server', - aliases: [ - 'serverinfo', - 'si', - 'server-info', - 'serverstats', - 'server-stats' - ], - group: 'server', - memberName: 'server', - description: 'Gives you information about the current server.', - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true, - examples: [ - 'uwu!server', - 'uwu!serverinfo', - 'uwu!server-info', - 'uwu!serverstats', - 'uwu!server-stats', - 'uwu!si' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var o = msg.guild.members.cache.filter(m => m.presence.status === 'online').size; - - let embed = new MessageEmbed() - - .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL()}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) - .setDescription(`Here\'s all the information on \`${msg.guild.name}\``) - .setThumbnail(`${msg.guild.iconURL()}`) - .addField('Owner', `${msg.guild.owner}`, true) - .addField(`Members [${msg.guild.memberCount}]`, `${o} members are online.`, true) - .addField('Region', `${msg.guild.region}`, true) - .addField('Text channels', `${msg.guild.channels.cache.filter(c => c.type === 'text').size}`, true) - .addField('Voice channels', `${msg.guild.channels.cache.filter(c => c.type === 'voice').size}`, true) - .addField('Guild created', `${msg.guild.createdAt}`, false) - .addField(`${this.client.user?.username} joined`, `${msg.guild.members.cache.get('699473263998271489')?.joinedAt}`) - .setColor(0xFFCC4D); - - return msg.say(embed); - } -};
\ No newline at end of file diff --git a/src/commands/server/welcome.ts b/src/commands/server/welcome.ts deleted file mode 100644 index 68b3046..0000000 --- a/src/commands/server/welcome.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -import Welcome from '../../models/welcome.js'; -import mongo from 'mongoose'; -import config from '../../config.json'; -mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -module.exports = class WelcomeServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'welcome', - group: 'server', - memberName: 'welcome', - description: 'Allows you to set, change or delete a server welcome message.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: [ - 'uwu!welcome', - 'uwu!welcome set', - 'uwu!welcome remove' - ], - args: [ - { - key: 'wType', - prompt: 'Would you like to set, remove or change the current welcome channel?', - type: 'string', - default: '' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - //@ts-ignore doesnt matter if not all code paths return - async run(msg: CommandoMessage, { wType }: any) { - const welcome = new Welcome({ - _id: mongo.Types.ObjectId(), - username: msg.author.username, - userID: msg.author.id, - guildname: msg.guild.name, - guildID: msg.guild.id, - channelname: msg.channel, - channelID: msg.channel.id, - time: msg.createdAt - }) - // const guildExist = await Welcome.findOne({ guildID: msg.guild.id }) - - if (msg.member.hasPermission('MANAGE_GUILD')) { - Welcome.findOne({ guildID: msg.guild.id }, async (error, guild) => { - if (error) { - return console.log(error) - } else if (guild && wType == 'remove') { - await Welcome.findOneAndDelete({ guildID: msg.guild.id }) - return msg.say('The current welcome channel has been unset! ' + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild && wType == 'remove') { - return msg.reply('There is no current welcome channel set for this guild! ' + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (guild && wType == 'set') { - //@ts-ignore this exists - return msg.reply(`There already is a welcome channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild && wType == 'set') { - await welcome.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - - return msg.reply(`The welcome channel has been set to ${msg.channel}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild) { - return msg.reply('There is no current welcome channel set for this guild! To set one, do `uwu!welcome set` in the channel you want to set it in. ' + emoji.random()) - } else if (guild) { - //@ts-ignore this exists - return msg.reply(`The current welcome channel is ${guild.channelname}. ` + emoji.random()) - } - }) - } else { - return msg.reply('Insufficent permissions! ' + emoji.random()) - } - } -};
\ No newline at end of file diff --git a/src/commands/user/age.ts b/src/commands/user/age.ts deleted file mode 100644 index 13ead86..0000000 --- a/src/commands/user/age.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { formatDistance, formatRelative } from 'date-fns' -//@ts-ignore no types -import { stripIndents } from 'common-tags' - -module.exports = class AgeUser extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'age', - aliases: [ - 'account-age', - 'accountage' - ], - group: 'user', - memberName: 'age', - description: 'Checks when a specified Discord account was created.', - examples: ['uwu!age', 'uwu!age @sin#1337'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'uUser', - prompt: 'Who\'s age would you like to check?', - type: 'user', - default: '' - } - ] - }); - } - async run(msg: CommandoMessage, { uUser }: any) { - const target = uUser || msg.author - const { createdAt } = target - return msg.reply(stripIndents`${formatDistance(createdAt, new Date())} old. - Created on ${formatRelative(createdAt, new Date())} ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/user/id.ts b/src/commands/user/id.ts deleted file mode 100644 index a4d974d..0000000 --- a/src/commands/user/id.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class IDUser extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'id', - group: 'user', - memberName: 'id', - description: 'Tells you the your ID.', - examples: ['uwu!id'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'uUser', - prompt: 'Which user would you like to get the ID of?', - type: 'user', - default: (msg: { author: any; }) => msg.author - } - ] - }); - } - run(msg: CommandoMessage, { uUser }: any) { - return msg.reply(`**${uUser.id === msg.author.id ? 'Your' : `${uUser.username}'s`}** ID is **${uUser.id}**. ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/user/nickname.ts b/src/commands/user/nickname.ts deleted file mode 100644 index 09cf717..0000000 --- a/src/commands/user/nickname.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class NickNameUser extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'nickname', - aliases: ['nick', 'name'], - group: 'user', - memberName: 'nickname', - description: 'Allows you to change your nickname in the current server.', - args: [ - { - key: 'userNick', - prompt: 'What would you like to change your nickname to?', - type: 'string' - } - ], - examples: [ - 'uwu!nickname sinny', - 'uwu!nick s1nical', - 'uwu!name s1n' - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - run(msg: CommandoMessage, { userNick }: any) { - msg.member.setNickname(userNick) - return msg.reply(`Your nickname has been changed to ${userNick}. ` + emoji.random()) - } -}; */
\ No newline at end of file diff --git a/src/commands/user/nitro.ts b/src/commands/user/nitro.ts deleted file mode 100644 index a54eb38..0000000 --- a/src/commands/user/nitro.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore no types -import { stripIndents } from 'common-tags' - -module.exports = class NitroUser extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'nitro', - group: 'user', - memberName: 'nitro', - description: 'This message can only be viewed by users with Discord Nitro.', - examples: ['uwu!nitro'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setAuthor('Discord Nitro', 'https://cdn.discordapp.com/emojis/314068430611415041.png', 'https://discordapp.com/nitro') - .setThumbnail('https://cdn.discordapp.com/emojis/314068430611415041.png') - .setTimestamp(new Date()) - .setDescription(stripIndents` - This message can only be viewed by users with Discord Nitro. - [Lift off with Discord Nitro today](https://discordapp.com/nitro)`) - return msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/user/pfp.ts b/src/commands/user/pfp.ts deleted file mode 100644 index ac26a26..0000000 --- a/src/commands/user/pfp.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import emoji from 'emoji-random'; - -module.exports = class PFPServer extends Command { - constructor(client) { - super(client, { - name: 'pfp', - aliases: [ - 'profilepicture', - 'profile-picture', - 'profileimage', - 'profile-image', - 'avatar', - 'avi' - ], - group: 'user', - memberName: 'pfp', - description: 'Grabs the profile picture of a specified user.', - args: [ - { - key: 'userID', - prompt: 'Which user\'s profile picture would you like to grab?', - type: 'string' - } - ], - examples: ['uwu!pfp @sin#1337'], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - run(msg: CommandoMessage, { userID } ) { - userID = msg.mentions.users.first()?.id; - this.client.users.fetch(userID).then(user => { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle(`${msg.mentions.users.first()?.username}'s Profile Picture ` + emoji.random()) - .setImage(user.avatarURL()) - msg.say(emb) - }) - } -};
\ No newline at end of file diff --git a/src/commands/utility/average.ts b/src/commands/utility/average.ts deleted file mode 100644 index 233236c..0000000 --- a/src/commands/utility/average.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -import { formatDistance, formatRelative } from 'date-fns' -//TODO: check if this has types -//@ts-ignore no types -import { stripIndents } from 'common-tags' - -module.exports = class AverageUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'average', - aliases: [ - 'average-number', - 'averagenumber', - 'average-num', - 'averagenum' - ], - group: 'utility', - memberName: 'average', - description: 'Gets the average of specified numbers.', - examples: ['uwu!average 10 20 30 40 50'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'nNum', - prompt: 'What\'s another number you would like to average?', - type: 'float', - label: 'number', - infinite: true - } - ] - }); - } - async run(msg: CommandoMessage, { nNum }: any) { // this is really a string - if (nNum.length < 2) msg.reply('Please provide **2** or more numbers.') - - const reducer = (accumulator: any, currentValue: any) => accumulator + currentValue - return msg.reply(`The average of the specified numbers is ${nNum.reduce(reducer) / nNum.length}.` + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/utility/csgoserverstatus.ts b/src/commands/utility/csgoserverstatus.ts deleted file mode 100644 index 5f0cfe7..0000000 --- a/src/commands/utility/csgoserverstatus.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no @types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class CSGOServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'csgoserverstatus', - aliases: [ - 'counterstrikeserverstatus', - 'counter-strike-server-status', - 'counterstrikeglobaloffensiveserverstatus', - 'counter-strike-global-offensive-server-status', - 'csgoss' - ], - group: 'utility', - memberName: 'csgoserverstatus', - description: 'Grabs you the server status of a CS:GO server.', - examples: [ - 'uwu!csgoserverstatus', - 'uwu!csgoss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '27015', - max: 65535, - min: 1 - } - ] - }); - } - async run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'csgo', - } - - if (port) { - //@ts-ignore this get auto appended - options.port = port - } - - return gamedig - .query(options) - .then((data: any) => { - let emb = gameDigHelper(data) - emb.setColor(0xFFCC4D) - emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/730/header.jpg') - return msg.replyEmbed(emb) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/fortnitestats.ts b/src/commands/utility/fortnitestats.ts deleted file mode 100644 index 8eb65c4..0000000 --- a/src/commands/utility/fortnitestats.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore to types -import emoji from 'emoji-random' -import axios from 'axios' -import config from '../../config.json' -const platforms = ['pc', 'xbl', 'psn'] - -module.exports = class FortniteStatsUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'fortnitestats', - aliases: [ - 'fortnite-stats', - 'fortnitestatistics', - 'fortnite-statistics', - 'fnstats', - 'fn-stats', - 'fnstatistics', - 'fn-statistics', - 'fns', - 'fn-s', - 'fortnite' - ], - group: 'utility', - memberName: 'fortnitestats', - description: 'Grabs a specified player\'s Fortnite statistics.', - details: 'Available platforms are `pc` (PC), `xbp` (Xbox Live) and `psn` (Playstation Network).', - examples: [ - 'uwu!fortnitestats Frozen', - 'uwu!fns Sin' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'pPlatform', - prompt: 'What platform would you like to search on.', - type: 'string', - parse: (platform: string) => platform.toLowerCase(), - oneOf: platforms - }, - { - key: 'pUsername', - prompt: 'What user would you like to look up?', - type: 'string' - } - ] - }); - } - //TODO: - //@ts-ignore this is not async - async run(msg: CommandoMessage, { pPlatform, pUsername }: any) { - try { - const stats = ( - await axios - .get(`https://api.fortnitetracker.com/v1/profile/${pPlatform}/${pUsername}`, { - headers: { 'TRN-Api-Key': config.fortniteTrackerNetworkToken } - }) - .catch(err => { - console.error(err) - return msg.reply('Woops, There was an error with the (https://api.fortnitetracker.com) API. ' + emoji.random()) - }) - //@ts-ignore yes it does exist lmao - ).data - - if (stats.error === 'Player Not Found') { - return msg.reply('Specified player was not found on that platform. ' + emoji.random()) - } - - console.debug(`Result for ${pUsername} on ${pPlatform}:`, stats) - let emb = new MessageEmbed() - .setTitle(stats.epicUserHandle) - .setURL(`https://fortnitetracker.com/profile/${pPlatform}/${encodeURIComponent(pUsername)}`) - .setColor(0xFFCC4D) - .setFooter('Information providied by The Tracker Network.',) - - if (stats.lifeTimeStats[8] && stats.lifeTimeStats[9]) { - emb.addField("🏆 Wins", `${stats.lifeTimeStats[8].value} wins (${stats.lifeTimeStats[9].value})`) - } - - if (stats.lifeTimeStats[10] && stats.lifeTimeStats[11]) { - emb.addField( - "💀 Kills", - `${stats.lifeTimeStats[10].value} kills. ${stats.lifeTimeStats[11].value} K/D ratio.` - ); - } - - if (stats.lifeTimeStats[7]) { - emb.addField("🎮 Matches Played", stats.lifeTimeStats[7].value.toString()); - } - - if (stats.lifeTimeStats[6]) { - emb.addField("🔢 Score", stats.lifeTimeStats[6].value.toString()); - } - - return msg.replyEmbed(emb); - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/gmodserverstatus.ts b/src/commands/utility/gmodserverstatus.ts deleted file mode 100644 index 50c0e61..0000000 --- a/src/commands/utility/gmodserverstatus.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class GModServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'gmodserverstatus', - aliases: [ - 'g-mod-server-status', - 'garrysmodserverstatus', - 'garrys-mod-server-status', - 'gmodss' - ], - group: 'utility', - memberName: 'gmodserverstatus', - description: 'Grabs you the server status of a Garry\'s Mod server.', - examples: [ - 'uwu!gmodserverstatus', - 'uwu!gmodss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '27015', - max: 65535, - min: 1 - } - ] - }); - } - async run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'garrysmod' - } - - if (port) { - //@ts-ignore added auto - options.port = port - } - - return gamedig - .query(options) - .then((data: any) => { - let emb = gameDigHelper(data) - emb.setColor(0xFFCC4D) - emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/4000/header.jpg') - return msg.replyEmbed(emb) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/google.ts b/src/commands/utility/google.ts deleted file mode 100644 index 2c84bd5..0000000 --- a/src/commands/utility/google.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class GoogleUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'google', - group: 'utility', - memberName: 'google', - description: 'Googles something for you.', - examples: ['uwu!google sin'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'gTerm', - prompt: 'What would you like to search for?', - type: 'string' - } - ] - }); - } - run(msg: CommandoMessage, { gTerm }: any) { - let embed = new MessageEmbed() - .setTitle('**Google Search**') - .setColor(0xFFCC4D) - .addField('Searching Google for`' + gTerm + '`...', `[Click Here](https://google.com/search?q=${gTerm.replace(/ /g, '%20')})`) - return msg.say(embed) - } -};
\ No newline at end of file diff --git a/src/commands/utility/iss.ts b/src/commands/utility/iss.ts deleted file mode 100644 index 3bb4ff6..0000000 --- a/src/commands/utility/iss.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -import request from 'node-superfetch' - -module.exports = class ISSUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'iss', - aliases: ['internationalspacestation', 'international-space-station'], - group: 'utility', - memberName: 'iss', - description: 'Tells you the current location of the International Space Station.', - examples: ['uwu!iss'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage) { - try { - const { body } = await request.get('http://api.open-notify.org/iss-now.json') - //@ts-ignore this exists - const pos = body.iss_position - return msg.reply(`The ISS is currentaly at **${pos.latitude}, ${pos.longitude}**. ${emoji.random()}`) - } catch (err) { - return msg.reply(`Woops, an error has occurred: \`${err.message}\`. Try again later! ${emoji.random()}`) - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/romannumeral.ts b/src/commands/utility/romannumeral.ts deleted file mode 100644 index 39b9320..0000000 --- a/src/commands/utility/romannumeral.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import romanize from 'romanize' - -module.exports = class RomanNumeralUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'romannumeral', - aliases: [ - 'roman-numeral', - 'romannumerals', - 'roman-numerals' - ], - group: 'utility', - memberName: 'romannumeral', - description: 'Converts a number to a roman numeral.', - examples: ['uwu!romannumeral 12'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'nNum', - prompt: 'What number would you like to translate', - type: 'integer', - min: 1 - } - ] - }); - } - run(msg: CommandoMessage, { nNum }: any) { - if (nNum === parseInt(nNum, 10)) { - msg.reply(romanize(nNum)) - } - - const back = (value: string) => { - let res = 0 - - const decimal = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] - const roman = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] - for (let i = 0; i <= decimal.length; i++) { - while (value.indexOf(roman[i]) === 0) { - res += decimal[i] - value = value.replace(roman[i], '') - } - } - return res - } - - return msg.reply(back(nNum) + ' ' + emoji.random()) - } -};
\ No newline at end of file diff --git a/src/commands/utility/rustserverstatus.ts b/src/commands/utility/rustserverstatus.ts deleted file mode 100644 index dd91487..0000000 --- a/src/commands/utility/rustserverstatus.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class RustServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'rustserverstatus', - aliases: [ - 'rust-ss', - 'rust-server-status', - 'rustss' - ], - group: 'utility', - memberName: 'rustserverstatus', - description: 'Grabs you the server status of a Rust server.', - examples: [ - 'uwu!rustserverstatus', - 'uwu!rustss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '28015', - max: 65535, - min: 1 - } - ] - }); - } - run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'rust' - } - - if (port) { - //@ts-ignore gets added - options.port = port - } - - return gamedig - .query(options) - .then((data: any) => { - msg.replyEmbed( - gameDigHelper(data) - .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/252490/header.jpg') - .setColor(0xFFCC4D) - ) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/starboundserverstatus.ts b/src/commands/utility/starboundserverstatus.ts deleted file mode 100644 index 0d8e319..0000000 --- a/src/commands/utility/starboundserverstatus.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore no types -import emoji from 'emoji-random' -//@ts-ignore no types -import gamedig from 'gamedig' -const gameDigHelper = require('../../utils/gameDigHelper.js') - -module.exports = class StarboundServerStatusUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'starboundserverstatus', - aliases: [ - 'starbound-ss', - 'starbound-server-status', - 'sbss' - ], - group: 'utility', - memberName: 'starboundserverstatus', - description: 'Grabs you the server status of a Starbound server.', - examples: [ - 'uwu!starboundserverstatus', - 'uwu!sbss' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What is the IP or host of the server?', - type: 'string' - }, - { - key: 'port', - prompt: 'What is the port of the server?', - type: 'integer', - default: '21025', - max: 65535, - min: 1 - } - ] - }); - } - run(msg: CommandoMessage, { host, port }: any) { - try { - const options = { - host, - type: 'starbound' - } - - if (port) { - //@ts-ignore added auto - options.port = port - } - - return gamedig - .query(options) - // this is auto'd so might not be good - .then((data: { raw: { numplayers: any; }; maxplayers: any; name: any; query: { duration: any; address: any; port: any; }; password: any; }) => { - const curr = data.raw.numplayers - const max = data.maxplayers - - return msg.replyEmbed( - new MessageEmbed() - .setTitle(data.name) - .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/211820/header.jpg') - .setFooter(`Took ${data.query.duration} to complete.`) - .addFields([ - { - name: 'IP Address', - value: `${data.query.address} (port ${data.query.port})` - }, - { - name: "Online Players", - value: `${curr}/${max} (${Math.round((curr / max) * 100)}%)` - }, - { - name: "Password Required", - value: data.password ? "Yes" : "No" - } - ]) - .setColor(0xFFCC4D) - ) - }) - .catch((err: string) => { - if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) - - console.error(err) - return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) - }) - } finally { - return msg.channel.stopTyping() - } - } -};
\ No newline at end of file diff --git a/src/commands/utility/time.ts b/src/commands/utility/time.ts deleted file mode 100644 index 78fe391..0000000 --- a/src/commands/utility/time.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random' - -module.exports = class TimeUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'time', - group: 'utility', - memberName: 'time', - description: 'Check the time.', - examples: ['uwu!time'], - throttling: { - usages: 5, - duration: 30 - }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - }); - } - run(msg: CommandoMessage) { - return msg.reply(`The time is currently **${new Date()}**. ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/utility/whois.ts b/src/commands/utility/whois.ts deleted file mode 100644 index d699e39..0000000 --- a/src/commands/utility/whois.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -//@ts-ignore no types -import whois from 'whois'; - -module.exports = class WhoIsUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'whois', - group: 'utility', - memberName: 'whois', - description: 'Perform a whois on a specified or domain.', - examples: ['uwu!whois google.com'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - args: [ - { - key: 'host', - prompt: 'What host/ domain would you like to perform a who is on?', - type: 'string' - } - ] - }); - } - run(msg: CommandoMessage, { host }: any) { - //@ts-ignore doesnt matter if none is returned - return whois.lookup(host, (err: any, data: any) => { - if (err) return msg.reply(`Woops, there was an error getting that information for you! Please re-check your specified host/ domain. ${emoji.random()}`); - - msg.reply(`Check your DMs for the whois! ${emoji.random()}`); - return msg.author.send(data, { split: true }); - }); - } -};
\ No newline at end of file diff --git a/src/commands/utility/xorstr.ts b/src/commands/utility/xorstr.ts deleted file mode 100644 index 188ed75..0000000 --- a/src/commands/utility/xorstr.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; - -module.exports = class XorStrUtility extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'xorstr', - aliases: ['xor'], - group: 'utility', - memberName: 'xorstr', - description: 'Gives you Dexor\'s XorStr link and documentation.', - examples: ['uwu!xorstr', 'uwu!xor'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - return msg.reply('https://github.com/JustasMasiulis/xorstr'); - } -};
\ No newline at end of file diff --git a/src/commands/voice/abee.ts b/src/commands/voice/abee.ts deleted file mode 100644 index 2a838f0..0000000 --- a/src/commands/voice/abee.ts +++ /dev/null @@ -1,206 +0,0 @@ -//@ts-nocheck -import ytdl from 'ytdl-core'; -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore no types -import Youtube from 'simple-youtube-api'; -//const { youtubeAPI } = require('../../config.json'); -import config from '../../config.json'; -const youtube = new Youtube(config['yt-api-key']); -//@ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class ABeeVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'abee', - aliases: ['a-bee'], - group: 'voice', - memberName: 'abee', - description: 'A bee 🐝', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: ['uwu!abee', 'uwu!a-bee'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); - - const id = 'lvdnhWhQBdo'; - const video = await youtube.getVideoByID(id).catch(function () { - return msg.say( - 'There was a problem getting the video you provided. ' + emoji.random() - ); - }); - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .getVideoByID(videos[videoIndex - 1].id) - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'An error has occured when trying to get the video ID from YouTube. ' + emoji.random() - ); - }); - }); - } - playSong(queue, msg: CommandoMessage) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - ytdl(queue[0].url, { - quality: 'highestaudio', - highWaterMark: 1024 * 1024 * 10 - }) - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xF97DAE) - .addField('Now playing:', queue[0].title) - .addField('Duration:', queue[0].duration); - if (queue[1]) videoEmbed.addField('Next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('Can\'t play song. ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - let duration = this.formatDuration(video.duration); - if (duration == '00:00') duration = 'Live Stream'; - return { - url: `https://www.youtube.com/watch?v=${video.raw.id}`, - title: video.title, - duration, - thumbnail: video.thumbnails.high.url, - voiceChannel - }; - } - // prettier-ignore - formatDuration(durationObj) { - const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${ - durationObj.minutes ? durationObj.minutes : '00' - }:${ - (durationObj.seconds < 10) - ? ('0' + durationObj.seconds) - : (durationObj.seconds - ? durationObj.seconds - : '00') - }`; - return duration; - } -};
\ No newline at end of file diff --git a/src/commands/voice/itemshop.ts b/src/commands/voice/itemshop.ts deleted file mode 100644 index ad5df7b..0000000 --- a/src/commands/voice/itemshop.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* import ytdl from 'ytdl-core'; -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import Youtube from 'simple-youtube-api'; -//const { youtubeAPI } = require('../../config.json'); -import config from '../../config.json'; -const youtube = new Youtube(config['yt-api-key']); -import emoji from 'emoji-random'; - -module.exports = class ABeeVoice extends Command { - constructor(client) { - super(client, { - name: 'itemshop', - aliases: ['item-shop'], - group: 'voice', - memberName: 'itemshop', - description: 'Use code \'Frozen\' in the Fortnite item shop.', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: ['uwu!itemshop', 'uwu!item-shop'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); - - const id = 'pBiI1hTwU7E'; - const video = await youtube.getVideoByID(id).catch(function () { - return msg.say( - 'There was a problem getting the video you provided. ' + emoji.random() - ); - }); - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .getVideoByID(videos[videoIndex - 1].id) - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - msg.say(`${video.title} added to queue. ` + emoji.random()); - return; - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'An error has occured when trying to get the video ID from Youtube.' + emoji.random() - ); - }); - }); - } - playSong(queue, msg: CommandoMessage) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - ytdl(queue[0].url, { - quality: 'highestaudio', - highWaterMark: 1024 * 1024 * 10 - }) - - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xF97DAE) - .addField('Now playing:', queue[0].title) - .addField('Duration:', queue[0].duration); - if (queue[1]) videoEmbed.addField('Next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('Can\'t play song. ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - function timeCheck() { - if (dispatcher.streamTime >= 6000) { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - } - } - setInterval(timeCheck, 500); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - let duration = this.formatDuration(video.duration); - if (duration == '00:00') duration = 'Live Stream'; - return { - url: `https://www.youtube.com/watch?v=${video.raw.id}`, - title: video.title, - duration, - thumbnail: video.thumbnails.high.url, - voiceChannel - }; - } - // prettier-ignore - formatDuration(durationObj) { - const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${ - durationObj.minutes ? durationObj.minutes : '00' - }:${ - (durationObj.seconds < 10) - ? ('0' + durationObj.seconds) - : (durationObj.seconds - ? durationObj.seconds - : '00') - }`; - return duration; - } -}; */
\ No newline at end of file diff --git a/src/commands/voice/join.ts b/src/commands/voice/join.ts deleted file mode 100644 index f1b761d..0000000 --- a/src/commands/voice/join.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class JoinVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'join', - group: 'voice', - memberName: 'join', - description: 'Tells uwufier to join your voice channel.', - examples: ['uwu!join'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - } - }); - } - //@ts-ignore - run(msg: CommandoMessage) { - msg.reply(`\`uwu!join\` has been depricated in favour of a simpler user expirience. Uwufier will now join your channel whenever you request to play something with \`uwu!play\`! ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/commands/voice/leave.ts b/src/commands/voice/leave.ts deleted file mode 100644 index 28c6250..0000000 --- a/src/commands/voice/leave.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class LeaveVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'leave', - aliases: ['end', 'stop'], - group: 'voice', - memberName: 'leave', - description: 'Leaves voice channel and stops currently playing audio.', - guildOnly: true, - examples: ['uwu!leave', 'uwu!end', 'uwu!stop'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - //@ts-ignore - run(msg: CommandoMessage) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - //@ts-ignore - if (!msg.guild.musicData.queue) - return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); - //@ts-ignore - msg.guild.musicData.songDispatcher.end(); - //@ts-ignore - msg.guild.musicData.queue.length = 0; - return; - } -};
\ No newline at end of file diff --git a/src/commands/voice/loop.ts b/src/commands/voice/loop.ts deleted file mode 100644 index a12c4e8..0000000 --- a/src/commands/voice/loop.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class LoopVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'loop', - aliases: ['repeat'], - group: 'voice', - memberName: 'loop', - description: 'Loops currently playing track.', - guildOnly: true, - examples: ['uwu!loop', 'uwu!repeat'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - //@ts-ignore - run(msg: CommandoMessage) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - //@ts-ignore - msg.say(`${msg.guild.musicData.nowPlaying.title} added to queue. ` + emoji.random()); - //@ts-ignore - msg.guild.musicData.queue.unshift(msg.guild.musicData.nowPlaying); - return; - } -};
\ No newline at end of file diff --git a/src/commands/voice/minecraft.ts b/src/commands/voice/minecraft.ts deleted file mode 100644 index 742ddde..0000000 --- a/src/commands/voice/minecraft.ts +++ /dev/null @@ -1,209 +0,0 @@ -//@ts-nocheck -import ytdl from 'ytdl-core'; -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import Youtube from 'simple-youtube-api'; -//const { youtubeAPI } = require('../../config.json'); -import config from '../../config.json'; -const youtube = new Youtube(config['yt-api-key']); -import emoji from 'emoji-random'; - -module.exports = class MinecraftVoice extends Command { - constructor(client) { - super(client, { - name: 'minecraft', - aliases: ['minecraftsountrack', 'minecraft-soundtrack', 'mcs', 'mc-s'], - group: 'voice', - memberName: 'minecraft', - description: 'Plays the Minecraft soundtrack.', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: [ - 'uwu!minecraft', - 'uwu!minecraftsountrack', - 'uwu!minecraft-soundtrack', - 'uwu!mcs', - 'uwu!mc-s' - ], - throttling: { - usages: 1, - duration: 60 - }, - }); - } - async run(msg: CommandoMessage) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); - - const playlist = await youtube.getPlaylist('https://www.youtube.com/watch?v=05UM-i4PuOY&list=PLxOTV5xn7n1i2HcKtRBthP2loWjrBGAIY').catch(function () { - return msg.say('There was a problem getting the soundtrack. ' + emoji.random()); - }); - // remove the 10 if you removed the queue limit conditions below - const videosObj = await playlist.getVideos(24).catch(function () { - return msg.say( - 'There was a problem getting the soundtrack. ' + emoji.random() - ); - }); - for (let i = 0; i < videosObj.length; i++) { - const video = await videosObj[i].fetch(); - // this can be uncommented if you choose to limit the queue - // if (msg.guild.musicData.queue.length < 10) { - // - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - // } else { - // return msg.say( - // `I can't play the full playlist because there will be more than 10 songs in queue` - // ); - // } - } - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say( - 'Now playing the Minecraft soundtrack. ' + emoji.random() - ); - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .getVideoByID(videos[videoIndex - 1].id) - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say('Now playing the Minecraft soundtrack. ' + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'An error has occured when trying to get the video ID from YouTube. ' + emoji.random() - ); - }); - }); - } - playSong(queue, msg: CommandoMessage) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - ytdl(queue[0].url, { - quality: 'highestaudio', - highWaterMark: 1024 * 1024 * 10 - }) - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xFFCC4D) - .addField('Now Playing:', queue[0].title) - .addField('Duration:', queue[0].duration); - if (queue[1]) videoEmbed.addField('Next Song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('Can\'t play soundtrack. ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - let duration = this.formatDuration(video.duration); - if (duration == '00:00') duration = 'Live Stream'; - return { - url: `https://www.youtube.com/watch?v=${video.raw.id}`, - title: video.title, - duration, - thumbnail: video.thumbnails.high.url, - voiceChannel - }; - } - // prettier-ignore - formatDuration(durationObj) { - const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${ - durationObj.minutes ? durationObj.minutes : '00' - }:${ - (durationObj.seconds < 10) - ? ('0' + durationObj.seconds) - : (durationObj.seconds - ? durationObj.seconds - : '00') - }`; - return duration; - } -};
\ No newline at end of file diff --git a/src/commands/voice/pause.ts b/src/commands/voice/pause.ts deleted file mode 100644 index 500a320..0000000 --- a/src/commands/voice/pause.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class PauseVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'pause', - group: 'voice', - memberName: 'pause', - description: 'Pauses audio of previously playing.', - guildOnly: true, - examples: ['uwu!pause'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - //@ts-ignore - run(msg: CommandoMessage) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - msg.say('Song paused :pause_button:'); - - //@ts-ignore - msg.guild.musicData.songDispatcher.pause(); - } -};
\ No newline at end of file diff --git a/src/commands/voice/play.ts b/src/commands/voice/play.ts deleted file mode 100644 index 97858a3..0000000 --- a/src/commands/voice/play.ts +++ /dev/null @@ -1,297 +0,0 @@ -//@ts-nocheck -import ytdl from 'ytdl-core'; -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import Youtube from 'simple-youtube-api'; -//const { youtubeAPI } = require('../../config.json'); -import config from '../../config.json'; -const youtube = new Youtube(config['yt-api-key']); -import emoji from 'emoji-random'; -const volume = 100 / 100 / 25; - -module.exports = class PlayVoice extends Command { - constructor(client) { - super(client, { - name: 'play', - group: 'voice', - memberName: 'play', - description: 'Play the audio of a YouTube video in a voice channel. (Other audio providers coming soon!)', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - args: [ - { - key: 'query', - prompt: 'What song would you like to hear?', - type: 'string', - validate: function (query) { - return query.length > 0 && query.length < 200; - } - } - ], - examples: [ - 'uwu!play https://www.youtube.com/watch?v=dQw4w9WgXcQ', - 'uwu!play despacito' - ], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage, { query }) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); - - if ( - // if the user entered yt playlist url - query.match( - /^(?!.*\?.*\bv=)https:\/\/www\.youtube\.com\/.*\?.*\blist=.*$/ - ) - ) { - const playlist = await youtube.getPlaylist(query).catch(function () { - return msg.say('Playlist is either private or it does not exist. ' + emoji.random()); - }); - // remove the 10 if you removed the queue limit conditions below - const videosObj = await playlist.getVideos(10).catch(function () { - return msg.say( - 'There was a problem getting one or more of the videos in the playlist. ' + emoji.random() - ); - }); - for (let i = 0; i < videosObj.length; i++) { - const video = await videosObj[i].fetch(); - // this can be uncommented if you choose to limit the queue - // if (msg.guild.musicData.queue.length < 10) { - // - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - // } else { - // return msg.say( - // `I can't play the full playlist because there will be more than 10 songs in queue` - // ); - // } - } - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say( - `Playlist - :musical_note: ${playlist.title} :musical_note: has been added to queue. ` + emoji.random() - ); - } - } - - // This if statement checks if the user entered a youtube url, it can be any kind of youtube url - if (query.match(/^(http(s)?:\/\/)?((w){3}.)?youtu(be|.be)?(\.com)?\/.+/)) { - query = query - .replace(/(>|<)/gi, '') - .split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); - const id = query[2].split(/[^0-9a-z_\-]/i)[0]; - const video = await youtube.getVideoByID(id).catch(function () { - return msg.say( - 'There was a problem getting the video you provided. ' + emoji.random() - ); - }); - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - } - - // if user provided a song/video name - const videos = await youtube.searchVideos(query, 5).catch(function () { - return msg.say( - 'There was a problem searching the video you requested. ' + emoji.random() - ); - }); - if (videos.length < 5) { - return msg.say( - `There was some trouble finding what you were looking for, please try again or be more specific. ` + emoji.random() - ); - } - const vidNameArr = []; - for (let i = 0; i < videos.length; i++) { - vidNameArr.push(`${i + 1}: ${videos[i].title}`); - } - vidNameArr.push('exit'); - const embed = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle('Please choose a song (1 to 5) ' + emoji.random()) - .addField(``, '**Song #**' + vidNameArr[0]) - .addField(``, '**Song #**' + vidNameArr[1]) - .addField(``, '**Song #**' + vidNameArr[2]) - .addField(``, '**Song #**' + vidNameArr[3]) - .addField(``, '**Song #**' + vidNameArr[4]) - .addField(``, '**Exit selection**: ' + 'exit'); - var songEmbed = await msg.say({ - embed - }); - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .getVideoByID(videos[videoIndex - 1].id) - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'An error has occured when trying to get the video ID from YouTube. ' + emoji.random() - ); - }); - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'Try again and enter a number between 1 and 5 or exit. ' + emoji.random() - ); - }); - } - playSong(queue, msg: CommandoMessage) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - msg.guild.musicData.volume = volume; - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - ytdl(queue[0].url, { - quality: 'highestaudio', - highWaterMark: 1024 * 1024 * 10 - }) - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xFFCC4D) - .addField('Now playing:', queue[0].title) - .addField('Duration:', queue[0].duration); - if (queue[1]) videoEmbed.addField('Next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('Can\'t play song. ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - let duration = this.formatDuration(video.duration); - if (duration == '00:00') duration = 'Live Stream'; - return { - url: `https://www.youtube.com/watch?v=${video.raw.id}`, - title: video.title, - duration, - thumbnail: video.thumbnails.high.url, - voiceChannel - }; - } - // prettier-ignore - formatDuration(durationObj) { - const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${ - durationObj.minutes ? durationObj.minutes : '00' - }:${ - (durationObj.seconds < 10) - ? ('0' + durationObj.seconds) - : (durationObj.seconds - ? durationObj.seconds - : '00') - }`; - return duration; - } -}; diff --git a/src/commands/voice/psycho.ts b/src/commands/voice/psycho.ts deleted file mode 100644 index e8f14bc..0000000 --- a/src/commands/voice/psycho.ts +++ /dev/null @@ -1,203 +0,0 @@ -//@ts-nocheck -import ytdl from 'ytdl-core'; -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import Youtube from 'simple-youtube-api'; -//const { youtubeAPI } = require('../../config.json'); -import config from '../../config.json'; -const youtube = new Youtube(config['yt-api-key']); -import emoji from 'emoji-random'; - -module.exports = class PsychoVoice extends Command { - constructor(client) { - super(client, { - name: 'psycho', - group: 'voice', - memberName: 'psycho', - description: 'Plays Psycho by Mase.', - guildOnly: true, - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: ['uwu!psycho'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - async run(msg: CommandoMessage, { query }) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.say('Please join a channel and try again. ' + emoji.random()); - - const id = 'fnd_HSmAODs'; - const video = await youtube.getVideoByID(id).catch(function () { - return msg.say( - 'There was a problem getting the video you provided. ' + emoji.random() - ); - }); - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // return msg.say("I don't support live streams!"); - // } - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // return msg.say('I cannot play videos longer than 1 hour'); - // } - // // can be uncommented if you want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - this.constructSongObj(video, voiceChannel) - ); - if ( - msg.guild.musicData.isPlaying == false || - typeof msg.guild.musicData.isPlaying == 'undefined' - ) { - msg.guild.musicData.isPlaying = true; - return this.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - - var that = this; - msg.channel - .awaitMessages( - function (msg) { - return (msg.content > 0 && msg.content < 6) || msg.content === 'exit'; - }, { - max: 1, - time: 60000, - errors: ['time'] - } - ) - .then(function (response) { - const videoIndex = parseInt(response.first().content); - if (response.first().content === 'exit') return songEmbed.delete(); - youtube - .getVideoByID(videos[videoIndex - 1].id) - .then(function (video) { - // // can be uncommented if you don't want the bot to play live streams - // if (video.raw.snippet.liveBroadcastContent === 'live') { - // songEmbed.delete(); - // return msg.say("I don't support live streams!"); - // } - - // // can be uncommented if you don't want the bot to play videos longer than 1 hour - // if (video.duration.hours !== 0) { - // songEmbed.delete(); - // return msg.say('I cannot play videos longer than 1 hour'); - // } - - // // can be uncommented if you don't want to limit the queue - // if (msg.guild.musicData.queue.length > 10) { - // songEmbed.delete(); - // return msg.say( - // 'There are too many songs in the queue already, skip or wait a bit' - // ); - // } - msg.guild.musicData.queue.push( - that.constructSongObj(video, voiceChannel) - ); - if (msg.guild.musicData.isPlaying == false) { - msg.guild.musicData.isPlaying = true; - if (songEmbed) { - songEmbed.delete(); - } - that.playSong(msg.guild.musicData.queue, msg); - } else if (msg.guild.musicData.isPlaying == true) { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say(`${video.title} added to queue. ` + emoji.random()); - } - }) - .catch(function () { - if (songEmbed) { - songEmbed.delete(); - } - return msg.say( - 'An error has occured when trying to get the video ID from YouTube. ' + emoji.random() - ); - }); - }); - } - playSong(queue, msg: CommandoMessage) { - const classThis = this; // use classThis instead of 'this' because of lexical scope below - queue[0].voiceChannel - .join() - .then(function (connection) { - const dispatcher = connection - .play( - ytdl(queue[0].url, { - quality: 'highestaudio', - highWaterMark: 1024 * 1024 * 10 - }) - ) - .on('start', function () { - msg.guild.musicData.songDispatcher = dispatcher; - const volume = 100 / 100; - msg.guild.musicData.volume = volume; - dispatcher.setVolume(msg.guild.musicData.volume); - const videoEmbed = new MessageEmbed() - .setThumbnail(queue[0].thumbnail) - .setColor(0xFFCC4D) - .addField('Now playing:', queue[0].title) - .addField('Duration:', queue[0].duration); - if (queue[1]) videoEmbed.addField('Next song:', queue[1].title); - msg.say(videoEmbed); - msg.guild.musicData.nowPlaying = queue[0]; - return queue.shift(); - }) - .on('finish', function () { - if (queue.length >= 1) { - return classThis.playSong(queue, msg); - } else { - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - } - }) - .on('error', function (e) { - msg.say('Can\'t play song ' + emoji.random()); - console.error(e); - msg.guild.musicData.queue.length = 0; - msg.guild.musicData.isPlaying = false; - msg.guild.musicData.nowPlaying = null; - msg.guild.musicData.songDispatcher = null; - return msg.guild.me.voice.channel.leave(); - }); - }) - .catch(function (e) { - console.error(e); - return msg.guild.me.voice.channel.leave(); - }); - } - constructSongObj(video, voiceChannel) { - let duration = this.formatDuration(video.duration); - if (duration == '00:00') duration = 'Live Stream'; - return { - url: `https://www.youtube.com/watch?v=${video.raw.id}`, - title: video.title, - duration, - thumbnail: video.thumbnails.high.url, - voiceChannel - }; - } - // prettier-ignore - formatDuration(durationObj) { - const duration = `${durationObj.hours ? (durationObj.hours + ':') : ''}${ - durationObj.minutes ? durationObj.minutes : '00' - }:${ - (durationObj.seconds < 10) - ? ('0' + durationObj.seconds) - : (durationObj.seconds - ? durationObj.seconds - : '00') - }`; - return duration; - } -};
\ No newline at end of file diff --git a/src/commands/voice/queue.ts b/src/commands/voice/queue.ts deleted file mode 100644 index f8afedd..0000000 --- a/src/commands/voice/queue.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed }from 'discord.js'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class QueueVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'queue', - aliases: [ - 'q', - 'song-list', - 'next-songs', - 'songlist', - 'nextsongs', - 'nextsong', - 'next-song' - ], - group: 'voice', - memberName: 'queue', - description: 'Displays the current track queue.', - guildOnly: true, - examples: [ - 'uwu!queue', - 'uwu!q', - 'uwu!songlist', - 'uwu!song-list', - 'uwu!nextsong', - 'uwu!next-song', - 'uwu!nextsongs', - 'uwu!next-songs' - ], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - //@ts-ignore - if (msg.guild.musicData.queue.length == 0) - return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); - //@ts-ignore - const titleArray = []; - //@ts-ignore - msg.guild.musicData.queue.map(obj => { - titleArray.push(obj.title); - }); - let queueEmbed = new MessageEmbed() - .setColor(0xFFCC4D) - .setTitle('Music Queue ' + emoji.random()); - for (let i = 0; i < titleArray.length; i++) { - //@ts-ignore - queueEmbed.addField(``, `**${i + 1}**: ` + `${titleArray[i]}`); - } - return msg.say(queueEmbed); - } -};
\ No newline at end of file diff --git a/src/commands/voice/remove.ts b/src/commands/voice/remove.ts deleted file mode 100644 index 993a368..0000000 --- a/src/commands/voice/remove.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class RemoveVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'remove', - group: 'voice', - memberName: 'remove', - description: 'Removes a song from the current queue.', - guildOnly: true, - args: [ - { - key: 'songNumber', - prompt: 'What song would you like to remove from the current queue?', - type: 'integer' - } - ], - examples: ['uwu!remove 2'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage, { songNumber }: any) { - //@ts-ignore - if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { - return msg.reply('Please enter a valid song. ' + emoji.random()); - } - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - //@ts-ignore - msg.guild.musicData.queue.splice(songNumber - 1, 1); - return msg.say(`Removed song **#${songNumber}** from current queue. ` + emoji.random()); - } -};
\ No newline at end of file diff --git a/src/commands/voice/resume.ts b/src/commands/voice/resume.ts deleted file mode 100644 index 208fba5..0000000 --- a/src/commands/voice/resume.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class ResumeVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'resume', - group: 'voice', - memberName: 'resume', - description: 'Resumes audio of previously paused.', - guildOnly: true, - examples: ['uwu!resume'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ') + emoji.random(); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - msg.say('Song resumed :play_pause:'); - - //@ts-ignore - msg.guild.musicData.songDispatcher.resume(); - } -};
\ No newline at end of file diff --git a/src/commands/voice/shuffle.ts b/src/commands/voice/shuffle.ts deleted file mode 100644 index 7429f27..0000000 --- a/src/commands/voice/shuffle.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class ShuffleVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'shuffle', - group: 'voice', - memberName: 'shuffle', - description: 'Shuffles the current track queue.', - guildOnly: true, - examples: ['uwu!shuffle'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - //@ts-ignore - if (msg.guild.musicData.queue.length < 1) - return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); - - //@ts-ignore - shuffleQueue(msg.guild.musicData.queue); - - //@ts-ignore - const titleArray = []; - //@ts-ignore - msg.guild.musicData.queue.map(obj => { - titleArray.push(obj.title); - }); - var queueEmbed = new MessageEmbed() - .setColor(0xF97DAE) - .setTitle('New Music Queue ' + emoji.random()); - for (let i = 0; i < titleArray.length; i++) { - //@ts-ignore - queueEmbed.addField(`${i + 1}:`, `${titleArray[i]}`); - } - return msg.say(queueEmbed); - } -}; - -function shuffleQueue(queue: any) { - for (let i = queue.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [queue[i], queue[j]] = [queue[j], queue[i]]; - } -}
\ No newline at end of file diff --git a/src/commands/voice/skip.ts b/src/commands/voice/skip.ts deleted file mode 100644 index b4cef15..0000000 --- a/src/commands/voice/skip.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class SkipVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'skip', - group: 'voice', - memberName: 'skip', - description: 'Skip one song ahead in the current queue.', - guildOnly: true, - examples: ['uwu!skip'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - //@ts-ignore - run(msg: CommandoMessage) { - const voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - //@ts-ignore - msg.guild.musicData.songDispatcher.end(); - } -};
\ No newline at end of file diff --git a/src/commands/voice/skipall.ts b/src/commands/voice/skipall.ts deleted file mode 100644 index c7e0333..0000000 --- a/src/commands/voice/skipall.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class SkipAllVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'skipall', - aliases: [ - 'endqueue', - 'endq', - 'skipqueue', - 'skipq' - ], - group: 'voice', - memberName: 'skipall', - description: 'Removes all the songs from current queue.', - guildOnly: true, - examples: [ - 'uwu!endqueue', - 'uwu!endq', - 'uwu!skipqueue', - 'uwu!skipq' - ], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - //@ts-ignore - run(msg: CommandoMessage) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - //@ts-ignore - if (!msg.guild.musicData.queue) - return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); - //@ts-ignore - msg.guild.musicData.songDispatcher.end(); - //@ts-ignore - msg.guild.musicData.queue.length = 0; // clear queue - return; - } -};
\ No newline at end of file diff --git a/src/commands/voice/skipto.ts b/src/commands/voice/skipto.ts deleted file mode 100644 index ee4a7ba..0000000 --- a/src/commands/voice/skipto.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class SkipToVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'skipto', - group: 'voice', - memberName: 'skipto', - description: 'Skip to a certain song in the current queue.', - guildOnly: true, - args: [{ - key: 'songNumber', - prompt: 'What song would you like to skip to in the current queue?', - type: 'integer' - }], - examples: ['uwu!skipto 5'], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - //@ts-ignore - run(msg: CommandoMessage, { songNumber }: any) { - //@ts-ignore - if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { - return msg.reply('Please enter a valid song. ' + emoji.random()); - } - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - //@ts-ignore - if (msg.guild.musicData.queue < 1) - return msg.reply('There aren\'t any songs in the current queue. ' + emoji.random()); - - //@ts-ignore - msg.guild.musicData.queue.splice(0, songNumber - 1); - //@ts-ignore - msg.guild.musicData.songDispatcher.end(); - return; - } -};
\ No newline at end of file diff --git a/src/commands/voice/volume.ts b/src/commands/voice/volume.ts deleted file mode 100644 index 5678101..0000000 --- a/src/commands/voice/volume.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore -import emoji from 'emoji-random'; - -module.exports = class VolumeVoice extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'volume', - aliases: ['vol'], - group: 'voice', - memberName: 'volume', - description: 'Changes volume of any currently playing audio.', - guildOnly: true, - args: [ - { - key: 'wantedVol', - prompt: 'What would volume you like? (1 to 200)', - type: 'integer', - validate: (wantedVol: number) => wantedVol >= 1 && wantedVol <= 200 - } - ], - examples: [ - 'uwu!volume 20', - 'uwu!vol 50' - ], - clientPermissions: ['SPEAK', 'CONNECT', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage, { wantedVol }: any) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - - //@ts-ignore - if (typeof msg.guild.musicData.songDispatcher == 'undefined' || - //@ts-ignore - msg.guild.musicData.songDispatcher == null) { - return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); - } - - const volume = wantedVol / 100; - //@ts-ignore - msg.guild.musicData.volume = volume; - //@ts-ignore - msg.guild.musicData.songDispatcher.setVolume(volume); - return msg.reply(`Volume is now: **${wantedVol}%**. ` + emoji.random()); - } -};
\ No newline at end of file diff --git a/src/commands/zerotwo/darling.ts b/src/commands/zerotwo/darling.ts deleted file mode 100644 index 2f52ed4..0000000 --- a/src/commands/zerotwo/darling.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no @types -import emoji from 'emoji-random'; -import Darling from '../../models/darling.js'; -import mongo from 'mongoose'; -import config from '../../config.json'; -mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -module.exports = class DarlingZeroTwo extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'darling', - group: 'zerotwo', - memberName: 'darling', - description: 'Allows you to set, change or delete uwufier\'s darling.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: [ - 'uwu!darling', - 'uwu!darling set', - 'uwu!darling remove' - ], - args: [ - { - key: 'darlingName', - prompt: 'Who should the darling be?', - type: 'string', - default: '' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - //TODO: this - //@ts-ignore this is not asnc - async run(msg: CommandoMessage, { darlingName }: any) { // this is actually a string - const darling = new Darling({ - _id: mongo.Types.ObjectId(), - username: msg.author.username, - userID: msg.author.id, - guildname: msg.guild.name, - guildID: msg.guild.id, - time: msg.createdAt - }) - // const guildExist = await Darling.findOne({ guildID: msg.guild.id }) - - Darling.findOne({ guildID: msg.guild.id }, async (error, guild) => { - if (error) { - return console.log(error) - } else if (guild && darlingName == 'remove') { - // @ts-ignore linting error shows that channelID doesnt exist when it does - if (msg.author.id == guild.userID || msg.author.id == msg.guild.owner.id) { - await Darling.findOneAndDelete({ guildID: msg.guild.id }) - return msg.say('The current darling has been removed. ' + emoji.random()) - } else { - return msg.reply('Only my darling or the guild owner can remove the current darling. ' + emoji.random()) - } - } else if (!guild && darlingName == 'remove') { - return msg.reply('There is no darling set in this server. ' + emoji.random()) - } else if (guild && darlingName == 'set') { - // @ts-ignore linting error shows that channelID doesnt exist when it does - return msg.reply(`I already have a darling! It\'s <@${guild.userID}>! To set a new darling, either the current darling or the guild owner has to do \`uwu!darling remove\`. ` + emoji.random()) - } else if (!guild && darlingName == 'set') { - await darling.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - - const quotes = [ - 'I think I have taken a liking to you. Won\'t you be my darling?', - 'I like the look in your eyes. It makes my heart race. You are now my darling!', - 'Wow, your taste makes my heart race. It bites and lingers... The taste of danger. You are now my darling!' - ] - let quoteNum = quotes[Math.floor(Math.random() * quotes.length)] - return msg.reply(quoteNum) - } else if (!guild) { - return msg.reply('I haven\'t found my darling yet! To set one, do `uwu!darling set`. ' + emoji.random()) - } else if (guild) { - // @ts-ignore linting error shows that channelID doesnt exist when it does - return msg.reply(`My darling is <@${guild.userID}>. ` + emoji.random()) - } - }) - - // if (guildExist && darlingName == 'remove') { - // await Darling.findOneAndDelete({ guildID: msg.guild.id }) - // msg.say('The current darling has been removed.') - // } else if (!guildExist && darlingName == 'remove') { - // msg.reply('There is no darling set in this server.') - // } else if (darlingName || darlingName == 'set') { - // await darling.save().then(result => console.log(result)).catch(err => console.log(err)) - - // var quoteNum = Math.floor((Math.random() * 3) + 1); - // switch (quoteNum) { - // case 1: var quoteResult = 'I think I have taken a liking to you. Won\'t you be my darling?'; break - // case 2: var quoteResult = 'I like the look in your eyes. It makes my heart race. You are now my darling!'; break - // case 3: var quoteResult = 'Wow, your taste makes my heart race. It bites and lingers... The taste of danger. You are now my darling!'; break - // default: var quoteResult = 'I think I have taken a liking to you. Won\'t you be my darling?'; break - // } - // msg.reply(quoteResult) - // } else if (!guildExist) { - // msg.reply('I haven\'t found my darling yet!') - // } else if (guildExist) { - // await Darling.findOne({ userID: msg.author.id }, (err) => { - // if (err) console.log(err) - // }).then(res => { - // msg.reply(`My darling is <@${res.userID}>`) - // }) - // //msg.reply(`My darling is <@${result.userID}>`) - // } else { - // console.error() - // } - } -};
\ No newline at end of file diff --git a/src/commands/zerotwo/douse.ts b/src/commands/zerotwo/douse.ts deleted file mode 100644 index d9cdca3..0000000 --- a/src/commands/zerotwo/douse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class DouseZeroTwo extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'douse', - group: 'zerotwo', - memberName: 'douse', - description: 'Douses Zero Two.', - examples: [ - 'uwu!douse' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - let emb = new MessageEmbed() - .setColor(0xFFD0DF) - .setImage('https://i.pinimg.com/originals/6a/c8/26/6ac826e3d0cbd64eb4f42c12a73fcdb8.gif') - return msg.say(emb) - } -};
\ No newline at end of file diff --git a/src/commands/zerotwo/zerotwo.ts b/src/commands/zerotwo/zerotwo.ts deleted file mode 100644 index ba9602a..0000000 --- a/src/commands/zerotwo/zerotwo.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -// @ts-ignore no types -import emoji from 'emoji-random'; - -module.exports = class ZeroTwoZeroTwo extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'zerotwo', - group: 'zerotwo', - memberName: 'zerotwo', - description: 'Zero Two.', - examples: [ - 'uwu!zerotwo' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - throttling: { - usages: 5, - duration: 30 - }, - }); - } - run(msg: CommandoMessage) { - return msg.reply(`Zero Two is the best waifu of all, literally no one else can compare. Unironically she is the best waifu of all time. Literally praise her. This is not a joke she is literally the best. ${emoji.random()}`) - } -};
\ No newline at end of file diff --git a/src/config.json b/src/config.json deleted file mode 100644 index 60b479c..0000000 --- a/src/config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A", - "secret-dev":"NzEyMDg4MzY5MjA2OTE5MjY5.XsMeEw.Yy0a8m2vZLDbPi7cZ8aqCalMR68", - "yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8", - "version":"1.10.46", - "fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a", - "mongodburi": "mongodb://sin:[email protected]:47107/heroku_4qrjvmb9", - "validUsers": [ - "217348698294714370", - "612779586065006641", - "385964717480476684", - "649676743195754550", - "630042587914436648" - ] -} 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 diff --git a/src/server.ts b/src/server.ts deleted file mode 100644 index 11576f1..0000000 --- a/src/server.ts +++ /dev/null @@ -1,50 +0,0 @@ -//@ts-nocheck //TODO: this - -import express from 'express'; -import bodyParser from 'body-parser'; - -class WebSocket { - client: any; - app: any; - server: any; - constructor(port: any, client: any) { - this.client = client; - - this.app = express() - this.app.use(bodyParser.urlencoded({ extended: false })) - this.app.use(bodyParser.json()) - - this.registerRoots() - - this.server = this.app.listen(port, () => { - console.log('\x1b[0m' + 'Listening on port: ' + '\x1b[36m' + this.server.address().port) - }) - } - // http://localhost:port?token=123456 - registerRoots() { - this.app.all('*', function (req, res, next) { - res.header('Access-Control-Allow-Origin', '*'); - res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS'); - res.header('Access-Control-Allow-Headers', 'Content-Type'); - next(); - }); - - this.app.get('/', (req, res) => { - res.redirect('https://kyzer.co/discord/bots/uwufier/') - }) - this.app.get('/api/v1/commands/', async (req, res) => { - res.json({ commands: await this.client.registry.commands.size }) - }); - this.app.get('/api/v1/groups/', async (req, res) => { - res.json({ groups: await this.client.registry.groups.size }) - }); - this.app.get('/api/v1/commands/groups/', async (req, res) => { - res.json({ groups: await this.client.registry.groups.size }) - }); - this.app.get('/api/v1/guilds/', async (req, res) => { - res.json({ guilds: await this.client.guilds.cache.size }) - }); - } -} - -module.exports = WebSocket
\ No newline at end of file diff --git a/src/types/image.ts b/src/types/image.ts deleted file mode 100644 index 27ed336..0000000 --- a/src/types/image.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { ArgumentType, CommandoClient, CommandoMessage, Argument } from 'discord.js-commando'; -const fileTypeRe = /\.(jpe?g|png|gif)$/i; -import request from 'node-superfetch'; - -module.exports = class ImageArgumentType extends ArgumentType { - constructor(client: CommandoClient) { - super(client, 'image'); - } - //@ts-ignore - async validate(value: any, msg: CommandoMessage, arg: Argument) { - const attachment = msg.attachments.first(); - if (attachment) { - if (!attachment.height || !attachment.width) return false; - if (attachment.size > 8e+6) return 'Please provide an image under 8 MB.'; - //@ts-ignore type undefined is not assignable to type whatever - if (!fileTypeRe.test(attachment.name)) return 'Please only send PNG, JPG, or GIF format images.'; - return true; - } - if (fileTypeRe.test(value.toLowerCase())) { - try { - await request.get(value); - return true; - } catch { - return false; - } - } - return this.client.registry.types.get('user')?.validate(value, msg, arg); - } - async parse(value: any, msg: CommandoMessage, arg: Argument) { - const attachment = msg.attachments.first(); - if (attachment) return attachment.url; - if (fileTypeRe.test(value.toLowerCase())) return value; - const user = await this.client.registry.types.get('user')?.parse(value, msg, arg); - return user.displayAvatarURL({ format: 'png', size: 512 }); - } - //@ts-ignore - isEmpty(value: any, msg: CommandoMessage, arg: Argument) { - if (msg.attachments.size) return false; - return this.client.registry.types.get('user')?.isEmpty(value, msg, arg); - } -};
\ No newline at end of file diff --git a/src/types/month.ts b/src/types/month.ts deleted file mode 100644 index fdb5333..0000000 --- a/src/types/month.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ArgumentType, CommandoClient } from 'discord.js-commando'; -import months from '../assets/json/month.json' - -module.exports = class MonthArgumentType extends ArgumentType { - constructor(client: CommandoClient) { - super(client, 'month'); - } - - validate(value: string) { - const num = Number.parseInt(value, 10); - if (num > 0 && num < 13) return true; - if (months.includes(value.toLowerCase())) return true; - return false; - } - - parse(value: string) { - const num = Number.parseInt(value, 10); - if (!Number.isNaN(num)) return num; - return months.indexOf(value.toLowerCase()) + 1; - } -};
\ No newline at end of file diff --git a/src/utils/Canvas.ts b/src/utils/Canvas.ts deleted file mode 100644 index 23ae558..0000000 --- a/src/utils/Canvas.ts +++ /dev/null @@ -1,185 +0,0 @@ -// TODO: all this -//@ts-nocheck -import { createCanvas } from 'canvas' - -module.exports = class CanvasUtil { - static greyscale(ctx, x, y, width, height) { - const data = ctx.getImageData(x, y, width, height); - for (let i = 0; i < data.data.length; i += 4) { - const brightness = (0.34 * data.data[i]) + (0.5 * data.data[i + 1]) + (0.16 * data.data[i + 2]); - data.data[i] = brightness; - data.data[i + 1] = brightness; - data.data[i + 2] = brightness; - } - ctx.putImageData(data, x, y); - return ctx; - } - - static invert(ctx, x, y, width, height) { - const data = ctx.getImageData(x, y, width, height); - for (let i = 0; i < data.data.length; i += 4) { - data.data[i] = 255 - data.data[i]; - data.data[i + 1] = 255 - data.data[i + 1]; - data.data[i + 2] = 255 - data.data[i + 2]; - } - ctx.putImageData(data, x, y); - return ctx; - } - - static silhouette(ctx, x, y, width, height) { - const data = ctx.getImageData(x, y, width, height); - for (let i = 0; i < data.data.length; i += 4) { - data.data[i] = 0; - data.data[i + 1] = 0; - data.data[i + 2] = 0; - } - ctx.putImageData(data, x, y); - return ctx; - } - - static sepia(ctx, x, y, width, height) { - const data = ctx.getImageData(x, y, width, height); - for (let i = 0; i < data.data.length; i += 4) { - const brightness = (0.34 * data.data[i]) + (0.5 * data.data[i + 1]) + (0.16 * data.data[i + 2]); - data.data[i] = brightness + 100; - data.data[i + 1] = brightness + 50; - data.data[i + 2] = brightness; - } - ctx.putImageData(data, x, y); - return ctx; - } - - static contrast(ctx, x, y, width, height) { - const data = ctx.getImageData(x, y, width, height); - const factor = (259 / 100) + 1; - const intercept = 128 * (1 - factor); - for (let i = 0; i < data.data.length; i += 4) { - data.data[i] = (data.data[i] * factor) + intercept; - data.data[i + 1] = (data.data[i + 1] * factor) + intercept; - data.data[i + 2] = (data.data[i + 2] * factor) + intercept; - } - ctx.putImageData(data, x, y); - return ctx; - } - - static distort(ctx, amplitude, x, y, width, height, strideLevel = 4) { - const data = ctx.getImageData(x, y, width, height); - const temp = ctx.getImageData(x, y, width, height); - const stride = width * strideLevel; - for (let i = 0; i < width; i++) { - for (let j = 0; j < height; j++) { - const xs = Math.round(amplitude * Math.sin(2 * Math.PI * 3 * (j / height))); - const ys = Math.round(amplitude * Math.cos(2 * Math.PI * 3 * (i / width))); - const dest = (j * stride) + (i * strideLevel); - const src = ((j + ys) * stride) + ((i + xs) * strideLevel); - data.data[dest] = temp.data[src]; - data.data[dest + 1] = temp.data[src + 1]; - data.data[dest + 2] = temp.data[src + 2]; - } - } - ctx.putImageData(data, x, y); - return ctx; - } - - static hasAlpha(image) { - const canvas = createCanvas(image.width, image.height); - const ctx = canvas.getContext('2d'); - ctx.drawImage(image, 0, 0); - const data = ctx.getImageData(0, 0, canvas.width, canvas.height); - let hasAlphaPixels = false; - for (let i = 3; i < data.data.length; i += 4) { - if (data.data[i] < 255) { - hasAlphaPixels = true; - break; - } - } - return hasAlphaPixels; - } - - static drawImageWithTint(ctx, image, color, x, y, width, height) { - const { fillStyle, globalAlpha } = ctx; - ctx.fillStyle = color; - ctx.drawImage(image, x, y, width, height); - ctx.globalAlpha = 0.5; - ctx.fillRect(x, y, width, height); - ctx.fillStyle = fillStyle; - ctx.globalAlpha = globalAlpha; - } - - static shortenText(ctx, text, maxWidth) { - let shorten = false; - while (ctx.measureText(text).width > maxWidth) { - if (!shorten) shorten = true; - text = text.substr(0, text.length - 1); - } - return shorten ? `${text}...` : text; - } - - static wrapText(ctx, text, maxWidth) { - return new Promise(resolve => { - if (ctx.measureText(text).width < maxWidth) return resolve([text]); - if (ctx.measureText('W').width > maxWidth) return resolve(null); - const words = text.split(' '); - const lines = []; - let line = ''; - while (words.length > 0) { - let split = false; - while (ctx.measureText(words[0]).width >= maxWidth) { - const temp = words[0]; - words[0] = temp.slice(0, -1); - if (split) { - words[1] = `${temp.slice(-1)}${words[1]}`; - } else { - split = true; - words.splice(1, 0, temp.slice(-1)); - } - } - if (ctx.measureText(`${line}${words[0]}`).width < maxWidth) { - line += `${words.shift()} `; - } else { - lines.push(line.trim()); - line = ''; - } - if (words.length === 0) lines.push(line.trim()); - } - return resolve(lines); - }); - } - - static centerImage(base, data) { - const dataRatio = data.width / data.height; - const baseRatio = base.width / base.height; - let { width, height } = data; - let x = 0; - let y = 0; - if (baseRatio < dataRatio) { - height = data.height; - width = base.width * (height / base.height); - x = (data.width - width) / 2; - y = 0; - } else if (baseRatio > dataRatio) { - width = data.width; - height = base.height * (width / base.width); - x = 0; - y = (data.height - height) / 2; - } - return { x, y, width, height }; - } - - static centerImagePart(data, maxWidth, maxHeight, widthOffset, heightOffest) { - let { width, height } = data; - if (width > maxWidth) { - const ratio = maxWidth / width; - width = maxWidth; - height *= ratio; - } - if (height > maxHeight) { - const ratio = maxHeight / height; - height = maxHeight; - width *= ratio; - } - const x = widthOffset + ((maxWidth / 2) - (width / 2)); - const y = heightOffest + ((maxHeight / 2) - (height / 2)); - return { x, y, width, height }; - } -};
\ No newline at end of file diff --git a/src/utils/Util.ts b/src/utils/Util.ts deleted file mode 100644 index 4ad20a3..0000000 --- a/src/utils/Util.ts +++ /dev/null @@ -1,189 +0,0 @@ -import crypto from 'crypto'; -const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya', 'hai', 'si', 'sí', 'oui', 'はい', 'correct']; -const no = ['no', 'n', 'nah', 'nope', 'nop', 'iie', 'いいえ', 'non', 'fuck off']; - -module.exports = class Util { - static delay(ms: number) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - // TODO: maybe infer this - static shuffle(array: any) { - const arr = array.slice(0); - for (let i = arr.length - 1; i >= 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const temp = arr[i]; - arr[i] = arr[j]; - arr[j] = temp; - } - return arr; - } - - static list(arr: any[], conj = 'and') { - const len = arr.length; - if (len === 0) return ''; - if (len === 1) return arr[0]; - return `${arr.slice(0, -1).join(', ')}${len > 1 ? `${len > 2 ? ',' : ''} ${conj} ` : ''}${arr.slice(-1)}`; - } - - static shorten(text: string, maxLen = 2000) { - return text.length > maxLen ? `${text.substr(0, maxLen - 3)}...` : text; - } - - static randomRange(min: number, max: number) { - return Math.floor(Math.random() * (max - min + 1)) + min; - } - - static trimArray(arr: string[], maxLen = 10) { - if (arr.length > maxLen) { - const len = arr.length - maxLen; - arr = arr.slice(0, maxLen); - arr.push(`${len} more...`); - } - return arr; - } - - static removeDuplicates(arr: string | any[]) { - if (arr.length === 0 || arr.length === 1) return arr; - const newArr: any[] = []; - for (let i = 0; i < arr.length; i++) { - if (newArr.includes(arr[i])) continue; - newArr.push(arr[i]); - } - return newArr; - } - - static sortByName(arr: any[], prop: string | number) { - return arr.sort((a, b) => { - if (prop) return a[prop].toLowerCase() > b[prop].toLowerCase() ? 1 : -1; - return a.toLowerCase() > b.toLowerCase() ? 1 : -1; - }); - } - - static firstUpperCase(text: string, split = ' ') { - return text.split(split).map(word => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(' '); - } - - static formatNumber(number: string, minimumFractionDigits = 0) { - return Number.parseFloat(number).toLocaleString(undefined, { - minimumFractionDigits, - maximumFractionDigits: 2 - }); - } - - //TODO: maybe infer this - static base64(text: any, mode = 'encode') { - if (mode === 'encode') return Buffer.from(text).toString('base64'); - if (mode === 'decode') return Buffer.from(text, 'base64').toString('utf8') || null; - throw new TypeError(`${mode} is not a supported base64 mode.`); - } - - //TODO: maybe infer this - static hash(text: any, algorithm: any) { - return crypto.createHash(algorithm).update(text).digest('hex'); - } - - //TODO: maybe infer this - static streamToArray(stream: any) { - if (!stream.readable) return Promise.resolve([]); - return new Promise((resolve, reject) => { - const array: any = []; - function onData(data: any) { - array.push(data); - } - function onEnd(error: any) { - if (error) reject(error); - else resolve(array); - cleanup(); - } - function onClose() { - resolve(array); - cleanup(); - } - function cleanup() { - stream.removeListener('data', onData); - stream.removeListener('end', onEnd); - stream.removeListener('error', onEnd); - stream.removeListener('close', onClose); - } - stream.on('data', onData); - stream.on('end', onEnd); - stream.on('error', onEnd); - stream.on('close', onClose); - }); - } - - static percentColor(pct: number, percentColors: string | any[]) { - let i = 1; - for (i; i < percentColors.length - 1; i++) { - if (pct < percentColors[i].pct) { - break; - } - } - const lower = percentColors[i - 1]; - const upper = percentColors[i]; - const range = upper.pct - lower.pct; - const rangePct = (pct - lower.pct) / range; - const pctLower = 1 - rangePct; - const pctUpper = rangePct; - const color = { - r: Math.floor((lower.color.r * pctLower) + (upper.color.r * pctUpper)).toString(16).padStart(2, '0'), - g: Math.floor((lower.color.g * pctLower) + (upper.color.g * pctUpper)).toString(16).padStart(2, '0'), - b: Math.floor((lower.color.b * pctLower) + (upper.color.b * pctUpper)).toString(16).padStart(2, '0') - }; - return `#${color.r}${color.g}${color.b}`; - } - - static today(timeZone: number) { - const now = new Date(); - now.setHours(0); - now.setMinutes(0); - now.setSeconds(0); - now.setMilliseconds(0); - if (timeZone) now.setUTCHours(now.getUTCHours() + timeZone); - return now; - } - - static tomorrow(timeZone: any) { - const today = Util.today(timeZone); - today.setDate(today.getDate() + 1); - return today; - } - - static embedURL(title: any, url: string, display: any) { - return `[${title}](${url.replace(/\)/g, '%27')}${display ? ` "${display}"` : ''})`; - } - - static async verify(channel, user, { time = 30000, extraYes = [], extraNo = [] } = {}) { - const filter = res => { - const value = res.content.toLowerCase(); - return (user ? res.author.id === user.id : true) - && (yes.includes(value) || no.includes(value) || extraYes.includes(value) || extraNo.includes(value)); - }; - const verify = await channel.awaitMessages(filter, { - max: 1, - time - }); - if (!verify.size) return 0; - const choice = verify.first().content.toLowerCase(); - if (yes.includes(choice) || extraYes.includes(choice)) return true; - if (no.includes(choice) || extraNo.includes(choice)) return false; - return false; - } - - static cleanAnilistHTML(html) { - let clean = html - .replace(/\r|\n|\f/g, '') - .replace(/<br>/g, '\n') - .replace(/'/g, '\'') - .replace(/"/g, '"') - .replace(/<\/?i>/g, '*') - .replace(/<\/?b>/g, '**') - .replace(/~!|!~/g, '||') - .replace(/—/g, '—'); - if (clean.length > 2000) clean = `${clean.substr(0, 1995)}...`; - const spoilers = (clean.match(/\|\|/g) || []).length; - if (spoilers !== 0 && (spoilers && (spoilers % 2))) clean += '||'; - return clean; - } -};
\ No newline at end of file diff --git a/src/utils/gameDigHelper.ts b/src/utils/gameDigHelper.ts deleted file mode 100644 index 482c87a..0000000 --- a/src/utils/gameDigHelper.ts +++ /dev/null @@ -1,47 +0,0 @@ -//@ts-ignore no types -import ms from "ms"; -import { Util, MessageEmbed } from 'discord.js' - -/** -* Quickly create an embed for a GameDig status using values found in all responses -* @name gamedigHelper -* @param {Object} res Result from GameDig -* @returns {MessageEmbed} -*/ -module.exports = (res: any) => { - const playerCount = res.players.length - const maxPlayers = res.maxPlayers - - const emb = new MessageEmbed() - .setTitle(res.name) - .setFooter(`Took ${ms(res.ping)} to complete.`) - .addFields([ - { - name: 'Connect', - value: `${res.connect}` - }, - { - name: 'Online Players', - value: `${playerCount}/${maxPlayers} (${Math.round((playerCount / maxPlayers) * 100)}%)` - }, - { - name: 'Map', - value: Util.escapeMarkdown(res.map) - }, - { - name: 'Password Required', - value: res.password ? 'Yes' : 'No' - } - ]) - - const unconfirmedValues = new Map([ - [res.raw.secure, (secure: any) => emb.addField('Vac Secured', secure ? 'Yes' : 'No')], - [res.raw.games, game => emb.addField('Game', Util.escapeMarkdown(game))] - ]) - - unconfirmedValues.forEach((val, key) => { - if (typeof key !== 'undefined') val(key) - }) - - return emb -}
\ No newline at end of file diff --git a/src/utils/genCmdURL.ts b/src/utils/genCmdURL.ts deleted file mode 100644 index 0519de0..0000000 --- a/src/utils/genCmdURL.ts +++ /dev/null @@ -1 +0,0 @@ -module.exports = (cmd: { group: { name: string; }; name: any; }) => `/commands/${cmd.group.name.toLowerCase().replace(/\s/g, "-")}/${cmd.name}`;
\ No newline at end of file diff --git a/src/utils/simpleFormat.ts b/src/utils/simpleFormat.ts deleted file mode 100644 index 4564778..0000000 --- a/src/utils/simpleFormat.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** -* @name simpleFormat -* @param {number|string} value Value to format -* @returns {number} A number in fixed-point notation up to 2 decimal points -*/ -module.exports = (value: string) => { - const result = parseFloat(parseFloat(value).toFixed(2)); - return result; -};
\ No newline at end of file diff --git a/src/utils/stripWebhookURL.ts b/src/utils/stripWebhookURL.ts deleted file mode 100644 index 73a227c..0000000 --- a/src/utils/stripWebhookURL.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** -* Gets the ID and token for a webhook from a webhook URL from the Discord client -* @param {string} url URL for the webhook from the Discord client -* @returns {Object} Object with the webhook ID and token -*/ -module.exports = (url: string) => { - const regex = /https:\/\/discordapp\.com\/api\/webhooks\/(\d{1,})\/([\w-_]{1,})/; - const matches = regex.exec(url); - - //@ts-ignore dont care if null - return { id: matches[1], token: matches[2] }; -};
\ No newline at end of file diff --git a/src/utils/truncateText.ts b/src/utils/truncateText.ts deleted file mode 100644 index f2fa7d0..0000000 --- a/src/utils/truncateText.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** -* @param {string} string String to truncate -* @param {number} [number=2048] Number to truncate to -* @returns {string} Truncated string or original if string was short enough to begin with -*/ -module.exports = (string: any, number = 2048) => (string.length > number ? `${string.substring(0, number - 3)}...` : string);
\ No newline at end of file diff --git a/src/utils/wait.ts b/src/utils/wait.ts deleted file mode 100644 index 4af65f1..0000000 --- a/src/utils/wait.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** -* @name wait -* @param {number} delay Delay in milliseconds to wait for -* @returns {Promise<resolve>} -*/ -module.exports = (delay: number) => new Promise(resolve => setTimeout(resolve, delay));
\ No newline at end of file diff --git a/src/utils/winPercentage.ts b/src/utils/winPercentage.ts deleted file mode 100644 index 627dab8..0000000 --- a/src/utils/winPercentage.ts +++ /dev/null @@ -1,16 +0,0 @@ -import config from '../config.json' -/** -* @name winPercentage -* @param {number} multiplier Multiplier to calculate win percentage for -* @param {User} user User to calculate win percentage for -* @returns {number} User balance -*/ -module.exports = (multiplier: any, user: any) => { - // Load the default setting - //let { houseEdgePercentage } = config; - - // If they're a crown supporter, set it to the patron percentage - //if (config.patrons[user.id] && config.patrons[user.id].crown === true) houseEdgePercentage = 0; - - //return (100 - houseEdgePercentage) / multiplier; -};
\ No newline at end of file |