如果成员在低位或高位使用以下命令或混合,如何使下面的命令工作。
如果成员使用ping
则有效。
但如果成员使用Ping
则不起作用。
@bot.event
async def on_message(message):
message.content = message.content.lower()
await bot.process_commands(message)
@bot.command(pass_context=True)
async def ping(ctx):
msg = 'Pong {0.author.mention}'.format(ctx.message)
await bot.say(msg)
更新
以上on_message
在单个文件中正常工作但我将主文件拆分为多个文件。现在如何使它适用于所有文件中的cog。
答案 0 :(得分:0)
您可以在创建Bot
时将case_insensitive
选项传递给from discord.ext import commands
bot = commands.Bot('!', case_insensitive=True)
@bot.command(pass_context=True)
async def ping(ctx):
msg = 'Pong {0.author.mention}'.format(ctx.message)
await bot.say(msg)
。
public static void main(String[] args) {
System.out.println("Quenten's Copy");
Scanner input = new Scanner(System.in);
int number[] = new int [1000000]; // initialize first array
int count[] = new int [1000000]; // initialize second array
int temp = 0; // intialize integer to hold for comparison
int i; // intialize loop integer
System.out.print("Enter seven numbers: "); // ask user for input
// first loop - takes in user input
for (i = 0; i < 7; i++) {
number[i] = input.nextInt();
}
// second loop - checks for reoccurance of numbers
for (i = 0; i < number.length; i++) {
temp = number [i];
count [temp]++;
}
// final loop - gives the output of the count
for (i = 1; i < count.length; i++) {
if (count [i] > 0) {
// output statement - tells user each number and how many
// times each number occurs
System.out.printf("Number %d occurs %d times\n", i, count [i]);
}
}