From 0df858ee54ac3d1a5b7641051710a062b9b2ff99 Mon Sep 17 00:00:00 2001 From: Kyle Brown Date: Thu, 13 May 2021 17:49:34 -0700 Subject: [PATCH] make pretty, typo fix --- README.md | 4 ++-- src/boardsourcebot.nim | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2baa9a0..9105dc2 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Boardsource bot Boardsourcebot is designed to make the lives or the boardsource mods easier to help deal with repeat questions -## Requirementss +## Requirements 1. Install Nim using [choosenim](https://github.com/dom96/choosenim) or [Nim's website](https://nim-lang.org/install.html) -2. Install Nimble from [numble](https://github.com/nim-lang/nimble) +2. Install Nimble from [nimble](https://github.com/nim-lang/nimble) ## Building Copy `src/config.nim.example` to `src/config.nim` and add api key, as well as diff --git a/src/boardsourcebot.nim b/src/boardsourcebot.nim index 64eb11a..700c299 100644 --- a/src/boardsourcebot.nim +++ b/src/boardsourcebot.nim @@ -3,12 +3,12 @@ import dimscord, asyncdispatch, options, strformat, strutils import yaml/serialization, streams type CommandList = object - command : string - response : string - response2 : string + command: string + response: string + response2: string # YAML parser -proc registerCommands(file: string):seq[CommandList] = +proc registerCommands(file: string): seq[CommandList] = var commandList: seq[CommandList] var s = newFileStream(file) load(s, commandList) @@ -17,10 +17,10 @@ proc registerCommands(file: string):seq[CommandList] = let commands = registerCommands("commands.yaml") -func checkForCmd(prefix:string, commands:seq[CommandList], m:Message): seq[string] = +func checkForCmd(prefix: string, commands: seq[CommandList], m: Message): seq[string] = for i in commands: if fmt"{prefix}{i.command}" == m.content: - return @[i.response, i.response2] + return @[i.response, i.response2] return @[""] @@ -34,7 +34,7 @@ proc onReady(s: Shard, r: Ready) {.event(discord).} = proc messageCreate(s: Shard, m: Message) {.event(discord).} = let responseSeq = checkForCmd(prefix, commands, m) if m.author.bot: return - if not responseSeq[0].isEmptyOrWhitespace: # Validates response to command exists + if not responseSeq[0].isEmptyOrWhitespace: # Validates response to command exists let msg = await discord.api.sendMessage(m.channel_id, responseSeq[0]) if not responseSeq[1].isEmptyOrWhitespace: let msg2 = await discord.api.sendMessage(m.channel_id, responseSeq[1])