diff --git a/modules/ham.py b/modules/ham.py new file mode 100644 index 0000000..274ad92 --- /dev/null +++ b/modules/ham.py @@ -0,0 +1,24 @@ + +import json, requests + + +async def lookup(self,c,n,m): + if len(m) < 1: + await self.message(c, 'you need the callsign lol') + return + res = requests.get('https://callook.info/{}/json'.format(''.join(m))) + if res.status_code : + js = res.json() + if js['status'] == 'VALID': + await self.message(c, '{}, name: {} grid: {}, expires: {}'.format(js['current']['operClass'], js['name'], js['location']['gridsquare'], js['otherInfo']['expiryDate'])) + return + await self.message(c, 'invalid callsign') + else: + await self.message(c, 'something went wrong...') + + +async def init(self): + self.cmd['lookup'] = lookup + self.help['lookup'] = ['lookup - lookup a ham callsign','ROBERT'] + +