Update Readme and add token parameter

This commit is contained in:
runebaas 2018-05-02 23:32:40 +02:00
parent 2701f641cf
commit 55e152f4aa
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
5 changed files with 9 additions and 15 deletions

View file

@ -3,7 +3,7 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon>derp.ico</ApplicationIcon> <ApplicationIcon>derp.ico</ApplicationIcon>
<Version>1.1.0</Version> <Version>3.6.0</Version>
<Company>Pizza and Coffee Studios</Company> <Company>Pizza and Coffee Studios</Company>
<Authors>Pizza and Coffee Studios</Authors> <Authors>Pizza and Coffee Studios</Authors>
<Description>A Discord bot</Description> <Description>A Discord bot</Description>

View file

@ -5,13 +5,13 @@ namespace Geekbot.net.Lib
{ {
public class GeekbotLogger : IGeekbotLogger public class GeekbotLogger : IGeekbotLogger
{ {
private readonly bool _sumologicActive; private readonly bool _logAsJson;
private readonly NLog.Logger _logger; private readonly NLog.Logger _logger;
private readonly JsonSerializerSettings _serializerSettings; private readonly JsonSerializerSettings _serializerSettings;
public GeekbotLogger(RunParameters runParameters, bool sumologicActive) public GeekbotLogger(RunParameters runParameters, bool sumologicActive)
{ {
_sumologicActive = sumologicActive; _logAsJson = sumologicActive || runParameters.LogJson;
_logger = LoggerFactory.CreateNLog(runParameters, sumologicActive); _logger = LoggerFactory.CreateNLog(runParameters, sumologicActive);
_serializerSettings = new JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{ {
@ -43,7 +43,7 @@ namespace Geekbot.net.Lib
private string CreateLogString(string type, string source, string message, Exception stackTrace = null, object extra = null) private string CreateLogString(string type, string source, string message, Exception stackTrace = null, object extra = null)
{ {
if (_sumologicActive) if (_logAsJson)
{ {
var logObject = new GeekbotLoggerObject var logObject = new GeekbotLoggerObject
{ {

View file

@ -19,5 +19,8 @@ namespace Geekbot.net.Lib
[Option('e', "expose-errors", Default = false, HelpText = "Shows internal errors in the chat")] [Option('e', "expose-errors", Default = false, HelpText = "Shows internal errors in the chat")]
public bool ExposeErrors { get; set; } public bool ExposeErrors { get; set; }
[Option("token", Default = null, HelpText = "Set a new bot token")]
public string Token { get; set; }
} }
} }

View file

@ -1,5 +1,4 @@
using System; using System;
using System.Linq;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
@ -84,7 +83,7 @@ namespace Geekbot.net
Environment.Exit(102); Environment.Exit(102);
} }
_token = _redis.StringGet("discordToken"); _token = runParameters.Token ??_redis.StringGet("discordToken");
if (_token.IsNullOrEmpty) if (_token.IsNullOrEmpty)
{ {
Console.Write("Your bot Token: "); Console.Write("Your bot Token: ");

View file

@ -11,7 +11,6 @@ You can invite Geekbot to your server with [this link](https://discordapp.com/oa
* DotNet Core 2 * DotNet Core 2
* Redis * Redis
* Discord.net * Discord.net
* ffmpeg
## Running ## Running
@ -24,14 +23,7 @@ Run these commands
On your first run geekbot will ask for your bot token, everything else is taken care of. On your first run geekbot will ask for your bot token, everything else is taken care of.
### Launch Parameters For a list of launch options use `dotnet run -h`
| Parameter | Description |
| --- | --- |
| `--verbose` | Show more log information |
| `--disable-api` | Disables the webapi on startup |
| `--reset` | Resets certain parts of the bot |
| `--migrate` | Migrates the database from V3.1 to the new format from V3.2<br> (make sure to backup before running this) |
## Contributing ## Contributing