Skip to content

Commit 9fba644

Browse files
committed
Update Discord-Net, moved most features to modules for simplicity. Added embeds and interactivity.
1 parent d054ebe commit 9fba644

22 files changed

+552
-515
lines changed

SupportBot/Checks/CheckModule.cs

Lines changed: 0 additions & 71 deletions
This file was deleted.

SupportBot/CommandBuilderModule.cs

Lines changed: 0 additions & 43 deletions
This file was deleted.

SupportBot/CommandHandler.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
// ***********************************************************************
2-
// Assembly : SupportBot
3-
// Author : Nathan Pipes
4-
// Created : 01-24-2020
5-
//
6-
// Last Modified By : Nathan Pipes
7-
// Last Modified On : 02-23-2021
8-
// ***********************************************************************
9-
// <copyright file="CommandHandler.cs" company="NPipes">
10-
// Copyright (c) NPipes. All rights reserved.
11-
// </copyright>
12-
// <summary></summary>
13-
// ***********************************************************************
14-
using Discord.Commands;
1+
using Discord.Commands;
152
using Discord.WebSocket;
163
using Microsoft.Extensions.DependencyInjection;
174
using System;
@@ -20,6 +7,7 @@
207
using System.Reflection;
218
using System.Threading.Tasks;
229
using Discord;
10+
using SupportBot.Services;
2311

2412
namespace SupportBot
2513
{
@@ -28,6 +16,9 @@ namespace SupportBot
2816
/// </summary>
2917
public class CommandHandler
3018
{
19+
private readonly DatabaseService _databaseService;
20+
private readonly IServiceProvider _serviceProvider;
21+
3122
/// <summary>
3223
/// The client
3324
/// </summary>
@@ -36,21 +27,18 @@ public class CommandHandler
3627
/// The commands
3728
/// </summary>
3829
private readonly CommandService _commands;
39-
/// <summary>
40-
/// The services
41-
/// </summary>
42-
private readonly IServiceProvider _services;
4330

4431
/// <summary>
4532
/// Initializes a new instance of the <see cref="CommandHandler"/> class.
4633
/// </summary>
4734
/// <param name="services">The services.</param>
48-
public CommandHandler(IServiceProvider services)
35+
public CommandHandler(DiscordSocketClient client, CommandService commands, DatabaseService databaseService, IServiceProvider serviceProvider)
4936
{
50-
_commands = services.GetRequiredService<CommandService>();
37+
_databaseService = databaseService;
38+
_serviceProvider = serviceProvider;
39+
_commands = commands;
5140
_commands.Log += CommandsOnLog;
52-
_client = services.GetRequiredService<DiscordSocketClient>();
53-
_services = services;
41+
_client = client;
5442
}
5543

5644
private static Task CommandsOnLog(LogMessage arg)
@@ -66,7 +54,7 @@ private static Task CommandsOnLog(LogMessage arg)
6654
public async Task InstallCommandsAsync()
6755
{
6856
_client.MessageReceived += HandleCommandAsync;
69-
await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services);
57+
await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _serviceProvider);
7058
}
7159

7260
/// <summary>
@@ -78,7 +66,7 @@ private async Task HandleCommandAsync(SocketMessage messageParam)
7866
// Don't process the command if it was a system message
7967
if (messageParam is not SocketUserMessage message) return;
8068

81-
if (!Worker.Settings.AllowedChannels.Contains(message.Channel.Id))
69+
if (!_databaseService.GetSettings().AllowedChannels.Contains(message.Channel.Id))
8270
{
8371
return;
8472
}

SupportBot/Data/BotSettings.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
// ***********************************************************************
2-
// Assembly : SupportBot
3-
// Author : Grimston
4-
// Created : 04-04-2020
5-
//
6-
// Last Modified By : Grimston
7-
// Last Modified On : 02-20-2021
8-
// ***********************************************************************
9-
// <copyright file="BotSettings.cs" company="NPipes">
10-
// Copyright (c) NPipes. All rights reserved.
11-
// </copyright>
12-
// <summary></summary>
13-
// ***********************************************************************
14-
15-
namespace SupportBot.Data
1+
namespace SupportBot.Data
162
{
173
/// <summary>
184
/// Class BotSettings.

SupportBot/Data/SteamChecks.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using SupportBot.Modules.Modal;
2+
3+
namespace SupportBot.Data;
4+
5+
public class SteamChecks
6+
{
7+
/// <summary>
8+
/// Gets or sets the identifier.
9+
/// </summary>
10+
/// <value>The identifier.</value>
11+
public ulong Id { get; set; }
12+
13+
/// <summary>
14+
/// Gets or sets the name.
15+
/// </summary>
16+
/// <value>The name.</value>
17+
public Response SteamResponse { get; set; }
18+
}

SupportBot/HelpModule.cs

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)