removed unnecessary if statements

This commit is contained in:
Dustin 2024-08-25 21:27:22 -04:00
parent b14c704a52
commit e5636d95ed

View File

@ -141,21 +141,19 @@ class ollamarama:
async def ai(self, channel, message, sender, x=False): async def ai(self, channel, message, sender, x=False):
try: try:
if x: if x and message[2]:
if len(message) > 2: name = message[1]
name = message[1] message = message[2:]
if message[2]: if channel in self.messages:
message = message[2:] for user in self.messages[channel]:
if channel in self.messages: try:
for user in self.messages[channel]: username = await self.display_name(user)
try: if name == username:
username = await self.display_name(user) name_id = user
if name == username: except:
name_id = user name_id = name
except: await self.add_history("user", channel, name_id, ' '.join(message))
name_id = name await self.respond(channel, name_id, self.messages[channel][name_id], sender)
await self.add_history("user", channel, name_id, ' '.join(message))
await self.respond(channel, name_id, self.messages[channel][name_id], sender)
else: else:
await self.add_history("user", channel, sender, ' '.join(message[1:])) await self.add_history("user", channel, sender, ' '.join(message[1:]))
await self.respond(channel, sender, self.messages[channel][sender]) await self.respond(channel, sender, self.messages[channel][sender])