【发布时间】:2020-11-11 17:49:09
【问题描述】:
我正在尝试将另一个 Python 脚本的输出添加到我的 Discord 机器人。 我的第一个脚本“clash.py”有效,我有一个结果:项目列表,它适用于我的操作系统(Raspbian) 当用户发送特定命令时,我想将它放在 Discord 上:!clantest
这种方式适用于:
import discord
from discord.ext import commands
TOKEN = 'Token'
description = '''Merluchon Bot'''
bot = commands.Bot(command_prefix='!', description=description)
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
bot.command()
async def Mousse(ctx):
"""Cadeau pour le peuple"""
await ctx.send("https://viesdamelie.files.wordpress.com/2014/07/bain.gif")
bot.run(TOKEN)
如何以这种方式在命令中添加“clash.py”的结果:
async def clantest(ctx):
"""Cadeau pour le peuple"""
await ctx.send("clash.py")
即使我知道这不是它应有的方式,你也看到了这个想法。
非常感谢!!
【问题讨论】: