Python Discord.py字过滤器展开列表
我尝试在discord中构建聊天过滤器,这在generell中起作用。但现在我想用命令向列表中添加新的“坏话”。因此,我不必每次都打开代码并重新加载bot。 我只是想我可以像以前那样扩展列表,但我错了。它根本不起作用。 删除列表内容的功能工作正常Python Discord.py字过滤器展开列表,python,discord,discord.py,Python,Discord,Discord.py,我尝试在discord中构建聊天过滤器,这在generell中起作用。但现在我想用命令向列表中添加新的“坏话”。因此,我不必每次都打开代码并重新加载bot。 我只是想我可以像以前那样扩展列表,但我错了。它根本不起作用。 删除列表内容的功能工作正常 import datetime import discord from discord import message, ActivityType from discord.ext import commands import asyncio inte
import datetime
import discord
from discord import message, ActivityType
from discord.ext import commands
import asyncio
intents = discord.Intents().all()
bot = commands.Bot(command_prefix='.', intents=intents)
guild = 'SwiftNetwork'
time = datetime.date.today()
badword = ['bw', 'bw1', 'bw2', 'bw3']
@bot.event
async def on_ready():
print('Wir sind als {1} auf {0} eingeloggt Vers: {2}'.format(guild, bot.user.name, discord.__version__))
channel = bot.get_channel(id=697572461629407305)
await channel.send('Heute ist der {0}.{1}.{2}'.format(time.day, time.month, time.year))
# await bot.channel.send('Beep Boop Beep, Roboter Angriff wird gestartet..')
bot.loop.create_task(status_task())
@bot.event
async def on_message(ctx):
if ctx.author.bot:
return
for word in ctx.content.split(' '):
if word in badword:
await ctx.delete()
await bot.process_commands(ctx)
@bot.command()
async def addlist(ctx, *args):
for y in range(2, len(args)):
badword.extend(args[y])
await ctx.channel.send('added', args[y])