Innocenty Enikeew 9 лет назад
Родитель
Сommit
ae05363b5b
5 измененных файлов с 8 добавлено и 5 удалено
  1. 3 0
      chatikbot.lisp
  2. 0 3
      config.lisp.example
  3. 1 1
      plugins/huiza.lisp
  4. 3 0
      telegram.lisp
  5. 1 1
      utils.lisp

+ 3 - 0
chatikbot.lisp

@@ -75,6 +75,9 @@
       (bordeaux-threads:destroy-thread old-updates))))
 
 (defun start ()
+  ;; Test telegram token
+  (setf *bot-name* (concatenate 'string "@" (aget "username" (telegram-get-me))))
+
   (cleanup)
 
   ;; Run 'starting' hooks to set up schedules

+ 0 - 3
config.lisp.example

@@ -1,8 +1,5 @@
 (in-package #:chatikbot)
 
-;; Bot
-(setf *bot-name* "@chatikbot")
-
 ;; Telegram
 (setf *telegram-token* "123456789:YourTokenHere")
 

+ 1 - 1
plugins/huiza.lisp

@@ -1,7 +1,7 @@
 (in-package #:chatikbot)
 
 ;; Load pattern matching facility
-(load "patmatch.lisp")
+(load "plugins/patmatch.lisp")
 
 (defparameter *fuck-off*
   '((отъебись) (мне похуй) (ебаный ты нахуй!))

+ 3 - 0
telegram.lisp

@@ -31,6 +31,9 @@
          (cons "limit" limit)
          (cons "timeout" timeout))))
 
+(defun telegram-get-me ()
+  (%telegram-api-call "getMe"))
+
 (defun telegram-send-message (chat-id text &key parse-mode disable-web-preview reply-to reply-markup)
   (%telegram-api-call
    "sendMessage"

+ 1 - 1
utils.lisp

@@ -1,6 +1,6 @@
 (in-package #:chatikbot)
 
-(defvar *bot-name* "@chatikbot" "bot name to properly handle text input")
+(defvar *bot-name* nil "bot name to properly handle text input")
 
 (defvar *hooks* (make-hash-table) "Hooks storage")