Update irc.py

This commit is contained in:
therealvorteckz 2023-10-12 10:25:19 -07:00
parent d60395c76f
commit 81a6d8e315

20
irc.py
View File

@ -1,15 +1,11 @@
from config import config from config import config
import time import time
import ssl import ssl
import argparse
import logging import logging
import logging.handlers import logging.handlers
import asyncio import asyncio
import importlib
import time import time
import sys
import functions import functions
from functions import shop, buyweapon, buyammo, buybandages, shoot, reload, ammo, heal, revive, getmoney, getbandages, removeweapon, createuser, profile, removeuser, setlevel, createuser, punch, checkexist
import sqlite3 import sqlite3
# Formatting Control Characters / Color Codes # Formatting Control Characters / Color Codes
@ -192,7 +188,7 @@ class Bot(object):
if len(arguments) <= 2 or int(arguments[2]) == 0: if len(arguments) <= 2 or int(arguments[2]) == 0:
await bot.sendmsg(config.irc.channel, '[You must specify amount of bandages (greater than 0) to purchase]') await bot.sendmsg(config.irc.channel, '[You must specify amount of bandages (greater than 0) to purchase]')
else: else:
value = await buybandages(nick, int(arguments[2])) value = await functions.buybandages(nick, int(arguments[2]))
await bot.sendmsg(config.irc.channel, f'{value}') await bot.sendmsg(config.irc.channel, f'{value}')
if arguments[0] == '!test': if arguments[0] == '!test':
value = await functions.testfunction(nick) value = await functions.testfunction(nick)
@ -206,7 +202,7 @@ class Bot(object):
if value != None: if value != None:
await bot.sendmsg(config.irc.channel, f'{value}') await bot.sendmsg(config.irc.channel, f'{value}')
if arguments[0] == '!ammo': if arguments[0] == '!ammo':
ammovalue = await ammo(nick) ammovalue = await functions.ammo(nick)
await bot.sendmsg(config.irc.channel, f'{ammovalue}') await bot.sendmsg(config.irc.channel, f'{ammovalue}')
if arguments[0] == '!heal': if arguments[0] == '!heal':
value = await functions.heal(nick) value = await functions.heal(nick)
@ -253,8 +249,8 @@ class Bot(object):
data=c.fetchone() data=c.fetchone()
if data is None: if data is None:
await bot.sendmsg(config.irc.channel, '[Registering Player: %s]'%name) await bot.sendmsg(config.irc.channel, '[Registering Player: %s]'%name)
await createuser(name) await functions.createuser(name)
await profile(name) await functions.profile(name)
else: else:
await bot.sendmsg(config.irc.channel, f'{color("[Player already exists!]", red)}') await bot.sendmsg(config.irc.channel, f'{color("[Player already exists!]", red)}')
@ -279,16 +275,16 @@ class Bot(object):
data=c.fetchone() data=c.fetchone()
if data is None: if data is None:
await bot.sendmsg(config.irc.channel, f'[Registering Player: %s]'%nick) await bot.sendmsg(config.irc.channel, f'[Registering Player: %s]'%nick)
await createuser(nick) await functions.createuser(nick)
await profile(nick) await functions.profile(nick)
else: else:
await bot.sendmsg(config.irc.channel, f'{color("[Player already exists!]", red)}') await bot.sendmsg(config.irc.channel, f'{color("[Player already exists!]", red)}')
if arguments[0] == '!profile': if arguments[0] == '!profile':
try: try:
value = await profile(arguments[1].lower()) value = await functions.profile(arguments[1].lower())
await bot.sendmsg(config.irc.channel, f'{value}') await bot.sendmsg(config.irc.channel, f'{value}')
except: except:
value = await profile(nick) value = await functions.profile(nick)
await bot.sendmsg(config.irc.channel, f'{value}') await bot.sendmsg(config.irc.channel, f'{value}')
if arguments[0] == '!punch': if arguments[0] == '!punch':
await functions.punch(arguments[1].lower(), nick) await functions.punch(arguments[1].lower(), nick)