Example #1
0
        void IModule.Install(ModuleManager manager)
        {
            _manager = manager;
            _client  = manager.Client;

            manager.CreateCommands("", commServ =>
            {
                #region butthurt
                commServ.CreateCommand("butthurt")
                .Description("Sends specified user a butthurt report.")
                .Parameter("user", ParameterType.Unparsed)
                .Do(async(e) =>
                {
                    await e.Channel.SendMessage($"http://i.imgur.com/jhiVEpv.png");
                    await e.Channel.SendMessage($"{e.GetArg("user")} Please fill out this butthurt report.");
                });
                #endregion

                #region info
                commServ.CreateCommand("info")
                .Description("Provides the sender with the servers info.")
                .Do(async(e) =>
                {
                    await e.Channel.SendMessage(Svr.getServerInfo(e));
                });
                #endregion

                #region uinfo
                commServ.CreateCommand("uinfo")
                .Description("Provides the sender with either their info or if specified another users info.")
                .Parameter("user", ParameterType.Unparsed)
                .Do(async(e) =>
                {
                    /*if (e.Args[0] == string.Empty)
                     * {
                     * }
                     * else
                     * {
                     *  await e.Channel.SendMessage(Usr.getUserInfo(Usr.getUser(e), e, false));
                     * }*/
                    if (e.Args[0] != string.Empty)
                    {
                        await e.Channel.SendMessage(Usr.getUserInfo(Usr.getUser(e), e, false));
                    }
                });
                #endregion

                #region bot
                commServ.CreateCommand("bot")
                .Description("Sends the bot info to the user.")
                .Do(async(e) =>
                {
                    await e.User.PrivateChannel.SendMessage($@"**Xeno is created and maintained by ImPhantom**
**Xeno is still in *ALPHA*, So expect issues.**
**GitHub:** https://github.com/ImPhantom/Xeno
**Downloads:** http://bot.xenorp.com/");
                });
                #endregion
            });
        }
Example #2
0
File: Edit.cs Project: orapow/yt
 /// <summary>
 /// 输出服务信息
 /// </summary>
 /// <param name="path"></param>
 void outsvr(string path)
 {
     pc.SetT2("正在输出服务配置文件");
     Invoke(new Action(() =>
     {
         var svr = new Svr()
         {
             BlockSize = int.Parse(cb_blocksize.Text),
             Cached    = new Svr.Cache()
             {
                 MaxMem = int.Parse(tb_ch_max.Text), MinMem = int.Parse(tb_cb_min.Text), UseMemory = cb_ch_mem.Checked, UserFile = cb_ch_file.Checked
             },
             Dir          = dir,
             DocumentInfo = new DocumentInfo()
             {
                 Author = tb_author.Text, Category = "", Comments = tb_summary.Text, Desc = tb_remark.Text, Subject = "", Title = ""
             },
             FullExtend    = extends,
             InitialExtend = new Extend(),
             Key           = "",
             Name          = tb_svr_name.Text,
             Version       = 2,
             WaterMarked   = new Svr.WaterMark()
             {
                 Enabel = true, Img = pb_wmimg.Image, Transparent = tb_wmtran.Value
             },
             MapTile = new Svr.TileInfo()
             {
                 DPI = 72, Format = "Jpg", Height = 256, Quality = 75, Width = 256
             }
         };
         File.WriteAllBytes(path + "svr.x", Secret.XcEncode(Encoding.UTF8.GetBytes(Serialize.ToJson(svr)), tb_key.Text));
     }));
 }
Example #3
0
        public static void initEvents()
        {
            var client = Program.client;

            client.UserJoined += async(s, e) =>
            {
                await Svr.getLogChannel(e).SendMessage($":white_check_mark: **{e.User.Name}** has joined the {e.Server.Name} discord.");

                Console.WriteLine(Strings.infoEvent + $"({e.Server.Name}) {e.User.Name} has joined {e.Server.Name}.");
            };

            client.UserLeft += async(s, e) =>
            {
                await Svr.getLogChannel(e).SendMessage($":x: **{e.User.Name}** has left the {e.Server.Name} discord.");

                Console.WriteLine(Strings.infoEvent + $"({e.Server.Name}) {e.User.Name} has left {e.Server.Name}.");
            };

            client.UserBanned += async(s, e) =>
            {
                await Svr.getLogChannel(e).SendMessage($":x: **{e.User.Name}** has been banned.");

                Console.WriteLine(Strings.infoEvent + $"({e.Server.Name}) {e.User.Name} has been banned from {e.Server.Name}");
            };

            client.UserUnbanned += async(s, e) =>
            {
                await Svr.getLogChannel(e).SendMessage($":white_check_mark: **{e.User.Name}** has been unbanned.");

                Console.WriteLine(Strings.infoEvent + $"({e.Server.Name}) {e.User.Name} has been Unbanned from {e.Server.Name}");
            };

            client.ChannelCreated += async(s, e) =>
            {
                await Svr.getLogChannel(e).SendMessage($":grey_exclamation: **{e.Channel.Name}** has been created.");

                Console.WriteLine(Strings.infoEvent + $"({e.Server.Name}) {e.Channel.Name} has been created.");
            };

            client.ChannelDestroyed += async(s, e) =>
            {
                await Svr.getLogChannel(e).SendMessage($":grey_exclamation: **{e.Channel.Name}** has been deleted.");

                Console.WriteLine(Strings.infoEvent + $"({e.Server.Name}) {e.Channel.Name} has been deleted.");
            };

            client.MessageUpdated += async(s, e) =>
            {
                //var before = Strings.replaceLinks(e.Before.RawText, Strings.getLinks(e.Before.RawText));
                //var after = Strings.replaceLinks(e.After.RawText, Strings.getLinks(e.After.RawText));
                var dif = "**Before:** " + e.Before.Text + "\n **After:** " + e.After.Text;

                if (!e.User.IsBot)
                {
                    if (e.Before.Text.Contains("http") && e.After.Text.Contains("http")) //Temporary Fix for Issue (#1)
                    {
                        return;
                    }
                    else
                    {
                        await Svr.getLogChannel(e).SendMessage($":grey_exclamation: **{e.User.Name}** edited their message: \n " + dif);
                    }
                }
            };
        }