Esempio n. 1
0
        public async Task UpdateGroupRole(string gName, string req, string cName)
        {
            if (!await IsAdmin())
            {
                return;
            }
            if (Context.Guild == null)
            {
                await ReplyAsync("You must issue this command inside a server!");

                return;
            }
            var group = await GroupHandler.GetGroupHandler(Context.Guild.Id, gName);

            if (BigNumber.IsValidValue(req, group.TokenDecimal))
            {
                await group.UpdateRole(cName, req);

                await Context.Message.AddReactionAsync(new Emoji("✅"));
            }
            else
            {
                await ReplyAsync("Wrong token value in respect to decimals");
            }
        }
Esempio n. 2
0
        public static async Task UpdateRoleHandler(ulong guildId, ulong roleId, string req)
        {
            var collec = DatabaseConnection.GetDb().GetCollection <RoleHandler>("Roles");
            var role   = (await collec.FindAsync(r => r.RoleId == roleId)).FirstOrDefault();

            if (role == null)
            {
                return;
            }
            else
            {
                if (BigNumber.IsValidValue(req, role.tokenDecimal))
                {
                    role.Update(BigNumber.ParseValueToTokenDecimal(req, role.tokenDecimal));
                    var update = Builders <RoleHandler> .Update.Set(r => r.Requirement, role.Requirement);

                    await collec.UpdateOneAsync(r => r.RoleId == role.RoleId, update);
                }
            }
        }
Esempio n. 3
0
        public async Task AddRole(IRole role, string tokenName, string token, string req, int dec, string name)
        {
            if (!await IsAdmin())
            {
                return;
            }
            if (Context.Guild == null)
            {
                await ReplyAsync("You must issue this command inside a server!");

                return;
            }
            if (BigNumber.IsValidValue(req, dec))
            {
                await RoleHandler.AddRoleHandler(Context.Guild.Id, role.Id, token, req, dec, name, tokenName);

                await Context.Message.AddReactionAsync(new Emoji("✅"));
            }
            else
            {
                await ReplyAsync("Wrong token value in respect to decimals");
            }
        }