Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7e6b0a398 |
1
.idea/.idea.SethDiscordBot/.idea/.name
generated
Normal file
1
.idea/.idea.SethDiscordBot/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
|||||||
|
SethDiscordBot
|
||||||
10
.idea/.idea.SethDiscordBot/.idea/avalonia.xml
generated
Normal file
10
.idea/.idea.SethDiscordBot/.idea/avalonia.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AvaloniaProject">
|
||||||
|
<option name="projectPerEditor">
|
||||||
|
<map>
|
||||||
|
<entry key="Updater/MainWindow.axaml" value="Updater/Updater.csproj" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/.idea.SethDiscordBot/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.SethDiscordBot/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.SethDiscordBot/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.SethDiscordBot/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
85
.idea/.idea.SethDiscordBot/.idea/workspace.xml
generated
85
.idea/.idea.SethDiscordBot/.idea/workspace.xml
generated
@@ -1,43 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="AutoGeneratedRunConfigurationManager">
|
<component name="AutoGeneratedRunConfigurationManager">
|
||||||
<projectFile>DiscordBot/DiscordBot.csproj</projectFile>
|
<projectFile pubXmlPath="DiscordBot/Properties/PublishProfiles/LinuxProfile.pubxml">DiscordBot/DiscordBot.csproj</projectFile>
|
||||||
<projectFile pubXmlPath="DiscordBot/Properties/PublishProfiles/WindowsBuild.pubxml">DiscordBot/DiscordBot.csproj</projectFile>
|
<projectFile pubXmlPath="DiscordBot/Properties/PublishProfiles/WindowsBuild.pubxml">DiscordBot/DiscordBot.csproj</projectFile>
|
||||||
|
<projectFile>Updater/Updater.csproj</projectFile>
|
||||||
</component>
|
</component>
|
||||||
<component name="AutoImportSettings">
|
<component name="AutoImportSettings">
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="ab173b07-aba1-4bb8-94c1-ae9846bbdb0a" name="Changes" comment="">
|
<list default="true" id="ab173b07-aba1-4bb8-94c1-ae9846bbdb0a" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/Roles/AddRole.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.SethDiscordBot/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.SethDiscordBot/.idea/workspace.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/Roles/Internals/RoleManagement.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/Roles/Roles.csproj" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/BUILDS/net6.0/CMD_Utils.dll" beforeDir="false" afterPath="$PROJECT_DIR$/BUILDS/net6.0/CMD_Utils.dll" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/BUILDS/net6.0/Music Commands.dll" beforeDir="false" afterPath="$PROJECT_DIR$/BUILDS/net6.0/Music Commands.dll" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/BUILDS/net6.0/PluginManager.dll" beforeDir="false" afterPath="$PROJECT_DIR$/BUILDS/net6.0/PluginManager.dll" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/BUILDS/net6.0/PluginManager.dll" beforeDir="false" afterPath="$PROJECT_DIR$/BUILDS/net6.0/PluginManager.dll" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/CMD_LevelingSystem/Level.cs" beforeDir="false" afterPath="$PROJECT_DIR$/CMD_LevelingSystem/Level.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/CMD_Utils/Echo.cs" beforeDir="false" afterPath="$PROJECT_DIR$/CMD_Utils/Echo.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/CMD_Utils/FlipCoin.cs" beforeDir="false" afterPath="$PROJECT_DIR$/CMD_Utils/FlipCoin.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/CMD_Utils/Poll.cs" beforeDir="false" afterPath="$PROJECT_DIR$/CMD_Utils/Poll.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/CMD_Utils/Random.cs" beforeDir="false" afterPath="$PROJECT_DIR$/CMD_Utils/Random.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/Discord/Commands/Help.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/Discord/Commands/Help.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/Discord/Commands/Restart.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/Discord/Commands/Restart.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/Discord/Commands/Settings.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/Discord/Commands/Settings.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/Discord/Core/Boot.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/Discord/Core/Boot.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/Discord/Core/CommandHandler.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/Discord/Core/CommandHandler.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/DiscordBot.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/DiscordBot.csproj" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/DiscordBot/DiscordBot.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/DiscordBot.csproj" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/DiscordBot/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DiscordBot/Program.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/MusicCommands/Leave.cs" beforeDir="false" afterPath="$PROJECT_DIR$/MusicCommands/Leave.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/MusicCommands/MusicPlayer.cs" beforeDir="false" afterPath="$PROJECT_DIR$/MusicCommands/MusicPlayer.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/MusicCommands/Pause.cs" beforeDir="false" afterPath="$PROJECT_DIR$/MusicCommands/Pause.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/MusicCommands/Play.cs" beforeDir="false" afterPath="$PROJECT_DIR$/MusicCommands/Play.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/MusicCommands/Skip.cs" beforeDir="false" afterPath="$PROJECT_DIR$/MusicCommands/Skip.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/MusicCommands/queue.cs" beforeDir="false" afterPath="$PROJECT_DIR$/MusicCommands/queue.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/PluginManager/Config.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PluginManager/Config.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/PluginManager/Interfaces/DBCommand.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PluginManager/Interfaces/DBCommand.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/PluginManager/Items/Command.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PluginManager/Items/Command.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/PluginManager/Items/ConsoleCommandsHandler.cs" beforeDir="false" afterPath="$PROJECT_DIR$/PluginManager/Items/ConsoleCommandsHandler.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/SethDiscordBot.sln" beforeDir="false" afterPath="$PROJECT_DIR$/SethDiscordBot.sln" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -52,26 +27,48 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"WebServerToolWindowFactoryState": "false",
|
"WebServerToolWindowFactoryState": "false",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager" selected="Publish to IIS.DiscordBot: WindowsBuild">
|
||||||
|
<configuration name="DiscordBot: LinuxProfile" type="DotNetMsBuildPublish" factoryName="Publish to IIS">
|
||||||
|
<riderPublish publish_profile="LinuxProfile.pubxml" pubxml_path="$PROJECT_DIR$/DiscordBot/Properties/PublishProfiles/LinuxProfile.pubxml" uuid_high="612037599008934041" uuid_low="-9069359786678974134" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<configuration name="DiscordBot: WindowsBuild" type="DotNetMsBuildPublish" factoryName="Publish to IIS">
|
<configuration name="DiscordBot: WindowsBuild" type="DotNetMsBuildPublish" factoryName="Publish to IIS">
|
||||||
<riderPublish publish_profile="WindowsBuild.pubxml" pubxml_path="$PROJECT_DIR$/DiscordBot/Properties/PublishProfiles/WindowsBuild.pubxml" uuid_high="612037599008934041" uuid_low="-9069359786678974134" />
|
<riderPublish publish_profile="WindowsBuild.pubxml" pubxml_path="$PROJECT_DIR$/DiscordBot/Properties/PublishProfiles/WindowsBuild.pubxml" uuid_high="612037599008934041" uuid_low="-9069359786678974134" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="Updater" type="DotNetProject" factoryName=".NET Project">
|
||||||
|
<option name="EXE_PATH" value="" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
|
<option name="USE_MONO" value="0" />
|
||||||
|
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||||
|
<option name="PROJECT_PATH" value="$PROJECT_DIR$/Updater/Updater.csproj" />
|
||||||
|
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
||||||
|
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||||
|
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||||
|
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||||
|
<option name="PROJECT_TFM" value="" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Build" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
<component name="TaskManager">
|
<component name="TaskManager">
|
||||||
@@ -82,6 +79,8 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1658854902538</updated>
|
<updated>1658854902538</updated>
|
||||||
<workItem from="1658854908500" duration="1731000" />
|
<workItem from="1658854908500" duration="1731000" />
|
||||||
|
<workItem from="1662205818938" duration="46000" />
|
||||||
|
<workItem from="1662205887643" duration="139000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager;
|
using PluginManager;
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
@@ -17,21 +18,17 @@ internal class Level : DBCommand
|
|||||||
|
|
||||||
public string Usage => "level";
|
public string Usage => "level";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
if (!File.Exists(Config.GetValue<string>("LevelingSystemPath") + $"/{message.Author.Id}.dat"))
|
if (!File.Exists(Config.GetValue<string>("LevelingSystemPath") + $"/{context.Message.Author.Id}.dat"))
|
||||||
{
|
{
|
||||||
await context.Channel.SendMessageAsync("You are now unranked !");
|
await context.Channel.SendMessageAsync("You are now unranked !");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = await Functions.ConvertFromJson<User>(Config.GetValue<string>("LevelingSystemPath") + $"/{message.Author.Id}.dat");
|
var user = await Functions.ConvertFromJson<User>(Config.GetValue<string>("LevelingSystemPath") + $"/{context.Message.Author.Id}.dat");
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
await context.Channel.SendMessageAsync("You are now unranked !");
|
await context.Channel.SendMessageAsync("You are now unranked !");
|
||||||
@@ -39,7 +36,7 @@ internal class Level : DBCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
var builder = new EmbedBuilder();
|
var builder = new EmbedBuilder();
|
||||||
var r = new Random();
|
var r = new Random();
|
||||||
builder.WithColor(r.Next(256), r.Next(256), r.Next(256));
|
builder.WithColor(r.Next(256), r.Next(256), r.Next(256));
|
||||||
builder.AddField("Current Level", user.CurrentLevel, true)
|
builder.AddField("Current Level", user.CurrentLevel, true)
|
||||||
.AddField("Current EXP", user.CurrentEXP, true)
|
.AddField("Current EXP", user.CurrentEXP, true)
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
internal class Echo : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "echo";
|
|
||||||
|
|
||||||
public List<string> Aliases => null;
|
|
||||||
|
|
||||||
public string Description => "Replay with the same message";
|
|
||||||
|
|
||||||
public string Usage => "echo [message]";
|
|
||||||
|
|
||||||
public bool canUseDM => true;
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
|
||||||
{
|
|
||||||
var m = message.Content.Substring(6);
|
|
||||||
await message.Channel.SendMessageAsync(m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace CMD_Utils;
|
namespace CMD_Utils;
|
||||||
@@ -15,19 +17,16 @@ internal class FlipCoin : DBCommand
|
|||||||
|
|
||||||
public string Usage => "flip";
|
public string Usage => "flip";
|
||||||
|
|
||||||
public bool canUseDM => true;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteDM(SocketCommandContext context) => ExecuteServer(context);
|
||||||
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
var random = new System.Random();
|
var random = new System.Random();
|
||||||
var r = random.Next(1, 3);
|
var r = random.Next(1, 3);
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
await message.Channel.SendMessageAsync("Heads");
|
await context.Message.Channel.SendMessageAsync("Heads");
|
||||||
else
|
else
|
||||||
await message.Channel.SendMessageAsync("Tails");
|
await context.Message.Channel.SendMessageAsync("Tails");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
|
|
||||||
@@ -17,17 +19,12 @@ public class Poll : DBCommand
|
|||||||
|
|
||||||
public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... ";
|
public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... ";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => true;
|
public bool requireAdmin => true;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
if (isDM) return;
|
var question = context.Message.Content.Split(' ')[1].Replace('-', ' ');
|
||||||
var question = message.Content.Split(' ')[1].Replace('-', ' ');
|
var answers = Functions.MergeStrings(context.Message.Content.Split(' '), 2).Split(' ');
|
||||||
var answers = Functions.MergeStrings(message.Content.Split(' '), 2).Split(' ');
|
|
||||||
var embedBuilder = new EmbedBuilder();
|
var embedBuilder = new EmbedBuilder();
|
||||||
embedBuilder.Title = question;
|
embedBuilder.Title = question;
|
||||||
var len = answers.Length;
|
var len = answers.Length;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
public class Random : DBCommand
|
public class Random : DBCommand
|
||||||
@@ -12,31 +14,30 @@ public class Random : DBCommand
|
|||||||
public string Description => "random number between number1 and number2";
|
public string Description => "random number between number1 and number2";
|
||||||
|
|
||||||
public string Usage => "random [number1] [number2]";
|
public string Usage => "random [number1] [number2]";
|
||||||
|
|
||||||
public bool canUseDM => true;
|
|
||||||
public bool canUseServer => true;
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteDM(SocketCommandContext context) => ExecuteServer(context);
|
||||||
|
|
||||||
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var msg = message.Content;
|
var msg = context.Message.Content;
|
||||||
var a = int.Parse(msg.Split(' ')[1]);
|
var a = int.Parse(msg.Split(' ')[1]);
|
||||||
var b = int.Parse(msg.Split(' ')[2]);
|
var b = int.Parse(msg.Split(' ')[2]);
|
||||||
|
|
||||||
if (a > b)
|
if (a > b)
|
||||||
{
|
{
|
||||||
var temp = a;
|
var temp = a;
|
||||||
a = b;
|
a = b;
|
||||||
b = temp;
|
b = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
await message.Channel.SendMessageAsync("Your random generated number is " + new System.Random().Next(a, b));
|
await context.Message.Channel.SendMessageAsync("Your random generated number is " + new System.Random().Next(a, b));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
await message.Channel.SendMessageAsync("Invalid numbers or no numbers:\nUsage: " + Usage);
|
await context.Message.Channel.SendMessageAsync("Invalid numbers or no numbers:\nUsage: " + Usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Loaders;
|
using PluginManager.Loaders;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
@@ -31,16 +33,6 @@ internal class Help : DBCommand
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Usage => "help <command>";
|
public string Usage => "help <command>";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the command can be used <inheritdoca DM <see cref="IChannel" />/>
|
|
||||||
/// </summary>
|
|
||||||
public bool canUseDM => true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the command can be used in a server
|
|
||||||
/// </summary>
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the command require administrator to be executed
|
/// Check if the command require administrator to be executed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -53,9 +45,9 @@ internal class Help : DBCommand
|
|||||||
/// <param name="message">The command message</param>
|
/// <param name="message">The command message</param>
|
||||||
/// <param name="client">The discord bot client</param>
|
/// <param name="client">The discord bot client</param>
|
||||||
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
||||||
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
var args = Functions.GetArguments(message);
|
var args = Functions.GetArguments(context.Message);
|
||||||
if (args.Count != 0)
|
if (args.Count != 0)
|
||||||
{
|
{
|
||||||
foreach (var item in args)
|
foreach (var item in args)
|
||||||
@@ -72,30 +64,26 @@ internal class Help : DBCommand
|
|||||||
|
|
||||||
var embedBuilder = new EmbedBuilder();
|
var embedBuilder = new EmbedBuilder();
|
||||||
|
|
||||||
var adminCommands = "";
|
var adminCommands = "";
|
||||||
var normalCommands = "";
|
var normalCommands = "";
|
||||||
var DMCommands = "";
|
|
||||||
|
|
||||||
foreach (var cmd in PluginLoader.Commands!)
|
foreach (var cmd in PluginLoader.Commands!)
|
||||||
{
|
{
|
||||||
if (cmd.canUseDM)
|
|
||||||
DMCommands += cmd.Command + " ";
|
|
||||||
if (cmd.requireAdmin)
|
if (cmd.requireAdmin)
|
||||||
adminCommands += cmd.Command + " ";
|
adminCommands += cmd.Command + " ";
|
||||||
if (cmd.canUseServer)
|
else
|
||||||
normalCommands += cmd.Command + " ";
|
normalCommands += cmd.Command + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
embedBuilder.AddField("Admin Commands", adminCommands);
|
embedBuilder.AddField("Admin Commands", adminCommands);
|
||||||
embedBuilder.AddField("Normal Commands", normalCommands);
|
embedBuilder.AddField("Normal Commands", normalCommands);
|
||||||
embedBuilder.AddField("DM Commands", DMCommands);
|
|
||||||
context.Channel.SendMessageAsync(embed: embedBuilder.Build());
|
context.Channel.SendMessageAsync(embed: embedBuilder.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmbedBuilder GenerateHelpCommand(string command)
|
private EmbedBuilder GenerateHelpCommand(string command)
|
||||||
{
|
{
|
||||||
var embedBuilder = new EmbedBuilder();
|
var embedBuilder = new EmbedBuilder();
|
||||||
var cmd = PluginLoader.Commands!.Find(p => p.Command == command || (p.Aliases is not null && p.Aliases.Contains(command)));
|
var cmd = PluginLoader.Commands!.Find(p => p.Command == command || (p.Aliases is not null && p.Aliases.Contains(command)));
|
||||||
if (cmd == null) return null;
|
if (cmd == null) return null;
|
||||||
|
|
||||||
embedBuilder.AddField("Usage", cmd.Usage);
|
embedBuilder.AddField("Usage", cmd.Usage);
|
||||||
|
|||||||
@@ -30,33 +30,19 @@ internal class Restart : DBCommand
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Usage => "restart [-p | -c | -args | -cmd] <args>";
|
public string Usage => "restart [-p | -c | -args | -cmd] <args>";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the command can be used <inheritdoca DM <see cref="IChannel" />/>
|
|
||||||
/// </summary>
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the command can be used in a server
|
|
||||||
/// </summary>
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the command require administrator to be executed
|
/// Check if the command require administrator to be executed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main body of the command
|
/// The main body of the command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">The command context</param>
|
/// <param name="context">The command context</param>
|
||||||
/// <param name="message">The command message</param>
|
public async void ExecuteServer(DiscordLibCommands.SocketCommandContext context)
|
||||||
/// <param name="client">The discord bot client</param>
|
|
||||||
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
|
||||||
public async void Execute(DiscordLibCommands.SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
|
||||||
{
|
{
|
||||||
if (!(message.Author as SocketGuildUser).hasPermission(DiscordLib.GuildPermission.Administrator)) return;
|
var args = Functions.GetArguments(context.Message);
|
||||||
var args = Functions.GetArguments(message);
|
var OS = Functions.GetOperatingSystem();
|
||||||
var OS = Functions.GetOperatingSystem();
|
|
||||||
if (args.Count == 0)
|
if (args.Count == 0)
|
||||||
{
|
{
|
||||||
switch (OS)
|
switch (OS)
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager;
|
using PluginManager;
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
@@ -27,16 +29,6 @@ internal class Settings : DBCommand
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Usage => "set [keyword] [new Value]";
|
public string Usage => "set [keyword] [new Value]";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the command can be used <inheritdoca DM <see cref="IChannel" />/>
|
|
||||||
/// </summary>
|
|
||||||
public bool canUseDM => true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the command can be used in a server
|
|
||||||
/// </summary>
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the command require administrator to be executed
|
/// Check if the command require administrator to be executed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -46,16 +38,13 @@ internal class Settings : DBCommand
|
|||||||
/// The main body of the command
|
/// The main body of the command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">The command context</param>
|
/// <param name="context">The command context</param>
|
||||||
/// <param name="message">The command message</param>
|
public async void Execute(SocketCommandContext context)
|
||||||
/// <param name="client">The discord bot client</param>
|
|
||||||
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
|
||||||
{
|
{
|
||||||
var channel = message.Channel;
|
var channel = context.Message.Channel;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var content = message.Content;
|
var content = context.Message.Content;
|
||||||
var data = content.Split(' ');
|
var data = content.Split(' ');
|
||||||
var keyword = data[1];
|
var keyword = data[1];
|
||||||
if (keyword.ToLower() == "help")
|
if (keyword.ToLower() == "help")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager;
|
using PluginManager;
|
||||||
|
|
||||||
using static PluginManager.Others.Functions;
|
using static PluginManager.Others.Functions;
|
||||||
|
|
||||||
namespace DiscordBot.Discord.Core;
|
namespace DiscordBot.Discord.Core;
|
||||||
@@ -44,7 +47,7 @@ internal class Boot
|
|||||||
public Boot(string botToken, string botPrefix)
|
public Boot(string botToken, string botPrefix)
|
||||||
{
|
{
|
||||||
this.botPrefix = botPrefix;
|
this.botPrefix = botPrefix;
|
||||||
this.botToken = botToken;
|
this.botToken = botToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ internal class Boot
|
|||||||
{
|
{
|
||||||
DiscordSocketConfig config = new DiscordSocketConfig { AlwaysDownloadUsers = true };
|
DiscordSocketConfig config = new DiscordSocketConfig { AlwaysDownloadUsers = true };
|
||||||
|
|
||||||
client = new DiscordSocketClient(config);
|
client = new DiscordSocketClient(config);
|
||||||
service = new CommandService();
|
service = new CommandService();
|
||||||
|
|
||||||
CommonTasks();
|
CommonTasks();
|
||||||
@@ -81,9 +84,9 @@ internal class Boot
|
|||||||
{
|
{
|
||||||
if (client == null) return;
|
if (client == null) return;
|
||||||
client.LoggedOut += Client_LoggedOut;
|
client.LoggedOut += Client_LoggedOut;
|
||||||
client.Log += Log;
|
client.Log += Log;
|
||||||
client.LoggedIn += LoggedIn;
|
client.LoggedIn += LoggedIn;
|
||||||
client.Ready += Ready;
|
client.Ready += Ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task Client_LoggedOut()
|
private Task Client_LoggedOut()
|
||||||
@@ -96,7 +99,7 @@ internal class Boot
|
|||||||
private Task Ready()
|
private Task Ready()
|
||||||
{
|
{
|
||||||
Console.Title = "ONLINE";
|
Console.Title = "ONLINE";
|
||||||
isReady = true;
|
isReady = true;
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@@ -138,4 +141,5 @@ internal class Boot
|
|||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Loaders;
|
using PluginManager.Loaders;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
using PluginManager.Others.Permissions;
|
using PluginManager.Others.Permissions;
|
||||||
@@ -11,9 +13,9 @@ namespace DiscordBot.Discord.Core;
|
|||||||
|
|
||||||
internal class CommandHandler
|
internal class CommandHandler
|
||||||
{
|
{
|
||||||
private readonly string botPrefix;
|
private readonly string botPrefix;
|
||||||
private readonly DiscordSocketClient client;
|
private readonly DiscordSocketClient client;
|
||||||
private readonly CommandService commandService;
|
private readonly CommandService commandService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Command handler constructor
|
/// Command handler constructor
|
||||||
@@ -23,9 +25,9 @@ internal class CommandHandler
|
|||||||
/// <param name="botPrefix">The prefix to watch for</param>
|
/// <param name="botPrefix">The prefix to watch for</param>
|
||||||
public CommandHandler(DiscordSocketClient client, CommandService commandService, string botPrefix)
|
public CommandHandler(DiscordSocketClient client, CommandService commandService, string botPrefix)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.commandService = commandService;
|
this.commandService = commandService;
|
||||||
this.botPrefix = botPrefix;
|
this.botPrefix = botPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -75,57 +77,19 @@ internal class CommandHandler
|
|||||||
|
|
||||||
var plugin = PluginLoader.Commands!.Where(p => p.Command == message.Content.Split(' ')[0].Substring(botPrefix.Length) || (p.Aliases is not null && p.Aliases.Contains(message.Content.Split(' ')[0].Substring(botPrefix.Length)))).FirstOrDefault();
|
var plugin = PluginLoader.Commands!.Where(p => p.Command == message.Content.Split(' ')[0].Substring(botPrefix.Length) || (p.Aliases is not null && p.Aliases.Contains(message.Content.Split(' ')[0].Substring(botPrefix.Length)))).FirstOrDefault();
|
||||||
|
|
||||||
|
if (plugin is null) throw new System.Exception("Failed to run command. !");
|
||||||
|
|
||||||
if (plugin != null)
|
if (plugin.requireAdmin && !context.Message.Author.isAdmin())
|
||||||
{
|
return;
|
||||||
if (message.Channel == await message.Author.CreateDMChannelAsync())
|
|
||||||
{
|
|
||||||
if (plugin.canUseDM)
|
|
||||||
{
|
|
||||||
if (plugin.requireAdmin)
|
|
||||||
{
|
|
||||||
if (message.Author.isAdmin())
|
|
||||||
{
|
|
||||||
plugin.Execute(context, message, client, true);
|
|
||||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command (DM) : " + plugin.Command);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await message.Channel.SendMessageAsync("This command is for administrators only !");
|
if (context.Channel is SocketDMChannel)
|
||||||
return;
|
plugin.ExecuteDM(context);
|
||||||
}
|
else plugin.ExecuteServer(context);
|
||||||
|
|
||||||
plugin.Execute(context, message, client, true);
|
|
||||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command (DM) : " + plugin.Command);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await message.Channel.SendMessageAsync("This command is not for DMs");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin.canUseServer)
|
|
||||||
{
|
|
||||||
if (plugin.requireAdmin)
|
|
||||||
{
|
|
||||||
if (message.Author.isAdmin())
|
|
||||||
{
|
|
||||||
plugin.Execute(context, message, client, false);
|
|
||||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command : " + plugin.Command);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await message.Channel.SendMessageAsync("This command is for administrators only !");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.Execute(context, message, client, false);
|
|
||||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command : " + plugin.Command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
|
ex.WriteErrFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<StartupObject />
|
<StartupObject />
|
||||||
<SignAssembly>False</SignAssembly>
|
<SignAssembly>False</SignAssembly>
|
||||||
<IsPublishable>True</IsPublishable>
|
<IsPublishable>True</IsPublishable>
|
||||||
<AssemblyVersion>1.0.0.10</AssemblyVersion>
|
<AssemblyVersion>1.0.0.11</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
24
FreeGamesModule/Commands.cs
Normal file
24
FreeGamesModule/Commands.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Discord.Commands;
|
||||||
|
|
||||||
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
|
namespace FreeGamesModule
|
||||||
|
{
|
||||||
|
public class Free : DBCommand
|
||||||
|
{
|
||||||
|
public string Command => "free";
|
||||||
|
|
||||||
|
public List<string>? Aliases => null;
|
||||||
|
|
||||||
|
public string Description => "Check out any free game";
|
||||||
|
|
||||||
|
public string Usage => "free";
|
||||||
|
|
||||||
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
|
public void ExecuteServer(SocketCommandContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
FreeGamesModule/FreeGamesModule.csproj
Normal file
13
FreeGamesModule/FreeGamesModule.csproj
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
namespace MusicCommands;
|
namespace MusicCommands;
|
||||||
@@ -15,13 +17,9 @@ internal class Leave : DBCommand
|
|||||||
|
|
||||||
public string Usage => "leave";
|
public string Usage => "leave";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
if (Data.audioClient is not null && Data.voiceChannel is not null)
|
if (Data.audioClient is not null && Data.voiceChannel is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
namespace MusicCommands;
|
namespace MusicCommands;
|
||||||
@@ -15,13 +17,9 @@ internal class Pause : DBCommand
|
|||||||
|
|
||||||
public string Usage => "pause";
|
public string Usage => "pause";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
Data.MusicPlayer.isPaused = !Data.MusicPlayer.isPaused;
|
Data.MusicPlayer.isPaused = !Data.MusicPlayer.isPaused;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Audio;
|
using Discord.Audio;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
|
|
||||||
@@ -21,17 +23,13 @@ internal class Play : DBCommand
|
|||||||
|
|
||||||
public string Usage => "play [name/url]";
|
public string Usage => "play [name/url]";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory("Music");
|
Directory.CreateDirectory("Music");
|
||||||
var path = "./Music/";
|
var path = "./Music/";
|
||||||
string[] splitted = message.Content.Split(' ');
|
string[] splitted = context.Message.Content.Split(' ');
|
||||||
if (splitted.Length < 2)
|
if (splitted.Length < 2)
|
||||||
return;
|
return;
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
namespace MusicCommands
|
namespace MusicCommands
|
||||||
@@ -19,24 +21,20 @@ namespace MusicCommands
|
|||||||
|
|
||||||
public string Usage => "skip";
|
public string Usage => "skip";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
var loadedSong = Data.MusicPlayer.NowPlaying;
|
var loadedSong = Data.MusicPlayer.NowPlaying;
|
||||||
|
|
||||||
if (loadedSong is null || Data.MusicPlayer.isPlaying == false)
|
if (loadedSong is null || Data.MusicPlayer.isPlaying == false)
|
||||||
{
|
{
|
||||||
message.Channel.SendMessageAsync("There is no music playing");
|
await context.Message.Channel.SendMessageAsync("There is no music playing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Data.MusicPlayer.isPlaying = false;
|
Data.MusicPlayer.isPlaying = false;
|
||||||
message.Channel.SendMessageAsync($"You have skipped {loadedSong.Name}");
|
await context.Message.Channel.SendMessageAsync($"You have skipped {loadedSong.Name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,28 +3,26 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
|
||||||
namespace MusicCommands
|
namespace MusicCommands
|
||||||
{
|
{
|
||||||
public class queue : DBCommand
|
public class queue : DBCommand
|
||||||
{
|
{
|
||||||
public string Command => "queue";
|
public string Command => "queue";
|
||||||
public List<string> Aliases => new() { "q" };
|
public List<string> Aliases => new() { "q" };
|
||||||
|
|
||||||
public string Description => "check queue";
|
public string Description => "check queue";
|
||||||
|
|
||||||
public string Usage => "queue";
|
public string Usage => "queue";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
public bool requireAdmin => false;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
await context.Channel.SendMessageAsync($"You have {Data.Playlist.Count} items in queue");
|
await context.Channel.SendMessageAsync($"You have {Data.Playlist.Count} items in queue");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
@@ -28,27 +29,20 @@ public interface DBCommand
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
string Usage { get; }
|
string Usage { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// true if the command can be used in a DM channel, otherwise false
|
|
||||||
/// </summary>
|
|
||||||
bool canUseDM { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// true if the command can be used in a server, otherwise false
|
|
||||||
/// </summary>
|
|
||||||
bool canUseServer { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// true if the command requre admin, otherwise false
|
/// true if the command requre admin, otherwise false
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool requireAdmin { get; }
|
bool requireAdmin { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main body of the command. This is what is executed when user calls the command
|
/// The main body of the command. This is what is executed when user calls the command in Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">The disocrd Context</param>
|
/// <param name="context">The disocrd Context</param>
|
||||||
/// <param name="message">The message that the user types</param>
|
void ExecuteServer(SocketCommandContext context) { }
|
||||||
/// <param name="client">The discord client of the bot</param>
|
|
||||||
/// <param name="isDM">true if the message was sent from DM, otherwise false. It is always false if canUseDM is false</param>
|
/// <summary>
|
||||||
void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM);
|
/// The main body of the command. This is what is executed when user calls the command in DM
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The disocrd Context</param>
|
||||||
|
void ExecuteDM(SocketCommandContext context) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ namespace PluginManager.Others
|
|||||||
File.AppendAllText(errPath, ErrMessage + " \n");
|
File.AppendAllText(errPath, ErrMessage + " \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void WriteErrFile(this Exception ex)
|
||||||
|
{
|
||||||
|
WriteErrFile(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Merge one array of strings into one string
|
/// Merge one array of strings into one string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Discord.Rest;
|
using Discord.Rest;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
using Microsoft.Win32.SafeHandles;
|
using Microsoft.Win32.SafeHandles;
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
|
|
||||||
using Roles.Internals;
|
using Roles.Internals;
|
||||||
|
|
||||||
namespace Roles
|
namespace Roles
|
||||||
@@ -21,15 +25,11 @@ namespace Roles
|
|||||||
|
|
||||||
public string Usage => "addrole [user1] [user2] ... [role1] [role2] ...";
|
public string Usage => "addrole [user1] [user2] ... [role1] [role2] ...";
|
||||||
|
|
||||||
public bool canUseDM => false;
|
|
||||||
|
|
||||||
public bool canUseServer => true;
|
|
||||||
|
|
||||||
public bool requireAdmin => true;
|
public bool requireAdmin => true;
|
||||||
|
|
||||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
public async void ExecuteServer(SocketCommandContext context)
|
||||||
{
|
{
|
||||||
if (message.MentionedUsers.Count == 0 || message.MentionedRoles.Count == 0)
|
if (context.Message.MentionedUsers.Count == 0 || context.Message.MentionedRoles.Count == 0)
|
||||||
{
|
{
|
||||||
await context.Channel.SendMessageAsync($"Invalid invocation\nUsage:{Usage}");
|
await context.Channel.SendMessageAsync($"Invalid invocation\nUsage:{Usage}");
|
||||||
return;
|
return;
|
||||||
@@ -37,15 +37,20 @@ namespace Roles
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var users = message.MentionedUsers;
|
var users = context.Message.MentionedUsers;
|
||||||
var roles = message.MentionedRoles as IEnumerable<IRole>;
|
var roles = context.Message.MentionedRoles;
|
||||||
|
|
||||||
foreach (var user in users)
|
foreach (var user in users)
|
||||||
{
|
{
|
||||||
SocketGuildUser? usr = context.Client.GetUser(user.Username, user.Discriminator) as SocketGuildUser;
|
foreach (var role in roles)
|
||||||
if (usr is null)
|
{
|
||||||
throw new Exception("User is null");
|
try
|
||||||
await usr.AddRolesAsync(roles);
|
{
|
||||||
|
await ((SocketGuildUser)context.Guild.GetUser(user.Id)).AddRoleAsync(role);
|
||||||
|
await context.Channel.SendMessageAsync($"User {user.Mention} got role : {role.Name}");
|
||||||
|
}
|
||||||
|
catch (Exception ex) { ex.WriteErrFile(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Roles\Roles.csproj
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Others", "Others", "{727BBA0B-9114-4BC8-B9A8-3F461449A564}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Others", "Others", "{727BBA0B-9114-4BC8-B9A8-3F461449A564}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Updater", "Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeGamesModule", "FreeGamesModule\FreeGamesModule.csproj", "{8959C766-414D-4EF8-BC85-9928B30AAF0A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -65,6 +67,10 @@ Global
|
|||||||
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Release|Any CPU.Build.0 = Release|Any CPU
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8959C766-414D-4EF8-BC85-9928B30AAF0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8959C766-414D-4EF8-BC85-9928B30AAF0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8959C766-414D-4EF8-BC85-9928B30AAF0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8959C766-414D-4EF8-BC85-9928B30AAF0A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -79,6 +85,7 @@ Global
|
|||||||
{954F2AA9-6624-4554-946D-0F17B84487C3} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
{954F2AA9-6624-4554-946D-0F17B84487C3} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
||||||
{727BBA0B-9114-4BC8-B9A8-3F461449A564} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E}
|
{727BBA0B-9114-4BC8-B9A8-3F461449A564} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E}
|
||||||
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525} = {727BBA0B-9114-4BC8-B9A8-3F461449A564}
|
{24616F7E-E2E9-45A3-8A44-AB51FCD2D525} = {727BBA0B-9114-4BC8-B9A8-3F461449A564}
|
||||||
|
{8959C766-414D-4EF8-BC85-9928B30AAF0A} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF}
|
SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF}
|
||||||
|
|||||||
Reference in New Issue
Block a user