Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            SettingsSaver.ConcatFromDefault();
            BotInitSettings.ServersData.AddRange(SettingsSaver.SettingsDictinary);

            var client = new DiscordClient(new DiscordConfiguration {
                TokenType = TokenType.Bot, Token = File.ReadAllText("token.ini")
            });

            //mems
            MemeLoader = new MemeLoader(client);
            Directory.GetFiles("meme_templates").InvokeForAll(s => MemeLoader.LoadImage(Image.FromFile(s)));

            CommandsNextConfiguration commConfig = new()
            {
                StringPrefixes      = new string[] { "/" },
                EnableMentionPrefix = false,
                EnableDms           = false,
                EnableDefaultHelp   = true,
            };

            InteractivityConfiguration interactConfig = new()
            {
            };

            client.MessageCreated += (sender, s) => { Task.Run(() => CensorChat(s.Message, s.Guild, client)); return(Task.CompletedTask); };
            client.MessageUpdated += (sender, s) => { Task.Run(() => CensorChat(s.Message, s.Guild, client)); return(Task.CompletedTask); };

            //Log System
            var logger = new ActionLogger(client, "logs");

            client.UseCommandsNext(commConfig);
            client.UseInteractivity(interactConfig);

            client.GetCommandsNext().RegisterCommands <CommandHandler>();

            client.ConnectAsync().Wait();

            Thread.Sleep(-1);
        }
Ejemplo n.º 2
0
 public static void ConcatFromDefault(this SettingsSaver saver)
 {
     saver.ConcatFrom(File.ReadAllBytes("init.dat"));
 }
Ejemplo n.º 3
0
 public static void FlushToDefault(this SettingsSaver saver)
 {
     saver.FlushTo(File.OpenRead("init.dat"));
 }