예제 #1
0
 public VkMessage(VkClient <TUserStates> client, int user, string text, int messageId)
 {
     User           = user;
     Text           = text;
     Client         = client;
     this.messageId = messageId;
     UserState      = client.GetUserState(user);
 }
        static void Main(string[] args)
        {
            FileStream logtext = new FileStream("text.txt", FileMode.Append, FileAccess.Write, FileShare.Read);

            LoadCustomAnswers("CustomAnswersDatabase.txt");
            rnd    = new Random();
            client = new VkClient <UserState>(SkidAT);
            LoadUsersStates("UsersStates.txt");
            client.OffState             = UserState.DontReply;
            client.MessageReceived     += (s, e) => Log(e.Message, MessageDir.Received);
            client.MessageReceived     += (s, e) => { logtext.Write(Encoding.Default.GetBytes(e.Message.Text + "\r\n"), 0, 2 + Encoding.Default.GetByteCount(e.Message.Text)); logtext.Flush(); };
            client.MessageSended       += (s, e) => Log(e.Message, MessageDir.Sended);
            client.UpdateMessagesError += Client_UpdateMessagesError;
            client.MessageReceived     += Client_MessageReceived;
            client.StartReceiving();
            Console.ReadLine();
            SaveUsersStates("UsersStates.txt");
            SaveCustomAnswers("CustomAnswersDatabase.txt");
            logtext.Close();
            logtext.Dispose();
        }
예제 #3
0
 public MessageEventArgs(VkClient <TUserStates> client, MessagesMessage message)
 {
     Message = new VkMessage <TUserStates>(client, message.UserId.Value, message.Body, message.Id.Value);
 }