involve franz

This commit is contained in:
Adam R. Grey 2021-12-08 12:21:37 -05:00
parent c05b507d43
commit 3eb4d617e4
2 changed files with 9 additions and 2 deletions

View File

@ -10,6 +10,7 @@ using Discord.WebSocket;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Text;
using franz;
namespace silverworker_discord
{
@ -48,6 +49,10 @@ namespace silverworker_discord
_client.UserJoined += UserJoined;
_client.JoinedGuild += IJoined;
});
Telefranz.Configure("scheduler", config["kafka_bootstrap"]);
//Telefranz.Instance.addHandler
// Block this task until the program is closed.
await Task.Delay(-1);
}
@ -139,8 +144,8 @@ namespace silverworker_discord
private Task UserJoined(SocketGuildUser arg)
{
Console.WriteLine($"user joined: {arg.Nickname}. Guid: {arg.Guild.Id}. Channel: {arg.Guild.DefaultChannel}");
var abbreviatedNickname = arg.Nickname;
if (arg.Nickname.Length > 3)
var abbreviatedNickname = arg.Nickname ?? arg.Username;
if (abbreviatedNickname.Length > 3)
{
abbreviatedNickname = arg.Nickname.Substring(0, arg.Nickname.Length / 3);
}

View File

@ -4,6 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>silverworker_discord</RootNamespace>
<RestoreSources>$(RestoreSources);../packages/nuget/;https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>
<ItemGroup>
@ -12,6 +13,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="qrcoder" Version="1.4.2" />
<PackageReference Include="silvermeddlists.franz" Version="0.0.7" />
<PackageReference Include="youtubedlsharp" Version="0.3.1" />
</ItemGroup>