Exemplo n.º 1
0
        private async Task Invite([Remainder] string RemainingText)
        {
            var acm = discordSettings.AutoChannelManage;

            if (CheckIfInACM(acm, user))
            {
                if (Context.Message.MentionedUsers.Count > 5)
                {
                    addtext(Context.Guild, Context.Message.Channel as SocketTextChannel, user, "Only five users at a time", messageHandler);
                }
                else if (Context.Message.MentionedUsers.Count == 0)
                {
                    addtext(Context.Guild, Context.Message.Channel as SocketTextChannel, user, "You didnt mention anyone", messageHandler);
                }
                else
                {
                    var perms = new Discord.OverwritePermissions();

                    perms = perms.Modify(Discord.PermValue.Inherit, Discord.PermValue.Inherit, Discord.PermValue.Inherit, Discord.PermValue.Allow, Discord.PermValue.Allow,
                                         Discord.PermValue.Inherit, Discord.PermValue.Inherit, Discord.PermValue.Inherit, Discord.PermValue.Inherit, Discord.PermValue.Allow,
                                         Discord.PermValue.Inherit, Discord.PermValue.Inherit, Discord.PermValue.Allow, Discord.PermValue.Allow, Discord.PermValue.Inherit,
                                         Discord.PermValue.Inherit, Discord.PermValue.Allow, Discord.PermValue.Allow, Discord.PermValue.Inherit, Discord.PermValue.Inherit);


                    foreach (var a in Context.Message.MentionedUsers)
                    {
                        await user.VoiceChannel.AddPermissionOverwriteAsync(a, perms);
                    }

                    addtext(Context.Guild, Context.Message.Channel as SocketTextChannel, user, "The users can now join your channel", messageHandler);
                }
            }
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null;
Exemplo n.º 3
0
 /// <inheritdoc />
 public Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions) => null;
Exemplo n.º 4
0
 public Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
        public Task TestOverwritePermissionsNone()
        {
            // allow all for text channel
            var value = new OverwritePermissions(ChannelPermissions.None.RawValue, ChannelPermissions.None.RawValue);

            TestHelper(value, ChannelPermission.CreateInstantInvite, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageChannels, PermValue.Inherit);
            TestHelper(value, ChannelPermission.AddReactions, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ViewChannel, PermValue.Inherit);
            TestHelper(value, ChannelPermission.SendMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.SendTTSMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.EmbedLinks, PermValue.Inherit);
            TestHelper(value, ChannelPermission.AttachFiles, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ReadMessageHistory, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MentionEveryone, PermValue.Inherit);
            TestHelper(value, ChannelPermission.UseExternalEmojis, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageRoles, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageWebhooks, PermValue.Inherit);
            TestHelper(value, ChannelPermission.Connect, PermValue.Inherit);
            TestHelper(value, ChannelPermission.Speak, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MuteMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.DeafenMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MoveMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.UseVAD, PermValue.Inherit);

            value = new OverwritePermissions();

            TestHelper(value, ChannelPermission.CreateInstantInvite, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageChannels, PermValue.Inherit);
            TestHelper(value, ChannelPermission.AddReactions, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ViewChannel, PermValue.Inherit);
            TestHelper(value, ChannelPermission.SendMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.SendTTSMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.EmbedLinks, PermValue.Inherit);
            TestHelper(value, ChannelPermission.AttachFiles, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ReadMessageHistory, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MentionEveryone, PermValue.Inherit);
            TestHelper(value, ChannelPermission.UseExternalEmojis, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageRoles, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageWebhooks, PermValue.Inherit);
            TestHelper(value, ChannelPermission.Connect, PermValue.Inherit);
            TestHelper(value, ChannelPermission.Speak, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MuteMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.DeafenMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MoveMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.UseVAD, PermValue.Inherit);

            value = OverwritePermissions.InheritAll;

            TestHelper(value, ChannelPermission.CreateInstantInvite, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageChannels, PermValue.Inherit);
            TestHelper(value, ChannelPermission.AddReactions, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ViewChannel, PermValue.Inherit);
            TestHelper(value, ChannelPermission.SendMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.SendTTSMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageMessages, PermValue.Inherit);
            TestHelper(value, ChannelPermission.EmbedLinks, PermValue.Inherit);
            TestHelper(value, ChannelPermission.AttachFiles, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ReadMessageHistory, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MentionEveryone, PermValue.Inherit);
            TestHelper(value, ChannelPermission.UseExternalEmojis, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageRoles, PermValue.Inherit);
            TestHelper(value, ChannelPermission.ManageWebhooks, PermValue.Inherit);
            TestHelper(value, ChannelPermission.Connect, PermValue.Inherit);
            TestHelper(value, ChannelPermission.Speak, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MuteMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.DeafenMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.MoveMembers, PermValue.Inherit);
            TestHelper(value, ChannelPermission.UseVAD, PermValue.Inherit);

            return(Task.CompletedTask);
        }
Exemplo n.º 6
0
 /// <summary> Creates a new Overwrite with provided target information and modified permissions. </summary>
 public Overwrite(ulong targetId, PermissionTarget targetType, OverwritePermissions permissions)
 {
     TargetId    = targetId;
     TargetType  = targetType;
     Permissions = permissions;
 }
Exemplo n.º 7
0
 public Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) => throw new NotImplementedException();