Ejemplo n.º 1
0
        /// <summary>
        /// The render.
        /// </summary>
        /// <param name="output">
        /// The output.
        /// </param>
        /// <param name="ribbon">
        /// The ribbon.
        /// </param>
        /// <param name="button">
        /// The button.
        /// </param>
        /// <param name="context">
        /// The context.
        /// </param>
        public override void Render(System.Web.UI.HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
        {
            Assert.ArgumentNotNull(output, "output");
            Assert.ArgumentNotNull(ribbon, "ribbon");
            Assert.ArgumentNotNull(button, "button");
            Assert.ArgumentNotNull(context, "context");

            if (!Settings.Analytics.Enabled)
            {
                return;
            }
            Item[] items = context.Items;
            if (items.Length != 1)
            {
                return;
            }
            ID clientDeviceId = WebEditUtil.GetClientDeviceId();
            System.Collections.Generic.IEnumerable<RenderingDefinition> testingRenderings;
            if (Context.ClientPage.IsEvent)
            {
                string text = WebEditUtil.ConvertJSONLayoutToXML(WebUtil.GetFormValue("scLayout"));
                if (text == null)
                {
                    return;
                }
                testingRenderings = GetTestingRenderings(LayoutDefinition.Parse(text), clientDeviceId, Client.ContentDatabase);
            }
            else
            {
                Item item = items[0];
                testingRenderings = GetTestingRenderings(item, clientDeviceId);
            }
            output.Write("<div id=\"ComponentsPanelListHolder\" class=\"scRibbonGallery\">");
            output.Write("<div id=\"ComponentsPanelList\" class=\"scRibbonGalleryList\" style=\"width: 310px;\">");
            int num = 0;
            foreach (RenderingDefinition current in testingRenderings)
            {
                output.Write("<div style=\"display:\"block\">");
                this.RenderComponent(output, current, num,context);
                num++;
                output.Write("</div>");
            }
            output.Write("</div>");
            int val = 500;
            int val2 = 350;
            int num2 = 100;
            int num3 = num * num2 + 80;
            num3 = System.Math.Max(System.Math.Min(val, num3), val2);
            int num4 = 116;
            int num5 = 24;
            int num6 = 30;
            int num7 = num6 + num4 * System.Math.Min(num, 3) + num5;
            string click = (num == 0) ? "javascript:void(0);" : "javascript:return scShowComponentsGallery(this, event, 'Gallery.Components', {{height: {0}, width: {1} }}, {{}});".FormatWith(new object[]
            {
                num7,
                num3
            });
            base.RenderPanelButtons(output, "ComponentsPanelList", click);
            output.Write("</div>");
        }
        /// <summary>
        /// Overriding the Execute method that Sitecore calls.
        /// </summary>
        /// <param name = "context"></param>
        public override void Execute(CommandContext context)
        {
            if (context.Parameters["id"] == null || string.IsNullOrEmpty(context.Parameters["id"]))
            {
                return;
            }

            //only use on authoring environment
            Item currentItem = Sitecore.Context.ContentDatabase.GetItem(context.Parameters["id"]);
            if (currentItem == null)
            {
                return;
            }

            NameValueCollection nv = new NameValueCollection();
            nv.Add("id", context.Parameters["id"]);

            Item item = Sitecore.Context.ContentDatabase.GetItem(context.Parameters["id"]);
            if (item.IsNull())
            {
                return;
            }

            if (context.Parameters["fieldid"] != null)
            {
                nv.Add("fieldid", context.Parameters["fieldid"]);
            }

            nv.Add("la", item.Language.ToString());
            nv.Add("vs", item.Version.ToString());

            Sitecore.Context.ClientPage.Start(this, "ItemComparerForm", nv);
        }
Ejemplo n.º 3
0
 public static CommandContext Create(CommandContext parent, FileInfo fileInfo, TagCache cache, StringIdCache stringIds, HaloTag tag, Model model)
 {
     var context = new CommandContext(parent, string.Format("{0:X8}.hlmt", tag.Index));
     context.AddCommand(new HlmtListVariantsCommand(model, stringIds));
     context.AddCommand(new HlmtExtractModeCommand(cache, fileInfo, model, stringIds));
     return context;
 }
Ejemplo n.º 4
0
        public void BotAddCommand(CommandContext context, IEnumerable<string> arguments)
        {
            if (arguments.Count() < 1)
            {
                SendInContext(context, "Usage: !bot add name [nick [arguments]]");
                return;
            }

            string botID = arguments.ElementAt(0);
            if (!GameManager.Bots.ContainsKey(botID))
            {
                SendInContext(context, "Invalid bot!");
                return;
            }

            string botNick = arguments.ElementAtOrDefault(1) ?? botID;

            try
            {
                Manager.AddBot(botNick, (IBot)GameManager.Bots[botID].GetConstructor(new Type[] { typeof(GameManager), typeof(IEnumerable<string>) }).Invoke(new object[] { Manager, arguments.Skip(2) }));
                Manager.SendPublic(context.Nick, "Added <{0}> (a bot of type {1})", botNick, botID);
            }
            catch (ArgumentException e)
            {
                SendInContext(context, "Error adding {0}: {1}", botNick, e.Message);
            }
        }
Ejemplo n.º 5
0
        public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
        {
            var contextChunks = context.CustomData as List<Item>;
            if (contextChunks != null)
            {
                var chunk = contextChunks[0];
                contextChunks.RemoveAt(0);
                var psButtons = chunk.Children;
                var contextItem = context.Items.Length > 0 ? context.Items[0] : null;

                var ruleContext = new RuleContext
                {
                    Item = contextItem
                };
                foreach (var parameter in context.Parameters.AllKeys)
                {
                    ruleContext.Parameters[parameter] = context.Parameters[parameter];
                }

                foreach (Item psButton in psButtons)
                {
                    if (!RulesUtils.EvaluateRules(psButton["ShowRule"], ruleContext))
                    {
                        continue;
                    }

                    RenderLargeButton(output, ribbon, Control.GetUniqueID("script"),
                        Translate.Text(psButton.DisplayName),
                        psButton["__Icon"], string.Empty,
                        $"ise:runplugin(scriptDb={psButton.Database.Name},scriptId={psButton.ID})",
                        context.Parameters["ScriptRunning"] == "0" && RulesUtils.EvaluateRules(psButton["EnableRule"], ruleContext),
                        false, context);
                }
            }
        }
 public override void Execute(CommandContext context)
 {
     if (context is DeleteScheduleContext)
      {
     Execute((DeleteScheduleContext) context);
      }
 }
Ejemplo n.º 7
0
        public override Control[] GetSubmenuItems(CommandContext context)
        {
            var controls = base.GetSubmenuItems(context);

            if (controls == null || context.Items.Length != 1 || context.Items[0] == null)
            {
                return controls;
            }

            var menuItems = new List<Control>();

            var roots = ModuleManager.GetFeatureRoots(IntegrationPoints.ContentEditorInsertItemFeature);

            foreach (var root in ModuleManager.GetFeatureRoots(IntegrationPoints.ContentEditorInsertItemFeature))
            {
                ScriptLibraryMenuItem.GetLibraryMenuItems(context.Items[0], menuItems, root);
            }

            if (roots.Count > 0 && controls.Length > 0)
            {
                menuItems.Add(new MenuDivider());
            }
            menuItems.AddRange(controls);
            return menuItems.ToArray();
        }
 // Methods
 public override void Execute(CommandContext context)
 {
     var searchStringModel = ExtractSearchQuery(context.Parameters.GetValues("url")[0].Replace("\"", ""));
     var hitsCount = 0;
     var listOfItems = context.Items[0].Search(searchStringModel, out hitsCount).ToList();
     Items.CloneTo(listOfItems.Select(i => i.GetItem()).ToArray());
 }
        public override void Execute(CommandContext context)
        {
            PersonaHelper personaHelper = PersonaHelper.GetHelper();
            personaHelper.ResetProfiles();

            SheerResponse.Redraw();
        }
Ejemplo n.º 10
0
        public override void Execute(CommandContext context)
        {
            ID id = ID.Null;
            bool isId = false;

            var fieldId = context.Parameters["fieldId"];

            if (!string.IsNullOrEmpty(fieldId))
            {
                var form = System.Web.HttpContext.Current.Request.Form;

                if (form != null)
                {
                    string targetId = form[string.Format("{0}{1}", fieldId, Constants.Selected)];

                    if (string.IsNullOrEmpty(targetId))
                    {
                        targetId = form[string.Format("{0}{1}", fieldId, Constants.Unselected)];
                    }

                    isId = ID.TryParse(targetId, out id);
                }
            }

            Sitecore.Context.ClientPage.SendMessage(this, "item:load(id=" + (isId ? id.ToString() : string.Empty) + ")");
        }
Ejemplo n.º 11
0
 public override void Execute(CommandContext context)
 {
     if (Context.Request.FilePath == "/sitecore/shell/~/xaml/sitecore.shell.applications.analytics.trackingfielddetails.aspx")
      {
     SheerResponse.Eval("window.location.href = window.location.href");
      }
 }
        public override void Execute(CommandContext context)
        {
            if (context.Items.Length != 1) return;

            //TODO put the GUIDS used here somewhere central
            //If this is a template, launch the single template generator
            if (context.Items[0].TemplateID.ToString() == "{AB86861A-6030-46C5-B394-E8F99E8B87DB}")
            {
                //Build the url for the control
                string controlUrl = UIUtil.GetUri("control:xmlGenerateCustomItem");
                string id = context.Items[0].ID.ToString();
                string url = string.Format("{0}&id={1}", controlUrl, id);

                //Open the dialog
                Context.ClientPage.ClientResponse.Broadcast(Context.ClientPage.ClientResponse.ShowModalDialog(url), "Shell");
            }

                //If this is a template folder, launch the folder template generateor
            else if (context.Items[0].TemplateID.ToString() == "{0437FEE2-44C9-46A6-ABE9-28858D9FEE8C}")
            {
                //Build the url for the control
                string controlUrl = UIUtil.GetUri("control:xmlGenerateCustomItemByFolder");
                string id = context.Items[0].ID.ToString();
                string url = string.Format("{0}&id={1}", controlUrl, id);

                //Open the dialog
                Context.ClientPage.ClientResponse.Broadcast(Context.ClientPage.ClientResponse.ShowModalDialog(url), "Shell");
            }
            else
            {
                SheerResponse.Alert("You can only run the Custom Item Generator on a Template or Template Folder.", new string[0]);
            }
        }
Ejemplo n.º 13
0
        public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
        {
            var psButtons = button.GetChildren();
            foreach (Item psButton in psButtons)
            {
                var msg = Message.Parse(this, psButton["Click"]);
                var scriptDb = msg.Arguments["scriptDB"];
                var scriptId = msg.Arguments["script"];

                if (string.IsNullOrWhiteSpace(scriptDb) || string.IsNullOrWhiteSpace(scriptId))
                {
                    continue;
                }

                var scriptItem = Factory.GetDatabase(scriptDb).GetItem(scriptId);
                if (scriptItem == null || !RulesUtils.EvaluateRules(scriptItem["ShowRule"], context.Items[0]))
                {
                    continue;
                }

                RenderLargeButton(output, ribbon, Control.GetUniqueID("script"),
                    Translate.Text(scriptItem.DisplayName),
                    scriptItem["__Icon"], string.Empty,
                    psButton["Click"],
                    RulesUtils.EvaluateRules(scriptItem["EnableRule"], context.Items[0]),
                    false, context);

                return;
            }
        }
Ejemplo n.º 14
0
        public override void Execute(CommandContext context)
        {
            var selectedItem = context.Items.FirstOrDefault();
            if (selectedItem == null)
                return;

            string templateId = "{CC80011D-8EAE-4BFC-84F1-67ECD0223E9E}";

            TemplateItem newTemplate = new TemplateItem(Sitecore.Context.Database.GetItem(templateId));

            if (newTemplate != null)
            {
                try
                {
                    using (new Sitecore.SecurityModel.SecurityDisabler())
                    {
                        selectedItem.Editing.BeginEdit();
                        selectedItem.ChangeTemplate(newTemplate);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message, ex, this);
                    throw;
                }
                finally
                {
                    selectedItem.Editing.EndEdit();
                }
            }
        }
Ejemplo n.º 15
0
        public override CommandState QueryState(CommandContext context)
        {
            if (context.Items.Length != 1)
             {
            return CommandState.Disabled;
             }

             Item poll = context.Items[0];
             if (!poll.Access.CanWrite())
             {
            return CommandState.Disabled;
             }

             PollItem pollItem = new PollItem(context.Items[0]);
             if (pollItem.IsClosed)
             {
            return CommandState.Disabled;
             }

             if (pollItem.IsArchived)
             {
            return CommandState.Disabled;
             }

             return CommandState.Enabled;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Executes the command in the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Execute(CommandContext context)
        {
            if (context.Items.Count() == 0)
            {
                return;
            }

            Item currentItem = context.Items[0];
            if (currentItem.IsNull())
            {
                return;
            }

            string source = context.Parameters["source"];
            string fieldid = context.Parameters["fieldid"];
            if (string.IsNullOrEmpty(fieldid))
            {
                return;
            }

            NameValueCollection nv = new NameValueCollection();
            nv.Add("source", source);
            nv.Add("fieldid", fieldid);
            nv.Add("currentid", currentItem.ID.ToString());

            Sitecore.Context.ClientPage.Start(this, "RunAddForm", nv);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Get the state of the command. The command is always visible, but disabled if
        /// there is already a version in each language or if the user has no permission
        /// to edit the item.
        /// </summary>
        /// <param name="context">The current context.</param>
        /// <returns>State of the command.</returns>
        public override CommandState QueryState(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            if (context.Items.Length != 1)
            {
                return CommandState.Hidden;
            }

            Item item = context.Items[0];

            if (!Sitecore.Context.IsAdministrator && (!item.Access.CanWrite() || (!item.Locking.CanLock() && !item.Locking.HasLock())))
            {
                return CommandState.Disabled;
            }

            foreach (Language language in LanguageManager.GetLanguages(item.Database))
            {
                Item itemInLanguage = ItemManager.GetItem(item.ID, language, Sitecore.Data.Version.Latest, item.Database);
                if (itemInLanguage.Versions.GetVersions().Length == 0)
                {
                    return CommandState.Enabled;
                }
            }

            return CommandState.Disabled;
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Create a Bucket out of an item
 /// </summary>
 /// <param name="context">Command Context</param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     var items = context.Items;
     Assert.IsNotNull(items, "Context items list is null");
     Context.ClientPage.Start("uiBucketItems", new BucketArgs(items[0], new NameValueCollection()));
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Executes the command in the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

              string id = context.Parameters["id"];
              if (!ID.IsID(id))
              {
            return;
              }

              Item orderItem = Sitecore.Context.ContentDatabase.GetItem(new ID(id));
              if (orderItem == null)
              {
            return;
              }

              ICatalogView view = context.CustomData as ICatalogView;
              if (view == null)
              {
            return;
              }

              ClientPipelineArgs args = new ClientPipelineArgs(new NameValueCollection(context.Parameters));
              args.Parameters.Add("uri", orderItem.Uri.ToString());
              args.Parameters["fields"] = this.GetFields(view.EditorFields);
              args.CustomData.Add("catalogView", view);

              ContinuationManager.Current.Start(this, "Run", args);
        }
        // Methods
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            if (context.Items.Length == 1)
            {
                Item item = context.Items[0];
                if (!item.Appearance.ReadOnly && item.Access.CanWrite())
                {
                    var parameters = new NameValueCollection();
                    parameters["id"] = item.ID.ToString();
                    parameters["language"] = (Context.Language == null) ? item.Language.ToString() : Context.Language.ToString();
                    parameters["version"] = item.Version.ToString();
                    parameters["database"] = item.Database.Name;
                    parameters["isPageEditor"] = (context.Parameters["pageEditor"] == "1") ? "1" : "0";
                    parameters["searchString"] = context.Parameters.GetValues("url")[0].Replace("\"", string.Empty);

                    if (ContinuationManager.Current != null)
                    {
                        ContinuationManager.Current.Start(this, "Run", new ClientPipelineArgs(parameters));
                    }
                    else
                    {
                        Context.ClientPage.Start(this, "Run", parameters);
                    }
                }
            }
        }
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            var layoutAsJson = WebUtil.GetFormValue("scLayout");
            var deviceId = ShortID.Decode(WebUtil.GetFormValue("scDeviceID"));
            var uniqueId = context.Parameters["referenceId"];

            var layoutAsXml = Sitecore.Web.WebEditUtil.ConvertJSONLayoutToXML(layoutAsJson);
            Assert.IsNotNull(layoutAsXml, "layoutAsXml");
            WebUtil.SetSessionValue(this.HandleName, layoutAsXml);

            var layoutDef = LayoutDefinition.Parse(layoutAsXml);
            var deviceDefinition = layoutDef.GetDevice(deviceId);
            var index = deviceDefinition.GetIndex(uniqueId);

            var parameters = new NameValueCollection();
            parameters["handleName"] = HandleName;
            parameters["deviceId"] = deviceId;
            parameters["selectedindex"] = index.ToString();
            parameters.Add(context.Parameters);

            var args = new ClientPipelineArgs(parameters);
            Sitecore.Context.ClientPage.Start(this, "Run", args);
        }
Ejemplo n.º 22
0
        public CommandContext GetCommandContext()
        {
            var itemNotNull = Client.CoreDatabase.GetItem("{EE1860D8-09CB-49FE-9AB5-2F01D2D2D796}"); // /sitecore/content/Applications/Advanced System Reporter/Ribbon
            var context = new CommandContext {RibbonSourceUri = itemNotNull.Uri};

            return context;
        }
Ejemplo n.º 23
0
        public override void Execute(CommandContext context)
        {
            string scriptId = context.Parameters["script"];
            string scriptDb = context.Parameters["scriptDb"];
            Item scriptItem = Factory.GetDatabase(scriptDb).GetItem(new ID(scriptId));

            string showResults = scriptItem[ScriptItemFieldNames.ShowResults];
            string itemId = string.Empty;
            string itemDb = string.Empty;

            if (context.Items.Length > 0)
            {
                itemId = context.Items[0].ID.ToString();
                itemDb = context.Items[0].Database.Name;
            }

            var str = new UrlString(UIUtil.GetUri("control:PowerShellRunner"));
            str.Append("id", itemId);
            str.Append("db", itemDb);
            str.Append("scriptId", scriptId);
            str.Append("scriptDb", scriptDb);
            str.Append("autoClose", showResults);
            Context.ClientPage.ClientResponse.Broadcast(
                SheerResponse.ShowModalDialog(str.ToString(), "400", "220", "PowerShell Script Results", false),
                "Shell");
        }
 public static CommandContext Create(CommandContextStack stack, OpenTagCache info)
 {
     var context = new CommandContext(null, info.CacheFile.Name);
     context.AddCommand(new HelpCommand(stack));
     context.AddCommand(new ClearCommand());
     context.AddCommand(new DumpLogCommand());
     context.AddCommand(new EchoCommand());
     context.AddCommand(new DependencyCommand(info));
     context.AddCommand(new ExtractCommand(info));
     context.AddCommand(new ImportCommand(info));
     context.AddCommand(new InfoCommand(info));
     context.AddCommand(new ListCommand(info));
     context.AddCommand(new MapCommand());
     context.AddCommand(new DuplicateTagCommand(info));
     context.AddCommand(new AddressCommand());
     context.AddCommand(new ResourceDataCommand());
     if (info.StringIds != null)
     {
         context.AddCommand(new EditCommand(stack, info));
         context.AddCommand(new ExtractBitmapsCommand(info));
         context.AddCommand(new ImportBitmapCommand(info));
         context.AddCommand(new CollisionGeometryTestCommand(info));
         context.AddCommand(new PhysicsModelTestCommand(info));
         context.AddCommand(new StringIdCommand(info));
         context.AddCommand(new ListStringsCommand(info));
         context.AddCommand(new GenerateLayoutsCommand(info));
         context.AddCommand(new ModelTestCommand(info));
         context.AddCommand(new ConvertPluginsCommand(info));
         context.AddCommand(new GenerateTagNamesCommand(info));
         context.AddCommand(new MatchTagsCommand(info));
         context.AddCommand(new ConvertCommand(info));
     }
     return context;
 }
		/// <summary>
		/// Queries the state of the command.
		/// 
		/// </summary>
		/// <param name="context">The context.</param>
		/// <returns>
		/// The state of the command.
		/// </returns>
		public override CommandState QueryState(CommandContext context)
		{
			Error.AssertObject((object)context, "context");
			if (context.Items.Length != 1 || !Settings.Publishing.Enabled)
				return CommandState.Hidden;
			return base.QueryState(context);
		}
Ejemplo n.º 26
0
 // Methods
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     var parameters = new NameValueCollection();
     var args = new ClientPipelineArgs(parameters);
     ContinuationManager.Current.Start(this, "Run", args);
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Executes the command in the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull((object)context, "context");
            if (context.Items.Length != 1)
                return;
            NameValueCollection parameters = new NameValueCollection();

            string itemID = context.Parameters["itemid"] ?? context.Parameters["id"];
            ItemUri itemUri = ItemUri.ParseQueryString();
            if (string.IsNullOrEmpty(itemID) && itemUri != (ItemUri)null)
                itemID = itemUri.ItemID.ToString();

            parameters["itemid"] = itemID;
            string language = context.Parameters["language"];
            if (string.IsNullOrEmpty(language))
                language = itemUri.Language.ToString();

            Sitecore.Data.Version version = itemUri.Version;

            parameters["database"] = itemUri.DatabaseName;
            parameters["language"] = language;
            parameters["navigate"] = context.Parameters["navigate"];
            parameters["version"] = version.ToString();
            Context.ClientPage.Start((object)this, "Run", parameters);
        }
        public override void Execute(CommandContext context)
        {
            string formValue = WebUtil.GetFormValue("scPlainValue");
            context.Parameters.Add("fieldValue", formValue);

            Context.ClientPage.Start(this, "Run", context.Parameters);
        }
Ejemplo n.º 29
0
        public void Execute(ICommand command)
        {
            var commandHandler = _commandHandleProvider.GetInternalCommandHandle(command.GetType());

            var commandContext = new CommandContext(_repository);

            commandHandler(commandContext, command);

            var aggregateRoots = commandContext.AggregateRoots;

            if (aggregateRoots.Count > 1)
                throw new Exception("one command handler can change just only one aggregateRoot.");

            var aggregateRoot = aggregateRoots.First().Value;

            var domainEvents = aggregateRoot.GetUnCommitEvents();

            var eventStream = BuildEventStream(aggregateRoot, command.CommandId);

            _eventStore.AppendAsync(eventStream);

            if (aggregateRoot.Version % 3 == 0)
                _snapshotStorage.Create(new SnapshotRecord(aggregateRoot.AggregateRootId, aggregateRoot.Version,
                    _binarySerializer.Serialize(aggregateRoot)));

            _eventPublisher.PublishAsync(domainEvents);

            aggregateRoot.Clear();

            Console.WriteLine(aggregateRoot.ToString());

            Console.WriteLine("DomainEvents count is {0}", domainEvents.Count);
        }
 public override void Execute(CommandContext context)
 {
   var item = context.Items[0];
   var parameters = new NameValueCollection();
   parameters.Add("item", item.ID.ToString());
   Context.ClientPage.Start(this, "Run", parameters);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Quickly responds to the command with a embeded format
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="description"></param>
 /// <returns></returns>
 public static async Task <DiscordMessage> ReplyAsEmbedAsync(this CommandContext ctx, string format, params object[] args) =>
 await ctx.ReplyAsync(embed : ctx.ToEmbed().WithDescription(format, args));
Ejemplo n.º 32
0
 /// <summary>
 /// Quickly responds to the command with a embeded format
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="description"></param>
 /// <returns></returns>
 public static async Task <DiscordMessage> ReplyAsEmbedAsync(this CommandContext ctx, string description) =>
 await ctx.ReplyAsync(embed : ctx.ToEmbed().WithDescription(description));
Ejemplo n.º 33
0
 /// <summary>
 /// Quickly responds to the command with a exception dump
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="exception"></param>
 /// <param name="showStackTrace"></param>
 /// <returns></returns>
 public static async Task <DiscordMessage> ReplyExceptionAsync(this CommandContext ctx, Exception exception, bool showStackTrace = true) =>
 await ctx.ReplyAsync(embed : exception.ToEmbed(showStackTrace));