Bot will now show in the console when it joins or leaves a server

This commit is contained in:
Master Kwoth 2017-07-05 11:43:36 +02:00
parent 54a91b4a79
commit 6591dd7c74
5 changed files with 21 additions and 1 deletions

View File

@ -317,9 +317,23 @@ namespace NadekoBot
Client.Ready += SetClientReady; Client.Ready += SetClientReady;
await clientReady.Task.ConfigureAwait(false); await clientReady.Task.ConfigureAwait(false);
Client.Ready -= SetClientReady; Client.Ready -= SetClientReady;
Client.JoinedGuild += Client_JoinedGuild;
Client.LeftGuild += Client_LeftGuild;
_log.Info("Shard {0} logged in.", ShardId); _log.Info("Shard {0} logged in.", ShardId);
} }
private Task Client_LeftGuild(SocketGuild arg)
{
_log.Info("Left server: {0} [{1}]", arg?.Name, arg?.Id);
return Task.CompletedTask;
}
private Task Client_JoinedGuild(SocketGuild arg)
{
_log.Info("Joined server: {0} [{1}]", arg?.Name, arg?.Id);
return Task.CompletedTask;
}
public async Task RunAsync(params string[] args) public async Task RunAsync(params string[] args)
{ {
if(ShardId == 0) if(ShardId == 0)

View File

@ -22,6 +22,7 @@ namespace NadekoBot.Services
int TotalShards { get; } int TotalShards { get; }
string ShardRunCommand { get; } string ShardRunCommand { get; }
string ShardRunArguments { get; } string ShardRunArguments { get; }
string PatreonCampaignId { get; }
} }
public class DBConfig public class DBConfig

View File

@ -36,6 +36,8 @@ namespace NadekoBot.Services.Impl
public string ShardRunArguments { get; } public string ShardRunArguments { get; }
public int ShardRunPort { get; } public int ShardRunPort { get; }
public string PatreonCampaignId { get; }
public BotCredentials() public BotCredentials()
{ {
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
@ -64,6 +66,7 @@ namespace NadekoBot.Services.Impl
MashapeKey = data[nameof(MashapeKey)]; MashapeKey = data[nameof(MashapeKey)];
OsuApiKey = data[nameof(OsuApiKey)]; OsuApiKey = data[nameof(OsuApiKey)];
PatreonAccessToken = data[nameof(PatreonAccessToken)]; PatreonAccessToken = data[nameof(PatreonAccessToken)];
PatreonCampaignId = data[nameof(PatreonCampaignId)] ?? "334038";
ShardRunCommand = data[nameof(ShardRunCommand)]; ShardRunCommand = data[nameof(ShardRunCommand)];
ShardRunArguments = data[nameof(ShardRunArguments)]; ShardRunArguments = data[nameof(ShardRunArguments)];
if (string.IsNullOrWhiteSpace(ShardRunCommand)) if (string.IsNullOrWhiteSpace(ShardRunCommand))
@ -121,6 +124,7 @@ namespace NadekoBot.Services.Impl
public DBConfig Db { get; set; } = new DBConfig("sqlite", "Filename=./data/NadekoBot.db"); public DBConfig Db { get; set; } = new DBConfig("sqlite", "Filename=./data/NadekoBot.db");
public int TotalShards { get; set; } = 1; public int TotalShards { get; set; } = 1;
public string PatreonAccessToken { get; set; } = ""; public string PatreonAccessToken { get; set; } = "";
public string PatreonCampaignId { get; set; } = "334038";
public string ShardRunCommand { get; set; } = ""; public string ShardRunCommand { get; set; } = "";
public string ShardRunArguments { get; set; } = ""; public string ShardRunArguments { get; set; } = "";

View File

@ -64,7 +64,7 @@ namespace NadekoBot.Services.Utility
{ {
Links = new PatreonDataLinks() Links = new PatreonDataLinks()
{ {
next = "https://api.patreon.com/oauth2/api/campaigns/334038/pledges" next = $"https://api.patreon.com/oauth2/api/campaigns/{_creds.PatreonCampaignId}/pledges"
} }
}; };
do do

View File

@ -16,6 +16,7 @@
}, },
"TotalShards": 1, "TotalShards": 1,
"PatreonAccessToken": "", "PatreonAccessToken": "",
"PatreonCampaignId": "334038",
"ShardRunCommand": "", "ShardRunCommand": "",
"ShardRunArguments": "", "ShardRunArguments": "",
"ShardRunPort": null "ShardRunPort": null