Radis Easton
Radis Easton
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/18/2024 in #djs-questions
My bot stop Giving Roles and Removing them after a while
oh yeah this is will be good thank you
10 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/18/2024 in #djs-questions
My bot stop Giving Roles and Removing them after a while
🥲 i have a system that makes members join a room using reaction then after one hour remove them all like an event
10 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/18/2024 in #djs-questions
My bot stop Giving Roles and Removing them after a while
all most every 1 hour and remove from alot of members
10 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/18/2024 in #djs-questions
My bot stop Giving Roles and Removing them after a while
thank you
10 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
thank of you help i will try to make sure all my functions as async and await for them
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
🤣 it's old code sorry 🤣
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
so you mean i change give role function to await
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
execute(message, args, luna, Discord, prefix, index, useridfromslash, guildid, slashcommandon) {


mongoose.connect(mongoPass, {
useNewUrlParser: true,
useUnifiedTopology: true,
})

const ChannelSlash = luna.channels.cache.find(channel => channel.id === message)
const PlayerSystemFunctions = new MyPlayerSystemFunctions(luna);

const ChallengeCoin = luna.emojis.cache.find(emoji => emoji.name === "ChallengeCoin");
var LunaMsg = new MessageExtra(ChannelSlash ,message , useridfromslash , slashcommandon, luna)


var AcceptedRoles = new ArrayList;

AcceptedRoles.add(["1157940292469674004","937314384009654323","885599560402092043" ,"885604872215466045","950735462518124634" , "940231757922439179"]);



var role = args[0];
role = role.replace("<@&","");
role = role.replace(">","");

if(!AcceptedRoles.contains(role))
return LunaMsg.send("**لا يمكن إعطاء هذه الرتبة**", "@");

args = args.filter(item => item !== args[0])

args.forEach(async user => {
user = user.replace("<", "");
user = user.replace("@", "");
user = user.replace(">", "");
user = user.replace("!", "");

if (parseInt(user) != `NaN`) {
await PlayerSystemFunctions.GiveRole(guildid,user,role)
}
});

LunaMsg.send(`**تم توزيع بنجاح <@&${role}>**`,"@")
}
execute(message, args, luna, Discord, prefix, index, useridfromslash, guildid, slashcommandon) {


mongoose.connect(mongoPass, {
useNewUrlParser: true,
useUnifiedTopology: true,
})

const ChannelSlash = luna.channels.cache.find(channel => channel.id === message)
const PlayerSystemFunctions = new MyPlayerSystemFunctions(luna);

const ChallengeCoin = luna.emojis.cache.find(emoji => emoji.name === "ChallengeCoin");
var LunaMsg = new MessageExtra(ChannelSlash ,message , useridfromslash , slashcommandon, luna)


var AcceptedRoles = new ArrayList;

AcceptedRoles.add(["1157940292469674004","937314384009654323","885599560402092043" ,"885604872215466045","950735462518124634" , "940231757922439179"]);



var role = args[0];
role = role.replace("<@&","");
role = role.replace(">","");

if(!AcceptedRoles.contains(role))
return LunaMsg.send("**لا يمكن إعطاء هذه الرتبة**", "@");

args = args.filter(item => item !== args[0])

args.forEach(async user => {
user = user.replace("<", "");
user = user.replace("@", "");
user = user.replace(">", "");
user = user.replace("!", "");

if (parseInt(user) != `NaN`) {
await PlayerSystemFunctions.GiveRole(guildid,user,role)
}
});

LunaMsg.send(`**تم توزيع بنجاح <@&${role}>**`,"@")
}
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
wait i show you one of my codes
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
on normal i do that
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
luna is the Client and this functions on my class it's work , but after a while the system don't give roles or remove them.
GiveRole(GuildID, PlayerID, RoleID) {
const Guild = this.luna.guilds.cache.get(GuildID);
if(Guild){


const Member = Guild.members.cache.find(member => member.id == PlayerID)
if (!Member) return console.log(`[ERROR GiveRole][@Function] #i can't find the @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`);
const Role = Guild.roles.cache.find(role => role.id == RoleID)
if (!Role) return console.log(`[ERROR GiveRole][@Function] #i can't find the @Role with (ID = ${RoleID}) in @Guild (ID = ${GuildID})`);

Member.roles.add(Role).catch(error => {
console.error(`[ERROR GiveRole][@Function] #i can't Add the @Role with (ID = ${RoleID}) to @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`)
});
}
}




RemoveRole(GuildID, PlayerID, RoleID) {
const Guild = this.luna.guilds.cache.get(GuildID);
if(Guild){

const Member = Guild.members.cache.find(member => member.id == PlayerID)
if (!Member) return console.log(`[ERROR RemoveRole][@Function] #i can't find the @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`);
const Role = Guild.roles.cache.find(role => role.id == RoleID)
if (!Role) return console.log(`[ERROR RemoveRole][@Function] #i can't find the @Role with (ID = ${RoleID}) in @Guild (ID = ${GuildID})`);

Member.roles.remove(Role).catch(error => {
console.error(`[ERROR RemoveRole][@Function] #i can't Remove the @Role with (ID = ${RoleID}) to @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`)
});

}
}
GiveRole(GuildID, PlayerID, RoleID) {
const Guild = this.luna.guilds.cache.get(GuildID);
if(Guild){


const Member = Guild.members.cache.find(member => member.id == PlayerID)
if (!Member) return console.log(`[ERROR GiveRole][@Function] #i can't find the @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`);
const Role = Guild.roles.cache.find(role => role.id == RoleID)
if (!Role) return console.log(`[ERROR GiveRole][@Function] #i can't find the @Role with (ID = ${RoleID}) in @Guild (ID = ${GuildID})`);

Member.roles.add(Role).catch(error => {
console.error(`[ERROR GiveRole][@Function] #i can't Add the @Role with (ID = ${RoleID}) to @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`)
});
}
}




RemoveRole(GuildID, PlayerID, RoleID) {
const Guild = this.luna.guilds.cache.get(GuildID);
if(Guild){

const Member = Guild.members.cache.find(member => member.id == PlayerID)
if (!Member) return console.log(`[ERROR RemoveRole][@Function] #i can't find the @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`);
const Role = Guild.roles.cache.find(role => role.id == RoleID)
if (!Role) return console.log(`[ERROR RemoveRole][@Function] #i can't find the @Role with (ID = ${RoleID}) in @Guild (ID = ${GuildID})`);

Member.roles.remove(Role).catch(error => {
console.error(`[ERROR RemoveRole][@Function] #i can't Remove the @Role with (ID = ${RoleID}) to @Member with (ID = ${PlayerID}) in @Guild (ID = ${GuildID})`)
});

}
}
12 replies
DIAdiscord.js - Imagine an app
Created by Radis Easton on 3/10/2024 in #djs-questions
remove and add roles stop after time of running ?
hi @Qjuh thank you for reply . on code it's normal command to add roles it's work nomrmaly but i have alot of my other reaction handler like when some on join server using emoji and get roles and like that things> can you tall me more about ratelimit , i think my system do a lot of roles handling (add - remove)
12 replies