Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 789749d2684ddd311549021a0a571c31b3459a38
parent 8c3c64e6d8d74aeac51faee7bb4979a474907ff5
Author: Demonstrandum <moi@knutsen.co>
Date:   Mon, 18 May 2020 01:10:28 +0100

Clone with --no-checkout and fix whitelist

Diffstat:
MProcfile | 2+-
Aclone_nocheckout.sh | 9+++++++++
Dgit.js | 23-----------------------
Mlib/main.ts | 6+++---
4 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/Procfile b/Procfile @@ -1,3 +1,3 @@ # Keep alive, lol. -worker: while true; do curl 'simp-o-matic.herokuapp.com' & sleep 300; done +worker: source clone_nocheckout.sh; while true; do curl 'simp-o-matic.herokuapp.com' & sleep 300; done web: yarn start diff --git a/clone_nocheckout.sh b/clone_nocheckout.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +git clone \ + --no-checkout \ + https://github.com/Demonstrandum/Simp-O-Matic.git \ + ./tmp + +mv ./tmp/.git ./.git + diff --git a/git.js b/git.js @@ -1,23 +0,0 @@ -const git = require('nodegit'); -const path = require('path'); - -const info = async dir => { - const repo = await git.Repository.open(dir); - const master = await repo.getMasterCommit(); - const history = master.history(git.Revwalk.SORT.TIME); - - let count = 0; - history.on("commit", commit => { - if (count++ >= Infinity) return; - console.log(`\`${commit.sha().slice(0, 7)}\` — ` - + `${commit.message().trim()}` - + ` (by ${commit.author().name()})`); - }); - console.log('Start history:'); - history.start(); - history.on("end", () => { - console.log('hi'); - }); -}; - -info(path.resolve(process.cwd(), "./.git")); diff --git a/lib/main.ts b/lib/main.ts @@ -240,9 +240,9 @@ export class SimpOMatic { if (message.content.startsWith('..')) return; - if (CONFIG.whitelistchannels - && CONFIG.whitelistchannels.length > 0 - && CONFIG.whitelistchannels.includes(message.channel.id)) + if (CONFIG.whitelistchannels + && CONFIG.whitelistchannels.length > 0 + && !CONFIG.whitelistchannels.includes(message.channel.id)) return; const last_command = this._COMMAND_HISTORY.last();