discord.py-rewrite

discord.py How to add Mute command

允我心安 提交于 2021-02-16 15:19:24
问题 I'm making a discord bot and I really want to make a mute command to mute toxic users. This is the code I've currently done, this isn't the rewrite version. @bot.command(pass_context = True) async def mute(ctx, user_id, userName: discord.User): if ctx.message.author.server_permissions.administrator: user = ctx.message.author role = discord.utils.get(user.server.roles, name="Muted") await client.add_roles(user, role) else: embed=discord.Embed(title="Permission Denied.", description="You don't

discord.py How to add Mute command

孤街浪徒 提交于 2021-02-16 15:19:07
问题 I'm making a discord bot and I really want to make a mute command to mute toxic users. This is the code I've currently done, this isn't the rewrite version. @bot.command(pass_context = True) async def mute(ctx, user_id, userName: discord.User): if ctx.message.author.server_permissions.administrator: user = ctx.message.author role = discord.utils.get(user.server.roles, name="Muted") await client.add_roles(user, role) else: embed=discord.Embed(title="Permission Denied.", description="You don't

Discord bot python: discord.errors.ClientException: ffmpeg was not found

做~自己de王妃 提交于 2021-02-16 03:58:56
问题 I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel

Discord bot python: discord.errors.ClientException: ffmpeg was not found

守給你的承諾、 提交于 2021-02-16 03:54:34
问题 I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel

Discord bot python: discord.errors.ClientException: ffmpeg was not found

馋奶兔 提交于 2021-02-16 03:54:15
问题 I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel

discord.py-rewrite - Dynamic Web Scraping using PyQt5 not working properly

末鹿安然 提交于 2021-02-11 18:10:20
问题 In short, I'm making a discord bot that downloads the "World of the Day" picture in the website https://growtopiagame.com as D:\Kelbot/render.png and then sends the picture to the channel the command was called. However, it is not a static website and the URL is not in the source code, so I found a solution that uses PyQt5: import re import bs4 as bs import sys import urllib.request from PyQt5.QtWebEngineWidgets import QWebEnginePage from PyQt5.QtWidgets import QApplication from PyQt5.QtCore

How can I automatically split a list up based on a given requirement?

若如初见. 提交于 2021-02-11 15:21:02
问题 On Discord, you can only have messages of character length 2000 or under. I am trying to append the server name, member amount and server ID for each server that the bot is in to a list, and then sending the list to a channel. However, as the list length exceeds 2000 I have tried to split it up, however the method requires it to be updated every time manually as the list gets larger. How can I make the script automatically split up the list based on how many 'splits' are required and then

Discord.py> How to schedule a operation? i tried using schedule

泪湿孤枕 提交于 2021-02-11 14:13:03
问题 I'm trying to schedule a operation every 30 minutes. But this code isn't working. def Advice(): print("30 minutes") @client.event async def on_ready(): schedule.every(30).minutes.do(Advice) Can you please help me? 回答1: This might be what you're looking for. Here's an example for you. class Heartbeat(commands.Cog): def __init__(self, bot): self.bot = bot self.heartbeat.start() def cog_unload(self): self.heartbeat.stop() @tasks.loop(seconds=45) async def heartbeat(self): if not self.bot.debug:

Discord Python Rewrite - Account Generator

蓝咒 提交于 2021-02-11 13:36:27
问题 I Want to make a discord account generator using python and json, i can make it gen but i cant make it delete the account after genned, please help. The code: @client.command() async def gentest(ctx): genembed = discord.Embed( title="Minecraft NFA", colour=discord.Color.green() ) with open('alts.json', 'r') as f: alts = json.load(f) genembed.add_field(name="Account:", value=random.choice(alts), inline=False) with open('alts.json', 'w') as f: alts = alts.pop(alts) await ctx.author.send(embed

How to convert a string to a user discord.py

可紊 提交于 2021-02-11 13:23:33
问题 I'm trying to convert a string to a user so I can dm them. Here's my current code: @bot.command(pass_context=True) async def partnerwarn(ctx): file_names = glob.glob("p*") for file in file_names: f = open(file, 'r') content = f.read() f.close() member = file[1:] await bot.send_message(member : discord.User, "You've had under 7 partners! This is a warning, please make sure you actively partner!") print("Warned!") await bot.reply("**" + file[1:] + " was warned!**") It doesn't work because