This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kyranet/dev
First Smii release
- Loading branch information
Showing
16 changed files
with
609 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/ | |
config.mjs | ||
*.heapsnapshot | ||
*.log | ||
bwd/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Remove `.example` from the file extension to configure Smii | ||
|
||
export const CLIENT_OPTIONS = { | ||
commandEditing: true, | ||
commandLogging: false, | ||
commandMessageLifetime: 200, | ||
consoleEvents: { verbose: true }, | ||
customPromptDefaults: { limit: 5 }, | ||
messageCacheLifetime: 200, | ||
messageCacheMaxSize: 25, | ||
messageSweepInterval: 100, | ||
prefix: 's.', | ||
presence: { status: 'online', activity: { type: 'LISTENING', name: 'Smii, help' } }, | ||
regexPrefix: /smii(,|!)/i, | ||
typing: true, | ||
pieceDefaults: { | ||
commands: { deletable: true }, | ||
monitors: { ignoreOthers: false } | ||
} | ||
}; | ||
|
||
export const TOKEN = '< BOT TOKEN GOES HERE >'; | ||
export const SIZES = { | ||
WIDTH: 1500, | ||
HEIGTH: 1500 | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,4 @@ | ||
import { TOKEN } from '../config.mjs'; | ||
import Smii from './lib/Smii'; | ||
import { CLIENT_OPTIONS, TOKEN } from '../config.mjs'; | ||
import { Smii } from './index'; | ||
|
||
new Smii({ | ||
commandEditing: true, | ||
commandLogging: false, | ||
commandMessageLifetime: 200, | ||
consoleEvents: { verbose: true }, | ||
customPromptDefaults: { limit: 5 }, | ||
messageCacheLifetime: 200, | ||
messageCacheMaxSize: 25, | ||
messageSweepInterval: 100, | ||
prefix: 's.', | ||
presence: { status: 'online', activity: { type: 'LISTENING', name: 'Smii, help' } }, | ||
regexPrefix: /smii(,|!)/i, | ||
typing: true | ||
}).login(TOKEN); | ||
new Smii(CLIENT_OPTIONS).login(TOKEN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Command as KlasaCommand, util } from 'klasa'; | ||
|
||
export default class Command extends KlasaCommand { | ||
|
||
constructor(...args) { | ||
super(...args, { | ||
aliases: ['pull'], | ||
description: 'Update the bot', | ||
guarded: true, | ||
permissionLevel: 10, | ||
usage: '[branch:string]' | ||
}); | ||
} | ||
|
||
async run(message, [branch = 'master']) { | ||
const pullResponse = await util.exec(`git pull origin ${branch}`); | ||
const response = await message.channel.sendCode('prolog', [pullResponse.stdout, pullResponse.stderr || '✔'].join('\n-=-=-=-\n')); | ||
if (!await this.isCurrentBranch(branch)) { | ||
const switchResponse = await message.channel.send(`Switching to ${branch}...`); | ||
const checkoutResponse = await util.exec(`git checkout ${branch}`); | ||
await switchResponse.edit([checkoutResponse.stdout, checkoutResponse.stderr || '✔'].join('\n-=-=-=-\n'), { code: 'prolog' }); | ||
if ('reboot' in message.flags) return this.store.get('reboot').run(message); | ||
} else if (!pullResponse.stdout.includes('Already up-to-date.') && ('reboot' in message.flags)) { | ||
return this.store.get('reboot').run(message); | ||
} | ||
return response; | ||
} | ||
|
||
async isCurrentBranch(branch) { | ||
const { stdout } = await util.exec('git symbolic-ref --short HEAD'); | ||
return stdout === `refs/heads/${branch}\n` || stdout === `${branch}\n`; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.