This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -366,7 +366,5 @@ FodyWeavers.xsd
|
|||||||
*.txt
|
*.txt
|
||||||
|
|
||||||
#folders
|
#folders
|
||||||
/DiscordBotWindowsUI/
|
/Plugins/
|
||||||
/WindowsUI/
|
|
||||||
/BUILDS/
|
|
||||||
/DiscordBot.rar
|
/DiscordBot.rar
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<BaseOutputPath>bin\</BaseOutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
using Discord;
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager;
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace CMD_LevelingSystem;
|
|
||||||
|
|
||||||
internal class Level : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "level";
|
|
||||||
|
|
||||||
public List<string> Aliases => new() { "lvl" };
|
|
||||||
|
|
||||||
public string Description => "Display tour current level";
|
|
||||||
|
|
||||||
public string Usage => "level";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
if (!File.Exists(Config.GetValue<string>("LevelingSystemPath") + $"/{context.Message.Author.Id}.dat"))
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync("You are now unranked !");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var user = await Functions.ConvertFromJson<User>(Config.GetValue<string>("LevelingSystemPath") + $"/{context.Message.Author.Id}.dat");
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync("You are now unranked !");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var builder = new EmbedBuilder();
|
|
||||||
var r = new Random();
|
|
||||||
builder.WithColor(r.Next(256), r.Next(256), r.Next(256));
|
|
||||||
builder.AddField("Current Level", user.CurrentLevel, true)
|
|
||||||
.AddField("Current EXP", user.CurrentEXP, true)
|
|
||||||
.AddField("Required Exp", user.RequiredEXPToLevelUp, true);
|
|
||||||
builder.WithTimestamp(DateTimeOffset.Now);
|
|
||||||
await context.Channel.SendMessageAsync(embed: builder.Build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
namespace CMD_LevelingSystem;
|
|
||||||
|
|
||||||
public class DiscordUser
|
|
||||||
{
|
|
||||||
public string Username { get; set; }
|
|
||||||
public ushort DiscordTag { get; set; }
|
|
||||||
public ulong userID { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class User
|
|
||||||
{
|
|
||||||
public DiscordUser user { get; set; }
|
|
||||||
public int CurrentLevel { get; set; }
|
|
||||||
public long CurrentEXP { get; set; }
|
|
||||||
public long RequiredEXPToLevelUp { get; set; }
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<BaseOutputPath>bin\</BaseOutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<OutputPath>..\BUILDS\</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<DebugSymbols>false</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace CMD_Utils;
|
|
||||||
|
|
||||||
internal class FlipCoin : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "flip";
|
|
||||||
|
|
||||||
public List<string> Aliases => null;
|
|
||||||
|
|
||||||
public string Description => "Flip a coin";
|
|
||||||
|
|
||||||
public string Usage => "flip";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteDM(SocketCommandContext context) => ExecuteServer(context);
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
var random = new System.Random();
|
|
||||||
var r = random.Next(1, 3);
|
|
||||||
if (r == 1)
|
|
||||||
await context.Message.Channel.SendMessageAsync("Heads");
|
|
||||||
else
|
|
||||||
await context.Message.Channel.SendMessageAsync("Tails");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Discord;
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace CMD_Utils;
|
|
||||||
|
|
||||||
public class Poll : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "poll";
|
|
||||||
|
|
||||||
public List<string> Aliases => null;
|
|
||||||
|
|
||||||
public string Description => "Create a poll with options";
|
|
||||||
|
|
||||||
public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... ";
|
|
||||||
|
|
||||||
public bool requireAdmin => true;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
var question = context.Message.Content.Split(' ')[1].Replace('-', ' ');
|
|
||||||
var answers = Functions.MergeStrings(context.Message.Content.Split(' '), 2).Split(' ');
|
|
||||||
var embedBuilder = new EmbedBuilder();
|
|
||||||
embedBuilder.Title = question;
|
|
||||||
var len = answers.Length;
|
|
||||||
for (var i = 0; i < len; i++) embedBuilder.AddField($"Answer {i + 1}", answers[i].Replace('-', ' '), true);
|
|
||||||
var msg = await context.Channel.SendMessageAsync(embed: embedBuilder.Build());
|
|
||||||
|
|
||||||
var emotes = new List<IEmote>();
|
|
||||||
emotes.Add(Emoji.Parse(":one:"));
|
|
||||||
emotes.Add(Emoji.Parse(":two:"));
|
|
||||||
emotes.Add(Emoji.Parse(":three:"));
|
|
||||||
emotes.Add(Emoji.Parse(":four:"));
|
|
||||||
emotes.Add(Emoji.Parse(":five:"));
|
|
||||||
emotes.Add(Emoji.Parse(":six:"));
|
|
||||||
|
|
||||||
for (var i = 0; i < len; i++) await msg.AddReactionAsync(emotes[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
public class Random : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "random";
|
|
||||||
|
|
||||||
public List<string> Aliases => new() { "rnd" };
|
|
||||||
|
|
||||||
public string Description => "random number between number1 and number2";
|
|
||||||
|
|
||||||
public string Usage => "random [number1] [number2]";
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteDM(SocketCommandContext context) => ExecuteServer(context);
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var msg = context.Message.Content;
|
|
||||||
var a = int.Parse(msg.Split(' ')[1]);
|
|
||||||
var b = int.Parse(msg.Split(' ')[2]);
|
|
||||||
|
|
||||||
if (a > b)
|
|
||||||
{
|
|
||||||
var temp = a;
|
|
||||||
a = b;
|
|
||||||
b = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
await context.Message.Channel.SendMessageAsync("Your random generated number is " + new System.Random().Next(a, b));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
await context.Message.Channel.SendMessageAsync("Invalid numbers or no numbers:\nUsage: " + Usage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<BaseOutputPath></BaseOutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="bin\**" />
|
|
||||||
<EmbeddedResource Remove="bin\**" />
|
|
||||||
<None Remove="bin\**" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
using Discord;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using EVE_LevelingSystem.LevelingSystemCore;
|
|
||||||
|
|
||||||
using PluginManager;
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace EVE_LevelingSystem
|
|
||||||
{
|
|
||||||
internal class Level : DBEvent
|
|
||||||
{
|
|
||||||
public string name => "Leveling System Event Handler";
|
|
||||||
public string description => "The Leveling System Event Handler";
|
|
||||||
|
|
||||||
internal static Settings globalSettings = new();
|
|
||||||
|
|
||||||
|
|
||||||
public async void Start(DiscordSocketClient client)
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory("./Data/Resources/LevelingSystem");
|
|
||||||
if (!Config.ContainsKey("LevelingSystemPath"))
|
|
||||||
Config.AddValueToVariables("LevelingSystemPath", "./Data/Resources/LevelingSystem", true);
|
|
||||||
if (!Config.ContainsKey("LevelingSystemSettingsFile"))
|
|
||||||
Config.AddValueToVariables("LevelingSystemSettingsFile", "./Data/Resources/LevelingSystemSettings.txt", true);
|
|
||||||
//PluginManager.Config.AddValueToVariables
|
|
||||||
if (!File.Exists(Config.GetValue<string>("LevelingSystemSettingsFile")))
|
|
||||||
{
|
|
||||||
globalSettings = new Settings { TimeToWaitBetweenMessages = 5 };
|
|
||||||
await Functions.SaveToJsonFile<Settings>(Config.GetValue<string>("LevelingSystemSettingsFile"), globalSettings);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
globalSettings = await Functions.ConvertFromJson<Settings>(Config.GetValue<string>("LevelingSystemSettingsFile"));
|
|
||||||
|
|
||||||
// Console.WriteLine(globalSettings.TimeToWaitBetweenMessages);
|
|
||||||
client.MessageReceived += ClientOnMessageReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ClientOnMessageReceived(SocketMessage arg)
|
|
||||||
{
|
|
||||||
if (arg.Author.IsBot || arg.IsTTS || arg.Content.StartsWith(Config.GetValue<string>("prefix"))) return;
|
|
||||||
string userID = arg.Author.Id.ToString();
|
|
||||||
User user;
|
|
||||||
if (File.Exists($"{Config.GetValue<string>("LevelingSystemPath")}/{userID}.dat"))
|
|
||||||
{
|
|
||||||
user = await Functions.ConvertFromJson<User>(Config.GetValue<string>("LevelingSystemPath")! + $"/{userID}.dat");
|
|
||||||
// Console.WriteLine(Config.GetValue("LevelingSystemPath"));
|
|
||||||
if (user.AddEXP()) await arg.Channel.SendMessageAsync($"{arg.Author.Mention} is now level {user.CurrentLevel}");
|
|
||||||
await Functions.SaveToJsonFile(Config.GetValue<string>("LevelingSystemPath") + $"/{userID}.dat", user);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
user = new User { CurrentEXP = 0, CurrentLevel = 1, RequiredEXPToLevelUp = LevelCalculator.GetNextLevelRequiredEXP(1), user = new DiscordUser { DiscordTag = arg.Author.DiscriminatorValue, userID = arg.Author.Id, Username = arg.Author.Username } };
|
|
||||||
if (user.AddEXP()) await arg.Channel.SendMessageAsync($"{arg.Author.Mention} is now level {user.CurrentLevel}");
|
|
||||||
await Functions.SaveToJsonFile<User>($"{Config.GetValue<string>("LevelingSystemPath")}/{userID}.dat", user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using PluginManager;
|
|
||||||
|
|
||||||
namespace EVE_LevelingSystem.LevelingSystemCore
|
|
||||||
{
|
|
||||||
internal static class LevelCalculator
|
|
||||||
{
|
|
||||||
internal static List<string> OnWaitingList = new();
|
|
||||||
|
|
||||||
internal static Int64 GetNextLevelRequiredEXP(int currentLevel)
|
|
||||||
{
|
|
||||||
return currentLevel * 8 + 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void LevelUp(this User user)
|
|
||||||
{
|
|
||||||
user.CurrentEXP = 0;
|
|
||||||
user.RequiredEXPToLevelUp = GetNextLevelRequiredEXP(user.CurrentLevel);
|
|
||||||
user.CurrentLevel++;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static bool AddEXP(this User user)
|
|
||||||
{
|
|
||||||
if (OnWaitingList.Contains(user.user.userID.ToString())) return false;
|
|
||||||
Random r = new Random();
|
|
||||||
int exp = r.Next(Level.globalSettings.MinEXP, Level.globalSettings.MaxEXP + 1);
|
|
||||||
Int64 userXP = user.CurrentEXP;
|
|
||||||
Int64 reqEXP = user.RequiredEXPToLevelUp;
|
|
||||||
if (userXP + exp >= reqEXP)
|
|
||||||
{
|
|
||||||
user.LevelUp();
|
|
||||||
user.CurrentEXP = exp - (reqEXP - userXP);
|
|
||||||
//Console.WriteLine("Level up");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
user.CurrentEXP += exp;
|
|
||||||
|
|
||||||
OnWaitingList.Add(user.user.userID.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
new Thread(() =>
|
|
||||||
{
|
|
||||||
int minutesToWait = Level.globalSettings.TimeToWaitBetweenMessages;
|
|
||||||
Thread.Sleep(60000 * minutesToWait);
|
|
||||||
OnWaitingList.Remove(user.user.userID.ToString());
|
|
||||||
}
|
|
||||||
).Start();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using Discord;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
namespace EVE_LevelingSystem.LevelingSystemCore
|
|
||||||
{
|
|
||||||
public class DiscordUser
|
|
||||||
{
|
|
||||||
public string Username { get; set; }
|
|
||||||
public ushort DiscordTag { get; set; }
|
|
||||||
public ulong userID { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class User
|
|
||||||
{
|
|
||||||
public DiscordUser user { get; set; }
|
|
||||||
public int CurrentLevel { get; set; }
|
|
||||||
public long CurrentEXP { get; set; }
|
|
||||||
public long RequiredEXPToLevelUp { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EVE_LevelingSystem
|
|
||||||
{
|
|
||||||
public class Settings
|
|
||||||
{
|
|
||||||
public int TimeToWaitBetweenMessages { get; set; }
|
|
||||||
public int MinEXP { get; set; }
|
|
||||||
public int MaxEXP { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
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 [platform]";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<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,35 +0,0 @@
|
|||||||
using AngleSharp.Dom;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MusicCommands
|
|
||||||
{
|
|
||||||
internal class AudioFile
|
|
||||||
{
|
|
||||||
internal string Name { get; set; }
|
|
||||||
internal string Url { get; set; }
|
|
||||||
|
|
||||||
internal AudioFile(string name, string url)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal async Task DownloadAudioFile()
|
|
||||||
{
|
|
||||||
Process proc = new Process();
|
|
||||||
proc.StartInfo.FileName = "MusicDownloader";
|
|
||||||
proc.StartInfo.Arguments = $"{Url},{Name}";
|
|
||||||
proc.StartInfo.UseShellExecute = false;
|
|
||||||
proc.StartInfo.RedirectStandardOutput = true;
|
|
||||||
|
|
||||||
proc.Start();
|
|
||||||
await proc.WaitForExitAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using Discord;
|
|
||||||
using Discord.Audio;
|
|
||||||
|
|
||||||
namespace MusicCommands;
|
|
||||||
|
|
||||||
internal static class Data
|
|
||||||
{
|
|
||||||
internal static IAudioClient audioClient = null;
|
|
||||||
internal static IVoiceChannel voiceChannel = null;
|
|
||||||
|
|
||||||
internal static MusicPlayer MusicPlayer = null;
|
|
||||||
internal static MusicPlaylist Playlist = new();
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
namespace MusicCommands;
|
|
||||||
|
|
||||||
internal class Leave : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "leave";
|
|
||||||
|
|
||||||
public List<string> Aliases => null;
|
|
||||||
|
|
||||||
public string Description => "Leave the voice channel";
|
|
||||||
|
|
||||||
public string Usage => "leave";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
if (Data.audioClient is not null && Data.voiceChannel is not null)
|
|
||||||
{
|
|
||||||
await Data.audioClient.StopAsync();
|
|
||||||
await Data.voiceChannel.DisconnectAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Data.Playlist is not null)
|
|
||||||
{
|
|
||||||
Data.Playlist.ClearQueue();
|
|
||||||
Data.Playlist = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Data.MusicPlayer is not null)
|
|
||||||
{
|
|
||||||
Data.MusicPlayer.Stop();
|
|
||||||
Data.MusicPlayer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<Nullable>warnings</Nullable>
|
|
||||||
<BaseOutputPath>bin\</BaseOutputPath>
|
|
||||||
<AssemblyName>Music Commands</AssemblyName>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<OutputPath>../BUILDS/</OutputPath>
|
|
||||||
<ErrorReport>none</ErrorReport>
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<DebugSymbols>false</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="YoutubeExplode" Version="6.2.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MusicCommands;
|
|
||||||
|
|
||||||
internal class MusicPlayer
|
|
||||||
{
|
|
||||||
private Stream outputStream { get; }
|
|
||||||
internal AudioFile NowPlaying = null;
|
|
||||||
|
|
||||||
internal bool isPlaying, isPaused;
|
|
||||||
|
|
||||||
public MusicPlayer(Stream outputChannel)
|
|
||||||
{
|
|
||||||
outputStream = outputChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Play(Stream source, int byteSize, AudioFile songPlaying)
|
|
||||||
{
|
|
||||||
isPlaying = true;
|
|
||||||
NowPlaying = songPlaying;
|
|
||||||
while (isPlaying)
|
|
||||||
{
|
|
||||||
if (isPaused)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var bits = new byte[byteSize];
|
|
||||||
var read = await source.ReadAsync(bits, 0, byteSize);
|
|
||||||
if (read == 0)
|
|
||||||
break;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await outputStream.WriteAsync(bits, 0, read);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await source.FlushAsync();
|
|
||||||
await source.DisposeAsync();
|
|
||||||
source.Close();
|
|
||||||
await outputStream.FlushAsync();
|
|
||||||
isPlaying = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
isPlaying = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace MusicCommands
|
|
||||||
{
|
|
||||||
internal class MusicPlaylist
|
|
||||||
{
|
|
||||||
internal MusicPlaylist()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Initialized playlist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Queue<AudioFile> QueueList = new();
|
|
||||||
|
|
||||||
public void Enqueue(AudioFile query) => QueueList.Enqueue(query);
|
|
||||||
public void ClearQueue() => QueueList.Clear();
|
|
||||||
|
|
||||||
public int Count => QueueList.Count;
|
|
||||||
public AudioFile GetNextSong => QueueList.Dequeue();
|
|
||||||
public AudioFile WhatIsNext => QueueList.Peek();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
namespace MusicCommands;
|
|
||||||
|
|
||||||
internal class Pause : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "pause";
|
|
||||||
|
|
||||||
public List<string> Aliases => null;
|
|
||||||
|
|
||||||
public string Description => "Pause/Unpause the music that is currently running";
|
|
||||||
|
|
||||||
public string Usage => "pause";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
Data.MusicPlayer.isPaused = !Data.MusicPlayer.isPaused;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using Discord;
|
|
||||||
using Discord.Audio;
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace MusicCommands;
|
|
||||||
|
|
||||||
internal class Play : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "play";
|
|
||||||
|
|
||||||
public List<string> Aliases => new() { "p" };
|
|
||||||
|
|
||||||
public string Description => "Play music from a file";
|
|
||||||
|
|
||||||
public string Usage => "play [name/url]";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory("Music");
|
|
||||||
var path = "./Music/";
|
|
||||||
string[] splitted = context.Message.Content.Split(' ');
|
|
||||||
if (splitted.Length < 2)
|
|
||||||
return;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (splitted.Length == 2 && splitted[1].Contains("youtube.com") || splitted[1].Contains("youtu.be"))
|
|
||||||
{
|
|
||||||
var url = splitted[1];
|
|
||||||
path += $"{Functions.CreateMD5(url)}";
|
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
|
||||||
Data.Playlist.Enqueue(new AudioFile(path, null));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var file = new AudioFile(path, url);
|
|
||||||
await file.DownloadAudioFile();
|
|
||||||
Data.Playlist.Enqueue(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var searchString = splitted.MergeStrings(1);
|
|
||||||
path += $"{Functions.CreateMD5(searchString)}";
|
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
|
||||||
Data.Playlist.Enqueue(new AudioFile(path, null));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync("Searching for " + searchString);
|
|
||||||
var file = new AudioFile(path, searchString);
|
|
||||||
await file.DownloadAudioFile();
|
|
||||||
Data.Playlist.Enqueue(file);
|
|
||||||
if (Data.MusicPlayer is null)
|
|
||||||
await context.Channel.SendMessageAsync("Playing: " + searchString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Data.MusicPlayer is not null)
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync("Queued your request: " + splitted.MergeStrings(1));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (false); // run only one time !
|
|
||||||
|
|
||||||
|
|
||||||
Data.voiceChannel = (context.User as IGuildUser)?.VoiceChannel;
|
|
||||||
|
|
||||||
if (Data.voiceChannel == null)
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync("User must be in a voice channel, or a voice channel must be passed as an argument.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Data.audioClient is null)
|
|
||||||
{
|
|
||||||
Data.audioClient = await Data.voiceChannel.ConnectAsync(true);
|
|
||||||
Data.MusicPlayer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
using (var discordChanneAudioOutStream = Data.audioClient.CreatePCMStream(AudioApplication.Mixed))
|
|
||||||
{
|
|
||||||
Data.MusicPlayer ??= new MusicPlayer(discordChanneAudioOutStream);
|
|
||||||
while (Data.Playlist.Count > 0)
|
|
||||||
{
|
|
||||||
var nowPlaying = Data.Playlist.GetNextSong;
|
|
||||||
using (var ffmpeg = CreateStream(nowPlaying.Name))
|
|
||||||
using (var ffmpegOutputBaseStream = ffmpeg.StandardOutput.BaseStream)
|
|
||||||
{
|
|
||||||
await Data.MusicPlayer.Play(ffmpegOutputBaseStream, 1024, nowPlaying);
|
|
||||||
Console.WriteLine("Finished playing from " + nowPlaying.Url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Data.MusicPlayer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Process CreateStream(string path)
|
|
||||||
{
|
|
||||||
return Process.Start(new ProcessStartInfo { FileName = "ffmpeg", Arguments = $"-hide_banner -loglevel panic -i \"{path}\" -ac 2 -f s16le -ar 48000 pipe:1", UseShellExecute = false, RedirectStandardOutput = true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
namespace MusicCommands
|
|
||||||
{
|
|
||||||
public class Skip : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "skip";
|
|
||||||
|
|
||||||
public List<string> Aliases => null;
|
|
||||||
|
|
||||||
public string Description => "skip the music that is currently running";
|
|
||||||
|
|
||||||
public string Usage => "skip";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
var loadedSong = Data.MusicPlayer.NowPlaying;
|
|
||||||
|
|
||||||
if (loadedSong is null || Data.MusicPlayer.isPlaying == false)
|
|
||||||
{
|
|
||||||
await context.Message.Channel.SendMessageAsync("There is no music playing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Data.MusicPlayer.isPlaying = false;
|
|
||||||
await context.Message.Channel.SendMessageAsync($"You have skipped {loadedSong.Name}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
namespace MusicCommands
|
|
||||||
{
|
|
||||||
public class queue : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "queue";
|
|
||||||
public List<string> Aliases => new() { "q" };
|
|
||||||
|
|
||||||
public string Description => "check queue";
|
|
||||||
|
|
||||||
public string Usage => "queue";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync($"You have {Data.Playlist.Count} items in queue");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
using System.IO.Compression;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
using Discord;
|
|
||||||
using Discord.Commands;
|
|
||||||
using Discord.Rest;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using Microsoft.Win32.SafeHandles;
|
|
||||||
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
using Roles.Internals;
|
|
||||||
|
|
||||||
namespace Roles
|
|
||||||
{
|
|
||||||
public class AddRole : DBCommand
|
|
||||||
{
|
|
||||||
public string Command => "addrole";
|
|
||||||
|
|
||||||
public List<string> Aliases => new() { "ar", "addr", "roleadd" };
|
|
||||||
|
|
||||||
public string Description => "Role options";
|
|
||||||
|
|
||||||
public string Usage => "addrole [user1] [user2] ... [role1] [role2] ...";
|
|
||||||
|
|
||||||
public bool requireAdmin => true;
|
|
||||||
|
|
||||||
public async void ExecuteServer(SocketCommandContext context)
|
|
||||||
{
|
|
||||||
if (context.Message.MentionedUsers.Count == 0 || context.Message.MentionedRoles.Count == 0)
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync($"Invalid invocation\nUsage:{Usage}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var users = context.Message.MentionedUsers;
|
|
||||||
var roles = context.Message.MentionedRoles;
|
|
||||||
|
|
||||||
foreach (var user in users)
|
|
||||||
{
|
|
||||||
foreach (var role in roles)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
await context.Channel.SendMessageAsync(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Discord;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
using PluginManager.Others;
|
|
||||||
|
|
||||||
namespace Roles.Internals
|
|
||||||
{
|
|
||||||
internal static class RoleManagement
|
|
||||||
{
|
|
||||||
internal static async void AddRole(this SocketGuildUser user, string roleName)
|
|
||||||
{
|
|
||||||
string role = roleName;
|
|
||||||
IRole? r = user.Guild.Roles.FirstOrDefault(rl => rl.Name == role || rl.Mention == role);
|
|
||||||
if (r is null)
|
|
||||||
throw new Exception("The role does not exist");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await user.AddRoleAsync(r);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
throw new Exception("Insufficient permissions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static async void AddRole(this SocketGuildUser user, IRole role)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await user.AddRoleAsync(role);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
throw new Exception("Insufficient permissions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static async void AddRoles(this SocketGuildUser user, string[] roleNames)
|
|
||||||
{
|
|
||||||
foreach (string rolename in roleNames)
|
|
||||||
{
|
|
||||||
string roleName = rolename;
|
|
||||||
IRole? r = user.Guild.Roles.FirstOrDefault(rl => rl.Name == roleName || rl.Mention == roleName);
|
|
||||||
if (r is null)
|
|
||||||
throw new Exception("The role does not exist");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await user.AddRoleAsync(r);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
throw new Exception("Insufficient permissions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static async void AddRoles(this SocketGuildUser user, IEnumerable<IRole> roles)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await user.AddRolesAsync(roles);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (ex.Message.Contains("Permission", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
throw new Exception("Insufficient permissions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<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>
|
|
||||||
@@ -13,31 +13,31 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Events", "Events", "{A290C0
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Commands", "Commands", "{449FA364-0B72-43FF-B3A3-806E2916200E}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Commands", "Commands", "{449FA364-0B72-43FF-B3A3-806E2916200E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_Utils", "CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_Utils", "Plugins\CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MusicCommands", "MusicCommands\MusicCommands.csproj", "{B1B4976E-5112-4217-B57B-3A03C5207B6E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MusicCommands", "Plugins\MusicCommands\MusicCommands.csproj", "{B1B4976E-5112-4217-B57B-3A03C5207B6E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EVE_LevelingSystem", "EVE_LevelingSystem\EVE_LevelingSystem.csproj", "{EEC445DC-0C4B-43EA-8694-606BA0390B77}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EVE_LevelingSystem", "Plugins\EVE_LevelingSystem\EVE_LevelingSystem.csproj", "{EEC445DC-0C4B-43EA-8694-606BA0390B77}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "CMD_LevelingSystem\CMD_LevelingSystem.csproj", "{1A4E49FF-9A0A-4C54-AF35-CFFBA64353D9}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "Plugins\CMD_LevelingSystem\CMD_LevelingSystem.csproj", "{1A4E49FF-9A0A-4C54-AF35-CFFBA64353D9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Roles\Roles.csproj", "{954F2AA9-6624-4554-946D-0F17B84487C3}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roles", "Plugins\Roles\Roles.csproj", "{954F2AA9-6624-4554-946D-0F17B84487C3}"
|
||||||
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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Updater", "Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Updater", "Plugins\Updater\Updater.csproj", "{24616F7E-E2E9-45A3-8A44-AB51FCD2D525}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeGamesModule", "FreeGamesModule\FreeGamesModule.csproj", "{8959C766-414D-4EF8-BC85-9928B30AAF0A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeGamesModule", "Plugins\FreeGamesModule\FreeGamesModule.csproj", "{8959C766-414D-4EF8-BC85-9928B30AAF0A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordBotWindowsUI", "DiscordBotWindowsUI\DiscordBotWindowsUI.csproj", "{EFE12083-F9FE-4807-8E39-809E0391BAF0}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordBotWindowsUI", "Plugins\DiscordBotWindowsUI\DiscordBotWindowsUI.csproj", "{EFE12083-F9FE-4807-8E39-809E0391BAF0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsUI", "WindowsUI\WindowsUI.csproj", "{ECF79CD3-789E-476D-8512-CE0FAF71ADF5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsUI", "Plugins\WindowsUI\WindowsUI.csproj", "{ECF79CD3-789E-476D-8512-CE0FAF71ADF5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlashCommands", "SlashCommands\SlashCommands.csproj", "{56D7545A-6DCF-4996-A1A5-40180CE9DE10}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlashCommands", "Plugins\SlashCommands\SlashCommands.csproj", "{56D7545A-6DCF-4996-A1A5-40180CE9DE10}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Slash", "Slash", "{0B1FD8FA-35D3-4DC1-9D98-6178247B29CA}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Slash", "Slash", "{0B1FD8FA-35D3-4DC1-9D98-6178247B29CA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlashRandom", "SlashRandom\SlashRandom.csproj", "{23A4778E-A65C-44B7-A82C-AE2A35103E8D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlashRandom", "Plugins\SlashRandom\SlashRandom.csproj", "{23A4778E-A65C-44B7-A82C-AE2A35103E8D}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -112,6 +112,7 @@ Global
|
|||||||
{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}
|
{8959C766-414D-4EF8-BC85-9928B30AAF0A} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
||||||
|
{EFE12083-F9FE-4807-8E39-809E0391BAF0} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E}
|
||||||
{ECF79CD3-789E-476D-8512-CE0FAF71ADF5} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
|
{ECF79CD3-789E-476D-8512-CE0FAF71ADF5} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
|
||||||
{56D7545A-6DCF-4996-A1A5-40180CE9DE10} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
|
{56D7545A-6DCF-4996-A1A5-40180CE9DE10} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
|
||||||
{0B1FD8FA-35D3-4DC1-9D98-6178247B29CA} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
{0B1FD8FA-35D3-4DC1-9D98-6178247B29CA} = {449FA364-0B72-43FF-B3A3-806E2916200E}
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager;
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
using SlashCommands.Items;
|
|
||||||
|
|
||||||
namespace SlashCommands
|
|
||||||
{
|
|
||||||
public class Initializer : DBEvent
|
|
||||||
{
|
|
||||||
public string name => "Slash command engine";
|
|
||||||
|
|
||||||
public string description => "The slash commands initializer and engine";
|
|
||||||
|
|
||||||
public async void Start(DiscordSocketClient client)
|
|
||||||
{
|
|
||||||
if(!Config.ContainsKey("ServerID") || Config.GetValue<string>("ServerID") == "null" || Config.GetValue<string>("ServerID").Length != 18)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Invalid Server ID. Change config.json from file and restart bot");
|
|
||||||
await Task.Delay(2000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SlashCommandLoader loader = new SlashCommandLoader("./Data/Plugins/SlashCommands/", "dll", client);
|
|
||||||
loader.FileLoaded += (args) => Console.WriteLine(args[0] + " => " + args[1]);
|
|
||||||
loader.PluginLoaded += (args) => Console.WriteLine(args[0] + " => " + args[1]);
|
|
||||||
Globals.commands = await loader.Load();
|
|
||||||
|
|
||||||
client.SlashCommandExecuted += async (args) =>
|
|
||||||
{
|
|
||||||
foreach (var cmd in Globals.commands)
|
|
||||||
{
|
|
||||||
if (cmd.Command == args.Data.Name)
|
|
||||||
{
|
|
||||||
await cmd.ExecuteServer(args);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
|
|
||||||
namespace SlashCommands.Items
|
|
||||||
{
|
|
||||||
public interface DBSlashCommand
|
|
||||||
{
|
|
||||||
string Command { get; }
|
|
||||||
string Description { get; }
|
|
||||||
string Usage { get; }
|
|
||||||
bool requireAdmin { get; }
|
|
||||||
bool PrivateResponse { get; }
|
|
||||||
Task ExecuteServer(SocketSlashCommand command);
|
|
||||||
Task InitializeCommand(DiscordSocketClient client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SlashCommands.Items
|
|
||||||
{
|
|
||||||
internal class Globals
|
|
||||||
{
|
|
||||||
internal static List<DBSlashCommand> commands = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SlashCommands.Items
|
|
||||||
{
|
|
||||||
public class SlashCommandLoader
|
|
||||||
{
|
|
||||||
internal DiscordSocketClient client;
|
|
||||||
|
|
||||||
internal delegate void FileLoadedEventHandler(string[] args);
|
|
||||||
|
|
||||||
internal delegate void PluginLoadedEventHandler(string[] args);
|
|
||||||
|
|
||||||
internal event FileLoadedEventHandler? FileLoaded;
|
|
||||||
|
|
||||||
internal event PluginLoadedEventHandler? PluginLoaded;
|
|
||||||
|
|
||||||
private string location, extension;
|
|
||||||
internal SlashCommandLoader(string location, string extension, DiscordSocketClient client)
|
|
||||||
{
|
|
||||||
this.location = location;
|
|
||||||
this.extension = extension;
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal async Task<List<DBSlashCommand>> Load()
|
|
||||||
{
|
|
||||||
List<DBSlashCommand> slashCommands = new();
|
|
||||||
var files = Directory.GetFiles(location, $"*.{extension}", SearchOption.AllDirectories);
|
|
||||||
foreach(var file in files)
|
|
||||||
{
|
|
||||||
Assembly.LoadFrom(file);
|
|
||||||
if(FileLoaded != null)
|
|
||||||
{
|
|
||||||
var args = new string[] { file, "Loaded" };
|
|
||||||
FileLoaded.Invoke(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var interfaceType = typeof(DBSlashCommand);
|
|
||||||
var types = AppDomain.CurrentDomain.GetAssemblies()
|
|
||||||
.SelectMany(a => a.GetTypes())
|
|
||||||
.Where(p => interfaceType.IsAssignableFrom(p) && p.IsClass)
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
foreach(var type in types)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var plugin = (DBSlashCommand)Activator.CreateInstance(type);
|
|
||||||
slashCommands.Add(plugin);
|
|
||||||
if (PluginLoaded != null)
|
|
||||||
{
|
|
||||||
var args = new string[] { plugin.Command, "Loaded successfully" };
|
|
||||||
PluginLoaded.Invoke(args);
|
|
||||||
|
|
||||||
await plugin.InitializeCommand(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
var args = new string[] { type.Name, "Failed to load" };
|
|
||||||
PluginLoaded!.Invoke(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return slashCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<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,65 +0,0 @@
|
|||||||
using Discord;
|
|
||||||
using Discord.WebSocket;
|
|
||||||
|
|
||||||
using PluginManager;
|
|
||||||
using PluginManager.Interfaces;
|
|
||||||
|
|
||||||
using SlashCommands.Items;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace CMD_Utils
|
|
||||||
{
|
|
||||||
public class SlashRandom : DBSlashCommand
|
|
||||||
{
|
|
||||||
public string Command => "random";
|
|
||||||
|
|
||||||
public string Description => "Random number";
|
|
||||||
|
|
||||||
public string Usage => "random [min] [max]";
|
|
||||||
|
|
||||||
public bool requireAdmin => false;
|
|
||||||
|
|
||||||
public bool PrivateResponse => true;
|
|
||||||
|
|
||||||
public async Task InitializeCommand(DiscordSocketClient client)
|
|
||||||
{
|
|
||||||
var guildCommand = new SlashCommandBuilder();
|
|
||||||
guildCommand.WithName(Command);
|
|
||||||
guildCommand.WithDescription(Description);
|
|
||||||
guildCommand.AddOption(new SlashCommandOptionBuilder()
|
|
||||||
.WithName("min")
|
|
||||||
.WithDescription("Minimum number")
|
|
||||||
.WithRequired(true)
|
|
||||||
.WithType(ApplicationCommandOptionType.Integer));
|
|
||||||
guildCommand.AddOption(new SlashCommandOptionBuilder()
|
|
||||||
.WithName("max")
|
|
||||||
.WithDescription("Maximum number")
|
|
||||||
.WithRequired(true)
|
|
||||||
.WithType(ApplicationCommandOptionType.Integer));
|
|
||||||
await client.GetGuild(ulong.Parse(Config.GetValue<string>("ServerID"))).CreateApplicationCommandAsync(guildCommand.Build());
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task ExecuteServer(SocketSlashCommand command)
|
|
||||||
{
|
|
||||||
var commandArguments = command.Data.Options.ToArray();
|
|
||||||
|
|
||||||
if (commandArguments.Count() == 0)
|
|
||||||
{
|
|
||||||
await command.RespondAsync("Please provide a min and max value", ephemeral: true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var min = (int)commandArguments[0].Value;
|
|
||||||
var max = (int)commandArguments[1].Value;
|
|
||||||
|
|
||||||
|
|
||||||
await command.RespondAsync("User generated number: " + new System.Random().Next(min, max + 1), ephemeral: PrivateResponse);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SlashCommands\SlashCommands.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
454
Updater/.gitignore
vendored
454
Updater/.gitignore
vendored
@@ -1,454 +0,0 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.rsuser
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Mono auto generated files
|
|
||||||
mono_crash.*
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
[Ww][Ii][Nn]32/
|
|
||||||
[Aa][Rr][Mm]/
|
|
||||||
[Aa][Rr][Mm]64/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
[Ll]ogs/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUnit
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
nunit-*.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
|
|
||||||
# Tye
|
|
||||||
.tye/
|
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
|
||||||
ScaffoldingReadMe.txt
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_h.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.iobj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*_wpftmp.csproj
|
|
||||||
*.log
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
|
||||||
coverage*.json
|
|
||||||
coverage*.xml
|
|
||||||
coverage*.info
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# NuGet Symbol Packages
|
|
||||||
*.snupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/[Pp]ackages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/[Pp]ackages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/[Pp]ackages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
*.appxbundle
|
|
||||||
*.appxupload
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!?*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
*.rptproj.rsuser
|
|
||||||
*- [Bb]ackup.rdl
|
|
||||||
*- [Bb]ackup ([0-9]).rdl
|
|
||||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# CodeRush personal settings
|
|
||||||
.cr/personal
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
|
||||||
OpenCover/
|
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
|
||||||
*.nvuser
|
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
|
||||||
healthchecksdb
|
|
||||||
|
|
||||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
|
||||||
MigrationBackup/
|
|
||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
|
||||||
.ionide/
|
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
|
||||||
FodyWeavers.xsd
|
|
||||||
|
|
||||||
##
|
|
||||||
## Visual studio for Mac
|
|
||||||
##
|
|
||||||
|
|
||||||
|
|
||||||
# globs
|
|
||||||
Makefile.in
|
|
||||||
*.userprefs
|
|
||||||
*.usertasks
|
|
||||||
config.make
|
|
||||||
config.status
|
|
||||||
aclocal.m4
|
|
||||||
install-sh
|
|
||||||
autom4te.cache/
|
|
||||||
*.tar.gz
|
|
||||||
tarballs/
|
|
||||||
test-results/
|
|
||||||
|
|
||||||
# Mac bundle stuff
|
|
||||||
*.dmg
|
|
||||||
*.app
|
|
||||||
|
|
||||||
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
|
|
||||||
# General
|
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
|
||||||
.LSOverride
|
|
||||||
|
|
||||||
# Icon must end with two \r
|
|
||||||
Icon
|
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
|
||||||
._*
|
|
||||||
|
|
||||||
# Files that might appear in the root of a volume
|
|
||||||
.DocumentRevisions-V100
|
|
||||||
.fseventsd
|
|
||||||
.Spotlight-V100
|
|
||||||
.TemporaryItems
|
|
||||||
.Trashes
|
|
||||||
.VolumeIcon.icns
|
|
||||||
.com.apple.timemachine.donotpresent
|
|
||||||
|
|
||||||
# Directories potentially created on remote AFP share
|
|
||||||
.AppleDB
|
|
||||||
.AppleDesktop
|
|
||||||
Network Trash Folder
|
|
||||||
Temporary Items
|
|
||||||
.apdisk
|
|
||||||
|
|
||||||
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
|
|
||||||
# Windows thumbnail cache files
|
|
||||||
Thumbs.db
|
|
||||||
ehthumbs.db
|
|
||||||
ehthumbs_vista.db
|
|
||||||
|
|
||||||
# Dump file
|
|
||||||
*.stackdump
|
|
||||||
|
|
||||||
# Folder config file
|
|
||||||
[Dd]esktop.ini
|
|
||||||
|
|
||||||
# Recycle Bin used on file shares
|
|
||||||
$RECYCLE.BIN/
|
|
||||||
|
|
||||||
# Windows Installer files
|
|
||||||
*.cab
|
|
||||||
*.msi
|
|
||||||
*.msix
|
|
||||||
*.msm
|
|
||||||
*.msp
|
|
||||||
|
|
||||||
# Windows shortcuts
|
|
||||||
*.lnk
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
|
|
||||||
##
|
|
||||||
## Visual Studio Code
|
|
||||||
##
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<Application xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
x:Class="Updater.App">
|
|
||||||
<Application.Styles>
|
|
||||||
<FluentTheme Mode="Dark"/>
|
|
||||||
</Application.Styles>
|
|
||||||
</Application>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Updater
|
|
||||||
{
|
|
||||||
public partial class App : Application
|
|
||||||
{
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnFrameworkInitializationCompleted()
|
|
||||||
{
|
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
||||||
{
|
|
||||||
desktop.MainWindow = new MainWindow() { Width = 250, Height = 50 };
|
|
||||||
}
|
|
||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
mc:Ignorable="d" d:DesignWidth="250" d:DesignHeight="50"
|
|
||||||
x:Class="Updater.MainWindow"
|
|
||||||
Title="Updater">
|
|
||||||
<StackPanel Margin="0">
|
|
||||||
<Label Content="Updating ... "/>
|
|
||||||
<ProgressBar x:Class="Updater.MainWindow" x:Name="progressBar1" IsIndeterminate="True" />
|
|
||||||
</StackPanel>
|
|
||||||
</Window>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Updater
|
|
||||||
{
|
|
||||||
public partial class MainWindow : Window
|
|
||||||
{
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
Activated += (sender, e) => FormActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async void FormActive()
|
|
||||||
{
|
|
||||||
if (Program.Command != "/update")
|
|
||||||
return;
|
|
||||||
await Task.Delay(3000);
|
|
||||||
WebClient c = new WebClient();
|
|
||||||
Directory.CreateDirectory("./Updater/Downloads");
|
|
||||||
await c.DownloadFileTaskAsync(Program.Link, "./Updater/Downloads/Update.zip");
|
|
||||||
await Task.Run(() => ZipFile.ExtractToDirectory("./Updater/Downloads/Update.zip", Program.Location, true));
|
|
||||||
Process.Start(Program.AppToOpen);
|
|
||||||
File.Delete("./Updater/Downloads/Update.zip");
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Updater
|
|
||||||
{
|
|
||||||
internal class Program
|
|
||||||
{
|
|
||||||
|
|
||||||
public static string Command, Link, AppToOpen, Location;
|
|
||||||
|
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
|
||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
|
||||||
// yet and stuff might break.
|
|
||||||
[STAThread]
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
Command = args[0];
|
|
||||||
Link = args[1];
|
|
||||||
AppToOpen = args[2];
|
|
||||||
Location = string.Join(' ', args, 3, args.Length - 3);
|
|
||||||
BuildAvaloniaApp()
|
|
||||||
.StartWithClassicDesktopLifetime(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
|
||||||
=> AppBuilder.Configure<App>()
|
|
||||||
.UsePlatformDetect()
|
|
||||||
.LogToTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<!--Avalonia doesen't support TrimMode=link currently,but we are working on that https://github.com/AvaloniaUI/Avalonia/issues/6892 -->
|
|
||||||
<TrimMode>copyused</TrimMode>
|
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove=".gitignore" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<!--This helps with theme dll-s trimming.
|
|
||||||
If you will publish your application in self-contained mode with p:PublishTrimmed=true and it will use Fluent theme Default theme will be trimmed from the output and vice versa.
|
|
||||||
https://github.com/AvaloniaUI/Avalonia/issues/5593 -->
|
|
||||||
<TrimmableAssembly Include="Avalonia.Themes.Fluent" />
|
|
||||||
<TrimmableAssembly Include="Avalonia.Themes.Default" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
|
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
|
||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
|
|
||||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
Reference in New Issue
Block a user