Skip to content

Commit

Permalink
prep
Browse files Browse the repository at this point in the history
  • Loading branch information
th0mk committed Mar 31, 2024
1 parent c097b22 commit 5bf303a
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/FMBot.Bot/Builders/GameBuilders.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace FMBot.Bot.Builders;

public class GameBuilders
{

}
19 changes: 10 additions & 9 deletions src/FMBot.Bot/Handlers/CommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,23 @@ private async Task ExecuteCommand(SocketUserMessage msg, ShardedCommandContext c

var aprilFirst = new DateTime(2024, 4, 1);
var randomNumber = RandomNumberGenerator.GetInt32(1, 30);
if (DateTime.Today == aprilFirst && randomNumber == 1)
if (DateTime.Today <= aprilFirst && randomNumber == 2)
{
var randomResponse = RandomNumberGenerator.GetInt32(1, 6);
var randomResponse = RandomNumberGenerator.GetInt32(1, 7);
var response = randomResponse switch

Check warning on line 333 in src/FMBot.Bot/Handlers/CommandHandler.cs

View workflow job for this annotation

GitHub Actions / build

The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '0' is not covered.

Check warning on line 333 in src/FMBot.Bot/Handlers/CommandHandler.cs

View workflow job for this annotation

GitHub Actions / build

The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '0' is not covered.
{
1 => "😴 Zzz... Scrobble? Oh, right, music stats! I was dreaming of vinyl records in the cloud.",
2 => "😴 Oh sorry, I was sleeping.. I guess I'll get to work.",
3 => "😴 Oh hey, good morning, just woke up. I wasn't sleep scrobbling, was I? Let's get to work.",
4 => "😴 Sorry, I dozed off while listening to #3 from Aphex Twin. I'll get to work now.",
5 => "😴 Help! Oh sorry, I was having a nightmare where someone stole my Daft Punk crown. I'll get to work now.."
1 => "<:sleeping:1224093069779931216> Zzz... Scrobble? Oh, right, music stats! I was dreaming of vinyl records in the cloud.",
2 => "<:sleeping:1224093069779931216> Oh sorry, I was sleeping.. I guess I'll get to work.",
3 => "<:sleeping:1224093069779931216> Oh hey, good morning, just woke up. I wasn't sleep scrobbling, was I? Let's get to work.",
4 => "<:sleeping:1224093069779931216> Sorry, I dozed off while listening to #3 from Aphex Twin. I'll get to work now.",
5 => "<:sleeping:1224093069779931216> Help! Oh sorry, I was having a nightmare where someone stole my Daft Punk crown. I'll get to work now..",
6 => "<:sleeping:1224093069779931216> Zzz... Oh hi, did you run a command?",
};

await context.Channel.SendMessageAsync(response);
await Task.Delay(RandomNumberGenerator.GetInt32(1000, 1400));
await Task.Delay(RandomNumberGenerator.GetInt32(1200, 1600));
await context.Channel.TriggerTypingAsync();
await Task.Delay(RandomNumberGenerator.GetInt32(1000, 1400));
await Task.Delay(RandomNumberGenerator.GetInt32(1400, 1600));
}

var result = await this._commands.ExecuteAsync(context, argPos, this._provider);
Expand Down
1 change: 1 addition & 0 deletions src/FMBot.Bot/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ private void ConfigureServices(IServiceCollection services)
.AddSingleton<GeniusService>()
.AddSingleton<GenreBuilders>()
.AddSingleton<GenreService>()
.AddSingleton<GameBuilders>()
.AddSingleton<GuildBuilders>()
.AddSingleton<GuildService>()
.AddSingleton<GuildSettingBuilder>()
Expand Down
57 changes: 57 additions & 0 deletions src/FMBot.Bot/TextCommands/GameCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Threading.Tasks;
using System;
using Discord.Commands;
using FMBot.Bot.Attributes;
using FMBot.Bot.Builders;
using FMBot.Bot.Extensions;
using FMBot.Bot.Interfaces;
using FMBot.Bot.Models;
using FMBot.Bot.Services;
using FMBot.Domain.Models;
using Microsoft.Extensions.Options;
using Fergun.Interactive;

namespace FMBot.Bot.TextCommands;

//[Name("Games")]
public class GameCommands : BaseCommandModule
{
private readonly UserService _userService;
private readonly GameBuilders _gameBuilders;
private readonly IPrefixService _prefixService;

private InteractiveService Interactivity { get; }

public GameCommands(IOptions<BotSettings> botSettings, UserService userService, GameBuilders gameBuilders, IPrefixService prefixService, InteractiveService interactivity) : base(botSettings)
{
this._userService = userService;
this._gameBuilders = gameBuilders;
this._prefixService = prefixService;
this.Interactivity = interactivity;
}

//[Command("jumble", RunMode = RunMode.Async)]
//[Summary("Play the Jumble game.")]
[UsernameSetRequired]
//[CommandCategories(CommandCategory.Friends)]
public async Task JumbleAsync()
{
_ = this.Context.Channel.TriggerTypingAsync();

var contextUser = await this._userService.GetUserSettingsAsync(this.Context.User);
var prfx = this._prefixService.GetPrefix(this.Context.Guild?.Id);

try
{
//var response = await this._gameBuilders.FriendsAsync(new ContextModel(this.Context, prfx, contextUser));

//await this.Context.SendResponse(this.Interactivity, response);
//this.Context.LogCommandUsed(response.CommandResponse);
}
catch (Exception e)
{
await this.Context.HandleCommandException(e);
}
}

}

0 comments on commit 5bf303a

Please sign in to comment.