forked from Raiza.dev/EliteBot
Remove more (unnecessary) double quotes...
This commit is contained in:
parent
f66d05d632
commit
a3312cffda
2 changed files with 15 additions and 12 deletions
21
elitebot.py
21
elitebot.py
|
@ -1,34 +1,37 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from src.bot import Bot
|
from src.bot import Bot
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Usage: python elitebot.py <config_file>")
|
print('Usage: python elitebot.py <config_file>')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
config_file = sys.argv[1]
|
config_file = sys.argv[1]
|
||||||
try:
|
try:
|
||||||
bot = Bot(config_file)
|
bot = Bot(config_file)
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
print(f"Config file not found: {e}")
|
print(f'Config file not found: {e}')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error loading bot: {e}")
|
print(f'Error loading bot: {e}')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print("EliteBot started successfully!")
|
print('EliteBot started successfully!')
|
||||||
bot.start()
|
bot.start()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error starting EliteBot: {e}")
|
print(f'Error starting EliteBot: {e}')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
main()
|
main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\nEliteBot has been stopped.")
|
print('\nEliteBot has been stopped.')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An unexpected error occurred: {e}")
|
print(f'An unexpected error occurred: {e}')
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Plugin(PluginBase):
|
||||||
self.bot.ircsend(f'PART {message_parts[1]}')
|
self.bot.ircsend(f'PART {message_parts[1]}')
|
||||||
self.channel_manager.remove_channel(message_parts[1])
|
self.channel_manager.remove_channel(message_parts[1])
|
||||||
|
|
||||||
elif message_parts[0] == "!quit":
|
elif message_parts[0] == '!quit':
|
||||||
if len(message_parts) == 0:
|
if len(message_parts) == 0:
|
||||||
quit_message = 'EliteBot!'
|
quit_message = 'EliteBot!'
|
||||||
else:
|
else:
|
||||||
|
@ -37,9 +37,9 @@ class Plugin(PluginBase):
|
||||||
self.bot.connected = False
|
self.bot.connected = False
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
elif message_parts[0] == "!raw":
|
elif message_parts[0] == '!raw':
|
||||||
if len(message_parts) > 1:
|
if len(message_parts) > 1:
|
||||||
if message_parts[1].upper() == "PRIVMSG" and len(message_parts) > 3:
|
if message_parts[1].upper() == 'PRIVMSG' and len(message_parts) > 3:
|
||||||
raw_command = ' '.join(message_parts[1:3]) + " :" + ' '.join(message_parts[3:])
|
raw_command = ' '.join(message_parts[1:3]) + " :" + ' '.join(message_parts[3:])
|
||||||
else:
|
else:
|
||||||
raw_command = ' '.join(message_parts[1:])
|
raw_command = ' '.join(message_parts[1:])
|
||||||
|
|
Loading…
Add table
Reference in a new issue