Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.0 #21

Merged
merged 30 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e94eb8d
Chore: Build Config + Deps
gazmull Apr 20, 2019
c3d5ee5
Docs: various updates:
gazmull Apr 20, 2019
c2f4afe
Changes:
gazmull Apr 20, 2019
8445075
Feat(fun): mock, owo, weapon types for quiz
gazmull Apr 20, 2019
23043fd
Feat(kamihime): Glossary Command (Fixes #20)
gazmull Apr 20, 2019
6e024e8
Feat(info): assist ability powerup 2nd
gazmull Apr 20, 2019
0c6ba8a
src(util): removed clear
gazmull Apr 20, 2019
92667aa
Feat(list): Sort option
gazmull Apr 20, 2019
76d2813
Refactor(functions): setInterval => setTimeout
gazmull Apr 20, 2019
025a74b
src(ready): Leftover from:
gazmull Apr 20, 2019
263d56d
Chore: Update deps and types
gazmull Apr 20, 2019
3440efc
src(owo): Improve prompt trigger rate to 33%
gazmull Apr 21, 2019
baf34c6
Fix(countdown-scheduler): Insecure destruction
gazmull Apr 22, 2019
f4f8bd6
fix(countdown-scheduler): actual fix for insecure destruction
gazmull Apr 22, 2019
7cfabed
Chore(deps): discord-paginationembed@1.0.0-beta.4
gazmull Apr 27, 2019
e5ba57a
Refactor(ready): Use call() instead of bind()
gazmull Apr 27, 2019
5fbe737
Fix(list): sort option
gazmull Apr 27, 2019
55a0fe6
Fix(list): sort test fails immediately
gazmull May 1, 2019
06658bb
Fix(Info): Missing element on burst description
gazmull May 6, 2019
7f34ffa
Docs: Fix Oldies
gazmull May 11, 2019
e1da30d
src(glossary): refresher for glossary db
gazmull May 11, 2019
e7ab742
Revert(Client): handleEdits causing errors+
gazmull May 11, 2019
c3b78b5
src(info): Refactor + weap FLB move + wiki updates
gazmull May 11, 2019
cb465e5
Docs: FLB flag
gazmull May 11, 2019
bc4eed7
Fix(info): Follow-up fixes on FLB flag override
gazmull May 11, 2019
d3c18be
src(info): SSR+ burst discriminator for weapons
gazmull May 13, 2019
3c3d2b4
Fix(info): Fallback on burstDesc from burstFLB
gazmull May 13, 2019
0684178
Fix(list): sort argument returns an array
gazmull May 13, 2019
1571201
Fix(info): Make -f flag work w/o -r flag invoke
gazmull May 13, 2019
af284ef
Docs(info): Add more info regarding FLB flag
gazmull May 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{js, ts, json, yml}]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
*.gif binary
*.png binary
*.webp binary

# 4 teh 100%
*.js linguist-vendored
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ yarn-error.log

#Build
build
docs
logs
*.tsbuildinfo

#Private Source
auth.js
Expand Down
1 change: 0 additions & 1 deletion .nodemon.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"verbose": true,
"watch": [ "build" ],
"ignore": [ "provider", ".vscode", "typings" ],
"env": { "NODE_ENV": "development" },
"ext": "js"
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sudo: false
jobs:
include:
- stage: docs-build
script: yarn run test && yarn run docs:parse
script: bash ./deploy/travis.sh
cache:
directories:
- node_modules
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"npm.autoDetect": "on",
"tslint.configFile": ".\\.tslint.js",
"tslint.configFile": ".tslint.js",
"tslint.exclude": "build/**/*",
"tslint.jsEnable": true,
"typescript.tsdk": "node_modules\\typescript\\lib",
"typescript.tsdk": "node_modules/typescript/lib",
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 gazmull
Copyright (c) 2018-present gazmull

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
- [**Bot Guide**](https://docs.thegzm.space/eros-bot)

# Features
- Realtime Character/Weapon information pulls from [**Kamihime Project Nutaku Fandom**](https://kamihime-project.fandom.com)
- Realtime Character/Weapon information pulls from [**Kamihime PROJECT EN Fandom**](https://kamihime-project.fandom.com)
- Kamihime Database (Harem Scenes)
- Only Nutaku version is available.
- Only Kamihime EN (Nutaku) version is available.
- Uses REST API (JSON) from [**Kamihime Database**](https://github.com/gazmull/kamihime-database)
- Tweets updates from [**@Kamihime_Nutaku**](https://twitter.com/kamihime_nutaku)
- Tweets updates from [**@Kamihime_EN**](https://twitter.com/kamihime_en)
- Customise the `Twitter Channel` with `?set twitterchannel <channel>`
- Get notified with in-game events via Countdown notification system
- Customise the `Countdown Channel` with `?set cdchannel <channel>`
Expand Down Expand Up @@ -48,12 +48,12 @@
- **Tag**
- Main: `tag`, `tags`
- **Fun**
- Main: `ask`, `insult`, `say`, `quiz`
- Main: `ask`, `insult`, `say`, `mock`, `owo`, `quiz`
- **Leveling System**
- Main: `level`
- **Utility**
- Main: `memberinfo`, `serverinfo`, `ping`, `stats`
- Bot Owner: `eval`, `clear`
- Bot Owner: `eval`

# Self-Hosting
> ### [**Add the bot instead? (24/7)**](http://addbot.thegzm.space)
Expand Down Expand Up @@ -142,4 +142,6 @@ If one cannot afford to do a pull request, submitting documentation contribution
2. Run `$ yarn run dev:start`

# License
MIT
> [**MIT**](https://github.com/gazmull/discord-paginationembed/blob/master/LICENSE)

© 2018-present [**Euni (gazmull)**](https://github.com/gazmull)
2 changes: 1 addition & 1 deletion auth.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ module.exports = {
access_token_secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
consumer_key: 'xxx',
consumer_secret: 'xxxxxxxxxxxxxx',
user: '806331327108653057' // current ID: Kamihime_Nutaku (gettwitterid.com)
user: '806331327108653057' // current ID: Kamihime_EN (gettwitterid.com)
}
};
29 changes: 29 additions & 0 deletions deploy/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
# Based on https://github.com/hydrabolt/discord.js-site/blob/master/deploy/deploy.sh

set -e

if [ "$TRAVIS_BRANCH" != "master" -o -n "$TRAVIS_TAG" -o "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Not building for a non master branch push - building without deploying."
yarn test
exit 0
fi

echo -e "Building for a master branch push - building and deploying."

REPO=$(git config remote.origin.url)
SHA=$(git rev-parse --verify HEAD)
TARGET_BRANCH="gh-pages"

git clone $REPO gh -b $TARGET_BRANCH

yarn docs:build

rsync --delete-before --exclude='.git' --exclude='index.html' --exclude='gitbook.yaml' -avh docs/ gh/

cd gh
git add --all .
git config user.name "Travis CI"
git config user.email "${COMMIT_EMAIL}"
git commit -m "Build: ${SHA}" || true
git push "https://${GITHUB_TOKEN}@github.com/gazmull/eros-bot.git" $TARGET_BRANCH
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eros-bot",
"version": "3.4.0",
"description": "A simple bot for pulling character information and harem episodes from Kamihime Project Fandom and Kamihime Database.",
"description": "A simple bot for pulling character information and harem episodes from Kamihime PROJECT Fandom and Kamihime Database.",
"main": "build/index.js",
"typings": "typings",
"engines": {
Expand Down Expand Up @@ -41,33 +41,35 @@
"dependencies": {
"bufferutil": "^4.0.1",
"chalk": "^2.4.2",
"discord-akairo": "8.0.0-beta.1",
"discord-paginationembed": "^1.0.0-beta.1",
"discord-akairo": "^8.0.0-beta.8",
"discord-paginationembed": "^1.0.0-beta.4",
"discord.js": "github:discordjs/discord.js",
"erlpack": "github:discordapp/erlpack",
"fs-extra": "^7.0.1",
"infobox-parser": "^3.2.0",
"mariadb": "^2.0.3",
"moment-timezone": "^0.5.23",
"node-fetch": "^2.3.0",
"moment-timezone": "^0.5.25",
"node-fetch": "^2.4.1",
"nodemw": "^0.12.2",
"reflect-metadata": "^0.1.13",
"sequelize": "5.0.0-beta.15",
"sequelize-typescript": "^0.6.8-beta.0",
"twitter-lite": "^0.9.2",
"sequelize": "^5.7.6",
"sequelize-typescript": "1.0.0-beta.1",
"twitter-lite": "^0.9.4",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^3.8.0",
"winston-daily-rotate-file": "^3.9.0",
"zlib-sync": "^0.1.4"
},
"devDependencies": {
"@types/bluebird": "^3.5.26",
"@types/fs-extra": "^5.0.5",
"@types/json2md": "^1.5.0",
"@types/moment-timezone": "^0.5.12",
"@types/node": "^11.11.4",
"@types/node-fetch": "^2.1.7",
"@types/node": "^11.13.8",
"@types/node-fetch": "^2.3.3",
"@types/validator": "^10.11.0",
"json2md": "^1.6.3",
"tslint": "^5.14.0",
"tslint": "^5.16.0",
"tslint-eslint-rules": "^5.4.0",
"typescript": "^3.3.4000"
"typescript": "^3.4.5"
}
}
6 changes: 3 additions & 3 deletions src/commands/countdown/add.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Message } from 'discord.js';
import * as moment from 'moment';
import ErosCommand from '../../struct/command';
import Command from '../../struct/command';
import CountdownCommand from './countdown';

export default class extends ErosCommand {
export default class extends Command {
constructor () {
super('countdown-add', {
description: {
Expand All @@ -27,7 +27,7 @@ export default class extends ErosCommand {
match: 'rest',
prompt: {
start: 'what should the new countdown be named?',
retry: (_, __, input: { phrase: string }) =>
retry: (_, input: { phrase: string }) =>
`**${input.phrase}** already exists. Please provide again.`
}
},
Expand Down
73 changes: 19 additions & 54 deletions src/commands/countdown/countdown.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Collection, Message, User } from 'discord.js';
import { Flag } from 'discord-akairo';
import { Collection, Message } from 'discord.js';
import * as fs from 'fs-extra';
import * as moment from 'moment-timezone';
import { ICountdown } from '../../../typings';
import ErosCommand from '../../struct/command';
import Command from '../../struct/command';
import prettifyMs from '../../util/prettifyMs';

export default class extends ErosCommand {
export default class extends Command {
constructor () {
super('countdown', {
aliases: [ 'countdown', 'cd' ],
description: {
content: [
'Displays countdowns related to Kamihime Project in-game events.',
'Displays countdowns related to Kamihime PROJECT in-game events.',
'It includes special and some regular events.',
'Available Methods:',
'- `help`',
Expand All @@ -30,11 +31,7 @@ export default class extends ErosCommand {
'delete A User\'s Birthday',
'test 2018-05-16T20:00',
]
},
args: [
{ id: 'method', type: [ 'help', 'current', 'add', 'remove', 'delete', 'del', 'test', 'check', 'subscribe' ] },
{ id: 'details', match: 'rest', default: '' },
]
}
});

this.init();
Expand All @@ -48,36 +45,23 @@ export default class extends ErosCommand {

public userCountdowns: Collection<number, string[]> = new Collection();

public authorized (user: User) {
return this.client.config.countdownAuthorized.includes(user.id);
}

public async exec (message: Message, { method, details }: { method: string, details: string }) {
const authorized = this.authorized(message.author);

if (
!method ||
(!authorized && ![ 'test', 'check', 'subscribe', 'current', 'help' ].includes(method))
) return this.defaultCommand(message);
if (method === 'current') return message.util.reply(`Current time is: ${moment.tz(this.timezone)}`);
if (method === 'help') return this.authorisedHelp(message);

const commands: { [key: string]: ErosCommand } = {
add: this.handler.modules.get('countdown-add'),
del: this.handler.modules.get('countdown-delete'),
delete: this.handler.modules.get('countdown-delete'),
remove: this.handler.modules.get('countdown-delete'),
test: this.handler.modules.get('countdown-test'),
check: this.handler.modules.get('countdown-test'),
subscribe: this.handler.modules.get('countdown-subscribe')
public * args () {
const child = yield {
type: [
[ 'countdown-add', 'add' ],
[ 'countdown-delete', 'remove', 'del', 'delete' ],
[ 'countdown-test', 'test', 'check' ],
[ 'countdown-subscribe', 'subscribe', 'sub' ],
[ 'countdown-current', 'current', 'now' ],
[ 'countdown-help', 'help' ],
]
};
const command = commands[method];

return this.handler.handleDirectCommand(message, details, command);
return child ? Flag.continue(child) : { };
}

public async defaultCommand (message: Message) {
const embed = this.util.embed(message);
public async exec (message: Message) {
const embed = this.client.embed(message);

await this.prepareCountdowns();

Expand All @@ -87,25 +71,6 @@ export default class extends ErosCommand {
return message.util.send(embed);
}

public async authorisedHelp (message: Message) {
const prefix = await this.handler.prefix(message);
const embed = this.util.embed(message)
.setColor(0xFF00AE)
.addField('Adding a Countdown', [
`❯ Usage: ${prefix}countdown add <date> <name>`,
'❯ Date Format: [YYYY]-[MM]-[DD]T[HH]:[mm]',
'❯ Note: Date has to be provided in PDT. https://time.is/PDT',
'❯ Note: Naming can also affect the countdown notifications, so be careful when to append `- End`!',
])
.addField('Removing a Countdown', `❯ Usage: ${prefix}countdown remove <name>`)
.addField('Testing a Countdown', [
`❯ Usage: ${prefix}countdown test <date>`,
'❯ Same date format from adding a countdown.',
]);

return message.util.send(embed);
}

public async prepareCountdowns () {
const now = moment.tz(this.timezone);

Expand Down
19 changes: 19 additions & 0 deletions src/commands/countdown/current.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Message } from 'discord.js';
import * as moment from 'moment-timezone';
import Command from '../../struct/command';
import CountdownCommand from './countdown';

export default class extends Command {
constructor () {
super('countdown-current', {
description: { content: 'Shows the current date and time.' },
ratelimit: 2
});
}

public async exec (message: Message) {
const parent = this.handler.modules.get('countdown') as CountdownCommand;

return message.util.reply(`Current time is: ${moment.tz(parent.timezone)}`);
}
}
7 changes: 4 additions & 3 deletions src/commands/countdown/delete.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Message } from 'discord.js';
import ErosCommand from '../../struct/command';
import Command from '../../struct/command';
import CountdownCommand from './countdown';

export default class extends ErosCommand {
export default class extends Command {
constructor () {
super('countdown-delete', {
description: {
Expand All @@ -18,7 +18,7 @@ export default class extends ErosCommand {
match: 'rest',
prompt: {
start: 'what countdown should be deleted?',
retry: (_, __, input: { phrase: string }) =>
retry: (_, input: { phrase: string }) =>
` **${input.phrase}** does not exist. Please provide again.`
}
},
Expand All @@ -32,6 +32,7 @@ export default class extends ErosCommand {

if (!found) return message.util.reply(`countdown named \`${name}\` not found.`);

parent.userCountdowns.delete(found);
parent.countdowns.delete(found);
await parent.save();

Expand Down
Loading