/// <inheritdoc />
 public async Task <IUserMessage> ModifyMessageAsync(ulong messageId, Action <MessageProperties> func, RequestOptions options = null)
 => await ChannelHelper.ModifyMessageAsync(this, messageId, func, Discord, options).ConfigureAwait(false);
 /// <inheritdoc />
 public Task <IReadOnlyCollection <RestMessage> > GetPinnedMessagesAsync(RequestOptions options = null)
 => ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
 /// <inheritdoc />
 /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
 public Task <RestUserMessage> SendFilesAsync(IEnumerable <FileAttachment> attachments, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
 => ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
 public Task DeleteMessagesAsync(IEnumerable <IMessage> messages, RequestOptions options = null)
 => ChannelHelper.DeleteMessagesAsync(this, Discord, messages, options);
 /// <summary>
 ///     Gets the last N messages from this message channel.
 /// </summary>
 /// <remarks>
 ///     This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(int, CacheMode, RequestOptions)"/>.
 ///     Please visit its documentation for more details on this method.
 /// </remarks>
 /// <param name="limit">The numbers of message to be gotten from.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     Paged collection of messages.
 /// </returns>
 public IAsyncEnumerable <IReadOnlyCollection <IMessage> > GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
 => ChannelHelper.GetMessagesAsync(this, Discord, null, Direction.Before, limit, options);
示例#6
0
 //Webhooks
 /// <summary>
 ///     Creates a webhook in this text channel.
 /// </summary>
 /// <param name="name">The name of the webhook.</param>
 /// <param name="avatar">The avatar of the webhook.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     A task that represents the asynchronous creation operation. The task result contains the newly created
 ///     webhook.
 /// </returns>
 public Task <RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null)
 => ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options);
 public Task <RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
 => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
 /// <inheritdoc />
 /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
 /// <exception cref="ArgumentException">The only valid <see cref="MessageFlags"/> are <see cref="MessageFlags.SuppressEmbeds"/> and <see cref="MessageFlags.None"/>.</exception>
 public Task <RestUserMessage> SendMessageAsync(string text                 = null, bool isTTS = false, Embed embed = null,
                                                RequestOptions options      = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null,
                                                MessageComponent components = null, ISticker[] stickers             = null, Embed[] embeds = null, MessageFlags flags = MessageFlags.None)
 => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference,
                                   components, stickers, options, embeds, flags);
    public void buy(int money_type)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("BuyGoodsPanelScript_hotfix", "buy"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.BuyGoodsPanelScript_hotfix", "buy", null, money_type);
            return;
        }

        int totalPrice = 0;

        if (money_type == m_shopData.money_type)
        {
            totalPrice = m_shopData.price * m_goods_num;
        }
        else if (money_type == m_shopData.money_type2)
        {
            totalPrice = m_shopData.price2 * m_goods_num;
        }

        switch (money_type)
        {
        case 1:
            if (UserData.gold < totalPrice)
            {
                ToastScript.createToast("金币不足,请前去充值");
                return;
            }
            else
            {
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>()
                .setGoodsInfo(m_shopData.goods_id, m_goods_num, money_type);
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>().CallBack = onReceive_BuyGoods;
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>().OnRequest();
            }
            break;

        case 2:
            if (UserData.yuanbao < totalPrice)
            {
                ToastScript.createToast("元宝不足,请前去充值");
                return;
            }
            else
            {
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>()
                .setGoodsInfo(m_shopData.goods_id, m_goods_num, money_type);
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>().CallBack = onReceive_BuyGoods;
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>().OnRequest();
            }
            break;

        //人民币购买
        case 3:
            if (!OtherData.s_canRecharge)
            {
                ToastScript.createToast("元宝购买暂未开放,敬请期待");
                return;
            }

            if (UserData.IsRealName)
            {
#if UNITY_ANDROID
                if (!ChannelHelper.Is3RdLogin())
                {
                    PayTypePanelScript.create(m_shopData);
                }
                else
                {
                    PlatformHelper.pay(PlatformHelper.GetChannelName(), "AndroidCallBack", "GetPayResult", SetRequest(m_shopData));
                }
#elif UNITY_IPHONE
                PlatformHelper.pay(PlatformHelper.GetChannelName(), "AndroidCallBack", "GetPayResult", SetRequest(m_shopData));
#else
                PayTypePanelScript.create(m_shopData);
#endif
                Destroy(this.gameObject);
            }
            else
            {
                CommonExitPanelScript commonExit =
                    CommonExitPanelScript.create().GetComponent <CommonExitPanelScript>();
                commonExit.TextContent.text = "您还未实名,无法购买";
                commonExit.ButtonClose.gameObject.SetActive(true);
                commonExit.ButtonConfirm.onClick.AddListener(delegate()
                {
                    RealNameScript.create();
                    Destroy(commonExit.gameObject);
                });
            }
            break;

        case 4:
            if (UserData.medal < totalPrice)
            {
                ToastScript.createToast("徽章不足,无法购买");
                return;
            }
            else
            {
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>()
                .setGoodsInfo(m_shopData.goods_id, m_goods_num, money_type);
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>().CallBack = onReceive_BuyGoods;
                LogicEnginerScript.Instance.GetComponent <BuyGoodsRequest>().OnRequest();
            }
            break;
        }
    }
示例#10
0
 /// <inheritdoc />
 public async Task <IReadOnlyCollection <IInviteMetadata> > GetInvitesAsync(RequestOptions options = null)
 => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false);
示例#11
0
 /// <inheritdoc />
 public virtual Task SyncPermissionsAsync(RequestOptions options = null)
 => ChannelHelper.SyncPermissionsAsync(this, Discord, options);
示例#12
0
 //Invites
 /// <inheritdoc />
 public async Task <IInviteMetadata> CreateInviteAsync(int?maxAge = 86400, int?maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)
 => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false);
示例#13
0
 /// <summary>
 ///     Gets the webhooks available in this text channel.
 /// </summary>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     A task that represents the asynchronous get operation. The task result contains a read-only collection
 ///     of webhooks that is available in this channel.
 /// </returns>
 public Task <IReadOnlyCollection <RestWebhook> > GetWebhooksAsync(RequestOptions options = null)
 => ChannelHelper.GetWebhooksAsync(this, Discord, options);
示例#14
0
 /// <summary>
 ///     Gets a webhook available in this text channel.
 /// </summary>
 /// <param name="id">The identifier of the webhook.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     A task that represents the asynchronous get operation. The task result contains a webhook associated
 ///     with the identifier; <c>null</c> if the webhook is not found.
 /// </returns>
 public Task <RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
 => ChannelHelper.GetWebhookAsync(this, Discord, id, options);
示例#15
0
 /// <inheritdoc />
 public IDisposable EnterTypingState(RequestOptions options = null)
 => ChannelHelper.EnterTypingState(this, Discord, options);
示例#16
0
        private async Task <ChannelItemResult> GetChannelItemsInternal(CancellationToken cancellationToken)
        {
            var helper = new ChannelHelper();

            return(await helper.GetChannelItemResult(UserManager, LibraryManager, _channelToConfigure, Logger, TraktApi, cancellationToken));
        }
示例#17
0
 /// <summary>
 ///     Gets the message associated with the given <paramref name="id"/>.
 /// </summary>
 /// <param name="id">TThe ID of the message.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     The message gotten from either the cache or the download, or <c>null</c> if none is found.
 /// </returns>
 public async Task <IMessage> GetMessageAsync(ulong id, RequestOptions options = null)
 {
     return(await ChannelHelper.GetMessageAsync(this, Discord, id, options).ConfigureAwait(false));
 }
示例#18
0
 /// <inheritdoc />
 public Task <RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)
 => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options, isSpoiler);
示例#19
0
 //TODO: Use RPC cache
 public Task <RestMessage> GetMessageAsync(ulong id, RequestOptions options = null)
 => ChannelHelper.GetMessageAsync(this, Discord, id, options);
示例#20
0
        public override object Do(PanelContext data)
        {
            string oid = data.Objects["oid"] as string;

            if (We7Helper.IsEmptyID(oid))
            {
                throw new Exception("不能添加到根栏目");
            }

            if (!string.IsNullOrEmpty(oid))
            {
                Channel targetChannel = HelperFactory.GetHelper <ChannelHelper>().GetChannel(oid, null);
                //if (targetChannel != null && !String.IsNullOrEmpty(targetChannel.ModelName))
                if (targetChannel != null)
                {
                    //ModelInfo modelInfo = ModelHelper.GetModelInfo(targetChannel.ModelName);
                    //We7DataTable dt = modelInfo.DataSet.Tables[0];

                    List <DataKey> dataKeys = data.State as List <DataKey>;
                    foreach (DataKey key in dataKeys)
                    {
                        string id = key["ID"] as string;

                        //SingleTableLinkTo(data, dt, id);

                        Article a = ArticleHelper.GetArticle(id);
                        if (a != null)
                        {
                            DataSet ds  = BaseDataProvider.CreateDataSet(data.Model);
                            DataRow row = ds.Tables[data.Table.Name].NewRow();
                            ds.Tables[data.Table.Name].Rows.Add(row);

                            a.OwnerID = oid;
                            if (row.Table.Columns.Contains("OwnerID"))
                            {
                                row["OwnerID"] = oid;
                            }
                            if (row.Table.Columns.Contains("Title"))
                            {
                                row["Title"] = a.Title;
                            }
                            if (row.Table.Columns.Contains("Description"))
                            {
                                row["Description"] = a.Description;
                            }
                            a.ContentType = (int)TypeOfArticle.LinkArticle;
                            if (row.Table.Columns.Contains("ContentType"))
                            {
                                row["ContentType"] = a.ContentType;
                            }
                            a.ContentUrl = GetContentUrl(a);
                            if (row.Table.Columns.Contains("ContentUrl"))
                            {
                                row["ContentUrl"] = a.ContentUrl;
                            }
                            a.Content = "";
                            if (row.Table.Columns.Contains("Content"))
                            {
                                row["Content"] = "";
                            }
                            a.SourceID = a.ID;
                            if (row.Table.Columns.Contains("SourceID"))
                            {
                                row["SourceID"] = a.ID;
                            }
                            a.Updated = DateTime.Now;
                            if (row.Table.Columns.Contains("Updated"))
                            {
                                row["Updated"] = a.Updated;
                            }

                            a.Created = DateTime.Now;
                            if (row.Table.Columns.Contains("Created"))
                            {
                                row["Created"] = a.Created;
                            }

                            a.Overdue = DateTime.Now.AddYears(2);
                            if (row.Table.Columns.Contains("Overdue"))
                            {
                                row["Overdue"] = a.Overdue;
                            }

                            Channel ch = ChannelHelper.GetChannel(oid, null);
                            if (ch != null)
                            {
                                a.ChannelFullUrl = ch.FullUrl;
                                if (row.Table.Columns.Contains("ChannelFullUrl"))
                                {
                                    row["ChannelFullUrl"] = a.ChannelFullUrl;
                                }
                                a.ChannelName = ch.FullPath;
                                if (row.Table.Columns.Contains("ChannelName"))
                                {
                                    row["ChannelName"] = a.ChannelName;
                                }
                                a.FullChannelPath = ch.FullFolderPath;
                                if (row.Table.Columns.Contains("FullChannelPath"))
                                {
                                    row["FullChannelPath"] = a.FullChannelPath;
                                }
                                a.State = ch.Process != null && ch.Process == "1" ? 2 : a.State;
                                if (row.Table.Columns.Contains("State"))
                                {
                                    row["State"] = a.State;
                                }
                            }
                            a.ID = We7Helper.CreateNewID();
                            if (row.Table.Columns.Contains("ID"))
                            {
                                row["ID"] = a.ID;
                            }
                            a.ModelXml = BaseDataProvider.GetXml(ds);
                            ArticleHelper.AddArticle(a);
                            // 往全文检索里更新数据
                            ArticleIndexHelper.InsertData(a.ID, 0);
                        }
                    }
                }
            }
            return(null);
        }
示例#21
0
 public Task <RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, RequestOptions options = null)
 => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, options);
示例#22
0
 public int IndexOf(ChannelHelper value)
 {
     return (List.IndexOf(value));
 }
示例#23
0
 /// <inheritdoc />
 public Task <RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null)
 => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, messageReference, options, isSpoiler);
示例#24
0
 public void Insert(int index, ChannelHelper value)
 {
     List.Insert(index, value);
 }
示例#25
0
 /// <summary>
 ///     Gets a collection of messages in this channel.
 /// </summary>
 /// <remarks>
 ///     This method follows the same behavior as described in <see cref="IMessageChannel.GetMessagesAsync(IMessage, Direction, int, CacheMode, RequestOptions)"/>.
 ///     Please visit its documentation for more details on this method.
 /// </remarks>
 /// <param name="fromMessage">The starting message to get the messages from.</param>
 /// <param name="dir">The direction of the messages to be gotten from.</param>
 /// <param name="limit">The numbers of message to be gotten from.</param>
 /// <param name="options">The options to be used when sending the request.</param>
 /// <returns>
 ///     Paged collection of messages.
 /// </returns>
 public IAsyncEnumerable <IReadOnlyCollection <IMessage> > GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null)
 => ChannelHelper.GetMessagesAsync(this, Discord, fromMessage.Id, dir, limit, options);
示例#26
0
 public void Remove(ChannelHelper value)
 {
     List.Remove(value);
 }
示例#27
0
 /// <inheritdoc />
 /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
 public Task <RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null)
 => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
示例#28
0
 public int Add(ChannelHelper value)
 {
     return (List.Add(value));
 }
示例#29
0
 /// <inheritdoc />
 public Task DeleteMessageAsync(IMessage message, RequestOptions options = null)
 => ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options);
示例#30
0
 public bool Contains(ChannelHelper value)
 {
     // If value is not of type Int16, this will return false.
     return (List.Contains(value));
 }
示例#31
0
 /// <inheritdoc />
 public Task TriggerTypingAsync(RequestOptions options = null)
 => ChannelHelper.TriggerTypingAsync(this, Discord, options);
示例#32
0
 public string GetChannelText(string id)
 {
     return(ChannelHelper.GetChannelName(ArticleHelper.GetArticle(id).OwnerID));
 }
示例#33
0
 /// <inheritdoc />
 public Task CloseAsync(RequestOptions options = null)
 => ChannelHelper.DeleteAsync(this, Discord, options);
示例#34
0
 public Task ModifyAsync(Action <TextChannelProperties> func, RequestOptions options = null)
 => ChannelHelper.ModifyAsync(this, Discord, func, options);
示例#35
0
 public void AddPointCollection(PointCollection pc)
 {
     foreach (PointHelper p in pc)
     {
         bool foundchannel = false;
         foreach (ChannelHelper ch in m_channelCollection)
         {
             if (ch.ChannelName == p.Channelname)
             {
                 ch.PointCollection.Add(p);
                 if (p.DateTimeValue > m_MaxDateTime) m_MaxDateTime = p.DateTimeValue;
                 if (p.DateTimeValue < m_MinDateTime) m_MinDateTime = p.DateTimeValue;
                 if (p.Pointvalue < ch.MinValue) ch.MinValue = p.Pointvalue;
                 if (p.Pointvalue > ch.MaxValue) ch.MaxValue = p.Pointvalue;
                 foundchannel = true;
             }
         }
         if (!foundchannel)
         {
             ChannelHelper nch = new ChannelHelper();
             nch.ChannelName = p.Channelname;
             nch.PointCollection.Add(p);
             nch.ChannelColor = Color.FromArgb(m_channelCollection.Count * 10, 255 - (m_channelCollection.Count * 10), 128);
             if (p.DateTimeValue > m_MaxDateTime) m_MaxDateTime = p.DateTimeValue;
             if (p.DateTimeValue < m_MinDateTime) m_MinDateTime = p.DateTimeValue;
             if (p.Pointvalue < nch.MinValue) nch.MinValue = p.Pointvalue;
             if (p.Pointvalue > nch.MaxValue) nch.MaxValue = p.Pointvalue;
             m_channelCollection.Add(nch);
         }
     }
     Console.WriteLine("mindate: "+ m_MinDateTime.ToString() + " maxdate: " + m_MaxDateTime.ToString());
     this.Invalidate(true);
 }
 public Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null)
 => ChannelHelper.RemovePermissionOverwriteAsync(this, Discord, role, options);