fix: some cleanup and fixing runtime bugs, refs NOISSUE
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using song_of_the_day;
|
||||
|
||||
public class SignalIntegration
|
||||
{
|
||||
public static SignalIntegration? Instance;
|
||||
private readonly ILogger<SignalIntegration> logger;
|
||||
|
||||
private readonly ILogger logger;
|
||||
|
||||
public SignalIntegration(string uri, int port, string phoneNumber)
|
||||
public SignalIntegration(ILogger<SignalIntegration> logger)
|
||||
{
|
||||
using ILoggerFactory factory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Information));
|
||||
this.logger = factory.CreateLogger("SignalIntegration");
|
||||
|
||||
var uri = AppConfiguration.Instance.SignalAPIEndpointUri;
|
||||
var port = int.Parse(AppConfiguration.Instance.SignalAPIEndpointPort);
|
||||
var phoneNumber = AppConfiguration.Instance.HostPhoneNumber;
|
||||
this.logger = logger;
|
||||
|
||||
var http = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri(uri + ":" + port)
|
||||
};
|
||||
apiClient = new song_of_the_day.swaggerClient(http);
|
||||
apiClient = new swaggerClient(http);
|
||||
apiClient.BaseUrl = "";
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
private song_of_the_day.swaggerClient apiClient;
|
||||
private swaggerClient apiClient;
|
||||
|
||||
private string phoneNumber;
|
||||
|
||||
@@ -83,6 +82,11 @@ public class SignalIntegration
|
||||
|
||||
public async Task IntroduceUserAsync(User user)
|
||||
{
|
||||
if (user == null || user.SignalMemberId == null)
|
||||
{
|
||||
logger.LogWarning("Attempt to introduce unknown user was aborted.");
|
||||
return;
|
||||
}
|
||||
await this.SendMessageToUserAsync("Hi, my name is Proggy and I am your friendly neighborhood *Song of the Day* bot!", user.SignalMemberId);
|
||||
await this.SendMessageToUserAsync("You are receiving this message because you have been invited to a *Song of the Day* community group.", user.SignalMemberId);
|
||||
await this.SendMessageToUserAsync("In that community group I will pick a person at random each day at 8 AM and encourage them to share a song with the rest of the community.", user.SignalMemberId);
|
||||
|
Reference in New Issue
Block a user