由于代码问题很长,但为什么我的机器人不再响应?这是为朋友定制的,过去一周左右一直在工作,但现在没有回应。也没有出现错误。它发送消息的唯一时间是当 League Membership 不在成员角色中并且它发送正确的消息时。否则,机器人不会响应。
import discord
from discord.ext import commands
from keep_alive import keep_alive
import asyncio
import os
import pytz
from datetime import datetime
timestamp = datetime.now(pytz.timezone('EST'))
intents = discord.Intents.default()
intents.members=True
bot = commands.Bot(command_prefix='-', intents=intents)
@bot.event
async def on_member_join(member):
guild = bot.get_guild(801206329049612288)
membercount = len([m for m in guild.members if not m.bot])
embedwelcome = discord.Embed(title="Your KFG Future Awaits You.", description=None, color=discord.Color.teal())
embedwelcome.add_field(name="Things to do:", value=f"•Get Signed or claim a Franchise!\n•Make friends in the community!\n•Collect Rings\n•Make your way to the Super Bowl and win it all!\nWhat are you waiting for? Hurry up and get started!\n (You were member #{membercount}.)", inline=True)
await member.send(embed=embedwelcome)
print(f"{timestamp} - {member}")
@bot.command()
async def membercount(ctx):
guild = bot.get_guild(801206329049612288)
membercount = len([m for m in guild.members if not m.bot])
await ctx.send(f'KFG has {membercount} members.')
print(f"{timestamp} - {ctx.author}")
@bot.command()
async def welcomemessage(ctx):
guild = bot.get_guild(801206329049612288)
membercount = len([m for m in guild.members if not m.bot])
embedwelcome = discord.Embed(title="Your KFG Future Awaits You.", description=None, color=discord.Color.teal())
embedwelcome.add_field(name="Things to do:", value=f"•Get Signed or claim a Franchise!\n•Make friends in the community!\n•Collect Rings\n•Make your way to the Super Bowl and win it all!\nWhat are you waiting for? Hurry up and get started!\n (You were member #{membercount}.)", inline=True)
await ctx.send(embed=embedwelcome)
print(f"{timestamp} - {ctx.author}")
@bot.event
async def on_ready():
print ("I'm online.")
await bot.change_presence(activity=discord.Game(name="KFG on top!"))
@bot.event
async def on_message(message, user:discord.Member=None):
if "sign" in message.content:
signer=message.author
signee=message.mentions[0].mention
signeeid=message.mentions[0].id
server=bot.get_guild(801206329049612288)
teamsidslist=[801217912689393714, 801218094814986300, 801224104086208513, 801224243115196426, 801218409878519849, 801222227479625758, 801217334395011113, 801224558589378570, 801222379682005035, 801224701128343662, 801222478646476820, 801222668128747540, 801224835032285225, 801225075231031316, 801225211306967080, 801225374369185793, 801225554199576627, 801225700283121674, 801222743030104104, 801225798408732692, 801222852132995132, 801225991242514473, 801222923746148392, 801223092298186782, 801226082207924244, 801223311081996288, 801226241948647496, 801223486973542451, 801223635858882562, 801223809340276745, 801226427890139137, 801223952344416337]
teamnames=['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Ravens', 'Buffalo Bills', 'Carolina Panthers', 'Chicago Bears', 'Cincinnati Bengals', 'Cleveland Browns', 'Dallas Cowboys', 'Denver Broncos', 'Detroit Lions', 'Green Bay Packers', 'Houston Texans', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Miami Dolphins', 'Los Angeles Chargers', 'Kansas City Chiefs', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Las Vegas Raiders', 'Los Angeles Chargers', 'Los Angeles Rams', 'Miami Dolphins', 'Minnesota Vikings', 'New England Patriots','New Orleans Saints', 'New York Giants', 'New York Jets', 'Philidelphia Eagles', 'Pittsburgh Steelers', 'San Fransisco 49ers', 'Seattle Seahawks', 'Tampa Bay Buccaneers', 'Tennesse Titans', 'Washington Football Team']
teamemojis=['Arizona_Cardinals', 'Atlanta_Falcons', 'Baltimore_Ravens', 'Buffalo_Bills', 'Carolina_Panthers', 'Chicago_Bears', 'Cincinnati_Bengals', 'Cleveland_Browns', 'Dallas_Cowboys', 'Denver_Broncos', 'Detroit_Lions', 'Green_Bay_Packers', 'Houston_Texans', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Miami_Dolphins', 'Los_Angeles_Chargers', 'Kansas_City_Chiefs', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Las_Vegas_Raiders', 'Los_Angeles_Chargers', 'Los_Angeles_Rams', 'Miami_Dolphins', 'Minnesota_Vikings', 'New_England_Patriots', 'New_Orleans_Saints', 'New_York_Giants', 'New_York_Jets', 'Philidelphia_Eagles', 'Pittsburgh_Steelers', 'San_Francisco_49ers', 'Seattle_Seahawks', 'Tampa_Bay_Buccaneers', 'Tennessee_Titans', 'Washington_Football_Team']
FO = discord.utils.get(message.author.guild.roles, id=801257262240235530)
GM = discord.utils.get(message.author.guild.roles, id=801257315620749362)
HC = discord.utils.get(message.author.guild.roles, id=801257358751694848)
AC = discord.utils.get(message.author.guild.roles, id=801257421334904872)
FA = discord.utils.get(message.author.guild.roles, id=801255786062807090)
Suspended = discord.utils.get(message.author.guild.roles, id=805818648802361426)
roster=[]
agency=[]
teams=[]
for rolesids in message.author.roles:
if rolesids.id in teamsidslist:
teams.append(rolesids.id)
step2=str(teams)
step3=step2.replace("[","")
step4=step3.replace("]","")
print(step4)
step5=teamsidslist.index(int(step4))
print(step5)
emote=discord.utils.get(server.emojis,name=teamemojis[step5])
teamname=teamnames[step5]
team = discord.utils.get(message.author.guild.roles,id=int(step4))
for agents in server.members:
if FA in agents.roles:
agency.append(agents.id)
if signeeid not in agency:
embedno = discord.Embed(title="Transaction Failed!", description=None, color=discord.Color.red())
embedno.add_field(name="This Transaction Couldn't Be Completed.", value="This player is signed already! Have them demand from their team or get released.")
await message.channel.send(embed=embedno)
elif [FO, GM, HC, AC] in message.author.roles:
for guys in server.members:
if guys.id==signeeid:
await guys.add_roles(team)
await guys.remove_roles(FA)
if Suspended in guys.roles:
await message.channel.send("This player is signable, but is ineligible as they are suspended.")
roster.append(guys)
roster_size=str(len(roster))
SignEmbed= discord.Embed(title="KFG Transactions", description=None, color=discord.Color.green())
SignEmbed.add_field(name='Successful Transaction.', value=signee+" has been signed to the "+str(emote)+" "+teamname+"!")
SignEmbed.add_field(name="Roster Size is now ", value=roster_size+'/20', inline=True)
await message.channel.send(embed=SignEmbed)
bot.remove_command('help')
@bot.event
async def on_message3(message, user:discord.Member=None):
if "I demand" in message.content:
signer=message.author
signee=message.mentions[0].mention
signeeid=message.mentions[0].id
server=bot.get_guild(801206329049612288)
teamsidslist=[801217912689393714, 801218094814986300, 801224104086208513, 801224243115196426, 801218409878519849, 801222227479625758, 801217334395011113, 801224558589378570, 801222379682005035, 801224701128343662, 801222478646476820, 801222668128747540, 801224835032285225, 801225075231031316, 801225211306967080, 801225374369185793, 801225554199576627, 801225700283121674, 801222743030104104, 801225798408732692, 801222852132995132, 801225991242514473, 801222923746148392, 801223092298186782, 801226082207924244, 801223311081996288, 801226241948647496, 801223486973542451, 801223635858882562, 801223809340276745, 801226427890139137, 801223952344416337]
teamnames=['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Ravens', 'Buffalo Bills', 'Carolina Panthers', 'Chicago Bears', 'Cincinnati Bengals', 'Cleveland Browns', 'Dallas Cowboys', 'Denver Broncos', 'Detroit Lions', 'Green Bay Packers', 'Houston Texans', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Miami Dolphins', 'Los Angeles Chargers', 'Kansas City Chiefs', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Las Vegas Raiders', 'Los Angeles Chargers', 'Los Angeles Rams', 'Miami Dolphins', 'Minnesota Vikings', 'New England Patriots','New Orleans Saints', 'New York Giants', 'New York Jets', 'Philidelphia Eagles', 'Pittsburgh Steelers', 'San Fransisco 49ers', 'Seattle Seahawks', 'Tampa Bay Buccaneers', 'Tennesse Titans', 'Washington Football Team']
teamemojis=['Arizona_Cardinals', 'Atlanta_Falcons', 'Baltimore_Ravens', 'Buffalo_Bills', 'Carolina_Panthers', 'Chicago_Bears', 'Cincinnati_Bengals', 'Cleveland_Browns', 'Dallas_Cowboys', 'Denver_Broncos', 'Detroit_Lions', 'Green_Bay_Packers', 'Houston_Texans', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Miami_Dolphins', 'Los_Angeles_Chargers', 'Kansas_City_Chiefs', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Las_Vegas_Raiders', 'Los_Angeles_Chargers', 'Los_Angeles_Rams', 'Miami_Dolphins', 'Minnesota_Vikings', 'New_England_Patriots', 'New_Orleans_Saints', 'New_York_Giants', 'New_York_Jets', 'Philidelphia_Eagles', 'Pittsburgh_Steelers', 'San_Francisco_49ers', 'Seattle_Seahawks', 'Tampa_Bay_Buccaneers', 'Tennessee_Titans', 'Washington_Football_Team']
FO = discord.utils.get(message.author.guild.roles, id=801257262240235530)
GM = discord.utils.get(message.author.guild.roles, id=801257315620749362)
HC = discord.utils.get(message.author.guild.roles, id=801257358751694848)
AC = discord.utils.get(message.author.guild.roles, id=801257421334904872)
FA = discord.utils.get(message.author.guild.roles, id=801255786062807090)
roster=[]
teams=[]
agency=[]
for rolesids in message.author.roles:
if rolesids.id in teamsidslist:
teams.append(rolesids.id)
step2=str(teams)
step3=step2.replace("[","")
step4=step3.replace("]","")
print(step4)
step5=teamsidslist.index(int(step4))
print(step5)
emote=discord.utils.get(server.emojis,name=teamemojis[step5])
teamname=teamnames[step5]
team = discord.utils.get(message.author.guild.roles,id=int(step4))
if [teams] in message.author.roles:
for guys in server.members:
if guys.id==signeeid:
await guys.add_roles(FA)
await guys.remove_roles(team)
if signeeid in agency:
await message.channel.send('You are not signed and cannot demand!')
roster.append(guys)
roster_size=str(len(roster))
SignEmbed= discord.Embed(title="KFG Transactions", description=None, color=discord.Color.green())
SignEmbed.add_field(name='Successful Transaction.', value=signee+" has demanded from the "+str(emote)+" "+teamname+"!")
SignEmbed.add_field(name=f"{str(emote)} {teamname}Roster Size is now ", value=roster_size+'/20', inline=True)
await message.channel.send(embed=SignEmbed)
@bot.event
async def on_message2(message, user:discord.Member=None):
if "release" in message.content:
signer=message.author
signee=message.mentions[0].mention
signeeid=message.mentions[0].id74
server=bot.get_guild(801206329049612288)
teamsidslist=[801217912689393714, 801218094814986300, 801224104086208513, 801224243115196426, 801218409878519849, 801222227479625758, 801217334395011113, 801224558589378570, 801222379682005035, 801224701128343662, 801222478646476820, 801222668128747540, 801224835032285225, 801225075231031316, 801225211306967080, 801225374369185793, 801225554199576627, 801225700283121674, 801222743030104104, 801225798408732692, 801222852132995132, 801225991242514473, 801222923746148392, 801223092298186782, 801226082207924244, 801223311081996288, 801226241948647496, 801223486973542451, 801223635858882562, 801223809340276745, 801226427890139137, 801223952344416337]
teamnames=['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Ravens', 'Buffalo Bills', 'Carolina Panthers', 'Chicago Bears', 'Cincinnati Bengals', 'Cleveland Browns', 'Dallas Cowboys', 'Denver Broncos', 'Detroit Lions', 'Green Bay Packers', 'Houston Texans', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Miami Dolphins', 'Los Angeles Chargers', 'Kansas City Chiefs', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Las Vegas Raiders', 'Los Angeles Chargers', 'Los Angeles Rams', 'Miami Dolphins', 'Minnesota Vikings', 'New England Patriots','New Orleans Saints', 'New York Giants', 'New York Jets', 'Philidelphia Eagles', 'Pittsburgh Steelers', 'San Fransisco 49ers', 'Seattle Seahawks', 'Tampa Bay Buccaneers', 'Tennesse Titans', 'Washington Football Team']
teamemojis=['Arizona_Cardinals', 'Atlanta_Falcons', 'Baltimore_Ravens', 'Buffalo_Bills', 'Carolina_Panthers', 'Chicago_Bears', 'Cincinnati_Bengals', 'Cleveland_Browns', 'Dallas_Cowboys', 'Denver_Broncos', 'Detroit_Lions', 'Green_Bay_Packers', 'Houston_Texans', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Miami_Dolphins', 'Los_Angeles_Chargers', 'Kansas_City_Chiefs', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Las_Vegas_Raiders', 'Los_Angeles_Chargers', 'Los_Angeles_Rams', 'Miami_Dolphins', 'Minnesota_Vikings', 'New_England_Patriots', 'New_Orleans_Saints', 'New_York_Giants', 'New_York_Jets', 'Philidelphia_Eagles', 'Pittsburgh_Steelers', 'San_Francisco_49ers', 'Seattle_Seahawks', 'Tampa_Bay_Buccaneers', 'Tennessee_Titans', 'Washington_Football_Team']
FO = discord.utils.get(message.author.guild.roles, id=801257262240235530)
GM = discord.utils.get(message.author.guild.roles, id=801257315620749362)
HC = discord.utils.get(message.author.guild.roles, id=801257358751694848)
AC = discord.utils.get(message.author.guild.roles, id=801257421334904872)
FA = discord.utils.get(message.author.guild.roles, id=801255786062807090)
roster=[]
teams=[]
for rolesids in message.author.roles:
if rolesids.id in teamsidslist:
teams.append(rolesids.id)
step2=str(teams)
step3=step2.replace("[","")
step4=step3.replace("]","")
print(step4)
step5=teamsidslist.index(int(step4))
print(step5)
emote=discord.utils.get(server.emojis,name=teamemojis[step5])
teamname=teamnames[step5]
team = discord.utils.get(message.author.guild.roles,id=int(step4))
if [FO, GM, HC, AC] in message.author.roles:
for guys in server.members:
if guys.id==signeeid:
await guys.add_roles(FA)
await guys.remove_roles(team)
roster.append(guys)
roster_size=str(len(roster))
SignEmbed= discord.Embed(title="KFG Transactions", description=None, color=discord.Color.green())
SignEmbed.add_field(name='Successful Transaction.', value=signee+" has been released from the "+str(emote)+" "+teamname+"!")
SignEmbed.add_field(name="Roster Size is now ", value=roster_size+'/20', inline=True)
await message.channel.send(embed=SignEmbed)
async def on_message5(message, member:discord.Member=None):
if "promote" in message.content:
signer=message.author
signee=message.mentions[0].mention
signeeid=message.mentions[0].id
server=bot.get_guild(801206329049612288)
teamsidslist=[801217912689393714, 801218094814986300, 801224104086208513, 801224243115196426, 801218409878519849, 801222227479625758, 801217334395011113, 801224558589378570, 801222379682005035, 801224701128343662, 801222478646476820, 801222668128747540, 801224835032285225, 801225075231031316, 801225211306967080, 801225374369185793, 801225554199576627, 801225700283121674, 801222743030104104, 801225798408732692, 801222852132995132, 801225991242514473, 801222923746148392, 801223092298186782, 801226082207924244, 801223311081996288, 801226241948647496, 801223486973542451, 801223635858882562, 801223809340276745, 801226427890139137, 801223952344416337]
teamnames=['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Ravens', 'Buffalo Bills', 'Carolina Panthers', 'Chicago Bears', 'Cincinnati Bengals', 'Cleveland Browns', 'Dallas Cowboys', 'Denver Broncos', 'Detroit Lions', 'Green Bay Packers', 'Houston Texans', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Miami Dolphins', 'Los Angeles Chargers', 'Kansas City Chiefs', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Las Vegas Raiders', 'Los Angeles Chargers', 'Los Angeles Rams', 'Miami Dolphins', 'Minnesota Vikings', 'New England Patriots','New Orleans Saints', 'New York Giants', 'New York Jets', 'Philidelphia Eagles', 'Pittsburgh Steelers', 'San Fransisco 49ers', 'Seattle Seahawks', 'Tampa Bay Buccaneers', 'Tennesse Titans', 'Washington Football Team']
teamemojis=['Arizona_Cardinals', 'Atlanta_Falcons', 'Baltimore_Ravens', 'Buffalo_Bills', 'Carolina_Panthers', 'Chicago_Bears', 'Cincinnati_Bengals', 'Cleveland_Browns', 'Dallas_Cowboys', 'Denver_Broncos', 'Detroit_Lions', 'Green_Bay_Packers', 'Houston_Texans', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Miami_Dolphins', 'Los_Angeles_Chargers', 'Kansas_City_Chiefs', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Las_Vegas_Raiders', 'Los_Angeles_Chargers', 'Los_Angeles_Rams', 'Miami_Dolphins', 'Minnesota_Vikings', 'New_England_Patriots', 'New_Orleans_Saints', 'New_York_Giants', 'New_York_Jets', 'Philidelphia_Eagles', 'Pittsburgh_Steelers', 'San_Francisco_49ers', 'Seattle_Seahawks', 'Tampa_Bay_Buccaneers', 'Tennessee_Titans', 'Washington_Football_Team']
FO = discord.utils.get(message.author.guild.roles, id=801257262240235530)
GM = discord.utils.get(message.author.guild.roles, id=801257315620749362)
HC = discord.utils.get(message.author.guild.roles, id=801257358751694848)
AC = discord.utils.get(message.author.guild.roles, id=801257421334904872)
staffroles = [GM, HC, AC]
teams=[]
roster=[]
for rolesids in message.author.roles:
if rolesids.id in teamsidslist:
teams.append(rolesids.id)
step2=str(staffroles)
step3=step2.replace("[","")
step4=step3.replace("]","")
print(step4)
step5=teamsidslist.index(int(step4))
print(step5)
emote=discord.utils.get(server.emojis,name=teamemojis[step5])
teamname=teamnames[step5]
team = discord.utils.get(message.author.guild.roles,id=int(step4))
if FO in message.author.roles:
for guys in server.members:
if guys.id==signeeid:
await guys.add_roles(staffroles)
embedpromoted = discord.Embed(title='KFG Transactions', description=None)
embedpromoted.add_field(name="The "+teamname+ " have made a promotion!", value="Congratulations to "+signee+" as the "+str(emote)+teamname+ " has promoted them to "+staffroles+".")
await message.channel.send(embed=embedpromoted)
@bot.event
async def on_message4(message, member:discord.Member=None):
if "demote" in message.content:
signer=message.author
signee=message.mentions[0].mention
signeeid=message.mentions[0].id
server=bot.get_guild(801206329049612288)
teamsidslist=[801217912689393714, 801218094814986300, 801224104086208513, 801224243115196426, 801218409878519849, 801222227479625758, 801217334395011113, 801224558589378570, 801222379682005035, 801224701128343662, 801222478646476820, 801222668128747540, 801224835032285225, 801225075231031316, 801225211306967080, 801225374369185793, 801225554199576627, 801225700283121674, 801222743030104104, 801225798408732692, 801222852132995132, 801225991242514473, 801222923746148392, 801223092298186782, 801226082207924244, 801223311081996288, 801226241948647496, 801223486973542451, 801223635858882562, 801223809340276745, 801226427890139137, 801223952344416337]
teamnames=['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Ravens', 'Buffalo Bills', 'Carolina Panthers', 'Chicago Bears', 'Cincinnati Bengals', 'Cleveland Browns', 'Dallas Cowboys', 'Denver Broncos', 'Detroit Lions', 'Green Bay Packers', 'Houston Texans', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Miami Dolphins', 'Los Angeles Chargers', 'Kansas City Chiefs', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Las Vegas Raiders', 'Los Angeles Chargers', 'Los Angeles Rams', 'Miami Dolphins', 'Minnesota Vikings', 'New England Patriots','New Orleans Saints', 'New York Giants', 'New York Jets', 'Philidelphia Eagles', 'Pittsburgh Steelers', 'San Fransisco 49ers', 'Seattle Seahawks', 'Tampa Bay Buccaneers', 'Tennesse Titans', 'Washington Football Team']
teamemojis=['Arizona_Cardinals', 'Atlanta_Falcons', 'Baltimore_Ravens', 'Buffalo_Bills', 'Carolina_Panthers', 'Chicago_Bears', 'Cincinnati_Bengals', 'Cleveland_Browns', 'Dallas_Cowboys', 'Denver_Broncos', 'Detroit_Lions', 'Green_Bay_Packers', 'Houston_Texans', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Miami_Dolphins', 'Los_Angeles_Chargers', 'Kansas_City_Chiefs', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Las_Vegas_Raiders', 'Los_Angeles_Chargers', 'Los_Angeles_Rams', 'Miami_Dolphins', 'Minnesota_Vikings', 'New_England_Patriots', 'New_Orleans_Saints', 'New_York_Giants', 'New_York_Jets', 'Philidelphia_Eagles', 'Pittsburgh_Steelers', 'San_Francisco_49ers', 'Seattle_Seahawks', 'Tampa_Bay_Buccaneers', 'Tennessee_Titans', 'Washington_Football_Team']
FO = discord.utils.get(message.author.guild.roles, id=801257262240235530)
GM = discord.utils.get(message.author.guild.roles, id=801257315620749362)
HC = discord.utils.get(message.author.guild.roles, id=801257358751694848)
AC = discord.utils.get(message.author.guild.roles, id=801257421334904872)
staffroles = [GM, HC, AC]
teams=[]
roster=[]
for rolesids in message.author.roles:
if rolesids.id in teamsidslist:
teams.append(rolesids.id)
step2=str(staffroles)
step3=step2.replace("[","")
step4=step3.replace("]","")
print(step4)
step5=teamsidslist.index(int(step4))
print(step5)
emote=discord.utils.get(server.emojis,name=teamemojis[step5])
teamname=teamnames[step5]
team = discord.utils.get(message.author.guild.roles,id=int(step4))
if FO in message.author.roles:
for guys in server.members:
if guys.id==signeeid:
await guys.remove_roles(staffroles)
embedpromoted = discord.Embed(title='KFG Transactions', description=None)
embedpromoted.add_field(name="The "+teamname+ " has made a demotion.", value='Tough luck for '+signee+' as they have been demoted from their spot as '+staffroles+'on the '+str(emote)+teamname+'.', inline=True)
await message.channel.send(embed=embedpromoted)
@bot.command()
async def rostercount(ctx, member:discord.Member=None):
server=bot.get_guild(801206329049612288)
teamsidslist=[801217912689393714, 801218094814986300, 801224104086208513, 801224243115196426, 801218409878519849, 801222227479625758, 801217334395011113, 801224558589378570, 801222379682005035, 801224701128343662, 801222478646476820, 801222668128747540, 801224835032285225, 801225075231031316, 801225211306967080, 801225374369185793, 801225554199576627, 801225700283121674, 801222743030104104, 801225798408732692, 801222852132995132, 801225991242514473, 801222923746148392, 801223092298186782, 801226082207924244, 801223311081996288, 801226241948647496, 801223486973542451, 801223635858882562, 801223809340276745, 801226427890139137, 801223952344416337]
teamnames=['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Ravens', 'Buffalo Bills', 'Carolina Panthers', 'Chicago Bears', 'Cincinnati Bengals', 'Cleveland Browns', 'Dallas Cowboys', 'Denver Broncos', 'Detroit Lions', 'Green Bay Packers', 'Houston Texans', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Miami Dolphins', 'Los Angeles Chargers', 'Kansas City Chiefs', 'Indianapolis Colts', 'Jacksonville Jaguars', 'Kansas City Chiefs', 'Las Vegas Raiders', 'Los Angeles Chargers', 'Los Angeles Rams', 'Miami Dolphins', 'Minnesota Vikings', 'New England Patriots','New Orleans Saints', 'New York Giants', 'New York Jets', 'Philidelphia Eagles', 'Pittsburgh Steelers', 'San Fransisco 49ers', 'Seattle Seahawks', 'Tampa Bay Buccaneers', 'Tennesse Titans', 'Washington Football Team']
teamemojis=['Arizona_Cardinals', 'Atlanta_Falcons', 'Baltimore_Ravens', 'Buffalo_Bills', 'Carolina_Panthers', 'Chicago_Bears', 'Cincinnati_Bengals', 'Cleveland_Browns', 'Dallas_Cowboys', 'Denver_Broncos', 'Detroit_Lions', 'Green_Bay_Packers', 'Houston_Texans', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Miami_Dolphins', 'Los_Angeles_Chargers', 'Kansas_City_Chiefs', 'Indianaoplis_Colts', 'Jacksonville_Jaguars', 'Kansas_City_Chiefs', 'Las_Vegas_Raiders', 'Los_Angeles_Chargers', 'Los_Angeles_Rams', 'Miami_Dolphins', 'Minnesota_Vikings', 'New_England_Patriots', 'New_Orleans_Saints', 'New_York_Giants', 'New_York_Jets', 'Philidelphia_Eagles', 'Pittsburgh_Steelers', 'San_Francisco_49ers', 'Seattle_Seahawks', 'Tampa_Bay_Buccaneers', 'Tennessee_Titans', 'Washington_Football_Team']
roster=[]
teams=[]
roster=[]
step2=str(teams)
step3=step2.replace("[","")
step4=step3.replace("]","")
print(step4)
step5=teamsidslist.index(int(step4))
print(step5)
emote=discord.utils.get(server.emojis,name=teamemojis[step5])
teamname=teamnames[step5]
team = discord.utils.get(ctx.author.guild.roles,id=int(step4))
for guys in server.members:
await asyncio.sleep(1)
roster_size=(len(roster))
teamlist = discord.Embed(title=+str(emote)+teamname+"'s roster count:")
teamlist.add_field(name=roster_size, value=str(emote)+teamname+f"'s roster count - brought up by {ctx.author}")
await ctx.send(embed=teamlist)
@bot.event
async def on_command_error(ctx, error):
print(f"Some idiot raised an error at {timestamp} - it was {ctx.author}: {error}")
raise error
keep_alive()
bot.run(os.getenv('kfgbottoken'))
答案 0 :(得分:0)
您不能创建多个 on_message
事件。只有最后一个会起作用。此外,您必须将 bot.process_commands(message)
添加到 on_message
事件的最后一行。否则它会阻止命令运行。
@bot.event
async def on_message(message):
...
await bot.process_commands(message)
您所要做的就是将所有 on_message
事件集中到一个。