Turn GetTopicListing to ToString for Db.Topic

This commit is contained in:
Basique Evangelist 2021-04-19 16:14:01 +03:00
parent 1fa9c14666
commit bb226a9ece
Signed by untrusted user: BasiqueEvangelist
GPG Key ID: B370219149301706
3 changed files with 5 additions and 6 deletions

View File

@ -67,7 +67,7 @@ namespace JetHerald
var topics = await db.GetTopicsForChat((long)ctx.Channel.Id, "Discord");
await ctx.RespondAsync(topics.Any()
? "Topics:\n" + string.Join("\n", topics.Select(ListCommand.GetTopicListing))
? "Topics:\n" + string.Join("\n", topics)
: "No subscriptions active.");
}

View File

@ -20,12 +20,8 @@ namespace JetHerald
var topics = await db.GetTopicsForChat(chatid, "Telegram");
return topics.Any()
? "Topics:\n" + string.Join("\n", topics.Select(GetTopicListing))
? "Topics:\n" + string.Join("\n", topics)
: "No subscriptions active.";
}
internal static string GetTopicListing(Db.Topic t)
=> t.Name == t.Description ? t.Name : $"{t.Name}: {t.Description}";
}
}

View File

@ -25,6 +25,9 @@ namespace JetHerald
public long? ChatId { get; set; }
public string Service { get; set; }
public override string ToString()
=> Name == Description ? Name : $"{Name}: {Description}";
}
public class ExpiredTopicChat