Skip to content

Commit

Permalink
Fix alias bug and begin porting process.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Sep 2, 2018
1 parent 5471c14 commit f603b5f
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export const handleHelp: IveBotCommand = (client) => ({
generator: async (message, args) => {
const aliasCheck = (
i: string
) => client.commands[i].aliases && client.commands[i].aliases.includes(args.join(' '))
) => (
client.commands[i].aliases && client.commands[i].aliases.includes(
args.join(' ').split('/').join('')
)
)
if (
args.join(' ').split('/').join('') in client.commands
) return generateDocs(client.commands[args.join(' ').split('/').join('')])
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ MongoClient.connect(mongoURL === 'dotenv' ? process.env.MONGO_URL : mongoURL, {
// Avoid usage, submit PRs to bot/commands and not bot/index and bot/oldCommands.
client.on('messageCreate', botCallback(client, tempDB, db))
// Register all commands in bot/commands onto the CommandClient.
readdir('./server/bot/commands', (err, commandFiles) => {
readdir('./server/bot/oldCommands', (err, commandFiles) => {
// Handle any errors.
if (err) { console.error(err); throw new Error('Commands could not be retrieved.') }
// This only supports two levels of files, one including files inside commands, and one in..
// a subfolder.
commandFiles.forEach(commandFile => {
// If it's a file..
if (statSync('./server/bot/commands/' + commandFile).isFile() && commandFile.endsWith('.ts')) {
const commands: { [index: string]: IveBotCommand } = require('./bot/commands/' + commandFile)
if (statSync('./server/bot/oldCommands/' + commandFile).isFile() && commandFile.endsWith('.ts')) {
const commands: { [index: string]: IveBotCommand } = require('./bot/oldCommands/' + commandFile)
// ..and there are commands..
if (!Object.keys(commands).length) return
// ..register the commands.
Expand Down

0 comments on commit f603b5f

Please sign in to comment.