add config to ascii class
This commit is contained in:
parent
2cd8653144
commit
0b5780cc2b
|
@ -1,16 +1,24 @@
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace dotbot.Commands
|
namespace dotbot.Commands
|
||||||
{
|
{
|
||||||
public class AsciiArt : ModuleBase<SocketCommandContext>
|
public class AsciiArt : ModuleBase<SocketCommandContext>
|
||||||
{
|
{
|
||||||
|
private readonly IConfigurationRoot _config;
|
||||||
|
|
||||||
|
public AsciiArt(IConfigurationRoot config) {
|
||||||
|
_config = config;
|
||||||
|
}
|
||||||
|
|
||||||
[Command("ascii")]
|
[Command("ascii")]
|
||||||
[Summary("creates ascii word art")]
|
[Summary("creates ascii word art")]
|
||||||
public async Task CreateAsciiArt(
|
public async Task CreateAsciiArt(
|
||||||
[Summaery("font you want to use")] string fontName,
|
[Summary("font you want to use")] string fontName,
|
||||||
[Remainder] [Summary("text to convert")] string ArtString
|
[Remainder] [Summary("text to convert")] string ArtString
|
||||||
) {
|
) {
|
||||||
if (fontName == "list") {
|
if (fontName == "list") {
|
||||||
return await ReplyAsync($"available fonts for use with `{_config["prefix"]}ascii`:\n```{string.Join(", ", Directory.GetFiles("Fonts").Select(Path.GetFileNameWithoutExtension))}```");
|
return await ReplyAsync($"available fonts for use with `{_config["prefix"]}ascii`:\n```{string.Join(", ", Directory.GetFiles("Fonts").Select(Path.GetFileNameWithoutExtension))}```");
|
||||||
} else if (File.Exists($"Fonts/{fontName}.flf")) {
|
} else if (File.Exists($"Fonts/{fontName}.flf")) {
|
||||||
|
@ -22,3 +30,4 @@ namespace dotbot.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue