discord

How do I make my Python discord bot give roles on join?

浪尽此生 提交于 2020-12-27 05:51:42
问题 I have a bot that I'm trying to make better. It's called moderator bot and I'm working on adding new commands. I just can't find the code anywhere. How do I get moderator bot to give user roles when they join the server. And how do I make it configurable by the server owner so that the bot can be used over different servers? I also want it to DM the owner commands so they can see it along with only owner-set roles being able to access that command. It sounds advanced and probably is, but can

How to check is an user has a role on discord

霸气de小男生 提交于 2020-12-26 11:49:02
问题 I am struggling to find a way to check if an user has a role. I know how to find a certain role: public Role findRole(Guild guild, String name) { List<Role> roles = guild.getRolesByName(name, true); if (roles.size() <= 0) { throw new RuntimeException("Role with name " + name + " on Guild " + guild.getName() + " not found!"); } else { return roles.get(0); } } and i have a role: Role neededEole=findRole(event.getGuild(),"Admin"); I know how to search an user: String user=event.getAuthor().getId

How to check is an user has a role on discord

☆樱花仙子☆ 提交于 2020-12-26 11:48:20
问题 I am struggling to find a way to check if an user has a role. I know how to find a certain role: public Role findRole(Guild guild, String name) { List<Role> roles = guild.getRolesByName(name, true); if (roles.size() <= 0) { throw new RuntimeException("Role with name " + name + " on Guild " + guild.getName() + " not found!"); } else { return roles.get(0); } } and i have a role: Role neededEole=findRole(event.getGuild(),"Admin"); I know how to search an user: String user=event.getAuthor().getId

Discord Bot can only see itself and no other users in guild

徘徊边缘 提交于 2020-12-26 09:23:46
问题 I have recently been following this tutorial to get myself started with Discord's API. Unfortunately, when I got the part about printing all the users in the guild I hit a wall. When I try to print all users' names it only prints the name of the bot and nothing else . For reference, there are six total users in the guild. The bot has Administrator privileges . import os import discord TOKEN = os.environ.get('TOKEN') client = discord.Client() @client.event async def on_ready(): for guild in

Discord Bot can only see itself and no other users in guild

…衆ロ難τιáo~ 提交于 2020-12-26 09:23:21
问题 I have recently been following this tutorial to get myself started with Discord's API. Unfortunately, when I got the part about printing all the users in the guild I hit a wall. When I try to print all users' names it only prints the name of the bot and nothing else . For reference, there are six total users in the guild. The bot has Administrator privileges . import os import discord TOKEN = os.environ.get('TOKEN') client = discord.Client() @client.event async def on_ready(): for guild in

How to check if a specific user has a role? Discord js

大兔子大兔子 提交于 2020-12-26 08:39:46
问题 I know how to check if the message sender has a role: if(message.member.roles.has(role.id)) { console.log(`Yay, the author of the message has the role!`); } else { console.log(`Nope, noppers, nadda.`); } However, how can I check if specific user (using user id) has a specific role? var authorID = "111111111111111111" //Find role var role = message.guild.roles.find(role => role.name === "Private Splash Ping"); //Find member let member = message.guild.members.get(authorID); console.log(member

How to check if a specific user has a role? Discord js

泪湿孤枕 提交于 2020-12-26 08:39:09
问题 I know how to check if the message sender has a role: if(message.member.roles.has(role.id)) { console.log(`Yay, the author of the message has the role!`); } else { console.log(`Nope, noppers, nadda.`); } However, how can I check if specific user (using user id) has a specific role? var authorID = "111111111111111111" //Find role var role = message.guild.roles.find(role => role.name === "Private Splash Ping"); //Find member let member = message.guild.members.get(authorID); console.log(member

Discord.NET assigning roles

时光怂恿深爱的人放手 提交于 2020-12-15 07:13:20
问题 I am trying to get my discord bot to assign a role to a user when they input the command '!stream' I am very new to programming in c# and discord.net especially. Right now I have the code that should be assigning the role inside of a message received method. This probably isn't the best way to do it but I'm not super sure a better way right now. Anyways, here is the code: IGuildUser user = (IGuildUser)arg.Author; IRole role = ((IGuildChannel)arg.Channel).Guild.GetRole(theRoleID); if (arg

How to make my bot forward DMs sent to it to a channel

﹥>﹥吖頭↗ 提交于 2020-12-15 05:26:24
问题 So, I've got a bot that can send a user a DM via a very simple command. All I do is "!DM @user message" and it sends them the message. However, people sometimes try responding to the bot in DMs with their questions, but the bot does nothing with that, and I cannot see their replies. Would there be a way for me to make it so that if a user sends a DM to the bot, it will forward their message to a certain channel in my server (Channel ID: 756830076544483339). If possible, please can someone

Finding who deleted the message

不问归期 提交于 2020-12-15 05:01:44
问题 My discord.js bot is programmed to log deleted messages. I have the code setup, but I was wondering if there was a way to see who deleted it? Thanks. Heres the code: bot.on("messageDelete", (messageDelete) => { let DeleteEmbed = new Discord.RichEmbed() .setTitle("**DELETED MESSAGE**") .setColor("#fc3c3c") .addField("Author", messageDelete.author.tag, true) .addField("Channel", messageDelete.channel, true) .addField("Message", messageDelete.content) .setFooter(`Message ID: ${messageDelete.id}