discord

How to kick users on command

坚强是说给别人听的谎言 提交于 2020-07-11 05:55:35
问题 I don't have much knowledge on Python, and still in the process of learning it. I have been significantly modifying an open-source Discord bot coded in Python 2.7. I would like to add a feature that allows me to kick a user based on a command. Something like [commandprefix]kickuser [userid] But I have no idea how to make the bot grab the userid from the message I sent, and when I try to make it ultra-specific to kick my second account as a test, it doesn't work either. if message_content == '

How to kick users on command

一曲冷凌霜 提交于 2020-07-11 05:55:35
问题 I don't have much knowledge on Python, and still in the process of learning it. I have been significantly modifying an open-source Discord bot coded in Python 2.7. I would like to add a feature that allows me to kick a user based on a command. Something like [commandprefix]kickuser [userid] But I have no idea how to make the bot grab the userid from the message I sent, and when I try to make it ultra-specific to kick my second account as a test, it doesn't work either. if message_content == '

How to kick users on command

断了今生、忘了曾经 提交于 2020-07-11 05:55:34
问题 I don't have much knowledge on Python, and still in the process of learning it. I have been significantly modifying an open-source Discord bot coded in Python 2.7. I would like to add a feature that allows me to kick a user based on a command. Something like [commandprefix]kickuser [userid] But I have no idea how to make the bot grab the userid from the message I sent, and when I try to make it ultra-specific to kick my second account as a test, it doesn't work either. if message_content == '

Delete Messages with Python Discord bot?

耗尽温柔 提交于 2020-07-10 07:17:06
问题 I'm trying to make a Python Discord Bot that firstly can delete messages within a channel. I wanted it to be Terminator 3 themed so it would start out by the user saying Skynet then the bot asks to activate Y or N? and when the user types Y it would delete all the messages in the channel if the user typed N it would say judgment day is inevitable. any help would be greatly appreciated. import discord from discord.ext.commands import Bot from discord.ext import commands import asyncio token =

Delete Messages with Python Discord bot?

孤街醉人 提交于 2020-07-10 07:17:01
问题 I'm trying to make a Python Discord Bot that firstly can delete messages within a channel. I wanted it to be Terminator 3 themed so it would start out by the user saying Skynet then the bot asks to activate Y or N? and when the user types Y it would delete all the messages in the channel if the user typed N it would say judgment day is inevitable. any help would be greatly appreciated. import discord from discord.ext.commands import Bot from discord.ext import commands import asyncio token =

Discord.py Bot renaming a VoiceChannel only works sometimes

不打扰是莪最后的温柔 提交于 2020-07-10 05:15:51
问题 I have a discord bot written in discord.py and wanna rename a voice channel. It sometimes works but sometimes it doesn't. And I get no error. Here's the code: @client.event async def on_message(message): if "s!close" in message.content: voice_channel = client.get_channel(711953093335449632) await voice_channel.edit(name="support-closed") 回答1: Channels have recently been rate-limited in discord to prevent spamming the API and degrading server performance. 来源: https://stackoverflow.com

Why client.emojis, newer version of client.get_all_emojis() returns empy list when using Discord's Python API?

会有一股神秘感。 提交于 2020-07-09 14:31:47
问题 Based on this, this, this & this, I expected client.get_all_emojis() to work in my Discord chat bot: import discord from dotenv import load_dotenv import asyncio import os load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') GUILD = os.getenv('DISCORD_GUILD') client = discord.Client() @client.event async def on_message(message): if message.content == 'send emoji': await message.channel.send(client.get_all_emojis()[0]) client.run(TOKEN) I expected client.get_all_emojis() to be a list, & wanted the

Sending 2 different messages if message exceeds 2000 characters

烈酒焚心 提交于 2020-07-08 03:51:32
问题 Basically I'm making this lyrics command, and many times, the amount of characters in a lyric for most songs exceed 2000 characters, which is passed Discord's limit. I wonder how I would go about making it send 2 different messages at once. I'm wondering how I could make it send the first 2000 characters in one message, then send the remaining characters in a second message right after. Here is my code right here: if (message.content.startsWith(config.prefix + `lyrics`)) { var artistTitle =

Discord.js Embedded message multiple line value

痞子三分冷 提交于 2020-07-06 11:34:34
问题 The standard way of sending an embedded message is: message.channel.send({embed: { color: 3447003, title: "Test:", fields: [ { name: "Test 1", value="Test"}, { name: "Test 2", value: "TEST"}, { name: "Test 3", value: "TEST"} ] } }); I was wondering if there is any way I could make the messages in block form for example: Test1: Test2: test1 test1 test2 test2 test3 test3 test4 test4 I'm aiming so it goes inline and you can input multiple values/per title. First I thought that \n would do the

Discord.py bot leaving voice channel

社会主义新天地 提交于 2020-06-29 04:37:07
问题 I've been making a discord bot which enters a vc plays an audio then leaves, but I can't seem to get the leaving part to work. Here is my code: # Discord specific import import discord from discord.ext import commands import asyncio Client = discord.Client() client = commands.Bot(command_prefix="..") @client.command(pass_context=True) async def dan(ctx): author = ctx.message.author channel = author.voice_channel vc = await client.join_voice_channel(channel) player = vc.create_ffmpeg_player(