-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
213 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 32 additions & 34 deletions
66
src/DiscordNet/Controllers/MainHandler.cs → src/DiscordNet/Controllers/MainController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
using Discord.WebSocket; | ||
using DiscordNet.Handlers; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace DiscordNet.Controllers | ||
{ | ||
public class MainHandler | ||
{ | ||
public DiscordSocketClient Client; | ||
public IServiceProvider Services; | ||
|
||
public CommandHandler CommandHandler { get; private set; } | ||
public QueryHandler QueryHandler { get; private set; } | ||
|
||
public readonly string Prefix = "<@274366085011079169> "; | ||
|
||
public MainHandler(DiscordSocketClient client, IServiceProvider services) | ||
{ | ||
Client = client; | ||
Services = services; | ||
CommandHandler = new CommandHandler(); | ||
QueryHandler = new QueryHandler(); | ||
} | ||
|
||
public async Task InitializeEarlyAsync() | ||
{ | ||
await CommandHandler.InitializeAsync(this, Services); | ||
QueryHandler.Initialize(); | ||
} | ||
|
||
public MainHandler() => new MainHandler(); | ||
} | ||
} | ||
using Discord.WebSocket; | ||
using DiscordNet.Handlers; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace DiscordNet.Controllers | ||
{ | ||
public class MainController | ||
{ | ||
public DiscordSocketClient Client; | ||
public IServiceProvider Services; | ||
|
||
public CommandHandler CommandHandler { get; private set; } | ||
public QueryHandler QueryHandler { get; private set; } | ||
|
||
public readonly string Prefix = "<@274366085011079169> "; | ||
|
||
public MainController(DiscordSocketClient client, IServiceProvider services) | ||
{ | ||
Client = client; | ||
Services = services; | ||
CommandHandler = new CommandHandler(); | ||
QueryHandler = new QueryHandler(); | ||
} | ||
|
||
public async Task InitializeEarlyAsync() | ||
{ | ||
await CommandHandler.InitializeAsync(this, Services); | ||
QueryHandler.Initialize(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
using Discord; | ||
using Discord.Commands; | ||
using DiscordNet.Controllers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace DiscordNet.Modules.Addons | ||
{ | ||
public class MyCommandContext : ICommandContext | ||
{ | ||
public IDiscordClient Client { get; } | ||
public IGuild Guild { get; } | ||
public MainHandler MainHandler { get; } | ||
public MainController MainController { get; } | ||
public IMessageChannel Channel { get; } | ||
public IUser User { get; } | ||
public IUserMessage Message { get; } | ||
|
||
public bool IsPrivate => Channel is IPrivateChannel; | ||
|
||
public MyCommandContext(IDiscordClient client, MainHandler handler, IUserMessage msg) | ||
public MyCommandContext(IDiscordClient client, MainController controller, IUserMessage msg) | ||
{ | ||
Client = client; | ||
Guild = (msg.Channel as IGuildChannel)?.Guild; | ||
Channel = msg.Channel; | ||
User = msg.Author; | ||
Message = msg; | ||
MainHandler = handler; | ||
MainController = controller; | ||
} | ||
} | ||
} |
Oops, something went wrong.