discord

Overlapping commands?

你离开我真会死。 提交于 2019-12-20 07:34:22
问题 I'm trying to make a fun little discord chat bot with JavaScript and node.js and I'd like to put in a specific command without it affecting another one I already have set up. She works wonderfully on all the servers I have her on, and I've got it set up so that when someone in the server says anything with "rei are", she responds with a constant from areResponses. //const!!! const areResponses = ["HELL yeah!", "Yep!", "I'm pretty sure that's true!", "I\'m not gonna put all the responses here

Print friends-list to console Discord.py

ε祈祈猫儿з 提交于 2019-12-20 06:45:13
问题 How would I go about printing to console a list of all my friends? I'm hoping to be able to achieve this with the Discord.py library, hopefully someone here knows. I currently get the error: for user in discord.ClientUser.friends: TypeError: 'property' object is not iterable Program: token = "" prefix = "::" import discord import asyncio import codecs import sys import io from discord.ext import commands from discord.ext.commands import Bot print ("waiting") bot = commands.Bot(command_prefix

Experience (XP) not working for all users JSON Discord.PY

a 夏天 提交于 2019-12-20 05:43:20
问题 I'm trying to give points for messages typed in a room that has around 50-60 people that type in it. It will add the user to the JSON file the first time, but it won't add any more points for the messages they type. I tested it again and only one user was getting points for the messages they typed and the rest remained the same. Here is the code: @client.event async def on_message(message): if message.content.lower().startswith('!points'): await client.send_message(message.channel, "You have

role specific command

五迷三道 提交于 2019-12-20 03:52:53
问题 role specific command yes its working finally got it. from discord.ext import commands bot = commands.Bot('?') @bot.command(pass_context=True) @commands.has_any_role("Admin", "Moderator") async def hello(ctx): await bot.say("Hello {}".format(ctx.message.author.mention)) 回答1: You can use the discord.ext.commands extension, which offers a has_any_role decorator. from discord.ext import commands bot = commands.Bot('?') @bot.command(pass_context=True) @commands.has_any_role("Admin", "Moderator")

Discord bot check if user is admin

三世轮回 提交于 2019-12-19 10:51:45
问题 Hi i'm new to python coding with discord and I have tried to make a command that tells the user if they are a admin or not but well... its not working in the slightest @client.command(name="whoami",description="who are you?") async def whoami(): if message.author == client.user: return if context.message.author.mention == discord.Permissions.administrator: msg = "You're an admin {0.author.mention}".format(message) await client.send_message(message.channel, msg) else: msg = "You're an average

Discord.py --> channel.mention

吃可爱长大的小学妹 提交于 2019-12-19 10:23:34
问题 I'm trying to make a bot for a discord server that simply listens for specific messages, deletes them and then refers the user to a different text channel (in a clickable link by mentioning it) Here's what I have now: import Discord import asyncio client = discord.Client() @client.event async def on_message(message): msg = '{0.author.mention}\nWrong text channel\nUse '.format(message) if message.content.startswith('!p'): await client.delete_message(message) await client.send_message(message

Discord bot reading reactions

时光怂恿深爱的人放手 提交于 2019-12-18 15:54:17
问题 I need to implement some of the feature and one of the feature is implementing polls type feature. Can't use public discord bots due to some policies so we have to implement something on my own. Did some research yesterday and was able to make basic bot using python3 and commands api from discord.ext . Now what i need to figure out is: Read reactions added by a user to a message? Create a message with reactions (like bots which create reaction polls?) Pin a message? I believe from ctx i can

Discord bot reading reactions

谁都会走 提交于 2019-12-18 15:54:01
问题 I need to implement some of the feature and one of the feature is implementing polls type feature. Can't use public discord bots due to some policies so we have to implement something on my own. Did some research yesterday and was able to make basic bot using python3 and commands api from discord.ext . Now what i need to figure out is: Read reactions added by a user to a message? Create a message with reactions (like bots which create reaction polls?) Pin a message? I believe from ctx i can

Python asyncio - Loop exits with Task was destroyed but it is pending

Deadly 提交于 2019-12-18 13:01:32
问题 This is the relevant code of my python program: import discord import asyncio class Bot(discord.Client): def __init__(self): super().__init__() @asyncio.coroutine def my_background_task(self): yield from self.wait_until_ready() while not self.is_closed: yield from asyncio.sleep(3600*24) # <- This is line 76 where it fails doSomething() bot = Bot() loop = asyncio.get_event_loop() try: loop.create_task(bot.my_background_task()) loop.run_until_complete(bot.login('username', 'password')) loop.run

How do I make a list of all members in a discord server using discord.py?

妖精的绣舞 提交于 2019-12-18 09:02:52
问题 Hi guys I am writing a discord bot and I came across this error when trying to pull all the members from a server with the command !members in on_message event: elif message.content.startswith('!members'): x = server.Server.members for member in x: print(member) I want this command to pull all members and print them out in the console but I get the error TypeError: 'property' object is not iterable when I type the command in the discord channel. Could anyone help me make a list of all members