ascii art
This commit is contained in:
parent
0b5780cc2b
commit
425538ab0c
|
@ -1,6 +1,7 @@
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace dotbot.Commands
|
namespace dotbot.Commands
|
||||||
|
@ -20,10 +21,12 @@ namespace dotbot.Commands
|
||||||
[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))}```");
|
await ReplyAsync($"available fonts for use with `{_config["prefix"]}ascii`:\n```{string.Join(", ", Directory.GetFiles("Fonts").ToList().Select(Path.GetFileNameWithoutExtension))}```");
|
||||||
} else if (File.Exists($"Fonts/{fontName}.flf")) {
|
} else if (File.Exists($"Fonts/{fontName}.flf")) {
|
||||||
var font = new WenceyWang.FIGlet.FIGletFont(File.Open($"Fonts/{fontName}.flf"));
|
using (FileStream fs = File.OpenRead($"Fonts/{fontName}.flf")) {
|
||||||
await ReplyAsync($"```\n{(new WenceyWang.FIGlet.AsciiArt(ArtString, font: font)).ToString()}\n```");
|
var font = new WenceyWang.FIGlet.FIGletFont(fs);
|
||||||
|
await ReplyAsync($"```\n{(new WenceyWang.FIGlet.AsciiArt(ArtString, font: font)).ToString()}\n```");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await ReplyAsync($"```\n{(new WenceyWang.FIGlet.AsciiArt(fontName + ArtString)).ToString()}\n```");
|
await ReplyAsync($"```\n{(new WenceyWang.FIGlet.AsciiArt(fontName + ArtString)).ToString()}\n```");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Discord.Commands;
|
using Discord;
|
||||||
|
using Discord.Commands;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -16,6 +17,7 @@ namespace dotbot.Commands
|
||||||
_rand = rand;
|
_rand = rand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Command("roll")]
|
[Command("roll")]
|
||||||
[Summary("rolls an n-sided die (defaults to 6-sided")]
|
[Summary("rolls an n-sided die (defaults to 6-sided")]
|
||||||
public async Task RollDie([Summary("[number of sides]")] int sides = 6)
|
public async Task RollDie([Summary("[number of sides]")] int sides = 6)
|
||||||
|
@ -24,6 +26,7 @@ namespace dotbot.Commands
|
||||||
await ReplyAsync($"{Context.User.Mention}, you rolled a {_rand.Next(1, sides)}. (d{sides})");
|
await ReplyAsync($"{Context.User.Mention}, you rolled a {_rand.Next(1, sides)}. (d{sides})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Command("rand")]
|
[Command("rand")]
|
||||||
[Summary("gets a random number")]
|
[Summary("gets a random number")]
|
||||||
public async Task RandomInt([Summary("max number")] int max = 100)
|
public async Task RandomInt([Summary("max number")] int max = 100)
|
||||||
|
@ -40,10 +43,12 @@ namespace dotbot.Commands
|
||||||
await ReplyAsync($"{Context.User.Mention}, your random number (between {min} and {max}) is {_rand.Next(min, max)}");
|
await ReplyAsync($"{Context.User.Mention}, your random number (between {min} and {max}) is {_rand.Next(min, max)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Command("8ball")]
|
[Command("8ball")]
|
||||||
[Summary("ask the mighty 8-ball to determine your fortunes")]
|
[Summary("ask the mighty 8-ball to determine your fortunes")]
|
||||||
public async Task Ask8Ball([Remainder] [Summary("your question for the magic 8ball")] string question)
|
public async Task Ask8Ball([Remainder] [Summary("your question for the magic 8ball")] string question)
|
||||||
{
|
{
|
||||||
|
await Context.Message.DeleteAsync();
|
||||||
var responses = new List<string>
|
var responses = new List<string>
|
||||||
{
|
{
|
||||||
"It is certain",
|
"It is certain",
|
||||||
|
@ -67,8 +72,17 @@ namespace dotbot.Commands
|
||||||
"Outlook not so good",
|
"Outlook not so good",
|
||||||
"Very doubtful",
|
"Very doubtful",
|
||||||
};
|
};
|
||||||
await Context.Message.DeleteAsync();
|
|
||||||
await ReplyAsync($"{Context.User.Mention} asked: *{question}*\n\n**{responses.OrderBy(q => Guid.NewGuid()).First()}**");
|
await ReplyAsync($"{Context.User.Mention} asked: *{question}*\n\n**{responses.OrderBy(q => Guid.NewGuid()).First()}**");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Command("avatar")]
|
||||||
|
[Summary("displays a user's profile picture")]
|
||||||
|
public async Task SendAvatar([Summary("user to get pfp for")] IUser mentionedUser = null)
|
||||||
|
{
|
||||||
|
var user = mentionedUser ?? Context.User;
|
||||||
|
await ReplyAsync($"the avatar for {user.Mention} is at {user.GetAvatarUrl(size: 1024)}");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue